summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:25:51 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-11-11 21:25:51 +0000
commit7339bdc19342a078450b76b74274e6bc1e85d72d (patch)
tree0c59e7b9f22db96347a7b3dee309f6ad0fc4db97
parent0b619db6ff354fe2320a19c561515a5d734f5416 (diff)
parent756d3b447a8f19a9b7a1088315a8a8bb9855ae1f (diff)
downloadbase-android10-mainline-resolv-release.tar.gz
Snap for 6001391 from 756d3b447a8f19a9b7a1088315a8a8bb9855ae1f to qt-aml-resolv-releaseandroid-mainline-10.0.0_r8android10-mainline-resolv-release
Change-Id: I988bfede08bf5b89e25767625378019e4b1a8b9a
-rw-r--r--Android.bp105
-rw-r--r--CleanSpec.mk1
-rw-r--r--PREUPLOAD.cfg2
-rw-r--r--api/current.txt322
-rw-r--r--api/system-current.txt231
-rw-r--r--api/system-lint-baseline.txt6
-rw-r--r--api/test-current.txt25
-rw-r--r--api/test-lint-baseline.txt2263
-rw-r--r--cmds/incidentd/src/Section.cpp16
-rw-r--r--cmds/statsd/benchmark/log_event_benchmark.cpp4
-rw-r--r--cmds/statsd/src/StatsLogProcessor.h8
-rw-r--r--cmds/statsd/src/logd/LogEvent.cpp4
-rw-r--r--config/dirty-image-objects2
-rw-r--r--config/hiddenapi-greylist-max-p.txt50
-rw-r--r--config/hiddenapi-greylist.txt688
-rw-r--r--config/preloaded-classes3
-rw-r--r--core/java/android/accounts/AccountManager.java2
-rw-r--r--core/java/android/animation/FloatEvaluator.java2
-rw-r--r--core/java/android/app/ActivityManagerNative.java5
-rw-r--r--core/java/android/app/ActivityThread.java6
-rw-r--r--core/java/android/app/ContextImpl.java14
-rw-r--r--core/java/android/app/IActivityManager.aidl2
-rw-r--r--core/java/android/app/IUiModeManager.aidl1
-rw-r--r--core/java/android/app/PackageDeleteObserver.java5
-rw-r--r--core/java/android/app/PackageInstallObserver.java5
-rw-r--r--core/java/android/app/ResourcesManager.java7
-rw-r--r--core/java/android/app/SystemServiceRegistry.java17
-rw-r--r--core/java/android/app/TaskStackListener.java5
-rw-r--r--core/java/android/app/UiAutomationConnection.java6
-rw-r--r--core/java/android/app/UserSwitchObserver.java5
-rw-r--r--core/java/android/bluetooth/BluetoothAdapter.java51
-rw-r--r--core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl2
-rw-r--r--core/java/android/content/Context.java53
-rw-r--r--core/java/android/content/ContextWrapper.java41
-rw-r--r--core/java/android/content/SyncStats.java2
-rw-r--r--core/java/android/content/UndoManager.java6
-rw-r--r--core/java/android/content/pm/PackageParser.java130
-rw-r--r--core/java/android/content/res/ConfigurationBoundResourceCache.java5
-rw-r--r--core/java/android/content/res/DrawableCache.java5
-rw-r--r--core/java/android/content/res/TypedArray.java5
-rw-r--r--core/java/android/database/IContentObserver.aidl1
-rw-r--r--core/java/android/net/ConnectivityManager.java4
-rw-r--r--core/java/android/net/IConnectivityManager.aidl2
-rw-r--r--core/java/android/net/InterfaceConfiguration.java4
-rw-r--r--core/java/android/net/LinkProperties.java2
-rw-r--r--core/java/android/net/MobileLinkQualityInfo.java4
-rw-r--r--core/java/android/net/NetworkAgent.java12
-rw-r--r--core/java/android/net/NetworkScore.java157
-rw-r--r--core/java/android/net/SntpClient.java4
-rw-r--r--core/java/android/net/nsd/NsdManager.java4
-rw-r--r--core/java/android/net/util/SocketUtils.java14
-rw-r--r--core/java/android/os/AsyncTask.java22
-rw-r--r--core/java/android/os/BatteryStats.java46
-rw-r--r--core/java/android/os/BinderProxy.java59
-rw-r--r--core/java/android/os/CancellationSignal.java7
-rw-r--r--core/java/android/os/Debug.java2
-rw-r--r--core/java/android/os/IDeviceIdleController.aidl2
-rw-r--r--core/java/android/os/INetworkManagementService.aidl1
-rw-r--r--core/java/android/os/IPowerManager.aidl1
-rw-r--r--core/java/android/os/Parcel.java6
-rw-r--r--core/java/android/os/PowerManager.java1
-rw-r--r--core/java/android/os/Process.java1
-rw-r--r--core/java/android/os/Registrant.java1
-rw-r--r--core/java/android/os/RegistrantList.java6
-rw-r--r--core/java/android/os/RemoteCallback.java3
-rw-r--r--core/java/android/os/ServiceManager.java4
-rw-r--r--core/java/android/os/ServiceManagerNative.java4
-rw-r--r--core/java/android/os/SystemProperties.java5
-rw-r--r--core/java/android/os/UserHandle.java1
-rw-r--r--core/java/android/os/UserManager.java2
-rw-r--r--core/java/android/os/WorkSource.java4
-rw-r--r--core/java/android/os/image/DynamicSystemManager.java9
-rw-r--r--core/java/android/os/image/IDynamicSystemService.aidl7
-rw-r--r--core/java/android/os/storage/StorageEventListener.java5
-rw-r--r--core/java/android/os/telephony/TelephonyRegistryManager.java548
-rw-r--r--core/java/android/provider/CallLog.java18
-rw-r--r--core/java/android/provider/Settings.java9
-rw-r--r--core/java/android/provider/SettingsStringUtil.java2
-rw-r--r--core/java/android/service/carrier/CarrierMessagingServiceWrapper.java389
-rw-r--r--core/java/android/service/carrier/CarrierService.java21
-rw-r--r--core/java/android/service/carrier/ICarrierMessagingService.aidl1
-rw-r--r--core/java/android/service/dreams/IDreamManager.aidl1
-rw-r--r--core/java/android/service/euicc/EuiccService.java42
-rw-r--r--core/java/android/service/euicc/IEuiccService.aidl2
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java15
-rw-r--r--core/java/android/util/Singleton.java5
-rw-r--r--core/java/android/view/AccessibilityIterators.java4
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/view/View.java30
-rw-r--r--core/java/android/view/ViewDebug.java101
-rw-r--r--core/java/android/view/ViewTreeObserver.java5
-rw-r--r--core/java/android/view/animation/AnimationUtils.java8
-rw-r--r--core/java/android/webkit/CacheManager.java5
-rw-r--r--core/java/android/webkit/CookieManager.java5
-rw-r--r--core/java/android/webkit/WebChromeClient.java34
-rw-r--r--core/java/android/webkit/WebSettings.java7
-rw-r--r--core/java/android/widget/ListView.java4
-rw-r--r--core/java/android/widget/RelativeLayout.java8
-rw-r--r--core/java/android/widget/ScrollBarDrawable.java4
-rw-r--r--core/java/com/android/internal/app/AlertActivity.java4
-rw-r--r--core/java/com/android/internal/app/ChooserActivity.java4
-rw-r--r--core/java/com/android/internal/app/ResolverActivity.java4
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeConfig.java12
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl19
-rw-r--r--core/java/com/android/internal/compat/CompatibilityChangeInfo.java92
-rw-r--r--core/java/com/android/internal/compat/IPlatformCompat.aidl19
-rw-r--r--core/java/com/android/internal/content/PackageMonitor.java5
-rw-r--r--core/java/com/android/internal/logging/MetricsLogger.java4
-rw-r--r--core/java/com/android/internal/net/LegacyVpnInfo.java4
-rw-r--r--core/java/com/android/internal/net/VpnConfig.java4
-rw-r--r--core/java/com/android/internal/os/BaseCommand.java4
-rw-r--r--core/java/com/android/internal/os/BatterySipper.java2
-rw-r--r--core/java/com/android/internal/os/Zygote.java7
-rw-r--r--core/java/com/android/internal/os/ZygoteInit.java12
-rw-r--r--core/java/com/android/internal/preference/YesNoPreference.java3
-rw-r--r--core/java/com/android/internal/util/MemInfoReader.java4
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java6
-rw-r--r--core/java/com/android/internal/widget/PointerLocationView.java4
-rw-r--r--core/java/com/android/server/net/BaseNetworkObserver.java5
-rw-r--r--core/java/com/google/android/util/AbstractMessageParser.java8
-rw-r--r--core/jni/fd_utils.cpp26
-rw-r--r--core/proto/OWNERS2
-rw-r--r--core/proto/android/app/settings_enums.proto5
-rw-r--r--core/res/AndroidManifest.xml1
-rw-r--r--core/res/res/values-mcc208-mnc10-fr/strings.xml5
-rw-r--r--core/res/res/values/config.xml2
-rw-r--r--core/res/res/values/strings.xml4
-rw-r--r--core/tests/coretests/src/android/content/pm/PackageParserTest.java7
-rw-r--r--core/tests/coretests/src/android/provider/SettingsBackupTest.java1
-rw-r--r--data/etc/privapp-permissions-platform.xml6
-rw-r--r--graphics/java/android/graphics/Paint.java12
-rw-r--r--libs/hwui/Android.bp3
-rw-r--r--libs/hwui/HardwareBitmapUploader.cpp1
-rw-r--r--location/java/com/android/internal/location/GpsNetInitiatedHandler.java12
-rw-r--r--location/java/com/android/internal/location/ILocationProvider.aidl3
-rw-r--r--location/lib/Android.bp2
-rw-r--r--media/java/android/media/IRingtonePlayer.aidl1
-rw-r--r--media/java/android/media/Image.java2
-rw-r--r--media/java/android/media/ImageWriter.java8
-rw-r--r--media/java/android/media/MediaCodec.java26
-rw-r--r--media/java/android/media/MediaFile.java4
-rw-r--r--media/java/android/media/tv/OWNER5
-rw-r--r--media/jni/Android.bp7
-rw-r--r--media/jni/OWNERS3
-rw-r--r--media/jni/audioeffect/Android.bp5
-rw-r--r--media/jni/audioeffect/Visualizer.cpp446
-rw-r--r--media/jni/audioeffect/Visualizer.h180
-rw-r--r--media/jni/audioeffect/android_media_Visualizer.cpp2
-rw-r--r--media/jni/audioeffect/exports.lds6
-rw-r--r--media/jni/soundpool/Android.bp4
-rw-r--r--media/lib/signer/Android.bp2
-rw-r--r--mms/OWNERS14
-rw-r--r--mms/java/android/telephony/MmsManager.java118
-rw-r--r--mms/java/com/android/internal/telephony/IMms.aidl (renamed from telephony/java/com/android/internal/telephony/IMms.aidl)0
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLImpl.java16
-rw-r--r--opengl/java/com/google/android/gles_jni/GLImpl.java4
-rw-r--r--packages/CarSystemUI/res/layout/super_status_bar.xml8
-rw-r--r--packages/CarSystemUI/res/values/config.xml15
-rw-r--r--packages/CarSystemUI/res/values/integers_car.xml3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java80
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/DrivingStateHelper.java78
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java21
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/PowerManagerHelper.java60
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java61
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java215
-rw-r--r--packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java12
-rw-r--r--packages/Shell/AndroidManifest.xml27
-rw-r--r--packages/Shell/src/com/android/shell/BugreportProgressService.java2
-rw-r--r--packages/Shell/src/com/android/shell/HeapDumpActivity.java142
-rw-r--r--packages/Shell/src/com/android/shell/HeapDumpProvider.java101
-rw-r--r--packages/Shell/src/com/android/shell/HeapDumpReceiver.java188
-rw-r--r--packages/SystemUI/legacy/recents/res/values/config.xml8
-rw-r--r--packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java1
-rw-r--r--packages/SystemUI/res/layout/super_status_bar.xml10
-rw-r--r--packages/SystemUI/src/com/android/keyguard/CarrierTextController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/SystemUIFactory.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java155
-rw-r--r--packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java54
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java37
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java237
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java123
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java5
-rw-r--r--packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java2
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java56
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java4
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java5
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java285
-rw-r--r--packages/Tethering/Android.bp59
-rw-r--r--packages/Tethering/AndroidManifestBase.xml3
-rw-r--r--packages/Tethering/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp (renamed from services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp)0
-rw-r--r--packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java (renamed from services/net/java/android/net/dhcp/DhcpServerCallbacks.java)0
-rw-r--r--packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java (renamed from services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java)0
-rw-r--r--packages/Tethering/src/android/net/ip/IpServer.java (renamed from services/net/java/android/net/ip/IpServer.java)69
-rw-r--r--packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java (renamed from services/net/java/android/net/ip/RouterAdvertisementDaemon.java)155
-rw-r--r--packages/Tethering/src/android/net/util/InterfaceSet.java (renamed from services/net/java/android/net/util/InterfaceSet.java)2
-rw-r--r--packages/Tethering/src/android/net/util/PrefixUtils.java (renamed from services/net/java/android/net/util/PrefixUtils.java)5
-rw-r--r--packages/Tethering/src/com/android/server/connectivity/tethering/EntitlementManager.java (renamed from services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java)5
-rw-r--r--packages/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java (renamed from services/core/java/com/android/server/connectivity/tethering/OffloadController.java)20
-rw-r--r--packages/Tethering/src/com/android/server/connectivity/tethering/OffloadHardwareInterface.java (renamed from services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java)80
-rw-r--r--packages/Tethering/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java (renamed from services/core/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java)39
-rw-r--r--packages/Tethering/tests/unit/Android.bp12
-rw-r--r--packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java (renamed from tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java)0
-rw-r--r--packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java (renamed from tests/net/java/android/net/ip/IpServerTest.java)4
-rw-r--r--packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java (renamed from tests/net/java/android/net/util/InterfaceSetTest.java)0
-rw-r--r--packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/EntitlementManagerTest.java (renamed from tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java)0
-rw-r--r--packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/OffloadControllerTest.java (renamed from tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java)14
-rw-r--r--packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java (renamed from tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java)74
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java26
-rw-r--r--services/core/Android.bp13
-rw-r--r--services/core/java/com/android/server/AppStateTracker.java18
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java13
-rw-r--r--services/core/java/com/android/server/DeviceIdleController.java196
-rw-r--r--services/core/java/com/android/server/DynamicSystemService.java16
-rw-r--r--services/core/java/com/android/server/MasterClearReceiver.java2
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java38
-rw-r--r--services/core/java/com/android/server/VibratorService.java27
-rw-r--r--services/core/java/com/android/server/Watchdog.java2
-rw-r--r--services/core/java/com/android/server/am/ActiveServices.java73
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java18
-rw-r--r--services/core/java/com/android/server/am/ProcessList.java17
-rw-r--r--services/core/java/com/android/server/audio/AudioService.java24
-rw-r--r--services/core/java/com/android/server/compat/CompatChange.java45
-rw-r--r--services/core/java/com/android/server/compat/CompatConfig.java47
-rw-r--r--services/core/java/com/android/server/compat/PlatformCompat.java11
-rw-r--r--services/core/java/com/android/server/connectivity/NetworkAgentInfo.java24
-rw-r--r--services/core/java/com/android/server/display/color/ColorDisplayService.java68
-rw-r--r--services/core/java/com/android/server/display/color/TintController.java6
-rw-r--r--services/core/java/com/android/server/location/GnssLocationProvider.java43
-rw-r--r--services/core/java/com/android/server/notification/NotificationComparator.java6
-rwxr-xr-xservices/core/java/com/android/server/notification/NotificationManagerService.java50
-rw-r--r--services/core/java/com/android/server/notification/NotificationShellCmd.java105
-rw-r--r--services/core/java/com/android/server/pm/ApexManager.java776
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java64
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerShellCommand.java6
-rw-r--r--services/core/java/com/android/server/pm/StagingManager.java225
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java16
-rw-r--r--services/core/java/com/android/server/timezone/RulesManagerService.java6
-rw-r--r--services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java8
-rw-r--r--services/core/java/com/android/server/wallpaper/GLHelper.java148
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java157
-rw-r--r--services/core/java/com/android/server/wm/ActivityStack.java10
-rw-r--r--services/core/jni/Android.bp4
-rw-r--r--services/core/jni/com_android_server_VibratorService.cpp306
-rw-r--r--services/java/com/android/server/SystemServer.java2
-rw-r--r--services/net/Android.bp14
-rw-r--r--services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java130
-rw-r--r--services/tests/servicestests/Android.bp2
-rw-r--r--services/tests/servicestests/res/raw/apex_test.apexbin0 -> 318688 bytes
-rw-r--r--services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java2
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java298
-rw-r--r--services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java2
-rw-r--r--services/tests/uiservicestests/Android.bp2
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java15
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java15
-rw-r--r--services/tests/uiservicestests/src/com/android/server/notification/NotificationShellCmdTest.java4
-rw-r--r--startop/view_compiler/Android.bp2
-rw-r--r--startop/view_compiler/dex_builder.cc93
-rw-r--r--startop/view_compiler/dex_builder.h48
-rw-r--r--telecomm/java/android/telecom/CallerInfo.java (renamed from telephony/java/com/android/internal/telephony/CallerInfo.java)192
-rw-r--r--telecomm/java/android/telecom/CallerInfoAsyncQuery.java (renamed from telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java)56
-rw-r--r--telecomm/java/android/telecom/Connection.java6
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java3
-rw-r--r--telephony/common/com/android/internal/telephony/HbpcdLookup.java124
-rw-r--r--telephony/common/com/android/internal/telephony/HbpcdUtils.java163
-rw-r--r--telephony/common/com/android/internal/telephony/SmsApplication.java (renamed from telephony/java/com/android/internal/telephony/SmsApplication.java)18
-rw-r--r--telephony/common/com/android/internal/telephony/SmsNumberUtils.java627
-rw-r--r--telephony/common/com/google/android/mms/ContentType.java247
-rw-r--r--telephony/common/com/google/android/mms/InvalidHeaderValueException.java44
-rw-r--r--telephony/common/com/google/android/mms/MmsException.java66
-rwxr-xr-xtelephony/common/com/google/android/mms/package.html5
-rw-r--r--telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java95
-rw-r--r--telephony/common/com/google/android/mms/pdu/Base64.java170
-rw-r--r--telephony/common/com/google/android/mms/pdu/CharacterSets.java176
-rw-r--r--telephony/common/com/google/android/mms/pdu/DeliveryInd.java145
-rw-r--r--telephony/common/com/google/android/mms/pdu/EncodedStringValue.java298
-rw-r--r--telephony/common/com/google/android/mms/pdu/GenericPdu.java122
-rw-r--r--telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java164
-rw-r--r--telephony/common/com/google/android/mms/pdu/NotificationInd.java307
-rw-r--r--telephony/common/com/google/android/mms/pdu/NotifyRespInd.java121
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduBody.java204
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduComposer.java1229
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduContentTypes.java113
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduHeaders.java733
-rwxr-xr-xtelephony/common/com/google/android/mms/pdu/PduParser.java2023
-rw-r--r--telephony/common/com/google/android/mms/pdu/PduPart.java439
-rwxr-xr-xtelephony/common/com/google/android/mms/pdu/PduPersister.java1574
-rw-r--r--telephony/common/com/google/android/mms/pdu/QuotedPrintable.java71
-rw-r--r--telephony/common/com/google/android/mms/pdu/ReadOrigInd.java158
-rw-r--r--telephony/common/com/google/android/mms/pdu/ReadRecInd.java150
-rw-r--r--telephony/common/com/google/android/mms/pdu/RetrieveConf.java324
-rw-r--r--telephony/common/com/google/android/mms/pdu/SendConf.java124
-rw-r--r--telephony/common/com/google/android/mms/pdu/SendReq.java370
-rwxr-xr-xtelephony/common/com/google/android/mms/pdu/package.html5
-rw-r--r--telephony/common/com/google/android/mms/util/AbstractCache.java119
-rw-r--r--telephony/common/com/google/android/mms/util/DownloadDrmHelper.java115
-rw-r--r--telephony/common/com/google/android/mms/util/DrmConvertSession.java177
-rw-r--r--telephony/common/com/google/android/mms/util/PduCache.java268
-rw-r--r--telephony/common/com/google/android/mms/util/PduCacheEntry.java50
-rw-r--r--telephony/common/com/google/android/mms/util/SqliteWrapper.java128
-rwxr-xr-xtelephony/common/com/google/android/mms/util/package.html5
-rw-r--r--telephony/java/android/provider/Telephony.java13
-rw-r--r--telephony/java/android/telephony/Annotation.java472
-rw-r--r--telephony/java/android/telephony/CallAttributes.java2
-rw-r--r--[-rwxr-xr-x]telephony/java/android/telephony/CarrierConfigManager.java63
-rw-r--r--telephony/java/android/telephony/CellBroadcastService.java77
-rw-r--r--telephony/java/android/telephony/CellInfo.java8
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthNr.java14
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthWcdma.java7
-rw-r--r--telephony/java/android/telephony/DataFailCause.java362
-rw-r--r--telephony/java/android/telephony/DisconnectCause.java3
-rw-r--r--telephony/java/android/telephony/ICellBroadcastService.aidl9
-rw-r--r--telephony/java/android/telephony/ICellInfoCallback.aidl3
-rw-r--r--telephony/java/android/telephony/ImsManager.java66
-rw-r--r--telephony/java/android/telephony/NetworkRegistrationInfo.java2
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java29
-rw-r--r--telephony/java/android/telephony/PhoneStateListener.java16
-rw-r--r--telephony/java/android/telephony/PhysicalChannelConfig.java2
-rw-r--r--telephony/java/android/telephony/PreciseCallState.java2
-rw-r--r--telephony/java/android/telephony/PreciseDataConnectionState.java28
-rw-r--r--telephony/java/android/telephony/ServiceState.java5
-rw-r--r--telephony/java/android/telephony/SmsCbMessage.java26
-rw-r--r--telephony/java/android/telephony/SmsManager.java1579
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java44
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java404
-rw-r--r--telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl21
-rw-r--r--telephony/java/android/telephony/data/ApnSetting.java35
-rw-r--r--telephony/java/android/telephony/data/DataCallResponse.java12
-rw-r--r--telephony/java/android/telephony/data/DataProfile.java2
-rw-r--r--telephony/java/android/telephony/data/QualifiedNetworksService.java4
-rw-r--r--telephony/java/android/telephony/euicc/EuiccManager.java36
-rw-r--r--telephony/java/android/telephony/ims/ImsCallProfile.java59
-rw-r--r--telephony/java/android/telephony/ims/ImsMmTelManager.java313
-rw-r--r--telephony/java/android/telephony/ims/ImsRcsManager.java188
-rw-r--r--telephony/java/android/telephony/ims/ImsSsInfo.java27
-rw-r--r--telephony/java/android/telephony/ims/ImsUtListener.java79
-rw-r--r--telephony/java/android/telephony/ims/RcsUceAdapter.java102
-rw-r--r--telephony/java/android/telephony/ims/RegistrationManager.java285
-rw-r--r--telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl39
-rw-r--r--telephony/java/android/telephony/ims/aidl/IRcsUceControllerCallback.aidl29
-rw-r--r--telephony/java/android/telephony/ims/compat/ImsService.java4
-rw-r--r--telephony/java/android/telephony/ims/compat/feature/MMTelFeature.java17
-rw-r--r--telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java5
-rw-r--r--telephony/java/android/telephony/ims/compat/stub/ImsUtListenerImplBase.java15
-rw-r--r--telephony/java/android/telephony/ims/feature/MmTelFeature.java21
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java17
-rw-r--r--telephony/java/com/android/ims/ImsUtInterface.java3
-rw-r--r--telephony/java/com/android/ims/internal/IImsUtListener.aidl1
-rw-r--r--telephony/java/com/android/internal/telephony/DctConstants.java16
-rw-r--r--telephony/java/com/android/internal/telephony/GsmAlphabet.java17
-rw-r--r--telephony/java/com/android/internal/telephony/ISms.aidl19
-rw-r--r--telephony/java/com/android/internal/telephony/ISmsImplBase.java11
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephony.aidl44
-rw-r--r--telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl8
-rw-r--r--telephony/java/com/android/internal/telephony/IccCardConstants.java13
-rw-r--r--telephony/java/com/android/internal/telephony/PhoneConstants.java30
-rw-r--r--telephony/java/com/android/internal/telephony/RILConstants.java3
-rw-r--r--telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java17
-rw-r--r--telephony/java/com/android/internal/telephony/SmsHeader.java13
-rw-r--r--telephony/java/com/android/internal/telephony/SmsMessageBase.java16
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyPermissions.java60
-rw-r--r--telephony/java/com/android/internal/telephony/TelephonyProperties.java3
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/SmsMessage.java48
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/UserData.java13
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java22
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java10
-rw-r--r--telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java18
-rw-r--r--telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl2
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmSmsAddress.java8
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java11
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java9
-rw-r--r--telephony/java/com/android/internal/telephony/gsm/SmsMessage.java56
-rw-r--r--telephony/java/com/android/internal/telephony/uicc/IccUtils.java13
-rw-r--r--test-mock/Android.bp10
-rw-r--r--test-mock/src/android/test/mock/MockContext.java7
-rw-r--r--tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java7
-rw-r--r--tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java10
-rw-r--r--tests/net/Android.bp2
-rw-r--r--tests/net/common/java/android/net/NetworkScoreTest.kt104
-rw-r--r--tests/net/java/com/android/server/connectivity/LingerMonitorTest.java5
-rw-r--r--tests/testables/src/android/testing/TestableSettingsProvider.java6
-rw-r--r--tools/aapt2/compile/PseudolocaleGenerator.cpp2
-rw-r--r--tools/aapt2/compile/PseudolocaleGenerator_test.cpp21
-rw-r--r--tools/aapt2/format/Container.cpp23
-rw-r--r--tools/aapt2/formats.md17
-rw-r--r--tools/aapt2/java/ProguardRules.h6
-rw-r--r--tools/aapt2/java/ProguardRules_test.cpp8
-rwxr-xr-xtools/apilint/apilint147
-rw-r--r--tools/apilint/apilint.py2353
-rwxr-xr-xtools/apilint/apilint_sha.sh4
-rwxr-xr-xtools/apilint/apilint_sha_system.sh23
-rwxr-xr-xtools/apilint/apilint_stats.sh7
-rw-r--r--tools/apilint/apilint_test.py414
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java146
-rw-r--r--wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java2
404 files changed, 24499 insertions, 8190 deletions
diff --git a/Android.bp b/Android.bp
index a913324aa9ca..284e7015c115 100644
--- a/Android.bp
+++ b/Android.bp
@@ -34,6 +34,27 @@ filegroup {
path: "core/java",
}
+// These are subset of framework-core-sources that are needed by the
+// android.test.mock library. Ideally, the library should use public APIs only,
+// but unfortunately its API signature has some references to these private APIs.
+filegroup {
+ name: "framework-core-sources-for-test-mock",
+ srcs: [
+ "core/java/android/app/IApplicationThread.aidl",
+ "core/java/android/app/IServiceConnection.aidl",
+ "core/java/android/content/IContentProvider.java",
+ "core/java/android/content/pm/IPackageDataObserver.aidl",
+ "core/java/android/content/pm/InstantAppInfo.java",
+ "core/java/android/content/pm/KeySet.java",
+ "core/java/android/content/pm/PackageManager.java",
+ "core/java/android/content/pm/VerifierDeviceIdentity.java",
+ "core/java/android/content/res/Resources.java",
+ "core/java/android/os/storage/VolumeInfo.java",
+ "core/java/android/view/DisplayAdjustments.java",
+ ],
+ path: "core/java",
+}
+
filegroup {
name: "framework-drm-sources",
srcs: [
@@ -162,6 +183,23 @@ filegroup {
}
filegroup {
+ name: "framework-telephony-common-sources",
+ srcs: [
+ "telephony/common/**/*.java",
+ ],
+ path: "telephony/common",
+}
+
+filegroup {
+ name: "framework-mms-sources",
+ srcs: [
+ "mms/java/**/*.java",
+ "mms/java/**/*.aidl",
+ ],
+ path: "mms/java",
+}
+
+filegroup {
name: "framework-wifi-sources",
srcs: [
"wifi/java/**/*.java",
@@ -185,10 +223,12 @@ filegroup {
":framework-mca-filterfw-sources",
":framework-mca-filterpacks-sources",
":framework-mime-sources",
+ ":framework-mms-sources",
":framework-opengl-sources",
":framework-rs-sources",
":framework-sax-sources",
":framework-telecomm-sources",
+ ":framework-telephony-common-sources",
":framework-telephony-sources",
":framework-wifi-sources",
":PacProcessor-aidl-sources",
@@ -246,6 +286,7 @@ java_defaults {
"media/mca/effect/java",
"media/mca/filterfw/java",
"media/mca/filterpacks/java",
+ "mms/java",
"opengl/java",
"rs/java",
"sax/java",
@@ -374,15 +415,38 @@ filegroup {
}
java_library {
- name: "framework",
+ name: "framework-minus-apex",
defaults: ["framework-defaults"],
srcs: [":framework-non-updatable-sources"],
+ installable: true,
javac_shard_size: 150,
required: [
"framework-platform-compat-config",
"libcore-platform-compat-config",
"services-platform-compat-config",
],
+ // For backwards compatibility.
+ stem: "framework",
+}
+
+// This "framework" module is NOT installed to the device. It's
+// "framework-minus-apex" that gets installed to the device. Note that
+// the filename is still framework.jar (via the stem property) for
+// compatibility reason. The purpose of this module is to provide
+// framework APIs (both public and private) for bundled apps.
+// "framework-minus-apex" can't be used for the purpose because 1)
+// many apps have already hardcoded the name "framework" and
+// 2) it lacks API symbols from updatable modules - as it's clear from
+// its suffix "-minus-apex".
+java_library {
+ name: "framework",
+ defaults: ["framework-aidl-export-defaults"],
+ installable: false, // this lib is a build-only library
+ static_libs: [
+ "framework-minus-apex",
+ // TODO(jiyong): add stubs for APEXes here
+ ],
+ sdk_version: "core_platform",
}
java_library {
@@ -807,9 +871,11 @@ frameworks_base_subdirs = [
"media/mca/filterfw/java",
"media/mca/filterpacks/java",
"drm/java",
+ "mms/java",
"opengl/java",
"sax/java",
"telecomm/java",
+ "telephony/common",
"telephony/java",
"wifi/java",
"lowpan/java",
@@ -891,10 +957,11 @@ framework_docs_only_libs = [
]
metalava_framework_docs_args = "--manifest $(location core/res/AndroidManifest.xml) " +
- "--hide-package com.android.okhttp " +
- "--hide-package com.android.org.conscrypt --hide-package com.android.server " +
+ "--ignore-classes-on-classpath " +
+ "--hide-package com.android.server " +
"--error UnhiddenSystemApi " +
"--hide RequiresPermission " +
+ "--hide CallbackInterface " +
"--hide MissingPermission --hide BroadcastBehavior " +
"--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " +
"--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo "
@@ -953,7 +1020,6 @@ stubs_defaults {
previous_api: ":last-released-public-api",
merge_annotations_dirs: [
"metalava-manual",
- "ojluni-annotated-sdk-stubs",
],
}
@@ -1010,7 +1076,6 @@ stubs_defaults {
previous_api: ":last-released-public-api",
merge_annotations_dirs: [
"metalava-manual",
- "ojluni-annotated-sdk-stubs",
],
api_levels_annotations_enabled: true,
api_levels_annotations_dirs: [
@@ -1345,7 +1410,6 @@ droidstubs {
previous_api: ":last-released-public-api",
merge_annotations_dirs: [
"metalava-manual",
- "ojluni-annotated-sdk-stubs",
],
args: " --show-annotation android.annotation.SystemApi",
}
@@ -1377,8 +1441,6 @@ droidstubs {
name: "hiddenapi-mappings",
defaults: ["metalava-api-stubs-default"],
srcs: [
- ":non_openjdk_java_files",
- ":openjdk_java_files",
":opt-telephony-common-srcs",
],
@@ -1394,29 +1456,6 @@ droidstubs {
" --show-annotation android.annotation.TestApi ",
}
-filegroup {
- name: "apache-http-stubs-sources",
- srcs: [
- "core/java/org/apache/http/conn/ConnectTimeoutException.java",
- "core/java/org/apache/http/conn/scheme/HostNameResolver.java",
- "core/java/org/apache/http/conn/scheme/LayeredSocketFactory.java",
- "core/java/org/apache/http/conn/scheme/SocketFactory.java",
- "core/java/org/apache/http/conn/ssl/AbstractVerifier.java",
- "core/java/org/apache/http/conn/ssl/AllowAllHostnameVerifier.java",
- "core/java/org/apache/http/conn/ssl/AndroidDistinguishedNameParser.java",
- "core/java/org/apache/http/conn/ssl/BrowserCompatHostnameVerifier.java",
- "core/java/org/apache/http/conn/ssl/SSLSocketFactory.java",
- "core/java/org/apache/http/conn/ssl/StrictHostnameVerifier.java",
- "core/java/org/apache/http/conn/ssl/X509HostnameVerifier.java",
- "core/java/org/apache/http/params/CoreConnectionPNames.java",
- "core/java/org/apache/http/params/HttpConnectionParams.java",
- "core/java/org/apache/http/params/HttpParams.java",
- "core/java/android/net/http/SslCertificate.java",
- "core/java/android/net/http/SslError.java",
- "core/java/com/android/internal/util/HexDump.java",
- ],
-}
-
droidstubs {
name: "api-stubs-docs",
defaults: ["metalava-api-stubs-default"],
@@ -1492,6 +1531,10 @@ droidstubs {
api_file: "api/test-current.txt",
removed_api_file: "api/test-removed.txt",
},
+ api_lint: {
+ enabled: true,
+ baseline_file: "api/test-lint-baseline.txt",
+ },
},
}
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 6a909c0364e9..f7a285835126 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -254,6 +254,7 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/DynamicAndroidInsta
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/DefaultContainerService)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/CaptivePortalLogin)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/ext.jar)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java/com/google/android/mms)
# ******************************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER
# ******************************************************************
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index e731138ff40d..68311176a783 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,8 +1,6 @@
[Hook Scripts]
checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
-api_lint_hook = ${REPO_ROOT}/frameworks/base/tools/apilint/apilint_sha.sh ${PREUPLOAD_COMMIT}
-
strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT}
hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
diff --git a/api/current.txt b/api/current.txt
index 0c60fc16c5c4..ce4cb250e795 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2815,7 +2815,7 @@ package android.accessibilityservice {
method public final boolean dispatchGesture(@NonNull android.accessibilityservice.GestureDescription, @Nullable android.accessibilityservice.AccessibilityService.GestureResultCallback, @Nullable android.os.Handler);
method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
method @NonNull public final android.accessibilityservice.AccessibilityButtonController getAccessibilityButtonController();
- method @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT) @NonNull public final android.accessibilityservice.FingerprintGestureController getFingerprintGestureController();
+ method @NonNull @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT) public final android.accessibilityservice.FingerprintGestureController getFingerprintGestureController();
method @NonNull public final android.accessibilityservice.AccessibilityService.MagnificationController getMagnificationController();
method public android.view.accessibility.AccessibilityNodeInfo getRootInActiveWindow();
method public final android.accessibilityservice.AccessibilityServiceInfo getServiceInfo();
@@ -3524,11 +3524,11 @@ package android.animation {
package android.annotation {
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) public @interface SuppressLint {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) public @interface SuppressLint {
method public abstract String[] value();
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) public @interface TargetApi {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD}) public @interface TargetApi {
method public abstract int value();
}
@@ -3741,7 +3741,7 @@ package android.app {
method public void onContentChanged();
method public boolean onContextItemSelected(@NonNull android.view.MenuItem);
method public void onContextMenuClosed(@NonNull android.view.Menu);
- method @MainThread @CallSuper protected void onCreate(@Nullable android.os.Bundle);
+ method @CallSuper @MainThread protected void onCreate(@Nullable android.os.Bundle);
method public void onCreate(@Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
method @Nullable public CharSequence onCreateDescription();
@@ -3883,8 +3883,8 @@ package android.app {
method public void startActivityFromChild(@NonNull android.app.Activity, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
method @Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int);
method @Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
- method public boolean startActivityIfNeeded(@RequiresPermission @NonNull android.content.Intent, int);
- method public boolean startActivityIfNeeded(@RequiresPermission @NonNull android.content.Intent, int, @Nullable android.os.Bundle);
+ method public boolean startActivityIfNeeded(@NonNull @RequiresPermission android.content.Intent, int);
+ method public boolean startActivityIfNeeded(@NonNull @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
method public void startIntentSenderForResult(android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
method public void startIntentSenderForResult(android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
method public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
@@ -3892,8 +3892,8 @@ package android.app {
method public void startLocalVoiceInteraction(android.os.Bundle);
method public void startLockTask();
method @Deprecated public void startManagingCursor(android.database.Cursor);
- method public boolean startNextMatchingActivity(@RequiresPermission @NonNull android.content.Intent);
- method public boolean startNextMatchingActivity(@RequiresPermission @NonNull android.content.Intent, @Nullable android.os.Bundle);
+ method public boolean startNextMatchingActivity(@NonNull @RequiresPermission android.content.Intent);
+ method public boolean startNextMatchingActivity(@NonNull @RequiresPermission android.content.Intent, @Nullable android.os.Bundle);
method public void startPostponedEnterTransition();
method public void startSearch(@Nullable String, boolean, @Nullable android.os.Bundle, boolean);
method public void stopLocalVoiceInteraction();
@@ -6642,7 +6642,7 @@ package android.app.admin {
method @NonNull public java.util.Set<java.lang.String> getAffiliationIds(@NonNull android.content.ComponentName);
method @Nullable public java.util.Set<java.lang.String> getAlwaysOnVpnLockdownWhitelist(@NonNull android.content.ComponentName);
method @Nullable public String getAlwaysOnVpnPackage(@NonNull android.content.ComponentName);
- method @WorkerThread @NonNull public android.os.Bundle getApplicationRestrictions(@Nullable android.content.ComponentName, String);
+ method @NonNull @WorkerThread public android.os.Bundle getApplicationRestrictions(@Nullable android.content.ComponentName, String);
method @Deprecated @Nullable public String getApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName);
method public boolean getAutoTimeRequired();
method @NonNull public java.util.List<android.os.UserHandle> getBindDeviceAdminTargetUsers(@NonNull android.content.ComponentName);
@@ -7562,7 +7562,7 @@ package android.app.slice {
method public int checkSlicePermission(@NonNull android.net.Uri, int, int);
method @NonNull public java.util.List<android.net.Uri> getPinnedSlices();
method @NonNull public java.util.Set<android.app.slice.SliceSpec> getPinnedSpecs(android.net.Uri);
- method @WorkerThread @NonNull public java.util.Collection<android.net.Uri> getSliceDescendants(@NonNull android.net.Uri);
+ method @NonNull @WorkerThread public java.util.Collection<android.net.Uri> getSliceDescendants(@NonNull android.net.Uri);
method public void grantSlicePermission(@NonNull String, @NonNull android.net.Uri);
method @Nullable public android.net.Uri mapIntentToUri(@NonNull android.content.Intent);
method public void pinSlice(@NonNull android.net.Uri, @NonNull java.util.Set<android.app.slice.SliceSpec>);
@@ -7718,10 +7718,10 @@ package android.app.usage {
public class StorageStatsManager {
method @WorkerThread public long getFreeBytes(@NonNull java.util.UUID) throws java.io.IOException;
method @WorkerThread public long getTotalBytes(@NonNull java.util.UUID) throws java.io.IOException;
- method @WorkerThread @NonNull public android.app.usage.ExternalStorageStats queryExternalStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
- method @WorkerThread @NonNull public android.app.usage.StorageStats queryStatsForPackage(@NonNull java.util.UUID, @NonNull String, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
- method @WorkerThread @NonNull public android.app.usage.StorageStats queryStatsForUid(@NonNull java.util.UUID, int) throws java.io.IOException;
- method @WorkerThread @NonNull public android.app.usage.StorageStats queryStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
+ method @NonNull @WorkerThread public android.app.usage.ExternalStorageStats queryExternalStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
+ method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForPackage(@NonNull java.util.UUID, @NonNull String, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
+ method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForUid(@NonNull java.util.UUID, int) throws java.io.IOException;
+ method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
}
public final class UsageEvents implements android.os.Parcelable {
@@ -7980,9 +7980,9 @@ package android.bluetooth {
method public boolean isMultipleAdvertisementSupported();
method public boolean isOffloadedFilteringSupported();
method public boolean isOffloadedScanBatchingSupported();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) @NonNull public android.bluetooth.BluetoothServerSocket listenUsingInsecureL2capChannel() throws java.io.IOException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothServerSocket listenUsingInsecureL2capChannel() throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException;
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) @NonNull public android.bluetooth.BluetoothServerSocket listenUsingL2capChannel() throws java.io.IOException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothServerSocket listenUsingL2capChannel() throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothServerSocket listenUsingRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean setName(String);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean startDiscovery();
@@ -8350,9 +8350,9 @@ package android.bluetooth {
method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int);
method public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int, android.os.Handler);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean createBond();
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) @NonNull public android.bluetooth.BluetoothSocket createInsecureL2capChannel(int) throws java.io.IOException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothSocket createInsecureL2capChannel(int) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException;
- method @RequiresPermission(android.Manifest.permission.BLUETOOTH) @NonNull public android.bluetooth.BluetoothSocket createL2capChannel(int) throws java.io.IOException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothSocket createL2capChannel(int) throws java.io.IOException;
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException;
method public int describeContents();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean fetchUuidsWithSdp();
@@ -9517,14 +9517,14 @@ package android.content {
method public static void addPeriodicSync(android.accounts.Account, String, android.os.Bundle, long);
method public static Object addStatusChangeListener(int, android.content.SyncStatusObserver);
method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull String, @NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException, android.os.RemoteException;
- method public final int bulkInsert(@RequiresPermission.Write @NonNull android.net.Uri, @NonNull android.content.ContentValues[]);
+ method public final int bulkInsert(@NonNull @RequiresPermission.Write android.net.Uri, @NonNull android.content.ContentValues[]);
method @Nullable public final android.os.Bundle call(@NonNull android.net.Uri, @NonNull String, @Nullable String, @Nullable android.os.Bundle);
method @Nullable public final android.os.Bundle call(@NonNull String, @NonNull String, @Nullable String, @Nullable android.os.Bundle);
method @Deprecated public void cancelSync(android.net.Uri);
method public static void cancelSync(android.accounts.Account, String);
method public static void cancelSync(android.content.SyncRequest);
method @Nullable public final android.net.Uri canonicalize(@NonNull android.net.Uri);
- method public final int delete(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable String, @Nullable String[]);
+ method public final int delete(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable String, @Nullable String[]);
method @Deprecated public static android.content.SyncInfo getCurrentSync();
method public static java.util.List<android.content.SyncInfo> getCurrentSyncs();
method public static int getIsSyncable(android.accounts.Account, String);
@@ -9537,7 +9537,7 @@ package android.content {
method public static boolean getSyncAutomatically(android.accounts.Account, String);
method @Nullable public final String getType(@NonNull android.net.Uri);
method @NonNull public final android.content.ContentResolver.MimeTypeInfo getTypeInfo(@NonNull String);
- method @Nullable public final android.net.Uri insert(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable android.content.ContentValues);
+ method @Nullable public final android.net.Uri insert(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues);
method public static boolean isSyncActive(android.accounts.Account, String);
method public static boolean isSyncPending(android.accounts.Account, String);
method @NonNull public android.graphics.Bitmap loadThumbnail(@NonNull android.net.Uri, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException;
@@ -9556,9 +9556,9 @@ package android.content {
method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
- method @Nullable public final android.database.Cursor query(@RequiresPermission.Read @NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String);
- method @Nullable public final android.database.Cursor query(@RequiresPermission.Read @NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal);
- method @Nullable public final android.database.Cursor query(@RequiresPermission.Read @NonNull android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+ method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String);
+ method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal);
+ method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
method public final boolean refresh(@NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
method public final void registerContentObserver(@NonNull android.net.Uri, boolean, @NonNull android.database.ContentObserver);
method public void releasePersistableUriPermission(@NonNull android.net.Uri, int);
@@ -9573,7 +9573,7 @@ package android.content {
method public void takePersistableUriPermission(@NonNull android.net.Uri, int);
method @Nullable public final android.net.Uri uncanonicalize(@NonNull android.net.Uri);
method public final void unregisterContentObserver(@NonNull android.database.ContentObserver);
- method public final int update(@RequiresPermission.Write @NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]);
+ method public final int update(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]);
method public static void validateSyncExtrasBundle(android.os.Bundle);
method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProvider);
method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProviderClient);
@@ -9669,9 +9669,9 @@ package android.content {
public abstract class Context {
ctor public Context();
- method public boolean bindIsolatedService(@RequiresPermission @NonNull android.content.Intent, int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
+ method public boolean bindIsolatedService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
method public abstract boolean bindService(@RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int);
- method public boolean bindService(@RequiresPermission @NonNull android.content.Intent, int, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
+ method public boolean bindService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
method @CheckResult(suggest="#enforceCallingOrSelfPermission(String,String)") public abstract int checkCallingOrSelfPermission(@NonNull String);
method @CheckResult(suggest="#enforceCallingOrSelfUriPermission(Uri,int,String)") public abstract int checkCallingOrSelfUriPermission(android.net.Uri, int);
method @CheckResult(suggest="#enforceCallingPermission(String,String)") public abstract int checkCallingPermission(@NonNull String);
@@ -9768,7 +9768,8 @@ package android.content {
method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String);
method public abstract void sendOrderedBroadcast(@RequiresPermission android.content.Intent, @Nullable String);
- method public abstract void sendOrderedBroadcast(@RequiresPermission @NonNull android.content.Intent, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+ method public abstract void sendOrderedBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+ method public void sendOrderedBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyBroadcast(@RequiresPermission android.content.Intent);
method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
@@ -11621,7 +11622,7 @@ package android.content.pm {
method @NonNull public abstract android.graphics.drawable.Drawable getUserBadgedDrawableForDensity(@NonNull android.graphics.drawable.Drawable, @NonNull android.os.UserHandle, @Nullable android.graphics.Rect, int);
method @NonNull public abstract android.graphics.drawable.Drawable getUserBadgedIcon(@NonNull android.graphics.drawable.Drawable, @NonNull android.os.UserHandle);
method @NonNull public abstract CharSequence getUserBadgedLabel(@NonNull CharSequence, @NonNull android.os.UserHandle);
- method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) @NonNull public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions(@NonNull String, int);
+ method @NonNull @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions(@NonNull String, int);
method @Nullable public abstract android.content.res.XmlResourceParser getXml(@NonNull String, @XmlRes int, @Nullable android.content.pm.ApplicationInfo);
method public boolean hasSigningCertificate(@NonNull String, @NonNull byte[], int);
method public boolean hasSigningCertificate(int, @NonNull byte[], int);
@@ -12312,7 +12313,7 @@ package android.content.res {
ctor @Deprecated public Resources(android.content.res.AssetManager, android.util.DisplayMetrics, android.content.res.Configuration);
method public final void finishPreloading();
method public final void flushLayoutCache();
- method @NonNull public android.content.res.XmlResourceParser getAnimation(@AnimatorRes @AnimRes int) throws android.content.res.Resources.NotFoundException;
+ method @NonNull public android.content.res.XmlResourceParser getAnimation(@AnimRes @AnimatorRes int) throws android.content.res.Resources.NotFoundException;
method public final android.content.res.AssetManager getAssets();
method @AnyRes public static int getAttributeSetSourceResId(@Nullable android.util.AttributeSet);
method public boolean getBoolean(@BoolRes int) throws android.content.res.Resources.NotFoundException;
@@ -13582,10 +13583,10 @@ package android.graphics {
method public static android.graphics.Bitmap createBitmap(int, int, @NonNull android.graphics.Bitmap.Config, boolean, @NonNull android.graphics.ColorSpace);
method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, int, int, @NonNull android.graphics.Bitmap.Config, boolean);
method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, int, int, @NonNull android.graphics.Bitmap.Config, boolean, @NonNull android.graphics.ColorSpace);
- method public static android.graphics.Bitmap createBitmap(@NonNull @ColorInt int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
- method public static android.graphics.Bitmap createBitmap(@NonNull android.util.DisplayMetrics, @NonNull @ColorInt int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
- method public static android.graphics.Bitmap createBitmap(@NonNull @ColorInt int[], int, int, android.graphics.Bitmap.Config);
- method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, @NonNull @ColorInt int[], int, int, @NonNull android.graphics.Bitmap.Config);
+ method public static android.graphics.Bitmap createBitmap(@ColorInt @NonNull int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
+ method public static android.graphics.Bitmap createBitmap(@NonNull android.util.DisplayMetrics, @ColorInt @NonNull int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
+ method public static android.graphics.Bitmap createBitmap(@ColorInt @NonNull int[], int, int, android.graphics.Bitmap.Config);
+ method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, @ColorInt @NonNull int[], int, int, @NonNull android.graphics.Bitmap.Config);
method @NonNull public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Picture);
method @NonNull public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Picture, int, int, @NonNull android.graphics.Bitmap.Config);
method public static android.graphics.Bitmap createScaledBitmap(@NonNull android.graphics.Bitmap, int, int, boolean);
@@ -13816,8 +13817,8 @@ package android.graphics {
method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.Paint);
method public void drawLine(float, float, float, float, @NonNull android.graphics.Paint);
- method public void drawLines(@Size(multiple=4) @NonNull float[], int, int, @NonNull android.graphics.Paint);
- method public void drawLines(@Size(multiple=4) @NonNull float[], @NonNull android.graphics.Paint);
+ method public void drawLines(@NonNull @Size(multiple=4) float[], int, int, @NonNull android.graphics.Paint);
+ method public void drawLines(@NonNull @Size(multiple=4) float[], @NonNull android.graphics.Paint);
method public void drawOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint);
method public void drawOval(float, float, float, float, @NonNull android.graphics.Paint);
method public void drawPaint(@NonNull android.graphics.Paint);
@@ -13827,7 +13828,7 @@ package android.graphics {
method public void drawPicture(@NonNull android.graphics.Picture, @NonNull android.graphics.Rect);
method public void drawPoint(float, float, @NonNull android.graphics.Paint);
method public void drawPoints(@Size(multiple=2) float[], int, int, @NonNull android.graphics.Paint);
- method public void drawPoints(@Size(multiple=2) @NonNull float[], @NonNull android.graphics.Paint);
+ method public void drawPoints(@NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
method @Deprecated public void drawPosText(@NonNull char[], int, int, @NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
method @Deprecated public void drawPosText(@NonNull String, @NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
method public void drawRGB(int, int, int);
@@ -14188,10 +14189,10 @@ package android.graphics {
method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.nio.ByteBuffer);
method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.io.File);
method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.util.concurrent.Callable<android.content.res.AssetFileDescriptor>);
- method @WorkerThread @NonNull public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
- method @WorkerThread @NonNull public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
- method @WorkerThread @NonNull public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
- method @WorkerThread @NonNull public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
+ method @NonNull @WorkerThread public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
+ method @NonNull @WorkerThread public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
+ method @NonNull @WorkerThread public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
+ method @NonNull @WorkerThread public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
method public int getAllocator();
method @Nullable public android.graphics.Rect getCrop();
method public int getMemorySizePolicy();
@@ -14210,7 +14211,7 @@ package android.graphics {
method public void setPostProcessor(@Nullable android.graphics.PostProcessor);
method public void setTargetColorSpace(android.graphics.ColorSpace);
method public void setTargetSampleSize(@IntRange(from=1) int);
- method public void setTargetSize(@Px @IntRange(from=1) int, @Px @IntRange(from=1) int);
+ method public void setTargetSize(@IntRange(from=1) @Px int, @IntRange(from=1) @Px int);
method public void setUnpremultipliedRequired(boolean);
field public static final int ALLOCATOR_DEFAULT = 0; // 0x0
field public static final int ALLOCATOR_HARDWARE = 3; // 0x3
@@ -14317,8 +14318,8 @@ package android.graphics {
}
public class LinearGradient extends android.graphics.Shader {
- ctor public LinearGradient(float, float, float, float, @NonNull @ColorInt int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
- ctor public LinearGradient(float, float, float, float, @NonNull @ColorLong long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+ ctor public LinearGradient(float, float, float, float, @ColorInt @NonNull int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+ ctor public LinearGradient(float, float, float, float, @ColorLong @NonNull long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
ctor public LinearGradient(float, float, float, float, @ColorInt int, @ColorInt int, @NonNull android.graphics.Shader.TileMode);
ctor public LinearGradient(float, float, float, float, @ColorLong long, @ColorLong long, @NonNull android.graphics.Shader.TileMode);
}
@@ -14860,8 +14861,8 @@ package android.graphics {
}
public class RadialGradient extends android.graphics.Shader {
- ctor public RadialGradient(float, float, float, @NonNull @ColorInt int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
- ctor public RadialGradient(float, float, float, @NonNull @ColorLong long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+ ctor public RadialGradient(float, float, float, @ColorInt @NonNull int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+ ctor public RadialGradient(float, float, float, @ColorLong @NonNull long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
ctor public RadialGradient(float, float, float, @ColorInt int, @ColorInt int, @NonNull android.graphics.Shader.TileMode);
ctor public RadialGradient(float, float, float, @ColorLong long, @ColorLong long, @NonNull android.graphics.Shader.TileMode);
}
@@ -15119,8 +15120,8 @@ package android.graphics {
}
public class SweepGradient extends android.graphics.Shader {
- ctor public SweepGradient(float, float, @NonNull @ColorInt int[], @Nullable float[]);
- ctor public SweepGradient(float, float, @NonNull @ColorLong long[], @Nullable float[]);
+ ctor public SweepGradient(float, float, @ColorInt @NonNull int[], @Nullable float[]);
+ ctor public SweepGradient(float, float, @ColorLong @NonNull long[], @Nullable float[]);
ctor public SweepGradient(float, float, @ColorInt int, @ColorInt int);
ctor public SweepGradient(float, float, @ColorLong long, @ColorLong long);
}
@@ -15513,8 +15514,8 @@ package android.graphics.drawable {
method public void setColor(@ColorInt int);
method public void setColor(@Nullable android.content.res.ColorStateList);
method public void setColorFilter(@Nullable android.graphics.ColorFilter);
- method public void setColors(@Nullable @ColorInt int[]);
- method public void setColors(@Nullable @ColorInt int[], @Nullable float[]);
+ method public void setColors(@ColorInt @Nullable int[]);
+ method public void setColors(@ColorInt @Nullable int[], @Nullable float[]);
method public void setCornerRadii(@Nullable float[]);
method public void setCornerRadius(float);
method public void setDither(boolean);
@@ -15962,14 +15963,14 @@ package android.graphics.text {
public static class LineBreaker.ParagraphConstraints {
ctor public LineBreaker.ParagraphConstraints();
- method @Px @FloatRange(from=0) public float getDefaultTabStop();
- method @Px @FloatRange(from=0.0f) public float getFirstWidth();
- method @Px @IntRange(from=0) public int getFirstWidthLineCount();
+ method @FloatRange(from=0) @Px public float getDefaultTabStop();
+ method @FloatRange(from=0.0f) @Px public float getFirstWidth();
+ method @IntRange(from=0) @Px public int getFirstWidthLineCount();
method @Nullable public float[] getTabStops();
- method @Px @FloatRange(from=0.0f) public float getWidth();
- method public void setIndent(@Px @FloatRange(from=0.0f) float, @Px @IntRange(from=0) int);
- method public void setTabStops(@Nullable float[], @Px @FloatRange(from=0) float);
- method public void setWidth(@Px @FloatRange(from=0.0f) float);
+ method @FloatRange(from=0.0f) @Px public float getWidth();
+ method public void setIndent(@FloatRange(from=0.0f) @Px float, @IntRange(from=0) @Px int);
+ method public void setTabStops(@Nullable float[], @FloatRange(from=0) @Px float);
+ method public void setWidth(@FloatRange(from=0.0f) @Px float);
}
public static class LineBreaker.Result {
@@ -15992,7 +15993,7 @@ package android.graphics.text {
public static final class MeasuredText.Builder {
ctor public MeasuredText.Builder(@NonNull char[]);
ctor public MeasuredText.Builder(@NonNull android.graphics.text.MeasuredText);
- method @NonNull public android.graphics.text.MeasuredText.Builder appendReplacementRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, @Px @FloatRange(from=0) float);
+ method @NonNull public android.graphics.text.MeasuredText.Builder appendReplacementRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, @FloatRange(from=0) @Px float);
method @NonNull public android.graphics.text.MeasuredText.Builder appendStyleRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, boolean);
method @NonNull public android.graphics.text.MeasuredText build();
method @NonNull public android.graphics.text.MeasuredText.Builder setComputeHyphenation(boolean);
@@ -23003,7 +23004,7 @@ package android.location {
method @Nullable public String getGnssHardwareModelName();
method public int getGnssYearOfHardware();
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GpsStatus getGpsStatus(@Nullable android.location.GpsStatus);
- method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) @Nullable public android.location.Location getLastKnownLocation(@NonNull String);
+ method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.location.Location getLastKnownLocation(@NonNull String);
method @Nullable public android.location.LocationProvider getProvider(@NonNull String);
method @NonNull public java.util.List<java.lang.String> getProviders(boolean);
method @NonNull public java.util.List<java.lang.String> getProviders(@NonNull android.location.Criteria, boolean);
@@ -28457,17 +28458,17 @@ package android.net {
method public void addDefaultNetworkActiveListener(android.net.ConnectivityManager.OnNetworkActiveListener);
method public boolean bindProcessToNetwork(@Nullable android.net.Network);
method @NonNull public android.net.SocketKeepalive createSocketKeepalive(@NonNull android.net.Network, @NonNull android.net.IpSecManager.UdpEncapsulationSocket, @NonNull java.net.InetAddress, @NonNull java.net.InetAddress, @NonNull java.util.concurrent.Executor, @NonNull android.net.SocketKeepalive.Callback);
- method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @Nullable public android.net.Network getActiveNetwork();
+ method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network getActiveNetwork();
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getActiveNetworkInfo();
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo[] getAllNetworkInfo();
- method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @NonNull public android.net.Network[] getAllNetworks();
+ method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.Network[] getAllNetworks();
method @Deprecated public boolean getBackgroundDataSetting();
method @Nullable public android.net.Network getBoundNetworkForProcess();
method public int getConnectionOwnerUid(int, @NonNull java.net.InetSocketAddress, @NonNull java.net.InetSocketAddress);
method @Nullable public android.net.ProxyInfo getDefaultProxy();
- method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @Nullable public android.net.LinkProperties getLinkProperties(@Nullable android.net.Network);
+ method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.LinkProperties getLinkProperties(@Nullable android.net.Network);
method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public int getMultipathPreference(@Nullable android.net.Network);
- method @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) @Nullable public android.net.NetworkCapabilities getNetworkCapabilities(@Nullable android.net.Network);
+ method @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkCapabilities getNetworkCapabilities(@Nullable android.net.Network);
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getNetworkInfo(int);
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public android.net.NetworkInfo getNetworkInfo(@Nullable android.net.Network);
method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE) public int getNetworkPreference();
@@ -29366,7 +29367,8 @@ package android.net.rtp {
}
public class AudioGroup {
- ctor public AudioGroup();
+ ctor @Deprecated public AudioGroup();
+ ctor public AudioGroup(@Nullable android.content.Context);
method public void clear();
method public int getMode();
method public android.net.rtp.AudioStream[] getStreams();
@@ -30773,10 +30775,10 @@ package android.nfc.cardemulation {
method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
method public boolean removeAidsForService(android.content.ComponentName, String);
- method @RequiresPermission(android.Manifest.permission.NFC) @NonNull public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
+ method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
method public boolean supportsAidPrefixRegistration();
- method @RequiresPermission(android.Manifest.permission.NFC) @NonNull public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
+ method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
method public boolean unsetPreferredService(android.app.Activity);
field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
field public static final String CATEGORY_OTHER = "other";
@@ -33982,31 +33984,31 @@ package android.opengl {
package android.os {
- public abstract class AsyncTask<Params, Progress, Result> {
- ctor public AsyncTask();
- method public final boolean cancel(boolean);
- method @WorkerThread protected abstract Result doInBackground(Params...);
- method @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
- method @MainThread public static void execute(Runnable);
- method @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
- method public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException;
- method public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException;
- method public final android.os.AsyncTask.Status getStatus();
- method public final boolean isCancelled();
- method @MainThread protected void onCancelled(Result);
- method @MainThread protected void onCancelled();
- method @MainThread protected void onPostExecute(Result);
- method @MainThread protected void onPreExecute();
- method @MainThread protected void onProgressUpdate(Progress...);
- method @WorkerThread protected final void publishProgress(Progress...);
- field public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
- field public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
- }
-
- public enum AsyncTask.Status {
- enum_constant public static final android.os.AsyncTask.Status FINISHED;
- enum_constant public static final android.os.AsyncTask.Status PENDING;
- enum_constant public static final android.os.AsyncTask.Status RUNNING;
+ @Deprecated public abstract class AsyncTask<Params, Progress, Result> {
+ ctor @Deprecated public AsyncTask();
+ method @Deprecated public final boolean cancel(boolean);
+ method @Deprecated @WorkerThread protected abstract Result doInBackground(Params...);
+ method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
+ method @Deprecated @MainThread public static void execute(Runnable);
+ method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
+ method @Deprecated public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException;
+ method @Deprecated public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+ method @Deprecated public final android.os.AsyncTask.Status getStatus();
+ method @Deprecated public final boolean isCancelled();
+ method @Deprecated @MainThread protected void onCancelled(Result);
+ method @Deprecated @MainThread protected void onCancelled();
+ method @Deprecated @MainThread protected void onPostExecute(Result);
+ method @Deprecated @MainThread protected void onPreExecute();
+ method @Deprecated @MainThread protected void onProgressUpdate(Progress...);
+ method @Deprecated @WorkerThread protected final void publishProgress(Progress...);
+ field @Deprecated public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
+ field @Deprecated public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
+ }
+
+ @Deprecated public enum AsyncTask.Status {
+ enum_constant @Deprecated public static final android.os.AsyncTask.Status FINISHED;
+ enum_constant @Deprecated public static final android.os.AsyncTask.Status PENDING;
+ enum_constant @Deprecated public static final android.os.AsyncTask.Status RUNNING;
}
public class BadParcelableException extends android.util.AndroidRuntimeException {
@@ -34431,7 +34433,7 @@ package android.os {
method public void addData(String, byte[], int);
method public void addFile(String, java.io.File, int) throws java.io.IOException;
method public void addText(String, String);
- method @RequiresPermission(allOf={android.Manifest.permission.READ_LOGS, android.Manifest.permission.PACKAGE_USAGE_STATS}) @Nullable public android.os.DropBoxManager.Entry getNextEntry(String, long);
+ method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_LOGS, android.Manifest.permission.PACKAGE_USAGE_STATS}) public android.os.DropBoxManager.Entry getNextEntry(String, long);
method public boolean isTagEnabled(String);
field public static final String ACTION_DROPBOX_ENTRY_ADDED = "android.intent.action.DROPBOX_ENTRY_ADDED";
field public static final String EXTRA_DROPPED_COUNT = "android.os.extra.DROPPED_COUNT";
@@ -42666,6 +42668,7 @@ package android.system {
field public static final int IP_MULTICAST_TTL;
field public static final int IP_TOS;
field public static final int IP_TTL;
+ field public static final int MAP_ANONYMOUS;
field public static final int MAP_FIXED;
field public static final int MAP_PRIVATE;
field public static final int MAP_SHARED;
@@ -43800,7 +43803,7 @@ package android.telecom {
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
method public android.telecom.PhoneAccountHandle getSimCallManager();
method @Nullable public String getSystemDialerPackage();
- method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @Nullable public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
@@ -44161,6 +44164,7 @@ package android.telephony {
field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSRP_INT = "opportunistic_network_exit_threshold_rsrp_int";
field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT = "opportunistic_network_exit_threshold_rssnr_int";
field public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
+ field public static final String KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL = "prevent_clir_activation_and_deactivation_code_bool";
field public static final String KEY_RADIO_RESTART_FAILURE_CAUSES_INT_ARRAY = "radio_restart_failure_causes_int_array";
field public static final String KEY_RCS_CONFIG_SERVER_URL_STRING = "rcs_config_server_url_string";
field public static final String KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool";
@@ -44294,6 +44298,8 @@ package android.telephony {
public abstract class CellInfo implements android.os.Parcelable {
method public int describeContents();
method public int getCellConnectionStatus();
+ method @NonNull public abstract android.telephony.CellIdentity getCellIdentity();
+ method @NonNull public abstract android.telephony.CellSignalStrength getCellSignalStrength();
method public long getTimeStamp();
method public boolean isRegistered();
field public static final int CONNECTION_NONE = 0; // 0x0
@@ -44438,6 +44444,7 @@ package android.telephony {
method public int describeContents();
method public int getAsuLevel();
method public int getDbm();
+ method public int getEcNo();
method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR;
@@ -44725,6 +44732,7 @@ package android.telephony {
method public static int getDefaultSmsSubscriptionId();
method public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int);
method @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS) public void getSmsMessagesForFinancialApp(android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.SmsManager.FinancialSmsCallback);
+ method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSmscAddress();
method public int getSubscriptionId();
method public void injectSmsPdu(byte[], String, android.app.PendingIntent);
method public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
@@ -44732,6 +44740,7 @@ package android.telephony {
method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
method public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS}) public void sendTextMessageWithoutPersisting(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSmscAddress(@NonNull String);
field public static final String EXTRA_MMS_DATA = "android.telephony.extra.MMS_DATA";
field public static final String EXTRA_MMS_HTTP_STATUS = "android.telephony.extra.MMS_HTTP_STATUS";
field public static final String MMS_CONFIG_ALIAS_ENABLED = "aliasEnabled";
@@ -44773,13 +44782,60 @@ package android.telephony {
field public static final int MMS_ERROR_RETRY = 6; // 0x6
field public static final int MMS_ERROR_UNABLE_CONNECT_MMS = 3; // 0x3
field public static final int MMS_ERROR_UNSPECIFIED = 1; // 0x1
+ field public static final int RESULT_BLUETOOTH_DISCONNECTED = 27; // 0x1b
+ field public static final int RESULT_CANCELLED = 23; // 0x17
+ field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
+ field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
field public static final int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1
field public static final int RESULT_ERROR_LIMIT_EXCEEDED = 5; // 0x5
+ field public static final int RESULT_ERROR_NONE = 0; // 0x0
field public static final int RESULT_ERROR_NO_SERVICE = 4; // 0x4
field public static final int RESULT_ERROR_NULL_PDU = 3; // 0x3
field public static final int RESULT_ERROR_RADIO_OFF = 2; // 0x2
field public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8; // 0x8
field public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7; // 0x7
+ field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
+ field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
+ field public static final int RESULT_INVALID_BLUETOOTH_ADDRESS = 26; // 0x1a
+ field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
+ field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
+ field public static final int RESULT_INVALID_STATE = 12; // 0xc
+ field public static final int RESULT_MODEM_ERROR = 16; // 0x10
+ field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
+ field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
+ field public static final int RESULT_NO_BLUETOOTH_SERVICE = 25; // 0x19
+ field public static final int RESULT_NO_DEFAULT_SMS_APP = 32; // 0x20
+ field public static final int RESULT_NO_MEMORY = 13; // 0xd
+ field public static final int RESULT_NO_RESOURCES = 22; // 0x16
+ field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
+ field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
+ field public static final int RESULT_REMOTE_EXCEPTION = 31; // 0x1f
+ field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
+ field public static final int RESULT_RIL_CANCELLED = 119; // 0x77
+ field public static final int RESULT_RIL_ENCODING_ERR = 109; // 0x6d
+ field public static final int RESULT_RIL_INTERNAL_ERR = 113; // 0x71
+ field public static final int RESULT_RIL_INVALID_ARGUMENTS = 104; // 0x68
+ field public static final int RESULT_RIL_INVALID_MODEM_STATE = 115; // 0x73
+ field public static final int RESULT_RIL_INVALID_SMSC_ADDRESS = 110; // 0x6e
+ field public static final int RESULT_RIL_INVALID_SMS_FORMAT = 107; // 0x6b
+ field public static final int RESULT_RIL_INVALID_STATE = 103; // 0x67
+ field public static final int RESULT_RIL_MODEM_ERR = 111; // 0x6f
+ field public static final int RESULT_RIL_NETWORK_ERR = 112; // 0x70
+ field public static final int RESULT_RIL_NETWORK_NOT_READY = 116; // 0x74
+ field public static final int RESULT_RIL_NETWORK_REJECT = 102; // 0x66
+ field public static final int RESULT_RIL_NO_MEMORY = 105; // 0x69
+ field public static final int RESULT_RIL_NO_RESOURCES = 118; // 0x76
+ field public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117; // 0x75
+ field public static final int RESULT_RIL_RADIO_NOT_AVAILABLE = 100; // 0x64
+ field public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED = 114; // 0x72
+ field public static final int RESULT_RIL_REQUEST_RATE_LIMITED = 106; // 0x6a
+ field public static final int RESULT_RIL_SIM_ABSENT = 120; // 0x78
+ field public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY = 101; // 0x65
+ field public static final int RESULT_RIL_SYSTEM_ERR = 108; // 0x6c
+ field public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY = 29; // 0x1d
+ field public static final int RESULT_SMS_SEND_RETRY_FAILED = 30; // 0x1e
+ field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
+ field public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING = 28; // 0x1c
field public static final int STATUS_ON_ICC_FREE = 0; // 0x0
field public static final int STATUS_ON_ICC_READ = 1; // 0x1
field public static final int STATUS_ON_ICC_SENT = 5; // 0x5
@@ -44918,6 +44974,7 @@ package android.telephony {
field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
field public static final int DEFAULT_SUBSCRIPTION_ID = 2147483647; // 0x7fffffff
+ field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
field public static final int INVALID_SIM_SLOT_INDEX = -1; // 0xffffffff
field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
@@ -44970,6 +45027,7 @@ package android.telephony {
method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
method public android.telephony.TelephonyManager createForSubscriptionId(int);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean doesSwitchMultiSimConfigTriggerReboot();
+ method public int getActiveModemCount();
method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public java.util.List<android.telephony.CellInfo> getAllCellInfo();
method public int getCallState();
method public int getCardIdForDefaultEuicc();
@@ -44982,8 +45040,8 @@ package android.telephony {
method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId();
method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId(int);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getDeviceSoftwareVersion();
- method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList();
- method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @NonNull public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList(int);
+ method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList();
+ method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList(int);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String[] getForbiddenPlmns();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getGroupIdLevel1();
method public String getIccAuthentication(int, int, String);
@@ -45002,7 +45060,7 @@ package android.telephony {
method public String getNetworkOperatorName();
method public String getNetworkSpecifier();
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
- method public int getPhoneCount();
+ method @Deprecated public int getPhoneCount();
method public int getPhoneType();
method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
method @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState();
@@ -45017,10 +45075,12 @@ package android.telephony {
method @Nullable public CharSequence getSimSpecificCarrierIdName();
method public int getSimState();
method public int getSimState(int);
+ method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSubIdForPhoneAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
+ method public int getSupportedModemCount();
method @Nullable public String getTypeAllocationCode();
method @Nullable public String getTypeAllocationCode(int);
- method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
+ method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVisualVoicemailPackageName();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailAlphaTag();
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber();
@@ -45070,6 +45130,7 @@ package android.telephony {
method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
+ field public static final String ACTION_MULTI_SIM_CONFIG_CHANGED = "android.telephony.action.MULTI_SIM_CONFIG_CHANGED";
field public static final String ACTION_NETWORK_COUNTRY_CHANGED = "android.telephony.action.NETWORK_COUNTRY_CHANGED";
field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
field public static final String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
@@ -45110,6 +45171,7 @@ package android.telephony {
field public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT = "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT";
field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY";
field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT";
+ field public static final String EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED = "android.telephony.extra.NUM_OF_ACTIVE_SIM_SUPPORTED";
field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telephony.extra.PHONE_ACCOUNT_HANDLE";
field public static final String EXTRA_SPECIFIC_CARRIER_ID = "android.telephony.extra.SPECIFIC_CARRIER_ID";
field public static final String EXTRA_SPECIFIC_CARRIER_NAME = "android.telephony.extra.SPECIFIC_CARRIER_NAME";
@@ -45120,6 +45182,10 @@ package android.telephony {
field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID";
field public static final String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER";
field public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU";
+ field public static final int MODEM_COUNT_DUAL_MODEM = 2; // 0x2
+ field public static final int MODEM_COUNT_NO_MODEM = 0; // 0x0
+ field public static final int MODEM_COUNT_SINGLE_MODEM = 1; // 0x1
+ field public static final int MODEM_COUNT_TRI_MODEM = 3; // 0x3
field public static final int MULTISIM_ALLOWED = 0; // 0x0
field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2
field public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1; // 0x1
@@ -46948,7 +47014,7 @@ package android.text.style {
}
public static class LineHeightSpan.Standard implements android.text.style.LineHeightSpan android.text.ParcelableSpan {
- ctor public LineHeightSpan.Standard(@Px @IntRange(from=1) int);
+ ctor public LineHeightSpan.Standard(@IntRange(from=1) @Px int);
ctor public LineHeightSpan.Standard(@NonNull android.os.Parcel);
method public void chooseHeight(@NonNull CharSequence, int, int, int, int, @NonNull android.graphics.Paint.FontMetricsInt);
method public int describeContents();
@@ -51077,11 +51143,11 @@ package android.view {
field @Deprecated public static final boolean TRACE_RECYCLER = false;
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface ViewDebug.CapturedViewProperty {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface ViewDebug.CapturedViewProperty {
method public abstract boolean retrieveReturn() default false;
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface ViewDebug.ExportedProperty {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface ViewDebug.ExportedProperty {
method public abstract String category() default "";
method public abstract boolean deepExport() default false;
method public abstract android.view.ViewDebug.FlagToString[] flagMapping() default {};
@@ -51093,7 +51159,7 @@ package android.view {
method public abstract boolean resolveId() default false;
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface ViewDebug.FlagToString {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface ViewDebug.FlagToString {
method public abstract int equals();
method public abstract int mask();
method public abstract String name();
@@ -51111,7 +51177,7 @@ package android.view {
enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType REQUEST_LAYOUT;
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface ViewDebug.IntToString {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface ViewDebug.IntToString {
method public abstract int from();
method public abstract String to();
}
@@ -53660,18 +53726,18 @@ package android.view.textclassifier {
}
public interface TextClassifier {
- method @WorkerThread @NonNull public default android.view.textclassifier.TextClassification classifyText(@NonNull android.view.textclassifier.TextClassification.Request);
- method @WorkerThread @NonNull public default android.view.textclassifier.TextClassification classifyText(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextClassification classifyText(@NonNull android.view.textclassifier.TextClassification.Request);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextClassification classifyText(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
method public default void destroy();
- method @WorkerThread @NonNull public default android.view.textclassifier.TextLanguage detectLanguage(@NonNull android.view.textclassifier.TextLanguage.Request);
- method @WorkerThread @NonNull public default android.view.textclassifier.TextLinks generateLinks(@NonNull android.view.textclassifier.TextLinks.Request);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextLanguage detectLanguage(@NonNull android.view.textclassifier.TextLanguage.Request);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextLinks generateLinks(@NonNull android.view.textclassifier.TextLinks.Request);
method @WorkerThread public default int getMaxGenerateLinksTextLength();
method public default boolean isDestroyed();
method public default void onSelectionEvent(@NonNull android.view.textclassifier.SelectionEvent);
method public default void onTextClassifierEvent(@NonNull android.view.textclassifier.TextClassifierEvent);
- method @WorkerThread @NonNull public default android.view.textclassifier.ConversationActions suggestConversationActions(@NonNull android.view.textclassifier.ConversationActions.Request);
- method @WorkerThread @NonNull public default android.view.textclassifier.TextSelection suggestSelection(@NonNull android.view.textclassifier.TextSelection.Request);
- method @WorkerThread @NonNull public default android.view.textclassifier.TextSelection suggestSelection(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
+ method @NonNull @WorkerThread public default android.view.textclassifier.ConversationActions suggestConversationActions(@NonNull android.view.textclassifier.ConversationActions.Request);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextSelection suggestSelection(@NonNull android.view.textclassifier.TextSelection.Request);
+ method @NonNull @WorkerThread public default android.view.textclassifier.TextSelection suggestSelection(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
field public static final String EXTRA_FROM_TEXT_CLASSIFIER = "android.view.textclassifier.extra.FROM_TEXT_CLASSIFIER";
field public static final String HINT_TEXT_IS_EDITABLE = "android.text_is_editable";
field public static final String HINT_TEXT_IS_NOT_EDITABLE = "android.text_is_not_editable";
@@ -56134,12 +56200,12 @@ package android.widget {
ctor public Magnifier.Builder(@NonNull android.view.View);
method @NonNull public android.widget.Magnifier build();
method @NonNull public android.widget.Magnifier.Builder setClippingEnabled(boolean);
- method @NonNull public android.widget.Magnifier.Builder setCornerRadius(@Px @FloatRange(from=0) float);
+ method @NonNull public android.widget.Magnifier.Builder setCornerRadius(@FloatRange(from=0) @Px float);
method @NonNull public android.widget.Magnifier.Builder setDefaultSourceToMagnifierOffset(@Px int, @Px int);
- method @NonNull public android.widget.Magnifier.Builder setElevation(@Px @FloatRange(from=0) float);
+ method @NonNull public android.widget.Magnifier.Builder setElevation(@FloatRange(from=0) @Px float);
method @NonNull public android.widget.Magnifier.Builder setInitialZoom(@FloatRange(from=0.0f) float);
method @NonNull public android.widget.Magnifier.Builder setOverlay(@Nullable android.graphics.drawable.Drawable);
- method @NonNull public android.widget.Magnifier.Builder setSize(@Px @IntRange(from=0) int, @Px @IntRange(from=0) int);
+ method @NonNull public android.widget.Magnifier.Builder setSize(@IntRange(from=0) @Px int, @IntRange(from=0) @Px int);
method @NonNull public android.widget.Magnifier.Builder setSourceBounds(int, int, int, int);
}
@@ -56633,7 +56699,7 @@ package android.widget {
method @NonNull public static android.widget.RemoteViews.RemoteResponse fromPendingIntent(@NonNull android.app.PendingIntent);
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public static @interface RemoteViews.RemoteView {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface RemoteViews.RemoteView {
}
public abstract class RemoteViewsService extends android.app.Service {
@@ -57309,7 +57375,7 @@ package android.widget {
method public void setExtractedText(android.view.inputmethod.ExtractedText);
method public void setFallbackLineSpacing(boolean);
method public void setFilters(android.text.InputFilter[]);
- method public void setFirstBaselineToTopHeight(@Px @IntRange(from=0) int);
+ method public void setFirstBaselineToTopHeight(@IntRange(from=0) @Px int);
method public void setFontFeatureSettings(@Nullable String);
method public boolean setFontVariationSettings(@Nullable String);
method protected boolean setFrame(int, int, int, int);
@@ -57331,9 +57397,9 @@ package android.widget {
method public void setInputType(int);
method public void setJustificationMode(int);
method public void setKeyListener(android.text.method.KeyListener);
- method public void setLastBaselineToBottomHeight(@Px @IntRange(from=0) int);
+ method public void setLastBaselineToBottomHeight(@IntRange(from=0) @Px int);
method public void setLetterSpacing(float);
- method public void setLineHeight(@Px @IntRange(from=0) int);
+ method public void setLineHeight(@IntRange(from=0) @Px int);
method public void setLineSpacing(float, float);
method public void setLines(int);
method public final void setLinkTextColor(@ColorInt int);
@@ -60388,7 +60454,7 @@ package java.lang {
ctor public OutOfMemoryError(String);
}
- @java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public @interface Override {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target(java.lang.annotation.ElementType.METHOD) public @interface Override {
}
public class Package implements java.lang.reflect.AnnotatedElement {
@@ -60880,9 +60946,9 @@ package java.lang {
method @NonNull public StringBuilder reverse();
method public void setCharAt(int, char);
method public void setLength(int);
- method public CharSequence subSequence(int, int);
- method public String substring(int);
- method public String substring(int, int);
+ method @NonNull public CharSequence subSequence(int, int);
+ method @NonNull public String substring(int);
+ method @NonNull public String substring(int, int);
method public void trimToSize();
}
@@ -60892,7 +60958,7 @@ package java.lang {
ctor public StringIndexOutOfBoundsException(int);
}
- @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public @interface SuppressWarnings {
+ @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) public @interface SuppressWarnings {
method public abstract String[] value();
}
@@ -71215,20 +71281,20 @@ package java.util.concurrent {
method public boolean addAll(@NonNull java.util.Collection<? extends K>);
method public final void clear();
method public boolean contains(@NonNull Object);
- method public final boolean containsAll(java.util.Collection<?>);
+ method public final boolean containsAll(@NonNull java.util.Collection<?>);
method public void forEach(@NonNull java.util.function.Consumer<? super K>);
- method public java.util.concurrent.ConcurrentHashMap<K,V> getMap();
+ method @NonNull public java.util.concurrent.ConcurrentHashMap<K,V> getMap();
method @Nullable public V getMappedValue();
method public final boolean isEmpty();
method @NonNull public java.util.Iterator<K> iterator();
method public boolean remove(@NonNull Object);
- method public final boolean removeAll(java.util.Collection<?>);
- method public final boolean retainAll(java.util.Collection<?>);
+ method public final boolean removeAll(@NonNull java.util.Collection<?>);
+ method public final boolean retainAll(@NonNull java.util.Collection<?>);
method public final int size();
method @NonNull public java.util.Spliterator<K> spliterator();
- method public final Object[] toArray();
- method public final <T> T[] toArray(T[]);
- method public final String toString();
+ method @NonNull public final Object[] toArray();
+ method @NonNull public final <T> T[] toArray(@NonNull T[]);
+ method @NonNull public final String toString();
}
public class ConcurrentLinkedDeque<E> extends java.util.AbstractCollection<E> implements java.util.Deque<E> java.io.Serializable {
diff --git a/api/system-current.txt b/api/system-current.txt
index b81dec044ab7..33931122d0f3 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -568,7 +568,7 @@ package android.app {
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public byte[] getStatsMetadata() throws android.app.StatsManager.StatsUnavailableException;
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void removeConfig(long) throws android.app.StatsManager.StatsUnavailableException;
method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean removeConfiguration(long);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @NonNull public long[] setActiveConfigsChangedOperation(@Nullable android.app.PendingIntent) throws android.app.StatsManager.StatsUnavailableException;
+ method @NonNull @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public long[] setActiveConfigsChangedOperation(@Nullable android.app.PendingIntent) throws android.app.StatsManager.StatsUnavailableException;
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void setBroadcastSubscriber(android.app.PendingIntent, long, long) throws android.app.StatsManager.StatsUnavailableException;
method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean setBroadcastSubscriber(long, long, android.app.PendingIntent);
method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public boolean setDataFetchOperation(long, android.app.PendingIntent);
@@ -1242,9 +1242,13 @@ package android.bluetooth {
method public boolean disableBLE();
method public boolean enableBLE();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADMIN) public boolean enableNoAutoConnect();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean factoryReset();
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public long getDiscoveryEndMillis();
method public boolean isBleScanAlwaysAvailable();
method public boolean isLeEnabled();
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public boolean removeOnMetadataChangedListener(@NonNull android.bluetooth.BluetoothDevice, @NonNull android.bluetooth.BluetoothAdapter.OnMetadataChangedListener);
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean setScanMode(int, int);
+ method @RequiresPermission(android.Manifest.permission.BLUETOOTH) public boolean setScanMode(int);
field public static final String ACTION_BLE_STATE_CHANGED = "android.bluetooth.adapter.action.BLE_STATE_CHANGED";
field public static final String ACTION_REQUEST_BLE_SCAN_ALWAYS_AVAILABLE = "android.bluetooth.adapter.action.REQUEST_BLE_SCAN_ALWAYS_AVAILABLE";
}
@@ -1355,7 +1359,7 @@ package android.content {
method public abstract void sendBroadcast(android.content.Intent, @Nullable String, @Nullable android.os.Bundle);
method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, @Nullable android.os.Bundle);
method public abstract void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable android.os.Bundle, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
- method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void startActivityAsUser(@RequiresPermission @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+ method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public void startActivityAsUser(@NonNull @RequiresPermission android.content.Intent, @NonNull android.os.UserHandle);
field public static final String APP_PREDICTION_SERVICE = "app_prediction";
field public static final String BACKUP_SERVICE = "backup";
field public static final String BUGREPORT_SERVICE = "bugreport";
@@ -1373,6 +1377,7 @@ package android.content {
field public static final String STATS_MANAGER = "stats";
field public static final String STATUS_BAR_SERVICE = "statusbar";
field public static final String SYSTEM_UPDATE_SERVICE = "system_update";
+ field public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
field public static final String VR_SERVICE = "vrmanager";
field @Deprecated public static final String WIFI_RTT_SERVICE = "rttmanager";
field public static final String WIFI_SCANNING_SERVICE = "wifiscanner";
@@ -1842,8 +1847,8 @@ package android.content.rollback {
public final class RollbackManager {
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, "android.permission.TEST_MANAGE_ROLLBACKS"}) public void commitRollback(int, @NonNull java.util.List<android.content.pm.VersionedPackage>, @NonNull android.content.IntentSender);
- method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, "android.permission.TEST_MANAGE_ROLLBACKS"}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
- method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, "android.permission.TEST_MANAGE_ROLLBACKS"}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
+ method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, "android.permission.TEST_MANAGE_ROLLBACKS"}) public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
+ method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, "android.permission.TEST_MANAGE_ROLLBACKS"}) public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
field public static final String EXTRA_STATUS = "android.content.rollback.extra.STATUS";
field public static final String EXTRA_STATUS_MESSAGE = "android.content.rollback.extra.STATUS_MESSAGE";
field public static final int STATUS_FAILURE = 1; // 0x1
@@ -2353,24 +2358,24 @@ package android.hardware.location {
}
public final class ContextHubManager {
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.ContextHubClientCallback, @NonNull java.util.concurrent.Executor);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.ContextHubClientCallback);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.app.PendingIntent, long);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubTransaction<java.lang.Void> disableNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubTransaction<java.lang.Void> enableNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.ContextHubClientCallback, @NonNull java.util.concurrent.Executor);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.ContextHubClientCallback);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubClient createClient(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.app.PendingIntent, long);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubTransaction<java.lang.Void> disableNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubTransaction<java.lang.Void> enableNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int[] findNanoAppOnHub(int, @NonNull android.hardware.location.NanoAppFilter);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int[] getContextHubHandles();
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubInfo getContextHubInfo(int);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public java.util.List<android.hardware.location.ContextHubInfo> getContextHubs();
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public java.util.List<android.hardware.location.ContextHubInfo> getContextHubs();
method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.NanoAppInstanceInfo getNanoAppInstanceInfo(int);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int loadNanoApp(int, @NonNull android.hardware.location.NanoApp);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubTransaction<java.lang.Void> loadNanoApp(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.NanoAppBinary);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubTransaction<java.util.List<android.hardware.location.NanoAppState>> queryNanoApps(@NonNull android.hardware.location.ContextHubInfo);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubTransaction<java.lang.Void> loadNanoApp(@NonNull android.hardware.location.ContextHubInfo, @NonNull android.hardware.location.NanoAppBinary);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubTransaction<java.util.List<android.hardware.location.NanoAppState>> queryNanoApps(@NonNull android.hardware.location.ContextHubInfo);
method @Deprecated public int registerCallback(@NonNull android.hardware.location.ContextHubManager.Callback);
method @Deprecated public int registerCallback(android.hardware.location.ContextHubManager.Callback, android.os.Handler);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int sendMessage(int, int, @NonNull android.hardware.location.ContextHubMessage);
method @Deprecated @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public int unloadNanoApp(int);
- method @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) @NonNull public android.hardware.location.ContextHubTransaction<java.lang.Void> unloadNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
+ method @NonNull @RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE) public android.hardware.location.ContextHubTransaction<java.lang.Void> unloadNanoApp(@NonNull android.hardware.location.ContextHubInfo, long);
method @Deprecated public int unregisterCallback(@NonNull android.hardware.location.ContextHubManager.Callback);
field public static final int EVENT_HUB_RESET = 6; // 0x6
field public static final int EVENT_NANOAPP_ABORTED = 4; // 0x4
@@ -3035,7 +3040,7 @@ package android.hardware.usb {
}
public final class UsbPort {
- method @RequiresPermission(android.Manifest.permission.MANAGE_USB) @Nullable public android.hardware.usb.UsbPortStatus getStatus();
+ method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_USB) public android.hardware.usb.UsbPortStatus getStatus();
method @RequiresPermission(android.Manifest.permission.MANAGE_USB) public void setRoles(int, int);
}
@@ -3428,7 +3433,7 @@ package android.location {
method @NonNull public android.location.LocationRequest setFastestInterval(long);
method public void setHideFromAppOps(boolean);
method @NonNull public android.location.LocationRequest setInterval(long);
- method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @NonNull public android.location.LocationRequest setLocationSettingsIgnored(boolean);
+ method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.location.LocationRequest setLocationSettingsIgnored(boolean);
method @NonNull public android.location.LocationRequest setLowPowerMode(boolean);
method @NonNull public android.location.LocationRequest setNumUpdates(int);
method @NonNull public android.location.LocationRequest setProvider(@NonNull String);
@@ -4432,7 +4437,8 @@ package android.net.util {
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
- method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+ method @Deprecated @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+ method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int, @NonNull byte[]);
}
}
@@ -4698,8 +4704,11 @@ package android.net.wifi {
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsConfiguratorInitiator(@NonNull String, int, int, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startEasyConnectAsEnrolleeInitiator(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.EasyConnectStatusCallback);
method @RequiresPermission(android.Manifest.permission.UPDATE_DEVICE_STATS) public boolean startScan(android.os.WorkSource);
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean startSoftAp(@Nullable android.net.wifi.WifiConfiguration);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void startSubscriptionProvisioning(@NonNull android.net.wifi.hotspot2.OsuProvider, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.hotspot2.ProvisioningCallback);
method @RequiresPermission(anyOf={"android.permission.NETWORK_SETTINGS", android.Manifest.permission.NETWORK_SETUP_WIZARD}) public void stopEasyConnectSession();
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public boolean stopSoftAp();
+ method @RequiresPermission(anyOf={"android.permission.NETWORK_STACK", android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateInterfaceIpState(@Nullable String, int);
method @RequiresPermission("android.permission.WIFI_UPDATE_USABILITY_STATS_SCORE") public void updateWifiUsabilityScore(int, int, int);
field public static final int CHANGE_REASON_ADDED = 0; // 0x0
field public static final int CHANGE_REASON_CONFIG_CHANGE = 2; // 0x2
@@ -4714,10 +4723,16 @@ package android.net.wifi {
field public static final String EXTRA_CHANGE_REASON = "changeReason";
field public static final String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
field public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
+ field public static final String EXTRA_WIFI_AP_INTERFACE_NAME = "android.net.wifi.extra.WIFI_AP_INTERFACE_NAME";
+ field public static final String EXTRA_WIFI_AP_MODE = "android.net.wifi.extra.WIFI_AP_MODE";
field public static final String EXTRA_WIFI_AP_STATE = "wifi_state";
field public static final String EXTRA_WIFI_CONFIGURATION = "wifiConfiguration";
field public static final String EXTRA_WIFI_CREDENTIAL_EVENT_TYPE = "et";
field public static final String EXTRA_WIFI_CREDENTIAL_SSID = "ssid";
+ field public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0; // 0x0
+ field public static final int IFACE_IP_MODE_LOCAL_ONLY = 2; // 0x2
+ field public static final int IFACE_IP_MODE_TETHERED = 1; // 0x1
+ field public static final int IFACE_IP_MODE_UNSPECIFIED = -1; // 0xffffffff
field public static final int PASSPOINT_HOME_NETWORK = 0; // 0x0
field public static final int PASSPOINT_ROAMING_NETWORK = 1; // 0x1
field public static final String WIFI_AP_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_AP_STATE_CHANGED";
@@ -5315,8 +5330,8 @@ package android.os {
method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void cancelAuthorization(android.os.IncidentManager.AuthListener);
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void deleteIncidentReports(android.net.Uri);
method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public void denyReport(android.net.Uri);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @Nullable public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @NonNull public java.util.List<android.net.Uri> getIncidentReportList(String);
+ method @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
+ method @NonNull @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public java.util.List<android.net.Uri> getIncidentReportList(String);
method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public java.util.List<android.os.IncidentManager.PendingReport> getPendingReports();
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void reportIncident(android.os.IncidentReportArgs);
method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener);
@@ -5639,6 +5654,14 @@ package android.os.storage {
}
+package android.os.telephony {
+
+ public class TelephonyRegistryManager {
+ method public void notifyCarrierNetworkChange(boolean);
+ }
+
+}
+
package android.permission {
public final class PermissionControllerManager {
@@ -6122,7 +6145,7 @@ package android.provider {
package android.security.keystore {
public abstract class AttestationUtils {
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @NonNull public static java.security.cert.X509Certificate[] attestDeviceIds(android.content.Context, @NonNull int[], @NonNull byte[]) throws android.security.keystore.DeviceIdAttestationException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static java.security.cert.X509Certificate[] attestDeviceIds(android.content.Context, @NonNull int[], @NonNull byte[]) throws android.security.keystore.DeviceIdAttestationException;
field public static final int ID_TYPE_IMEI = 2; // 0x2
field public static final int ID_TYPE_MEID = 3; // 0x3
field public static final int ID_TYPE_SERIAL = 1; // 0x1
@@ -6202,18 +6225,18 @@ package android.security.keystore.recovery {
}
public class RecoveryController {
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public android.security.keystore.recovery.RecoverySession createRecoverySession();
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public android.security.keystore.recovery.RecoverySession createRecoverySession();
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key generateKey(@NonNull String) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public java.security.Key generateKey(@NonNull String, @Nullable byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public java.util.List<java.lang.String> getAliases() throws android.security.keystore.recovery.InternalRecoveryServiceException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public static android.security.keystore.recovery.RecoveryController getInstance(@NonNull android.content.Context);
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @Nullable public java.security.Key getKey(@NonNull String) throws android.security.keystore.recovery.InternalRecoveryServiceException, java.security.UnrecoverableKeyException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @Nullable public android.security.keystore.recovery.KeyChainSnapshot getKeyChainSnapshot() throws android.security.keystore.recovery.InternalRecoveryServiceException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key generateKey(@NonNull String, @Nullable byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.util.List<java.lang.String> getAliases() throws android.security.keystore.recovery.InternalRecoveryServiceException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public static android.security.keystore.recovery.RecoveryController getInstance(@NonNull android.content.Context);
+ method @Nullable @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key getKey(@NonNull String) throws android.security.keystore.recovery.InternalRecoveryServiceException, java.security.UnrecoverableKeyException;
+ method @Nullable @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public android.security.keystore.recovery.KeyChainSnapshot getKeyChainSnapshot() throws android.security.keystore.recovery.InternalRecoveryServiceException;
method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public int[] getRecoverySecretTypes() throws android.security.keystore.recovery.InternalRecoveryServiceException;
method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public int getRecoveryStatus(@NonNull String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public java.util.Map<java.lang.String,java.security.cert.X509Certificate> getRootCertificates();
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.util.Map<java.lang.String,java.security.cert.X509Certificate> getRootCertificates();
method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key importKey(@NonNull String, @NonNull byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public java.security.Key importKey(@NonNull String, @NonNull byte[], @Nullable byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.security.Key importKey(@NonNull String, @NonNull byte[], @Nullable byte[]) throws android.security.keystore.recovery.InternalRecoveryServiceException, android.security.keystore.recovery.LockScreenRequiredException;
method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public void initRecoveryService(@NonNull String, @NonNull byte[], @NonNull byte[]) throws java.security.cert.CertificateException, android.security.keystore.recovery.InternalRecoveryServiceException;
method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public static boolean isRecoverableKeyStoreEnabled(@NonNull android.content.Context);
method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public void removeKey(@NonNull String) throws android.security.keystore.recovery.InternalRecoveryServiceException;
@@ -6228,8 +6251,8 @@ package android.security.keystore.recovery {
public class RecoverySession implements java.lang.AutoCloseable {
method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public void close();
- method @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public java.util.Map<java.lang.String,java.security.Key> recoverKeyChainSnapshot(@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 @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) @NonNull public byte[] start(@NonNull String, @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;
+ method @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public java.util.Map<java.lang.String,java.security.Key> recoverKeyChainSnapshot(@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 @NonNull @RequiresPermission(android.Manifest.permission.RECOVER_KEYSTORE) public byte[] start(@NonNull String, @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 class SessionExpiredException extends java.security.GeneralSecurityException {
@@ -6370,7 +6393,29 @@ package android.service.carrier {
public abstract class ApnService extends android.app.Service {
ctor public ApnService();
method @NonNull public android.os.IBinder onBind(@Nullable android.content.Intent);
- method @WorkerThread @NonNull public abstract java.util.List<android.content.ContentValues> onRestoreApns(int);
+ method @NonNull @WorkerThread public abstract java.util.List<android.content.ContentValues> onRestoreApns(int);
+ }
+
+ public abstract class CarrierMessagingServiceWrapper {
+ ctor public CarrierMessagingServiceWrapper();
+ method public boolean bindToCarrierMessagingService(@NonNull android.content.Context, @NonNull String);
+ method public void disposeConnection(@NonNull android.content.Context);
+ method public void downloadMms(@NonNull android.net.Uri, int, @NonNull android.net.Uri, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ method public void filterSms(@NonNull android.service.carrier.MessagePdu, @NonNull String, int, int, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ method public abstract void onServiceReady();
+ method public void sendDataSms(@NonNull byte[], int, @NonNull String, int, int, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ method public void sendMms(@NonNull android.net.Uri, int, @NonNull android.net.Uri, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ method public void sendMultipartTextSms(@NonNull java.util.List<java.lang.String>, int, @NonNull String, int, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ method public void sendTextSms(@NonNull String, int, @NonNull String, int, @NonNull android.service.carrier.CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper);
+ }
+
+ public abstract static class CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper {
+ ctor public CarrierMessagingServiceWrapper.CarrierMessagingCallbackWrapper();
+ method public void onDownloadMmsComplete(int);
+ method public void onFilterComplete(int);
+ method public void onSendMmsComplete(int, @Nullable byte[]);
+ method public void onSendMultipartSmsComplete(int, @Nullable int[]);
+ method public void onSendSmsComplete(int, int);
}
}
@@ -6482,13 +6527,13 @@ package android.service.euicc {
method public android.service.euicc.EuiccProfileInfo.Builder setUiccAccessRule(@Nullable java.util.List<android.telephony.UiccAccessRule>);
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(flag=true, prefix={"POLICY_RULE_"}, value={android.service.euicc.EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE, android.service.euicc.EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, android.service.euicc.EuiccProfileInfo.POLICY_RULE_DELETE_AFTER_DISABLING}) public static @interface EuiccProfileInfo.PolicyRule {
+ @IntDef(flag=true, prefix={"POLICY_RULE_"}, value={android.service.euicc.EuiccProfileInfo.POLICY_RULE_DO_NOT_DISABLE, android.service.euicc.EuiccProfileInfo.POLICY_RULE_DO_NOT_DELETE, android.service.euicc.EuiccProfileInfo.POLICY_RULE_DELETE_AFTER_DISABLING}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccProfileInfo.PolicyRule {
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix={"PROFILE_CLASS_"}, value={android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_TESTING, android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_PROVISIONING, android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL, 0xffffffff}) public static @interface EuiccProfileInfo.ProfileClass {
+ @IntDef(prefix={"PROFILE_CLASS_"}, value={android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_TESTING, android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_PROVISIONING, android.service.euicc.EuiccProfileInfo.PROFILE_CLASS_OPERATIONAL, 0xffffffff}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccProfileInfo.ProfileClass {
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix={"PROFILE_STATE_"}, value={android.service.euicc.EuiccProfileInfo.PROFILE_STATE_DISABLED, android.service.euicc.EuiccProfileInfo.PROFILE_STATE_ENABLED, 0xffffffff}) public static @interface EuiccProfileInfo.ProfileState {
+ @IntDef(prefix={"PROFILE_STATE_"}, value={android.service.euicc.EuiccProfileInfo.PROFILE_STATE_DISABLED, android.service.euicc.EuiccProfileInfo.PROFILE_STATE_ENABLED, 0xffffffff}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccProfileInfo.ProfileState {
}
public abstract class EuiccService extends android.app.Service {
@@ -6497,7 +6542,8 @@ package android.service.euicc {
method public abstract int onDeleteSubscription(int, String);
method public android.service.euicc.DownloadSubscriptionResult onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean, @Nullable android.os.Bundle);
method @Deprecated public int onDownloadSubscription(int, @NonNull android.telephony.euicc.DownloadableSubscription, boolean, boolean);
- method public abstract int onEraseSubscriptions(int);
+ method @Deprecated public abstract int onEraseSubscriptions(int);
+ method public int onEraseSubscriptionsWithOptions(int, @android.telephony.euicc.EuiccCardManager.ResetOption int);
method public abstract android.service.euicc.GetDefaultDownloadableSubscriptionListResult onGetDefaultDownloadableSubscriptionList(int, boolean);
method public abstract android.service.euicc.GetDownloadableSubscriptionMetadataResult onGetDownloadableSubscriptionMetadata(int, android.telephony.euicc.DownloadableSubscription, boolean);
method public abstract String onGetEid(int);
@@ -6666,7 +6712,7 @@ package android.service.notification {
package android.service.oemlock {
public class OemLockManager {
- method @RequiresPermission(android.Manifest.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE) @Nullable public String getLockName();
+ method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE) public String getLockName();
method @RequiresPermission(android.Manifest.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE) public boolean isOemUnlockAllowedByCarrier();
method @RequiresPermission(android.Manifest.permission.MANAGE_USER_OEM_UNLOCK_STATE) public boolean isOemUnlockAllowedByUser();
method @RequiresPermission(android.Manifest.permission.MANAGE_CARRIER_OEM_UNLOCK_STATE) public void setOemUnlockAllowedByCarrier(boolean, @Nullable byte[]);
@@ -6679,7 +6725,7 @@ package android.service.persistentdata {
public class PersistentDataBlockManager {
method @RequiresPermission("android.permission.ACCESS_PDB_STATE") public int getDataBlockSize();
- method @RequiresPermission(anyOf={android.Manifest.permission.READ_OEM_UNLOCK_STATE, "android.permission.OEM_UNLOCK_STATE"}) @android.service.persistentdata.PersistentDataBlockManager.FlashLockState public int getFlashLockState();
+ method @android.service.persistentdata.PersistentDataBlockManager.FlashLockState @RequiresPermission(anyOf={android.Manifest.permission.READ_OEM_UNLOCK_STATE, "android.permission.OEM_UNLOCK_STATE"}) public int getFlashLockState();
method public long getMaximumDataBlockSize();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_OEM_UNLOCK_STATE, "android.permission.OEM_UNLOCK_STATE"}) public boolean getOemUnlockEnabled();
method public byte[] read();
@@ -7237,9 +7283,10 @@ package android.telephony {
public abstract class CellBroadcastService extends android.app.Service {
ctor public CellBroadcastService();
- method @CallSuper public android.os.IBinder onBind(android.content.Intent);
- method public abstract void onCdmaCellBroadcastSms(int, byte[]);
- method public abstract void onGsmCellBroadcastSms(int, byte[]);
+ method @CallSuper @NonNull public android.os.IBinder onBind(@Nullable android.content.Intent);
+ method public abstract void onCdmaCellBroadcastSms(int, @NonNull byte[], int);
+ method public abstract void onCdmaScpMessage(int, @NonNull java.util.List<android.telephony.cdma.CdmaSmsCbProgramData>, @NonNull String, @NonNull java.util.function.Consumer<android.os.Bundle>);
+ method public abstract void onGsmCellBroadcastSms(int, @NonNull byte[]);
field public static final String CELL_BROADCAST_SERVICE_INTERFACE = "android.telephony.CellBroadcastService";
}
@@ -7783,6 +7830,12 @@ package android.telephony {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneNumberRange> CREATOR;
}
+ public class PhoneNumberUtils {
+ method @NonNull public static String getUsernameFromUriNumber(@NonNull String);
+ method public static boolean isUriNumber(@Nullable String);
+ method public static boolean isVoiceMailNumber(@NonNull android.content.Context, int, @Nullable String);
+ }
+
public class PhoneStateListener {
method public void onCallAttributesChanged(@NonNull android.telephony.CallAttributes);
method @RequiresPermission("android.permission.READ_PRECISE_PHONE_STATE") public void onCallDisconnectCauseChanged(int, int);
@@ -8026,7 +8079,7 @@ package android.telephony {
}
public final class SmsCbMessage implements android.os.Parcelable {
- ctor public SmsCbMessage(int, int, int, @NonNull android.telephony.SmsCbLocation, int, @Nullable String, @Nullable String, int, @Nullable android.telephony.SmsCbEtwsInfo, @Nullable android.telephony.SmsCbCmasInfo);
+ ctor public SmsCbMessage(int, int, int, @NonNull android.telephony.SmsCbLocation, int, @Nullable String, @Nullable String, int, @Nullable android.telephony.SmsCbEtwsInfo, @Nullable android.telephony.SmsCbCmasInfo, int);
method @NonNull public static android.telephony.SmsCbMessage createFromCursor(@NonNull android.database.Cursor);
method public int describeContents();
method @Nullable public android.telephony.SmsCbCmasInfo getCmasWarningInfo();
@@ -8041,6 +8094,7 @@ package android.telephony {
method public long getReceivedTime();
method public int getSerialNumber();
method public int getServiceCategory();
+ method public int getSlotIndex();
method public boolean isCmasMessage();
method public boolean isEmergencyMessage();
method public boolean isEtwsMessage();
@@ -8062,25 +8116,8 @@ package android.telephony {
public final class SmsManager {
method public boolean disableCellBroadcastRange(int, int, int);
method public boolean enableCellBroadcastRange(int, int, int);
+ method public void sendMultipartTextMessage(@NonNull String, @NonNull String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void sendMultipartTextMessageWithoutPersisting(String, String, java.util.List<java.lang.String>, java.util.List<android.app.PendingIntent>, java.util.List<android.app.PendingIntent>);
- field public static final int RESULT_CANCELLED = 23; // 0x17
- field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
- field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
- field public static final int RESULT_ERROR_NONE = 0; // 0x0
- field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
- field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
- field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
- field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
- field public static final int RESULT_INVALID_STATE = 12; // 0xc
- field public static final int RESULT_MODEM_ERROR = 16; // 0x10
- field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
- field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
- field public static final int RESULT_NO_MEMORY = 13; // 0xd
- field public static final int RESULT_NO_RESOURCES = 22; // 0x16
- field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
- field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
- field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
- field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
}
public class SubscriptionInfo implements android.os.Parcelable {
@@ -8097,6 +8134,7 @@ package android.telephony {
method public void requestEmbeddedSubscriptionInfoListRefresh(int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultDataSubId(int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultSmsSubId(int);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultVoiceSubscriptionId(int);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setPreferredDataSubscriptionId(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSubscriptionEnabled(int, boolean);
field @NonNull public static final android.net.Uri ADVANCED_CALLING_ENABLED_CONTENT_URI;
@@ -8140,6 +8178,9 @@ package android.telephony {
public class TelephonyManager {
method @Deprecated @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void call(String, String);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionReportDefaultNetworkStatus(int, boolean);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionResetAll(int);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void carrierActionSetRadioEnabled(int, boolean);
method public int checkCarrierPrivilegesForPackage(String);
method public int checkCarrierPrivilegesForPackageAnyPhone(String);
method public void dial(String);
@@ -8162,11 +8203,14 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getDataActivationState();
method @Deprecated public boolean getDataEnabled();
method @Deprecated public boolean getDataEnabled(int);
+ method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
+ method public int getMaxNumberOfSimultaneouslyActiveSims();
method public static long getMaxNumberVerificationTimeoutMillis();
+ method @NonNull public String getNetworkCountryIso(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmask();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
@@ -8187,6 +8231,7 @@ package android.telephony {
method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelBySlot(int, int, int, int, int, int, int, @Nullable String);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int);
method public boolean isDataConnectivityPossible();
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle();
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
@@ -8200,6 +8245,7 @@ package android.telephony {
method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.MODIFY_PHONE_STATE}) public void requestCellInfoUpdate(@NonNull android.os.WorkSource, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void requestNumberVerification(@NonNull android.telephony.PhoneNumberRange, long, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.NumberVerificationCallback);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean resetRadioConfig();
+ method @RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL) public void resetSettings();
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setAllowedCarriers(int, java.util.List<android.service.carrier.CarrierIdentifier>);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCarrierDataEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setCarrierRestrictionRules(@NonNull android.telephony.CarrierRestrictionRules);
@@ -8222,6 +8268,7 @@ package android.telephony {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void toggleRadioOnOff();
method public void updateServiceLocation();
field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED";
+ field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED = "android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED";
field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED";
field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED";
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
@@ -8517,10 +8564,10 @@ package android.telephony.euicc {
field public static final int RESULT_UNKNOWN_ERROR = -1; // 0xffffffff
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(prefix={"CANCEL_REASON_"}, value={android.telephony.euicc.EuiccCardManager.CANCEL_REASON_END_USER_REJECTED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_POSTPONED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_TIMEOUT, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_PPR_NOT_ALLOWED}) public static @interface EuiccCardManager.CancelReason {
+ @IntDef(prefix={"CANCEL_REASON_"}, value={android.telephony.euicc.EuiccCardManager.CANCEL_REASON_END_USER_REJECTED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_POSTPONED, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_TIMEOUT, android.telephony.euicc.EuiccCardManager.CANCEL_REASON_PPR_NOT_ALLOWED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccCardManager.CancelReason {
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(flag=true, prefix={"RESET_OPTION_"}, value={android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_OPERATIONAL_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS}) public static @interface EuiccCardManager.ResetOption {
+ @IntDef(flag=true, prefix={"RESET_OPTION_"}, value={android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_OPERATIONAL_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_DELETE_FIELD_LOADED_TEST_PROFILES, android.telephony.euicc.EuiccCardManager.RESET_OPTION_RESET_DEFAULT_SMDP_ADDRESS}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccCardManager.ResetOption {
}
public static interface EuiccCardManager.ResultCallback<T> {
@@ -8529,7 +8576,8 @@ package android.telephony.euicc {
public class EuiccManager {
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void continueOperation(android.content.Intent, android.os.Bundle);
- method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(android.app.PendingIntent);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptions(@NonNull android.app.PendingIntent);
+ method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void eraseSubscriptionsWithOptions(@android.telephony.euicc.EuiccCardManager.ResetOption int, @NonNull android.app.PendingIntent);
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDefaultDownloadableSubscriptionList(android.app.PendingIntent);
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public void getDownloadableSubscriptionMetadata(android.telephony.euicc.DownloadableSubscription, android.app.PendingIntent);
method @RequiresPermission(android.Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS) public int getOtaStatus();
@@ -8575,7 +8623,7 @@ package android.telephony.euicc {
field public static final int EVENT_INSTALL = 1; // 0x1
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(flag=true, prefix={"EVENT_"}, value={android.telephony.euicc.EuiccNotification.EVENT_INSTALL, android.telephony.euicc.EuiccNotification.EVENT_ENABLE, android.telephony.euicc.EuiccNotification.EVENT_DISABLE, android.telephony.euicc.EuiccNotification.EVENT_DELETE}) public static @interface EuiccNotification.Event {
+ @IntDef(flag=true, prefix={"EVENT_"}, value={android.telephony.euicc.EuiccNotification.EVENT_INSTALL, android.telephony.euicc.EuiccNotification.EVENT_ENABLE, android.telephony.euicc.EuiccNotification.EVENT_DISABLE, android.telephony.euicc.EuiccNotification.EVENT_DELETE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccNotification.Event {
}
public final class EuiccRulesAuthTable implements android.os.Parcelable {
@@ -8593,7 +8641,7 @@ package android.telephony.euicc {
method public android.telephony.euicc.EuiccRulesAuthTable build();
}
- @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @IntDef(flag=true, prefix={"POLICY_RULE_FLAG_"}, value={android.telephony.euicc.EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED}) public static @interface EuiccRulesAuthTable.PolicyRuleFlag {
+ @IntDef(flag=true, prefix={"POLICY_RULE_FLAG_"}, value={android.telephony.euicc.EuiccRulesAuthTable.POLICY_RULE_FLAG_CONSENT_REQUIRED}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface EuiccRulesAuthTable.PolicyRuleFlag {
}
}
@@ -8638,6 +8686,7 @@ package android.telephony.ims {
method public android.os.Bundle getCallExtras();
method public int getCallType();
method public static int getCallTypeFromVideoState(int);
+ method public int getCallerNumberVerificationStatus();
method public int getEmergencyCallRouting();
method public int getEmergencyServiceCategories();
method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
@@ -8655,6 +8704,7 @@ package android.telephony.ims {
method public void setCallExtraBoolean(String, boolean);
method public void setCallExtraInt(String, int);
method public void setCallRestrictCause(int);
+ method public void setCallerNumberVerificationStatus(int);
method public void setEmergencyCallRouting(int);
method public void setEmergencyCallTesting(boolean);
method public void setEmergencyServiceCategories(int);
@@ -8705,6 +8755,9 @@ package android.telephony.ims {
field public static final int SERVICE_TYPE_EMERGENCY = 2; // 0x2
field public static final int SERVICE_TYPE_NONE = 0; // 0x0
field public static final int SERVICE_TYPE_NORMAL = 1; // 0x1
+ field public static final int VERIFICATION_STATUS_FAILED = 2; // 0x2
+ field public static final int VERIFICATION_STATUS_NOT_VERIFIED = 0; // 0x0
+ field public static final int VERIFICATION_STATUS_PASSED = 1; // 0x1
}
public class ImsCallSessionListener {
@@ -8797,17 +8850,23 @@ package android.telephony.ims {
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsExternalCallState> CREATOR;
}
- public class ImsMmTelManager {
+ public class ImsMmTelManager implements android.telephony.ims.RegistrationManager {
method @NonNull public static android.telephony.ims.ImsMmTelManager createForSubscriptionId(int);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getFeatureState(@NonNull java.util.function.Consumer<java.lang.Integer>, @NonNull java.util.concurrent.Executor) throws android.telephony.ims.ImsException;
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoWiFiModeSetting();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getVoWiFiRoamingModeSetting();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAdvancedCallingSettingEnabled();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAvailable(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCapable(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void isSupported(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>) throws android.telephony.ims.ImsException;
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isTtyOverVolteEnabled();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVoWiFiRoamingSettingEnabled();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVoWiFiSettingEnabled();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isVtSettingEnabled();
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+ method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerMmTelCapabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setAdvancedCallingSettingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setRttCapabilitySetting(boolean);
@@ -8817,7 +8876,8 @@ package android.telephony.ims {
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiRoamingSettingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoWiFiSettingEnabled(boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVtSettingEnabled(boolean);
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback);
+ method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.ImsMmTelManager.RegistrationCallback);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterMmTelCapabilityCallback(@NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback);
field public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; // 0x1
field public static final int WIFI_MODE_WIFI_ONLY = 0; // 0x0
@@ -8829,12 +8889,8 @@ package android.telephony.ims {
method public void onCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
}
- public static class ImsMmTelManager.RegistrationCallback {
- ctor public ImsMmTelManager.RegistrationCallback();
- method public void onRegistered(int);
- method public void onRegistering(int);
- method public void onTechnologyChangeFailed(int, @Nullable android.telephony.ims.ImsReasonInfo);
- method public void onUnregistered(@Nullable android.telephony.ims.ImsReasonInfo);
+ @Deprecated public static class ImsMmTelManager.RegistrationCallback extends android.telephony.ims.RegistrationManager.RegistrationCallback {
+ ctor @Deprecated public ImsMmTelManager.RegistrationCallback();
}
public final class ImsReasonInfo implements android.os.Parcelable {
@@ -9210,14 +9266,17 @@ package android.telephony.ims {
}
public class ImsUtListener {
+ method public void onLineIdentificationSupplementaryServiceResponse(int, @NonNull android.telephony.ims.ImsSsInfo);
method public void onSupplementaryServiceIndication(android.telephony.ims.ImsSsData);
method public void onUtConfigurationCallBarringQueried(int, android.telephony.ims.ImsSsInfo[]);
method public void onUtConfigurationCallForwardQueried(int, android.telephony.ims.ImsCallForwardInfo[]);
method public void onUtConfigurationCallWaitingQueried(int, android.telephony.ims.ImsSsInfo[]);
- method public void onUtConfigurationQueried(int, android.os.Bundle);
+ method @Deprecated public void onUtConfigurationQueried(int, android.os.Bundle);
method public void onUtConfigurationQueryFailed(int, android.telephony.ims.ImsReasonInfo);
method public void onUtConfigurationUpdateFailed(int, android.telephony.ims.ImsReasonInfo);
method public void onUtConfigurationUpdated(int);
+ field @Deprecated public static final String BUNDLE_KEY_CLIR = "queryClir";
+ field @Deprecated public static final String BUNDLE_KEY_SSINFO = "imsSsInfo";
}
public abstract class ImsVideoCallProvider {
@@ -9244,12 +9303,12 @@ package android.telephony.ims {
public class ProvisioningManager {
method @NonNull public static android.telephony.ims.ProvisioningManager createForSubscriptionId(int);
- method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getProvisioningIntValue(int);
- method @WorkerThread @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public int getProvisioningIntValue(int);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean getProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int);
method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public String getProvisioningStringValue(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerProvisioningChangedCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ProvisioningManager.Callback) throws android.telephony.ims.ImsException;
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningIntValue(int, int);
- method @WorkerThread @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int, boolean);
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public void setProvisioningStatusForCapability(@android.telephony.ims.feature.MmTelFeature.MmTelCapabilities.MmTelCapability int, int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) @WorkerThread public int setProvisioningStringValue(int, @NonNull String);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterProvisioningChangedCallback(@NonNull android.telephony.ims.ProvisioningManager.Callback);
field public static final int KEY_VOICE_OVER_WIFI_MODE_OVERRIDE = 27; // 0x1b
@@ -9266,6 +9325,24 @@ package android.telephony.ims {
method public void onProvisioningStringChanged(int, @NonNull String);
}
+ public interface RegistrationManager {
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+ method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
+ field public static final int REGISTRATION_STATE_NOT_REGISTERED = 0; // 0x0
+ field public static final int REGISTRATION_STATE_REGISTERED = 2; // 0x2
+ field public static final int REGISTRATION_STATE_REGISTERING = 1; // 0x1
+ }
+
+ public static class RegistrationManager.RegistrationCallback {
+ ctor public RegistrationManager.RegistrationCallback();
+ method public void onRegistered(int);
+ method public void onRegistering(int);
+ method public void onTechnologyChangeFailed(int, @Nullable android.telephony.ims.ImsReasonInfo);
+ method public void onUnregistered(@Nullable android.telephony.ims.ImsReasonInfo);
+ }
+
}
package android.telephony.ims.feature {
@@ -9330,6 +9407,8 @@ package android.telephony.ims.feature {
method public final android.telephony.ims.feature.MmTelFeature.MmTelCapabilities queryCapabilityStatus();
method public void setUiTtyMode(int, @Nullable android.os.Message);
method @android.telephony.ims.feature.MmTelFeature.ProcessCallResult public int shouldProcessCall(@NonNull String[]);
+ field public static final String EXTRA_IS_UNKNOWN_CALL = "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";
+ field public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD";
field public static final int PROCESS_CALL_CSFB = 1; // 0x1
field public static final int PROCESS_CALL_IMS = 0; // 0x0
}
diff --git a/api/system-lint-baseline.txt b/api/system-lint-baseline.txt
index fffec3e739ae..c64e3d884a70 100644
--- a/api/system-lint-baseline.txt
+++ b/api/system-lint-baseline.txt
@@ -127,6 +127,12 @@ MissingNullability: android.view.contentcapture.ViewNode#getTextLineCharOffsets(
+MutableBareField: android.net.wifi.WifiConfiguration#allowAutojoin:
+
+MutableBareField: android.net.wifi.WifiConfiguration#carrierId:
+
+
+
NoClone: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
diff --git a/api/test-current.txt b/api/test-current.txt
index f40b3246a3df..9fac1e05a453 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -793,8 +793,8 @@ package android.content.rollback {
public final class RollbackManager {
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) public void commitRollback(int, @NonNull java.util.List<android.content.pm.VersionedPackage>, @NonNull android.content.IntentSender);
method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void expireRollbackForPackage(@NonNull String);
- method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
- method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) @NonNull public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
+ method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) public java.util.List<android.content.rollback.RollbackInfo> getAvailableRollbacks();
+ method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_ROLLBACKS, android.Manifest.permission.TEST_MANAGE_ROLLBACKS}) public java.util.List<android.content.rollback.RollbackInfo> getRecentlyCommittedRollbacks();
method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void reloadPersistedData();
field public static final String EXTRA_STATUS = "android.content.rollback.extra.STATUS";
field public static final String EXTRA_STATUS_MESSAGE = "android.content.rollback.extra.STATUS_MESSAGE";
@@ -1078,7 +1078,7 @@ package android.location {
method @NonNull public android.location.LocationRequest setExpireIn(long);
method @NonNull public android.location.LocationRequest setFastestInterval(long);
method @NonNull public android.location.LocationRequest setInterval(long);
- method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) @NonNull public android.location.LocationRequest setLocationSettingsIgnored(boolean);
+ method @NonNull @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public android.location.LocationRequest setLocationSettingsIgnored(boolean);
method @NonNull public android.location.LocationRequest setNumUpdates(int);
method @NonNull public android.location.LocationRequest setProvider(@NonNull String);
method @NonNull public android.location.LocationRequest setQuality(int);
@@ -1654,7 +1654,8 @@ package android.net.util {
method public static void closeSocket(@Nullable java.io.FileDescriptor) throws java.io.IOException;
method @NonNull public static java.net.SocketAddress makeNetlinkSocketAddress(int, int);
method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int);
- method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+ method @Deprecated @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, @NonNull byte[]);
+ method @NonNull public static java.net.SocketAddress makePacketSocketAddress(int, int, @NonNull byte[]);
}
}
@@ -1852,8 +1853,8 @@ package android.os {
method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void cancelAuthorization(android.os.IncidentManager.AuthListener);
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void deleteIncidentReports(android.net.Uri);
method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public void denyReport(android.net.Uri);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @Nullable public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
- method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) @NonNull public java.util.List<android.net.Uri> getIncidentReportList(String);
+ method @Nullable @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public android.os.IncidentManager.IncidentReport getIncidentReport(android.net.Uri);
+ method @NonNull @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public java.util.List<android.net.Uri> getIncidentReportList(String);
method @RequiresPermission(android.Manifest.permission.APPROVE_INCIDENT_REPORTS) public java.util.List<android.os.IncidentManager.PendingReport> getPendingReports();
method @RequiresPermission(allOf={android.Manifest.permission.DUMP, android.Manifest.permission.PACKAGE_USAGE_STATS}) public void reportIncident(android.os.IncidentReportArgs);
method @RequiresPermission("android.permission.REQUEST_INCIDENT_REPORT_APPROVAL") public void requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener);
@@ -2399,7 +2400,7 @@ package android.security {
package android.security.keystore {
public abstract class AttestationUtils {
- method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") @NonNull public static java.security.cert.X509Certificate[] attestDeviceIds(android.content.Context, @NonNull int[], @NonNull byte[]) throws android.security.keystore.DeviceIdAttestationException;
+ method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public static java.security.cert.X509Certificate[] attestDeviceIds(android.content.Context, @NonNull int[], @NonNull byte[]) throws android.security.keystore.DeviceIdAttestationException;
field public static final int ID_TYPE_IMEI = 2; // 0x2
field public static final int ID_TYPE_MEID = 3; // 0x3
field public static final int ID_TYPE_SERIAL = 1; // 0x1
@@ -2865,6 +2866,9 @@ package android.telephony {
public class PhoneNumberUtils {
method public static int getMinMatchForTest();
+ method @NonNull public static String getUsernameFromUriNumber(@NonNull String);
+ method public static boolean isUriNumber(@Nullable String);
+ method public static boolean isVoiceMailNumber(@NonNull android.content.Context, int, @Nullable String);
method public static void setMinMatchForTest(int);
}
@@ -2888,6 +2892,7 @@ package android.telephony {
public final class SmsManager {
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int checkSmsShortCodeDestination(String, String);
+ method public void sendMultipartTextMessage(@NonNull String, @NonNull String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String);
field public static final int SMS_CATEGORY_FREE_SHORT_CODE = 1; // 0x1
field public static final int SMS_CATEGORY_NOT_SHORT_CODE = 0; // 0x0
field public static final int SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3; // 0x3
@@ -2895,10 +2900,16 @@ package android.telephony {
field public static final int SMS_CATEGORY_STANDARD_SHORT_CODE = 2; // 0x2
}
+ public class SubscriptionManager {
+ method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDefaultVoiceSubscriptionId(int);
+ }
+
public class TelephonyManager {
method public int checkCarrierPrivilegesForPackage(String);
method public int getCarrierIdListVersion();
+ method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
+ method @NonNull public String getNetworkCountryIso(int);
method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
diff --git a/api/test-lint-baseline.txt b/api/test-lint-baseline.txt
new file mode 100644
index 000000000000..1f85f3f46164
--- /dev/null
+++ b/api/test-lint-baseline.txt
@@ -0,0 +1,2263 @@
+// Baseline format: 1.0
+AcronymName: android.app.NotificationChannel#isImportanceLockedByOEM():
+
+AcronymName: android.app.NotificationChannel#setImportanceLockedByOEM(boolean):
+
+
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#ACTION_CLEANUP:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#ACTION_DOWNLOAD_RESULT_INTERNAL:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#ACTION_FILE_DESCRIPTOR_REQUEST:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_FD_COUNT:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_FINAL_URI:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_FREE_URI_LIST:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_PAUSED_LIST:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_PAUSED_URI_LIST:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_SERVICE_ID:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_TEMP_FILES_IN_USE:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_TEMP_FILE_ROOT:
+
+ActionValue: android.telephony.mbms.vendor.VendorUtils#EXTRA_TEMP_LIST:
+
+
+
+ArrayReturn: android.app.UiAutomation#executeShellCommandRw(String):
+
+ArrayReturn: android.location.GnssMeasurementsEvent#GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]) parameter #1:
+
+ArrayReturn: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #10:
+
+ArrayReturn: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #11:
+
+ArrayReturn: android.metrics.LogMaker#LogMaker(Object[]) parameter #0:
+
+ArrayReturn: android.metrics.LogMaker#deserialize(Object[]) parameter #0:
+
+ArrayReturn: android.metrics.LogMaker#serialize():
+
+ArrayReturn: android.net.TestNetworkManager#createTunInterface(android.net.LinkAddress[]) parameter #0:
+
+ArrayReturn: android.os.HwBlob#wrapArray(boolean[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(byte[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(double[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(float[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(int[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(long[]):
+
+ArrayReturn: android.os.HwBlob#wrapArray(short[]):
+
+ArrayReturn: android.os.NativeHandle#NativeHandle(java.io.FileDescriptor[], int[], boolean) parameter #0:
+
+ArrayReturn: android.os.NativeHandle#getFileDescriptors():
+
+ArrayReturn: android.security.keystore.AttestationUtils#attestDeviceIds(android.content.Context, int[], byte[]):
+
+ArrayReturn: android.view.FocusFinder#sort(android.view.View[], int, int, android.view.ViewGroup, boolean) parameter #0:
+
+ArrayReturn: android.view.contentcapture.ViewNode#getAutofillOptions():
+
+ArrayReturn: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillOptions(CharSequence[]) parameter #0:
+
+ArrayReturn: android.view.inspector.InspectableProperty#enumMapping():
+
+ArrayReturn: android.view.inspector.InspectableProperty#flagMapping():
+
+
+
+AutoBoxing: android.os.HwBlob#wrapArray(byte[]):
+
+AutoBoxing: android.os.HwBlob#wrapArray(double[]):
+
+AutoBoxing: android.os.HwBlob#wrapArray(float[]):
+
+AutoBoxing: android.os.HwBlob#wrapArray(int[]):
+
+AutoBoxing: android.os.HwBlob#wrapArray(long[]):
+
+AutoBoxing: android.os.HwBlob#wrapArray(short[]):
+
+AutoBoxing: android.os.VintfObject#getTargetFrameworkCompatibilityMatrixVersion():
+
+
+
+BannedThrow: android.app.ActivityTaskManager#removeStacksInWindowingModes(int[]):
+
+BannedThrow: android.app.ActivityTaskManager#removeStacksWithActivityTypes(int[]):
+
+BannedThrow: android.app.ActivityTaskManager#resizeStack(int, android.graphics.Rect):
+
+BannedThrow: android.app.ActivityTaskManager#setTaskWindowingMode(int, int, boolean):
+
+BannedThrow: android.app.ActivityTaskManager#setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean):
+
+BannedThrow: android.media.audiofx.AudioEffect#getParameter(byte[], byte[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#getParameter(int, byte[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#getParameter(int, int[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#getParameter(int, short[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#getParameter(int[], short[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(byte[], byte[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(int, byte[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(int, int):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(int, short):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(int[], byte[]):
+
+BannedThrow: android.media.audiofx.AudioEffect#setParameter(int[], int[]):
+
+BannedThrow: android.media.audiopolicy.AudioMix.Builder#Builder(android.media.audiopolicy.AudioMixingRule):
+
+BannedThrow: android.media.audiopolicy.AudioMix.Builder#build():
+
+BannedThrow: android.media.audiopolicy.AudioMix.Builder#setDevice(android.media.AudioDeviceInfo):
+
+BannedThrow: android.media.audiopolicy.AudioMix.Builder#setFormat(android.media.AudioFormat):
+
+BannedThrow: android.media.audiopolicy.AudioMix.Builder#setRouteFlags(int):
+
+BannedThrow: android.media.audiopolicy.AudioMixingRule.Builder#addMixRule(int, Object):
+
+BannedThrow: android.media.audiopolicy.AudioMixingRule.Builder#addRule(android.media.AudioAttributes, int):
+
+BannedThrow: android.media.audiopolicy.AudioMixingRule.Builder#excludeMixRule(int, Object):
+
+BannedThrow: android.media.audiopolicy.AudioMixingRule.Builder#excludeRule(android.media.AudioAttributes, int):
+
+BannedThrow: android.media.audiopolicy.AudioPolicy#createAudioRecordSink(android.media.audiopolicy.AudioMix):
+
+BannedThrow: android.media.audiopolicy.AudioPolicy#createAudioTrackSource(android.media.audiopolicy.AudioMix):
+
+BannedThrow: android.media.audiopolicy.AudioPolicy#setFocusDuckingBehavior(int):
+
+BannedThrow: android.media.audiopolicy.AudioPolicy.Builder#addMix(android.media.audiopolicy.AudioMix):
+
+BannedThrow: android.media.audiopolicy.AudioPolicy.Builder#setLooper(android.os.Looper):
+
+BannedThrow: android.os.HwBinder#getService(String, String):
+
+BannedThrow: android.os.HwBinder#getService(String, String, boolean):
+
+BannedThrow: android.os.Process#getThreadScheduler(int):
+
+
+
+CallbackInterface: android.app.prediction.AppPredictor.Callback:
+
+CallbackInterface: android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback:
+
+CallbackInterface: android.widget.Magnifier.Callback:
+
+
+
+CallbackMethodName: android.os.RemoteCallback:
+
+
+
+CompileTimeConstant: android.view.inputmethod.InputMethodSystemProperty#MULTI_CLIENT_IME_ENABLED:
+
+
+
+ConcreteCollection: android.content.AutofillOptions#whitelistedActivitiesForAugmentedAutofill:
+
+ConcreteCollection: android.content.ContentCaptureOptions#ContentCaptureOptions(int, int, int, int, int, android.util.ArraySet<android.content.ComponentName>) parameter #5:
+
+ConcreteCollection: android.content.ContentCaptureOptions#whitelistedComponents:
+
+ConcreteCollection: android.database.sqlite.SQLiteDebug.PagerStats#dbStats:
+
+ConcreteCollection: android.os.HwParcel#readBoolVector():
+
+ConcreteCollection: android.os.HwParcel#readDoubleVector():
+
+ConcreteCollection: android.os.HwParcel#readFloatVector():
+
+ConcreteCollection: android.os.HwParcel#readInt16Vector():
+
+ConcreteCollection: android.os.HwParcel#readInt32Vector():
+
+ConcreteCollection: android.os.HwParcel#readInt64Vector():
+
+ConcreteCollection: android.os.HwParcel#readInt8Vector():
+
+ConcreteCollection: android.os.HwParcel#readNativeHandleVector():
+
+ConcreteCollection: android.os.HwParcel#readStringVector():
+
+ConcreteCollection: android.os.HwParcel#writeBoolVector(java.util.ArrayList<java.lang.Boolean>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeDoubleVector(java.util.ArrayList<java.lang.Double>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeFloatVector(java.util.ArrayList<java.lang.Float>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeInt16Vector(java.util.ArrayList<java.lang.Short>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeInt32Vector(java.util.ArrayList<java.lang.Integer>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeInt64Vector(java.util.ArrayList<java.lang.Long>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeInt8Vector(java.util.ArrayList<java.lang.Byte>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeNativeHandleVector(java.util.ArrayList<android.os.NativeHandle>) parameter #0:
+
+ConcreteCollection: android.os.HwParcel#writeStringVector(java.util.ArrayList<java.lang.String>) parameter #0:
+
+ConcreteCollection: android.service.autofill.CompositeUserData#getFieldClassificationAlgorithms():
+
+ConcreteCollection: android.service.autofill.CompositeUserData#getFieldClassificationArgs():
+
+ConcreteCollection: android.service.autofill.InternalTransformation#batchApply(android.service.autofill.ValueFinder, android.widget.RemoteViews, java.util.ArrayList<android.util.Pair<java.lang.Integer,android.service.autofill.InternalTransformation>>) parameter #2:
+
+ConcreteCollection: android.service.autofill.UserData#getFieldClassificationAlgorithms():
+
+
+
+ContextFirst: android.os.VibrationEffect#get(android.net.Uri, android.content.Context) parameter #1:
+
+
+
+ContextNameSuffix: android.telephony.mbms.vendor.MbmsGroupCallServiceBase:
+
+
+
+EndsWithImpl: android.view.contentcapture.ViewNode.ViewStructureImpl:
+
+
+
+Enum: android.view.inspector.InspectableProperty.ValueType:
+
+
+
+EqualsAndHashCode: android.app.prediction.AppPredictionContext#equals(Object):
+
+EqualsAndHashCode: android.app.prediction.AppTarget#equals(Object):
+
+EqualsAndHashCode: android.app.prediction.AppTargetEvent#equals(Object):
+
+EqualsAndHashCode: android.net.apf.ApfCapabilities#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.ApfProgramEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.ApfStats#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.DhcpClientEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.IpManagerEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.IpReachabilityEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.NetworkEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.RaEvent#equals(Object):
+
+EqualsAndHashCode: android.net.metrics.ValidationProbeEvent#equals(Object):
+
+EqualsAndHashCode: android.os.IncidentManager.PendingReport#equals(Object):
+
+EqualsAndHashCode: android.os.StrictMode.ViolationInfo#hashCode():
+
+
+
+ExecutorRegistration: android.app.AppOpsManager#startWatchingActive(int[], android.app.AppOpsManager.OnOpActiveChangedListener):
+
+ExecutorRegistration: android.app.AppOpsManager#stopWatchingActive(android.app.AppOpsManager.OnOpActiveChangedListener):
+
+ExecutorRegistration: android.hardware.camera2.CameraDevice#createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler):
+
+ExecutorRegistration: android.location.LocationManager#requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper):
+
+ExecutorRegistration: android.media.audiofx.AudioEffect#setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener):
+
+ExecutorRegistration: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyFocusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener):
+
+ExecutorRegistration: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyStatusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener):
+
+ExecutorRegistration: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyVolumeCallback(android.media.audiopolicy.AudioPolicy.AudioPolicyVolumeCallback):
+
+ExecutorRegistration: android.os.IncidentManager#cancelAuthorization(android.os.IncidentManager.AuthListener):
+
+ExecutorRegistration: android.os.IncidentManager#requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener):
+
+ExecutorRegistration: android.os.RemoteCallback#RemoteCallback(android.os.RemoteCallback.OnResultListener, android.os.Handler):
+
+ExecutorRegistration: android.permission.PermissionControllerManager#getAppPermissions(String, android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, android.os.Handler):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsDownloadServiceBase#initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsStreamingServiceBase#initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int):
+
+ExecutorRegistration: android.telephony.mbms.vendor.MbmsStreamingServiceBase#startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback):
+
+
+
+ForbiddenSuperClass: android.app.AppDetailsActivity:
+
+
+
+GenericException: android.app.ActivityView#finalize():
+
+GenericException: android.app.prediction.AppPredictor#finalize():
+
+GenericException: android.service.autofill.CharSequenceTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+GenericException: android.service.autofill.DateTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+GenericException: android.service.autofill.ImageTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+GenericException: android.service.autofill.augmented.FillWindow#finalize():
+
+
+
+GetterSetterNames: android.app.NotificationChannel#isImportanceLockedByCriticalDeviceFunction():
+
+GetterSetterNames: android.app.NotificationChannel#isImportanceLockedByOEM():
+
+GetterSetterNames: android.location.GnssClock#setBiasNanos(double):
+
+GetterSetterNames: android.location.GnssClock#setBiasUncertaintyNanos(double):
+
+GetterSetterNames: android.location.GnssClock#setDriftNanosPerSecond(double):
+
+GetterSetterNames: android.location.GnssClock#setDriftUncertaintyNanosPerSecond(double):
+
+GetterSetterNames: android.location.GnssClock#setElapsedRealtimeNanos(long):
+
+GetterSetterNames: android.location.GnssClock#setElapsedRealtimeUncertaintyNanos(double):
+
+GetterSetterNames: android.location.GnssClock#setFullBiasNanos(long):
+
+GetterSetterNames: android.location.GnssClock#setLeapSecond(int):
+
+GetterSetterNames: android.location.GnssClock#setTimeUncertaintyNanos(double):
+
+GetterSetterNames: android.location.GnssMeasurement#setCarrierFrequencyHz(float):
+
+GetterSetterNames: android.location.GnssMeasurement#setCodeType(String):
+
+GetterSetterNames: android.location.GnssMeasurement#setSnrInDb(double):
+
+GetterSetterNames: android.location.LocationRequest#isLocationSettingsIgnored():
+
+GetterSetterNames: android.os.IncidentReportArgs#isAll():
+
+GetterSetterNames: android.service.notification.NotificationStats#setDirectReplied():
+
+GetterSetterNames: android.service.notification.NotificationStats#setExpanded():
+
+GetterSetterNames: android.service.notification.NotificationStats#setSeen():
+
+GetterSetterNames: android.service.notification.NotificationStats#setSnoozed():
+
+GetterSetterNames: android.service.notification.NotificationStats#setViewedSettings():
+
+GetterSetterNames: android.view.View#isAutofilled():
+
+GetterSetterNames: android.view.View#isDefaultFocusHighlightEnabled():
+
+
+
+IllegalStateException: android.media.audiopolicy.AudioMix.Builder#build():
+
+
+
+IntentBuilderName: android.app.backup.BackupManager#getConfigurationIntent(String):
+
+IntentBuilderName: android.app.backup.BackupManager#getDataManagementIntent(String):
+
+
+
+IntentName: android.provider.Settings.Secure#VOICE_INTERACTION_SERVICE:
+
+IntentName: android.provider.Telephony.Sms.Intents#SMS_CARRIER_PROVISION_ACTION:
+
+IntentName: android.service.notification.Adjustment#KEY_CONTEXTUAL_ACTIONS:
+
+
+
+InterfaceConstant: android.service.autofill.AutofillFieldClassificationService#SERVICE_INTERFACE:
+
+InterfaceConstant: android.service.autofill.augmented.AugmentedAutofillService#SERVICE_INTERFACE:
+
+InterfaceConstant: android.service.contentcapture.ContentCaptureService#SERVICE_INTERFACE:
+
+InterfaceConstant: android.service.notification.NotificationAssistantService#SERVICE_INTERFACE:
+
+InterfaceConstant: android.telecom.PhoneAccountSuggestionService#SERVICE_INTERFACE:
+
+
+
+KotlinOperator: android.os.WorkSource#get(int):
+
+
+
+ListenerInterface: android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener:
+
+ListenerInterface: android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener:
+
+ListenerInterface: android.os.IncidentManager.AuthListener:
+
+
+
+ListenerLast: android.hardware.camera2.CameraDevice#createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) parameter #4:
+
+ListenerLast: android.location.LocationManager#requestLocationUpdates(android.location.LocationRequest, android.location.LocationListener, android.os.Looper) parameter #2:
+
+ListenerLast: android.permission.PermissionControllerManager#getAppPermissions(String, android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, android.os.Handler) parameter #2:
+
+ListenerLast: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) parameter #1:
+
+ListenerLast: android.telephony.mbms.vendor.MbmsStreamingServiceBase#initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int) parameter #1:
+
+
+
+ManagerConstructor: android.content.pm.ShortcutManager#ShortcutManager(android.content.Context):
+
+
+
+MinMaxConstant: android.view.autofill.AutofillManager#MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS:
+
+
+
+MissingNullability: android.app.Activity#onMovedToDisplay(int, android.content.res.Configuration) parameter #1:
+
+MissingNullability: android.app.ActivityManager#addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int) parameter #0:
+
+MissingNullability: android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName) parameter #0:
+
+MissingNullability: android.app.ActivityManager#forceStopPackage(String) parameter #0:
+
+MissingNullability: android.app.ActivityManager#getPackageImportance(String) parameter #0:
+
+MissingNullability: android.app.ActivityManager#removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener) parameter #0:
+
+MissingNullability: android.app.ActivityManager#scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int) parameter #0:
+
+MissingNullability: android.app.ActivityManager.TaskDescription#getIconFilename():
+
+MissingNullability: android.app.ActivityTaskManager#clearLaunchParamsForPackages(java.util.List<java.lang.String>) parameter #0:
+
+MissingNullability: android.app.ActivityTaskManager#listAllStacks():
+
+MissingNullability: android.app.ActivityTaskManager#moveTopActivityToPinnedStack(int, android.graphics.Rect) parameter #1:
+
+MissingNullability: android.app.ActivityTaskManager#removeStacksInWindowingModes(int[]) parameter #0:
+
+MissingNullability: android.app.ActivityTaskManager#removeStacksWithActivityTypes(int[]) parameter #0:
+
+MissingNullability: android.app.ActivityTaskManager#resizeDockedStack(android.graphics.Rect, android.graphics.Rect) parameter #0:
+
+MissingNullability: android.app.ActivityTaskManager#resizeDockedStack(android.graphics.Rect, android.graphics.Rect) parameter #1:
+
+MissingNullability: android.app.ActivityTaskManager#resizeStack(int, android.graphics.Rect) parameter #1:
+
+MissingNullability: android.app.ActivityTaskManager#resizeStack(int, android.graphics.Rect, boolean) parameter #1:
+
+MissingNullability: android.app.ActivityTaskManager#resizeTask(int, android.graphics.Rect) parameter #1:
+
+MissingNullability: android.app.ActivityTaskManager#setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) parameter #4:
+
+MissingNullability: android.app.ActivityTaskManager#supportsMultiWindow(android.content.Context) parameter #0:
+
+MissingNullability: android.app.ActivityTaskManager#supportsSplitScreenMultiWindow(android.content.Context) parameter #0:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context) parameter #0:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet) parameter #0:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet) parameter #1:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet, int) parameter #0:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet, int) parameter #1:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet, int, boolean) parameter #0:
+
+MissingNullability: android.app.ActivityView#ActivityView(android.content.Context, android.util.AttributeSet, int, boolean) parameter #1:
+
+MissingNullability: android.app.ActivityView#gatherTransparentRegion(android.graphics.Region) parameter #0:
+
+MissingNullability: android.app.ActivityView#onVisibilityChanged(android.view.View, int) parameter #0:
+
+MissingNullability: android.app.ActivityView#setCallback(android.app.ActivityView.StateCallback) parameter #0:
+
+MissingNullability: android.app.ActivityView#setForwardedInsets(android.graphics.Insets) parameter #0:
+
+MissingNullability: android.app.ActivityView#startActivity(android.content.Intent, android.os.UserHandle) parameter #1:
+
+MissingNullability: android.app.ActivityView.StateCallback#onActivityViewDestroyed(android.app.ActivityView) parameter #0:
+
+MissingNullability: android.app.ActivityView.StateCallback#onActivityViewReady(android.app.ActivityView) parameter #0:
+
+MissingNullability: android.app.ActivityView.StateCallback#onTaskCreated(int, android.content.ComponentName) parameter #1:
+
+MissingNullability: android.app.AppDetailsActivity#onCreate(android.os.Bundle) parameter #0:
+
+MissingNullability: android.app.AppOpsManager#getOpStrs():
+
+MissingNullability: android.app.AppOpsManager#isOperationActive(int, int, String) parameter #2:
+
+MissingNullability: android.app.AppOpsManager#opToPermission(int):
+
+MissingNullability: android.app.AppOpsManager#permissionToOpCode(String) parameter #0:
+
+MissingNullability: android.app.AppOpsManager#setMode(String, int, String, int) parameter #0:
+
+MissingNullability: android.app.AppOpsManager#setMode(String, int, String, int) parameter #2:
+
+MissingNullability: android.app.AppOpsManager#setMode(int, int, String, int) parameter #2:
+
+MissingNullability: android.app.AppOpsManager#setUidMode(String, int, int) parameter #0:
+
+MissingNullability: android.app.AppOpsManager.HistoricalOp#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.AppOpsManager.HistoricalOps#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.AppOpsManager.HistoricalUidOps#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.AppOpsManager.OnOpActiveChangedListener#onOpActiveChanged(int, int, String, boolean) parameter #2:
+
+MissingNullability: android.app.AppOpsManager.OpEntry#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.NotificationManager#allowAssistantAdjustment(String) parameter #0:
+
+MissingNullability: android.app.NotificationManager#disallowAssistantAdjustment(String) parameter #0:
+
+MissingNullability: android.app.NotificationManager#getEffectsSuppressor():
+
+MissingNullability: android.app.NotificationManager#matchesCallFilter(android.os.Bundle) parameter #0:
+
+MissingNullability: android.app.PictureInPictureParams#getActions():
+
+MissingNullability: android.app.PictureInPictureParams#getSourceRectHint():
+
+MissingNullability: android.app.TimePickerDialog#getTimePicker():
+
+MissingNullability: android.app.UiAutomation#executeShellCommandRw(String):
+
+MissingNullability: android.app.UiAutomation#executeShellCommandRw(String) parameter #0:
+
+MissingNullability: android.app.UiAutomation#grantRuntimePermission(String, String, android.os.UserHandle) parameter #0:
+
+MissingNullability: android.app.UiAutomation#grantRuntimePermission(String, String, android.os.UserHandle) parameter #1:
+
+MissingNullability: android.app.UiAutomation#grantRuntimePermission(String, String, android.os.UserHandle) parameter #2:
+
+MissingNullability: android.app.UiAutomation#revokeRuntimePermission(String, String, android.os.UserHandle) parameter #0:
+
+MissingNullability: android.app.UiAutomation#revokeRuntimePermission(String, String, android.os.UserHandle) parameter #1:
+
+MissingNullability: android.app.UiAutomation#revokeRuntimePermission(String, String, android.os.UserHandle) parameter #2:
+
+MissingNullability: android.app.WallpaperManager#setWallpaperComponent(android.content.ComponentName) parameter #0:
+
+MissingNullability: android.app.WindowConfiguration#compareTo(android.app.WindowConfiguration) parameter #0:
+
+MissingNullability: android.app.WindowConfiguration#getAppBounds():
+
+MissingNullability: android.app.WindowConfiguration#getBounds():
+
+MissingNullability: android.app.WindowConfiguration#setAppBounds(android.graphics.Rect) parameter #0:
+
+MissingNullability: android.app.WindowConfiguration#setBounds(android.graphics.Rect) parameter #0:
+
+MissingNullability: android.app.WindowConfiguration#setTo(android.app.WindowConfiguration) parameter #0:
+
+MissingNullability: android.app.WindowConfiguration#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.admin.DevicePolicyManager#getOwnerInstalledCaCerts(android.os.UserHandle):
+
+MissingNullability: android.app.admin.SecurityLog.SecurityEvent#SecurityEvent(long, byte[]) parameter #1:
+
+MissingNullability: android.app.backup.BackupManager#getConfigurationIntent(String):
+
+MissingNullability: android.app.backup.BackupManager#getConfigurationIntent(String) parameter #0:
+
+MissingNullability: android.app.backup.BackupManager#getDataManagementIntent(String):
+
+MissingNullability: android.app.backup.BackupManager#getDataManagementIntent(String) parameter #0:
+
+MissingNullability: android.app.backup.BackupManager#getDestinationString(String):
+
+MissingNullability: android.app.backup.BackupManager#getDestinationString(String) parameter #0:
+
+MissingNullability: android.app.prediction.AppPredictionSessionId#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.prediction.AppPredictor#getSessionId():
+
+MissingNullability: android.app.prediction.AppTarget#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.prediction.AppTargetEvent#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.app.prediction.AppTargetId#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.content.AutofillOptions#forWhitelistingItself():
+
+MissingNullability: android.content.AutofillOptions#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.content.ContentCaptureOptions#forWhitelistingItself():
+
+MissingNullability: android.content.ContentCaptureOptions#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.content.ContentResolver#getSyncAdapterPackagesForAuthorityAsUser(String, int):
+
+MissingNullability: android.content.ContentResolver#getSyncAdapterPackagesForAuthorityAsUser(String, int) parameter #0:
+
+MissingNullability: android.content.Context#createPackageContextAsUser(String, int, android.os.UserHandle):
+
+MissingNullability: android.content.Context#createPackageContextAsUser(String, int, android.os.UserHandle) parameter #0:
+
+MissingNullability: android.content.Context#createPackageContextAsUser(String, int, android.os.UserHandle) parameter #2:
+
+MissingNullability: android.content.Context#getDisplay():
+
+MissingNullability: android.content.Context#getUser():
+
+MissingNullability: android.content.ContextWrapper#getDisplay():
+
+MissingNullability: android.content.ContextWrapper#setContentCaptureOptions(android.content.ContentCaptureOptions) parameter #0:
+
+MissingNullability: android.content.pm.ActivityInfo#isTranslucentOrFloating(android.content.res.TypedArray) parameter #0:
+
+MissingNullability: android.content.pm.LauncherApps#LauncherApps(android.content.Context) parameter #0:
+
+MissingNullability: android.content.pm.PackageInstaller.SessionParams#setGrantedRuntimePermissions(String[]) parameter #0:
+
+MissingNullability: android.content.pm.PackageManager#getNamesForUids(int[]) parameter #0:
+
+MissingNullability: android.content.pm.ShortcutManager#ShortcutManager(android.content.Context) parameter #0:
+
+MissingNullability: android.content.res.AssetManager#getOverlayableMap(String) parameter #0:
+
+MissingNullability: android.content.res.Configuration#windowConfiguration:
+
+MissingNullability: android.content.rollback.PackageRollbackInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.content.rollback.RollbackInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDebug#dump(android.util.Printer, String[]) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDebug#dump(android.util.Printer, String[]) parameter #1:
+
+MissingNullability: android.database.sqlite.SQLiteDebug#getDatabaseInfo():
+
+MissingNullability: android.database.sqlite.SQLiteDebug.DbStats#DbStats(String, long, long, int, int, int, int) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDebug.DbStats#cache:
+
+MissingNullability: android.database.sqlite.SQLiteDebug.DbStats#dbName:
+
+MissingNullability: android.database.sqlite.SQLiteDebug.PagerStats#dbStats:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal) parameter #1:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal) parameter #2:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal) parameter #3:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#cursorRequeried(android.database.Cursor) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]):
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]) parameter #1:
+
+MissingNullability: android.database.sqlite.SQLiteDirectCursorDriver#setBindArguments(String[]) parameter #0:
+
+MissingNullability: android.database.sqlite.SQLiteGlobal#getDefaultJournalMode():
+
+MissingNullability: android.database.sqlite.SQLiteGlobal#getDefaultSyncMode():
+
+MissingNullability: android.database.sqlite.SQLiteGlobal#getWALSyncMode():
+
+MissingNullability: android.graphics.ImageDecoder#createSource(android.content.res.Resources, java.io.InputStream, int) parameter #0:
+
+MissingNullability: android.graphics.ImageDecoder#createSource(android.content.res.Resources, java.io.InputStream, int) parameter #1:
+
+MissingNullability: android.graphics.drawable.AdaptiveIconDrawable#getSafeZone():
+
+MissingNullability: android.graphics.drawable.ColorDrawable#getXfermode():
+
+MissingNullability: android.hardware.camera2.CameraDevice#createCustomCaptureSession(android.hardware.camera2.params.InputConfiguration, java.util.List<android.hardware.camera2.params.OutputConfiguration>, int, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) parameter #0:
+
+MissingNullability: android.hardware.display.AmbientBrightnessDayStats#getBucketBoundaries():
+
+MissingNullability: android.hardware.display.AmbientBrightnessDayStats#getLocalDate():
+
+MissingNullability: android.hardware.display.AmbientBrightnessDayStats#getStats():
+
+MissingNullability: android.hardware.display.AmbientBrightnessDayStats#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.hardware.display.AmbientDisplayConfiguration#AmbientDisplayConfiguration(android.content.Context) parameter #0:
+
+MissingNullability: android.hardware.display.BrightnessChangeEvent#luxTimestamps:
+
+MissingNullability: android.hardware.display.BrightnessChangeEvent#luxValues:
+
+MissingNullability: android.hardware.display.BrightnessChangeEvent#packageName:
+
+MissingNullability: android.hardware.display.BrightnessChangeEvent#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.hardware.display.BrightnessConfiguration#getCurve():
+
+MissingNullability: android.hardware.display.BrightnessConfiguration#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.hardware.display.BrightnessConfiguration.Builder#Builder(float[], float[]) parameter #0:
+
+MissingNullability: android.hardware.display.BrightnessConfiguration.Builder#Builder(float[], float[]) parameter #1:
+
+MissingNullability: android.hardware.display.BrightnessCorrection#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.hardware.display.DisplayManager#getAmbientBrightnessStats():
+
+MissingNullability: android.hardware.display.DisplayManager#getBrightnessConfiguration():
+
+MissingNullability: android.hardware.display.DisplayManager#getBrightnessEvents():
+
+MissingNullability: android.hardware.display.DisplayManager#getStableDisplaySize():
+
+MissingNullability: android.hardware.display.DisplayManager#setBrightnessConfiguration(android.hardware.display.BrightnessConfiguration) parameter #0:
+
+MissingNullability: android.location.GnssClock#set(android.location.GnssClock) parameter #0:
+
+MissingNullability: android.location.GnssMeasurement#set(android.location.GnssMeasurement) parameter #0:
+
+MissingNullability: android.location.GnssMeasurementsEvent#GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]) parameter #0:
+
+MissingNullability: android.location.GnssMeasurementsEvent#GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]) parameter #1:
+
+MissingNullability: android.location.GnssNavigationMessage#set(android.location.GnssNavigationMessage) parameter #0:
+
+MissingNullability: android.location.GnssNavigationMessage#setData(byte[]) parameter #0:
+
+MissingNullability: android.location.LocationManager#getTestProviderCurrentRequests(String) parameter #0:
+
+MissingNullability: android.location.LocationRequest#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.media.AudioFocusInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String) parameter #3:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String) parameter #4:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String) parameter #6:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #10:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #11:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #3:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #4:
+
+MissingNullability: android.media.AudioRecordingConfiguration#AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]) parameter #6:
+
+MissingNullability: android.media.PlaybackParams#setAudioStretchMode(int):
+
+MissingNullability: android.media.audiofx.AudioEffect#EFFECT_TYPE_NULL:
+
+MissingNullability: android.media.audiofx.AudioEffect#byteArrayToInt(byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#byteArrayToShort(byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(byte[], byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(byte[], byte[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(int, byte[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(int, int[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(int, short[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(int[], short[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#getParameter(int[], short[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#intToByteArray(int):
+
+MissingNullability: android.media.audiofx.AudioEffect#isEffectTypeAvailable(java.util.UUID) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(byte[], byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(byte[], byte[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(int, byte[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(int[], byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(int[], byte[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(int[], int[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameter(int[], int[]) parameter #1:
+
+MissingNullability: android.media.audiofx.AudioEffect#setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect#shortToByteArray(short):
+
+MissingNullability: android.media.audiofx.AudioEffect.Descriptor#Descriptor(android.os.Parcel) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect.Descriptor#writeToParcel(android.os.Parcel) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect.OnParameterChangeListener#onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]) parameter #0:
+
+MissingNullability: android.media.audiofx.AudioEffect.OnParameterChangeListener#onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]) parameter #2:
+
+MissingNullability: android.media.audiofx.AudioEffect.OnParameterChangeListener#onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]) parameter #3:
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#Builder(android.media.audiopolicy.AudioMixingRule) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#build():
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#setDevice(android.media.AudioDeviceInfo):
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#setFormat(android.media.AudioFormat):
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#setFormat(android.media.AudioFormat) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioMix.Builder#setRouteFlags(int):
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#addMixRule(int, Object):
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#addMixRule(int, Object) parameter #1:
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#addRule(android.media.AudioAttributes, int):
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#addRule(android.media.AudioAttributes, int) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#build():
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#excludeMixRule(int, Object):
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#excludeMixRule(int, Object) parameter #1:
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#excludeRule(android.media.AudioAttributes, int):
+
+MissingNullability: android.media.audiopolicy.AudioMixingRule.Builder#excludeRule(android.media.AudioAttributes, int) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#createAudioRecordSink(android.media.audiopolicy.AudioMix):
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#createAudioRecordSink(android.media.audiopolicy.AudioMix) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#createAudioTrackSource(android.media.audiopolicy.AudioMix):
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#createAudioTrackSource(android.media.audiopolicy.AudioMix) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#setRegistration(String) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy#toLogFriendlyString():
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener#onAudioFocusAbandon(android.media.AudioFocusInfo) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener#onAudioFocusGrant(android.media.AudioFocusInfo, int) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener#onAudioFocusLoss(android.media.AudioFocusInfo, boolean) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener#onAudioFocusRequest(android.media.AudioFocusInfo, int) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener#onMixStateUpdate(android.media.audiopolicy.AudioMix) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.Builder#Builder(android.content.Context) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyFocusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener) parameter #0:
+
+MissingNullability: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyStatusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#LogMaker(Object[]) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#addTaggedData(int, Object):
+
+MissingNullability: android.metrics.LogMaker#addTaggedData(int, Object) parameter #1:
+
+MissingNullability: android.metrics.LogMaker#clearCategory():
+
+MissingNullability: android.metrics.LogMaker#clearPackageName():
+
+MissingNullability: android.metrics.LogMaker#clearSubtype():
+
+MissingNullability: android.metrics.LogMaker#clearTaggedData(int):
+
+MissingNullability: android.metrics.LogMaker#clearType():
+
+MissingNullability: android.metrics.LogMaker#deserialize(Object[]) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#getCounterName():
+
+MissingNullability: android.metrics.LogMaker#getPackageName():
+
+MissingNullability: android.metrics.LogMaker#getTaggedData(int):
+
+MissingNullability: android.metrics.LogMaker#isSubsetOf(android.metrics.LogMaker) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#isValidValue(Object) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#serialize():
+
+MissingNullability: android.metrics.LogMaker#setCategory(int):
+
+MissingNullability: android.metrics.LogMaker#setPackageName(String):
+
+MissingNullability: android.metrics.LogMaker#setPackageName(String) parameter #0:
+
+MissingNullability: android.metrics.LogMaker#setSubtype(int):
+
+MissingNullability: android.metrics.LogMaker#setType(int):
+
+MissingNullability: android.metrics.MetricsReader#next():
+
+MissingNullability: android.net.NetworkCapabilities#getCapabilities():
+
+MissingNullability: android.net.StaticIpConfiguration#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.net.TestNetworkInterface#CREATOR:
+
+MissingNullability: android.net.TestNetworkInterface#TestNetworkInterface(android.os.ParcelFileDescriptor, String) parameter #0:
+
+MissingNullability: android.net.TestNetworkInterface#TestNetworkInterface(android.os.ParcelFileDescriptor, String) parameter #1:
+
+MissingNullability: android.net.TestNetworkInterface#getFileDescriptor():
+
+MissingNullability: android.net.TestNetworkInterface#getInterfaceName():
+
+MissingNullability: android.net.TestNetworkInterface#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.net.TestNetworkManager#createTapInterface():
+
+MissingNullability: android.net.TestNetworkManager#createTunInterface(android.net.LinkAddress[]):
+
+MissingNullability: android.net.apf.ApfCapabilities#CREATOR:
+
+MissingNullability: android.net.apf.ApfCapabilities#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.net.metrics.DhcpClientEvent.Builder#setMsg(String) parameter #0:
+
+MissingNullability: android.os.Build#is64BitAbi(String) parameter #0:
+
+MissingNullability: android.os.Build.VERSION#ACTIVE_CODENAMES:
+
+MissingNullability: android.os.Environment#buildPath(java.io.File, java.lang.String...):
+
+MissingNullability: android.os.Environment#buildPath(java.io.File, java.lang.String...) parameter #0:
+
+MissingNullability: android.os.Environment#buildPath(java.io.File, java.lang.String...) parameter #1:
+
+MissingNullability: android.os.FileUtils#contains(java.io.File, java.io.File) parameter #0:
+
+MissingNullability: android.os.FileUtils#contains(java.io.File, java.io.File) parameter #1:
+
+MissingNullability: android.os.HwBinder#getService(String, String):
+
+MissingNullability: android.os.HwBinder#getService(String, String) parameter #0:
+
+MissingNullability: android.os.HwBinder#getService(String, String) parameter #1:
+
+MissingNullability: android.os.HwBinder#getService(String, String, boolean):
+
+MissingNullability: android.os.HwBinder#getService(String, String, boolean) parameter #0:
+
+MissingNullability: android.os.HwBinder#getService(String, String, boolean) parameter #1:
+
+MissingNullability: android.os.HwBinder#onTransact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #1:
+
+MissingNullability: android.os.HwBinder#onTransact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #2:
+
+MissingNullability: android.os.HwBinder#registerService(String) parameter #0:
+
+MissingNullability: android.os.HwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #1:
+
+MissingNullability: android.os.HwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #2:
+
+MissingNullability: android.os.HwBlob#copyToBoolArray(long, boolean[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToDoubleArray(long, double[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToFloatArray(long, float[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToInt16Array(long, short[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToInt32Array(long, int[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToInt64Array(long, long[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#copyToInt8Array(long, byte[], int) parameter #1:
+
+MissingNullability: android.os.HwBlob#getString(long):
+
+MissingNullability: android.os.HwBlob#putBlob(long, android.os.HwBlob) parameter #1:
+
+MissingNullability: android.os.HwBlob#putBoolArray(long, boolean[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putDoubleArray(long, double[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putFloatArray(long, float[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putInt16Array(long, short[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putInt32Array(long, int[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putInt64Array(long, long[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putInt8Array(long, byte[]) parameter #1:
+
+MissingNullability: android.os.HwBlob#putString(long, String) parameter #1:
+
+MissingNullability: android.os.HwBlob#wrapArray(boolean[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(byte[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(double[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(float[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(int[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(long[]):
+
+MissingNullability: android.os.HwBlob#wrapArray(short[]):
+
+MissingNullability: android.os.HwParcel#enforceInterface(String) parameter #0:
+
+MissingNullability: android.os.HwParcel#readBoolVector():
+
+MissingNullability: android.os.HwParcel#readBuffer(long):
+
+MissingNullability: android.os.HwParcel#readDoubleVector():
+
+MissingNullability: android.os.HwParcel#readEmbeddedBuffer(long, long, long, boolean):
+
+MissingNullability: android.os.HwParcel#readFloatVector():
+
+MissingNullability: android.os.HwParcel#readInt16Vector():
+
+MissingNullability: android.os.HwParcel#readInt32Vector():
+
+MissingNullability: android.os.HwParcel#readInt64Vector():
+
+MissingNullability: android.os.HwParcel#readInt8Vector():
+
+MissingNullability: android.os.HwParcel#readString():
+
+MissingNullability: android.os.HwParcel#readStringVector():
+
+MissingNullability: android.os.HwParcel#readStrongBinder():
+
+MissingNullability: android.os.HwParcel#writeBoolVector(java.util.ArrayList<java.lang.Boolean>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeBuffer(android.os.HwBlob) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeDoubleVector(java.util.ArrayList<java.lang.Double>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeFloatVector(java.util.ArrayList<java.lang.Float>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeInt16Vector(java.util.ArrayList<java.lang.Short>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeInt32Vector(java.util.ArrayList<java.lang.Integer>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeInt64Vector(java.util.ArrayList<java.lang.Long>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeInt8Vector(java.util.ArrayList<java.lang.Byte>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeInterfaceToken(String) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeString(String) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeStringVector(java.util.ArrayList<java.lang.String>) parameter #0:
+
+MissingNullability: android.os.HwParcel#writeStrongBinder(android.os.IHwBinder) parameter #0:
+
+MissingNullability: android.os.IHwBinder#linkToDeath(android.os.IHwBinder.DeathRecipient, long) parameter #0:
+
+MissingNullability: android.os.IHwBinder#queryLocalInterface(String):
+
+MissingNullability: android.os.IHwBinder#queryLocalInterface(String) parameter #0:
+
+MissingNullability: android.os.IHwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #1:
+
+MissingNullability: android.os.IHwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int) parameter #2:
+
+MissingNullability: android.os.IHwBinder#unlinkToDeath(android.os.IHwBinder.DeathRecipient) parameter #0:
+
+MissingNullability: android.os.IHwInterface#asBinder():
+
+MissingNullability: android.os.IncidentManager#approveReport(android.net.Uri) parameter #0:
+
+MissingNullability: android.os.IncidentManager#cancelAuthorization(android.os.IncidentManager.AuthListener) parameter #0:
+
+MissingNullability: android.os.IncidentManager#deleteIncidentReports(android.net.Uri) parameter #0:
+
+MissingNullability: android.os.IncidentManager#denyReport(android.net.Uri) parameter #0:
+
+MissingNullability: android.os.IncidentManager#getIncidentReport(android.net.Uri) parameter #0:
+
+MissingNullability: android.os.IncidentManager#getIncidentReportList(String) parameter #0:
+
+MissingNullability: android.os.IncidentManager#getPendingReports():
+
+MissingNullability: android.os.IncidentManager#reportIncident(android.os.IncidentReportArgs) parameter #0:
+
+MissingNullability: android.os.IncidentManager#requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener) parameter #1:
+
+MissingNullability: android.os.IncidentManager#requestAuthorization(int, String, int, android.os.IncidentManager.AuthListener) parameter #3:
+
+MissingNullability: android.os.IncidentManager.IncidentReport#IncidentReport(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.IncidentManager.IncidentReport#getInputStream():
+
+MissingNullability: android.os.IncidentManager.IncidentReport#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.IncidentReportArgs#IncidentReportArgs(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.IncidentReportArgs#addHeader(byte[]) parameter #0:
+
+MissingNullability: android.os.IncidentReportArgs#readFromParcel(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.IncidentReportArgs#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.ParcelFileDescriptor#getFile(java.io.FileDescriptor):
+
+MissingNullability: android.os.ParcelFileDescriptor#getFile(java.io.FileDescriptor) parameter #0:
+
+MissingNullability: android.os.RemoteCallback#RemoteCallback(android.os.RemoteCallback.OnResultListener) parameter #0:
+
+MissingNullability: android.os.RemoteCallback#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.StrictMode#setViolationLogger(android.os.StrictMode.ViolationLogger) parameter #0:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#ViolationInfo(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#ViolationInfo(android.os.Parcel, boolean) parameter #0:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#broadcastIntentAction:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#dump(android.util.Printer, String) parameter #0:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#dump(android.util.Printer, String) parameter #1:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#getStackTrace():
+
+MissingNullability: android.os.StrictMode.ViolationInfo#getViolationClass():
+
+MissingNullability: android.os.StrictMode.ViolationInfo#getViolationDetails():
+
+MissingNullability: android.os.StrictMode.ViolationInfo#tags:
+
+MissingNullability: android.os.StrictMode.ViolationInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.StrictMode.ViolationLogger#log(android.os.StrictMode.ViolationInfo) parameter #0:
+
+MissingNullability: android.os.UserHandle#of(int):
+
+MissingNullability: android.os.VibrationEffect#RINGTONES:
+
+MissingNullability: android.os.VibrationEffect#get(android.net.Uri, android.content.Context) parameter #0:
+
+MissingNullability: android.os.VibrationEffect#get(android.net.Uri, android.content.Context) parameter #1:
+
+MissingNullability: android.os.VibrationEffect#get(int):
+
+MissingNullability: android.os.VibrationEffect#get(int, boolean):
+
+MissingNullability: android.os.VibrationEffect.OneShot#OneShot(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.OneShot#scale(float, int):
+
+MissingNullability: android.os.VibrationEffect.OneShot#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.Prebaked#Prebaked(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.Prebaked#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.Waveform#Waveform(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.Waveform#Waveform(long[], int[], int) parameter #0:
+
+MissingNullability: android.os.VibrationEffect.Waveform#Waveform(long[], int[], int) parameter #1:
+
+MissingNullability: android.os.VibrationEffect.Waveform#getAmplitudes():
+
+MissingNullability: android.os.VibrationEffect.Waveform#getTimings():
+
+MissingNullability: android.os.VibrationEffect.Waveform#scale(float, int):
+
+MissingNullability: android.os.VibrationEffect.Waveform#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.VintfObject#getHalNamesAndVersions():
+
+MissingNullability: android.os.VintfObject#getSepolicyVersion():
+
+MissingNullability: android.os.VintfObject#getTargetFrameworkCompatibilityMatrixVersion():
+
+MissingNullability: android.os.VintfObject#getVndkSnapshots():
+
+MissingNullability: android.os.VintfObject#report():
+
+MissingNullability: android.os.VintfRuntimeInfo#getCpuInfo():
+
+MissingNullability: android.os.VintfRuntimeInfo#getHardwareId():
+
+MissingNullability: android.os.VintfRuntimeInfo#getKernelVersion():
+
+MissingNullability: android.os.VintfRuntimeInfo#getNodeName():
+
+MissingNullability: android.os.VintfRuntimeInfo#getOsName():
+
+MissingNullability: android.os.VintfRuntimeInfo#getOsRelease():
+
+MissingNullability: android.os.VintfRuntimeInfo#getOsVersion():
+
+MissingNullability: android.os.WorkSource#add(int, String) parameter #1:
+
+MissingNullability: android.os.WorkSource#addReturningNewbs(android.os.WorkSource) parameter #0:
+
+MissingNullability: android.os.WorkSource#getName(int):
+
+MissingNullability: android.os.WorkSource#setReturningDiffs(android.os.WorkSource) parameter #0:
+
+MissingNullability: android.os.health.HealthKeys.Constants#Constants(Class) parameter #0:
+
+MissingNullability: android.os.health.HealthKeys.Constants#getDataType():
+
+MissingNullability: android.os.health.HealthKeys.Constants#getKeys(int):
+
+MissingNullability: android.os.health.HealthStats#HealthStats(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.health.HealthStatsParceler#HealthStatsParceler(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.health.HealthStatsParceler#HealthStatsParceler(android.os.health.HealthStatsWriter) parameter #0:
+
+MissingNullability: android.os.health.HealthStatsParceler#getHealthStats():
+
+MissingNullability: android.os.health.HealthStatsParceler#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.os.health.HealthStatsWriter#HealthStatsWriter(android.os.health.HealthKeys.Constants) parameter #0:
+
+MissingNullability: android.os.health.HealthStatsWriter#addMeasurements(int, String, long) parameter #1:
+
+MissingNullability: android.os.health.HealthStatsWriter#addStats(int, String, android.os.health.HealthStatsWriter) parameter #1:
+
+MissingNullability: android.os.health.HealthStatsWriter#addStats(int, String, android.os.health.HealthStatsWriter) parameter #2:
+
+MissingNullability: android.os.health.HealthStatsWriter#addTimers(int, String, android.os.health.TimerStat) parameter #1:
+
+MissingNullability: android.os.health.HealthStatsWriter#addTimers(int, String, android.os.health.TimerStat) parameter #2:
+
+MissingNullability: android.os.health.HealthStatsWriter#flattenToParcel(android.os.Parcel) parameter #0:
+
+MissingNullability: android.os.storage.StorageVolume#getPath():
+
+MissingNullability: android.permission.RuntimePermissionPresentationInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.provider.CalendarContract.Calendars#SYNC_WRITABLE_COLUMNS:
+
+MissingNullability: android.provider.CalendarContract.Events#SYNC_WRITABLE_COLUMNS:
+
+MissingNullability: android.provider.ContactsContract.CommonDataKinds.Phone#ENTERPRISE_CONTENT_URI:
+
+MissingNullability: android.provider.ContactsContract.RawContactsEntity#CORP_CONTENT_URI:
+
+MissingNullability: android.provider.DeviceConfig#getProperty(String, String):
+
+MissingNullability: android.provider.DeviceConfig#getString(String, String, String):
+
+MissingNullability: android.provider.MediaStore#deleteContributedMedia(android.content.Context, String, android.os.UserHandle) parameter #0:
+
+MissingNullability: android.provider.MediaStore#deleteContributedMedia(android.content.Context, String, android.os.UserHandle) parameter #1:
+
+MissingNullability: android.provider.MediaStore#deleteContributedMedia(android.content.Context, String, android.os.UserHandle) parameter #2:
+
+MissingNullability: android.provider.MediaStore#getContributedMediaSize(android.content.Context, String, android.os.UserHandle) parameter #0:
+
+MissingNullability: android.provider.MediaStore#getContributedMediaSize(android.content.Context, String, android.os.UserHandle) parameter #1:
+
+MissingNullability: android.provider.MediaStore#getContributedMediaSize(android.content.Context, String, android.os.UserHandle) parameter #2:
+
+MissingNullability: android.provider.MediaStore#scanFile(android.content.Context, java.io.File):
+
+MissingNullability: android.provider.MediaStore#scanFile(android.content.Context, java.io.File) parameter #0:
+
+MissingNullability: android.provider.MediaStore#scanFile(android.content.Context, java.io.File) parameter #1:
+
+MissingNullability: android.provider.MediaStore#scanFileFromShell(android.content.Context, java.io.File):
+
+MissingNullability: android.provider.MediaStore#scanFileFromShell(android.content.Context, java.io.File) parameter #0:
+
+MissingNullability: android.provider.MediaStore#scanFileFromShell(android.content.Context, java.io.File) parameter #1:
+
+MissingNullability: android.provider.MediaStore#scanVolume(android.content.Context, java.io.File) parameter #0:
+
+MissingNullability: android.provider.MediaStore#scanVolume(android.content.Context, java.io.File) parameter #1:
+
+MissingNullability: android.provider.MediaStore#waitForIdle(android.content.Context) parameter #0:
+
+MissingNullability: android.security.KeyStoreException#KeyStoreException(int, String) parameter #1:
+
+MissingNullability: android.security.keystore.AttestationUtils#attestDeviceIds(android.content.Context, int[], byte[]) parameter #0:
+
+MissingNullability: android.security.keystore.KeyProtection.Builder#setBoundToSpecificSecureUserId(long):
+
+MissingNullability: android.service.autofill.AutofillFieldClassificationService#onBind(android.content.Intent):
+
+MissingNullability: android.service.autofill.AutofillFieldClassificationService#onBind(android.content.Intent) parameter #0:
+
+MissingNullability: android.service.autofill.CompositeUserData#getCategoryIds():
+
+MissingNullability: android.service.autofill.CompositeUserData#getDefaultFieldClassificationArgs():
+
+MissingNullability: android.service.autofill.CompositeUserData#getFieldClassificationAlgorithms():
+
+MissingNullability: android.service.autofill.CompositeUserData#getFieldClassificationArgs():
+
+MissingNullability: android.service.autofill.CompositeUserData#getValues():
+
+MissingNullability: android.service.autofill.CompositeUserData#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.service.autofill.UserData#getFieldClassificationAlgorithms():
+
+MissingNullability: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
+
+MissingNullability: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #1:
+
+MissingNullability: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #2:
+
+MissingNullability: android.service.autofill.augmented.AugmentedAutofillService#onUnbind(android.content.Intent) parameter #0:
+
+MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
+
+MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #1:
+
+MissingNullability: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #2:
+
+MissingNullability: android.service.notification.Adjustment#Adjustment(String, String, android.os.Bundle, CharSequence, int) parameter #0:
+
+MissingNullability: android.service.notification.Adjustment#Adjustment(String, String, android.os.Bundle, CharSequence, int) parameter #1:
+
+MissingNullability: android.service.notification.Adjustment#Adjustment(String, String, android.os.Bundle, CharSequence, int) parameter #2:
+
+MissingNullability: android.service.notification.Adjustment#Adjustment(String, String, android.os.Bundle, CharSequence, int) parameter #3:
+
+MissingNullability: android.service.notification.Adjustment#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.service.notification.NotificationAssistantService#attachBaseContext(android.content.Context) parameter #0:
+
+MissingNullability: android.service.notification.NotificationStats#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.service.notification.SnoozeCriterion#SnoozeCriterion(String, CharSequence, CharSequence) parameter #0:
+
+MissingNullability: android.service.notification.SnoozeCriterion#SnoozeCriterion(String, CharSequence, CharSequence) parameter #1:
+
+MissingNullability: android.service.notification.SnoozeCriterion#SnoozeCriterion(String, CharSequence, CharSequence) parameter #2:
+
+MissingNullability: android.service.notification.SnoozeCriterion#SnoozeCriterion(android.os.Parcel) parameter #0:
+
+MissingNullability: android.service.notification.SnoozeCriterion#getConfirmation():
+
+MissingNullability: android.service.notification.SnoozeCriterion#getExplanation():
+
+MissingNullability: android.service.notification.SnoozeCriterion#getId():
+
+MissingNullability: android.service.notification.SnoozeCriterion#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.telecom.Call.Details#getTelecomCallId():
+
+MissingNullability: android.telecom.CallScreeningService.CallResponse.Builder#setShouldScreenCallFurther(boolean):
+
+MissingNullability: android.telecom.Conference#getPrimaryConnection():
+
+MissingNullability: android.telecom.PhoneAccountSuggestionService#onBind(android.content.Intent):
+
+MissingNullability: android.telecom.PhoneAccountSuggestionService#onBind(android.content.Intent) parameter #0:
+
+MissingNullability: android.telephony.DataSpecificRegistrationInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.telephony.LteVopsSupportInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.telephony.NetworkRegistrationInfo#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.telephony.ServiceState#addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo) parameter #0:
+
+MissingNullability: android.telephony.ServiceState#setCellBandwidths(int[]) parameter #0:
+
+MissingNullability: android.telephony.SmsManager#checkSmsShortCodeDestination(String, String) parameter #0:
+
+MissingNullability: android.telephony.SmsManager#checkSmsShortCodeDestination(String, String) parameter #1:
+
+MissingNullability: android.telephony.TelephonyManager#checkCarrierPrivilegesForPackage(String) parameter #0:
+
+MissingNullability: android.telephony.TelephonyManager#getLine1AlphaTag():
+
+MissingNullability: android.telephony.TelephonyManager#getRadioHalVersion():
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #0:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #1:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #2:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #3:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #4:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #5:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String) parameter #6:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #0:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #1:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #2:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #3:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #4:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #5:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #6:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #7:
+
+MissingNullability: android.telephony.TelephonyManager#setCarrierTestOverride(String, String, String, String, String, String, String, String, String) parameter #8:
+
+MissingNullability: android.telephony.mbms.DownloadRequest.Builder#setServiceId(String):
+
+MissingNullability: android.telephony.mbms.DownloadRequest.Builder#setServiceId(String) parameter #0:
+
+MissingNullability: android.telephony.mbms.FileInfo#FileInfo(android.net.Uri, String) parameter #0:
+
+MissingNullability: android.telephony.mbms.FileInfo#FileInfo(android.net.Uri, String) parameter #1:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #0:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #1:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #2:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #3:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #4:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #5:
+
+MissingNullability: android.telephony.mbms.FileServiceInfo#FileServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date, java.util.List<android.telephony.mbms.FileInfo>) parameter #6:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #0:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #1:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #2:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #3:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #4:
+
+MissingNullability: android.telephony.mbms.StreamingServiceInfo#StreamingServiceInfo(java.util.Map<java.util.Locale,java.lang.String>, String, java.util.List<java.util.Locale>, String, java.util.Date, java.util.Date) parameter #5:
+
+MissingNullability: android.telephony.mbms.UriPathPair#getContentUri():
+
+MissingNullability: android.telephony.mbms.UriPathPair#getFilePathUri():
+
+MissingNullability: android.telephony.mbms.UriPathPair#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#asBinder():
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#cancelDownload(android.telephony.mbms.DownloadRequest) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#download(android.telephony.mbms.DownloadRequest) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int) parameter #2:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#requestUpdateFileServices(int, java.util.List<java.lang.String>) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#resetDownloadKnowledge(android.telephony.mbms.DownloadRequest) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsDownloadServiceBase#setTempFileRootDirectory(int, String) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#onBind(android.content.Intent):
+
+MissingNullability: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#onBind(android.content.Intent) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#asBinder():
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#getPlaybackUri(int, String) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int) parameter #2:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#requestUpdateStreamingServices(int, java.util.List<java.lang.String>) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback) parameter #2:
+
+MissingNullability: android.telephony.mbms.vendor.MbmsStreamingServiceBase#stopStreaming(int, String) parameter #1:
+
+MissingNullability: android.telephony.mbms.vendor.VendorUtils#getAppReceiverFromPackageName(android.content.Context, String):
+
+MissingNullability: android.telephony.mbms.vendor.VendorUtils#getAppReceiverFromPackageName(android.content.Context, String) parameter #0:
+
+MissingNullability: android.telephony.mbms.vendor.VendorUtils#getAppReceiverFromPackageName(android.content.Context, String) parameter #1:
+
+MissingNullability: android.text.Selection.MemoryTextWatcher#afterTextChanged(android.text.Editable) parameter #0:
+
+MissingNullability: android.text.Selection.MemoryTextWatcher#beforeTextChanged(CharSequence, int, int, int) parameter #0:
+
+MissingNullability: android.text.Selection.MemoryTextWatcher#onTextChanged(CharSequence, int, int, int) parameter #0:
+
+MissingNullability: android.transition.TransitionManager#getTransition(android.transition.Scene):
+
+MissingNullability: android.transition.TransitionManager#getTransition(android.transition.Scene) parameter #0:
+
+MissingNullability: android.util.FeatureFlagUtils#getAllFeatureFlags():
+
+MissingNullability: android.util.FeatureFlagUtils#isEnabled(android.content.Context, String) parameter #0:
+
+MissingNullability: android.util.FeatureFlagUtils#isEnabled(android.content.Context, String) parameter #1:
+
+MissingNullability: android.util.FeatureFlagUtils#setEnabled(android.content.Context, String, boolean) parameter #0:
+
+MissingNullability: android.util.FeatureFlagUtils#setEnabled(android.content.Context, String, boolean) parameter #1:
+
+MissingNullability: android.util.TimeUtils#formatDuration(long):
+
+MissingNullability: android.util.proto.EncodedBuffer#dumpBuffers(String) parameter #0:
+
+MissingNullability: android.util.proto.EncodedBuffer#dumpByteString(String, String, byte[]) parameter #0:
+
+MissingNullability: android.util.proto.EncodedBuffer#dumpByteString(String, String, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.EncodedBuffer#dumpByteString(String, String, byte[]) parameter #2:
+
+MissingNullability: android.util.proto.EncodedBuffer#getBytes(int):
+
+MissingNullability: android.util.proto.EncodedBuffer#getDebugString():
+
+MissingNullability: android.util.proto.EncodedBuffer#writeRawBuffer(byte[]) parameter #0:
+
+MissingNullability: android.util.proto.EncodedBuffer#writeRawBuffer(byte[], int, int) parameter #0:
+
+MissingNullability: android.util.proto.ProtoOutputStream#ProtoOutputStream(java.io.FileDescriptor) parameter #0:
+
+MissingNullability: android.util.proto.ProtoOutputStream#ProtoOutputStream(java.io.OutputStream) parameter #0:
+
+MissingNullability: android.util.proto.ProtoOutputStream#dump(String) parameter #0:
+
+MissingNullability: android.util.proto.ProtoOutputStream#getBytes():
+
+MissingNullability: android.util.proto.ProtoOutputStream#write(long, String) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#write(long, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeBytes(long, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeObject(long, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedBool(long, boolean[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedDouble(long, double[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedEnum(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedFixed32(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedFixed64(long, long[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedFloat(long, float[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedInt32(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedInt64(long, long[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedSFixed32(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedSFixed64(long, long[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedSInt32(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedSInt64(long, long[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedUInt32(long, int[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writePackedUInt64(long, long[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeRepeatedBytes(long, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeRepeatedObject(long, byte[]) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeRepeatedString(long, String) parameter #1:
+
+MissingNullability: android.util.proto.ProtoOutputStream#writeString(long, String) parameter #1:
+
+MissingNullability: android.util.proto.ProtoParseException#ProtoParseException(String) parameter #0:
+
+MissingNullability: android.util.proto.ProtoStream#FIELD_TYPE_NAMES:
+
+MissingNullability: android.util.proto.ProtoStream#getFieldCountString(long):
+
+MissingNullability: android.util.proto.ProtoStream#getFieldIdString(long):
+
+MissingNullability: android.util.proto.ProtoStream#getFieldTypeString(long):
+
+MissingNullability: android.util.proto.ProtoStream#getWireTypeString(int):
+
+MissingNullability: android.util.proto.ProtoStream#token2String(long):
+
+MissingNullability: android.util.proto.WireTypeMismatchException#WireTypeMismatchException(String) parameter #0:
+
+MissingNullability: android.view.Choreographer#postCallback(int, Runnable, Object) parameter #1:
+
+MissingNullability: android.view.Choreographer#postCallback(int, Runnable, Object) parameter #2:
+
+MissingNullability: android.view.Choreographer#postCallbackDelayed(int, Runnable, Object, long) parameter #1:
+
+MissingNullability: android.view.Choreographer#postCallbackDelayed(int, Runnable, Object, long) parameter #2:
+
+MissingNullability: android.view.Choreographer#removeCallbacks(int, Runnable, Object) parameter #1:
+
+MissingNullability: android.view.Choreographer#removeCallbacks(int, Runnable, Object) parameter #2:
+
+MissingNullability: android.view.FocusFinder#sort(android.view.View[], int, int, android.view.ViewGroup, boolean) parameter #0:
+
+MissingNullability: android.view.FocusFinder#sort(android.view.View[], int, int, android.view.ViewGroup, boolean) parameter #3:
+
+MissingNullability: android.view.KeyEvent#actionToString(int):
+
+MissingNullability: android.view.View#getTooltipView():
+
+MissingNullability: android.view.View#isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable) parameter #0:
+
+MissingNullability: android.view.View#isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable) parameter #1:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>) parameter #0:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>) parameter #1:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>) parameter #2:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>) parameter #0:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>) parameter #1:
+
+MissingNullability: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>) parameter #2:
+
+MissingNullability: android.view.WindowManager.LayoutParams#accessibilityTitle:
+
+MissingNullability: android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener#onAccessibilityServicesStateChanged(android.view.accessibility.AccessibilityManager) parameter #0:
+
+MissingNullability: android.view.accessibility.AccessibilityNodeInfo#setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger) parameter #0:
+
+MissingNullability: android.view.accessibility.AccessibilityNodeInfo#writeToParcelNoRecycle(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.view.accessibility.AccessibilityWindowInfo#setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger) parameter #0:
+
+MissingNullability: android.view.contentcapture.ContentCaptureEvent#writeToParcel(android.os.Parcel, int) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode#getAutofillId():
+
+MissingNullability: android.view.contentcapture.ViewNode#getClassName():
+
+MissingNullability: android.view.contentcapture.ViewNode#getContentDescription():
+
+MissingNullability: android.view.contentcapture.ViewNode#getExtras():
+
+MissingNullability: android.view.contentcapture.ViewNode#getHint():
+
+MissingNullability: android.view.contentcapture.ViewNode#getIdEntry():
+
+MissingNullability: android.view.contentcapture.ViewNode#getIdPackage():
+
+MissingNullability: android.view.contentcapture.ViewNode#getIdType():
+
+MissingNullability: android.view.contentcapture.ViewNode#getLocaleList():
+
+MissingNullability: android.view.contentcapture.ViewNode#getText():
+
+MissingNullability: android.view.contentcapture.ViewNode#getTextIdEntry():
+
+MissingNullability: android.view.contentcapture.ViewNode#getTextLineBaselines():
+
+MissingNullability: android.view.contentcapture.ViewNode#getTextLineCharOffsets():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#asyncNewChild(int):
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getAutofillId():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getExtras():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getHint():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getNode():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getTempRect():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#getText():
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#newChild(int):
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#newHtmlInfoBuilder(String):
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#newHtmlInfoBuilder(String) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillHints(String[]) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillId(android.view.autofill.AutofillId) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillId(android.view.autofill.AutofillId, int) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillOptions(CharSequence[]) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setAutofillValue(android.view.autofill.AutofillValue) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setClassName(String) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setContentDescription(CharSequence) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setHint(CharSequence) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setHtmlInfo(android.view.ViewStructure.HtmlInfo) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setId(int, String, String, String) parameter #1:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setId(int, String, String, String) parameter #2:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setId(int, String, String, String) parameter #3:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setLocaleList(android.os.LocaleList) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setText(CharSequence) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setText(CharSequence, int, int) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setTextIdEntry(String) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setTextLines(int[], int[]) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setTextLines(int[], int[]) parameter #1:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setTransformation(android.graphics.Matrix) parameter #0:
+
+MissingNullability: android.view.contentcapture.ViewNode.ViewStructureImpl#setWebDomain(String) parameter #0:
+
+MissingNullability: android.widget.CalendarView#getBoundsForDate(long, android.graphics.Rect) parameter #1:
+
+MissingNullability: android.widget.ImageView#isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable) parameter #0:
+
+MissingNullability: android.widget.ImageView#isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable) parameter #1:
+
+MissingNullability: android.widget.Magnifier#getMagnifierDefaultSize():
+
+MissingNullability: android.widget.Magnifier#setOnOperationCompleteCallback(android.widget.Magnifier.Callback) parameter #0:
+
+MissingNullability: android.widget.NumberPicker#getDisplayedValueForCurrentSelection():
+
+MissingNullability: android.widget.PopupMenu#getMenuListView():
+
+MissingNullability: android.widget.TimePicker#getAmView():
+
+MissingNullability: android.widget.TimePicker#getHourView():
+
+MissingNullability: android.widget.TimePicker#getMinuteView():
+
+MissingNullability: android.widget.TimePicker#getPmView():
+
+
+
+MutableBareField: android.content.AutofillOptions#appDisabledExpiration:
+
+MutableBareField: android.content.AutofillOptions#augmentedAutofillEnabled:
+
+MutableBareField: android.content.AutofillOptions#disabledActivities:
+
+MutableBareField: android.content.AutofillOptions#whitelistedActivitiesForAugmentedAutofill:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.DbStats#cache:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.DbStats#dbName:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.DbStats#dbSize:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.DbStats#lookaside:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.DbStats#pageSize:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.PagerStats#dbStats:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.PagerStats#largestMemAlloc:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.PagerStats#memoryUsed:
+
+MutableBareField: android.database.sqlite.SQLiteDebug.PagerStats#pageCacheOverflow:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#broadcastIntentAction:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#durationMillis:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#numAnimationsRunning:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#numInstances:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#tags:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#violationNumThisLoop:
+
+MutableBareField: android.os.StrictMode.ViolationInfo#violationUptimeMillis:
+
+
+
+NoByteOrShort: android.media.audiofx.AudioEffect#byteArrayToShort(byte[]):
+
+NoByteOrShort: android.media.audiofx.AudioEffect#setParameter(int, short) parameter #1:
+
+NoByteOrShort: android.media.audiofx.AudioEffect#shortToByteArray(short) parameter #0:
+
+NoByteOrShort: android.os.HwBlob#getInt16(long):
+
+NoByteOrShort: android.os.HwBlob#getInt8(long):
+
+NoByteOrShort: android.os.HwBlob#putInt16(long, short) parameter #1:
+
+NoByteOrShort: android.os.HwBlob#putInt8(long, byte) parameter #1:
+
+NoByteOrShort: android.os.HwParcel#readInt16():
+
+NoByteOrShort: android.os.HwParcel#readInt8():
+
+NoByteOrShort: android.os.HwParcel#writeInt16(short) parameter #0:
+
+NoByteOrShort: android.os.HwParcel#writeInt8(byte) parameter #0:
+
+NoByteOrShort: android.util.proto.EncodedBuffer#readRawByte():
+
+NoByteOrShort: android.util.proto.EncodedBuffer#writeRawByte(byte) parameter #0:
+
+
+
+NoClone: android.net.util.SocketUtils#bindSocketToInterface(java.io.FileDescriptor, String) parameter #0:
+
+NoClone: android.net.util.SocketUtils#closeSocket(java.io.FileDescriptor) parameter #0:
+
+NoClone: android.os.NativeHandle#NativeHandle(java.io.FileDescriptor, boolean) parameter #0:
+
+NoClone: android.os.NativeHandle#getFileDescriptor():
+
+NoClone: android.os.ParcelFileDescriptor#getFile(java.io.FileDescriptor) parameter #0:
+
+NoClone: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
+
+NoClone: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]) parameter #0:
+
+NoClone: android.util.proto.ProtoOutputStream#ProtoOutputStream(java.io.FileDescriptor) parameter #0:
+
+
+
+NotCloseable: android.app.ActivityView:
+
+NotCloseable: android.app.prediction.AppPredictor:
+
+NotCloseable: android.os.HwParcel:
+
+
+
+OnNameExpected: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.PrintWriter, String[]):
+
+OnNameExpected: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]):
+
+OnNameExpected: android.service.notification.ConditionProviderService#isBound():
+
+OnNameExpected: android.service.notification.NotificationAssistantService#attachBaseContext(android.content.Context):
+
+OnNameExpected: android.service.quicksettings.TileService#isQuickSettingsSupported():
+
+OnNameExpected: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#dispose(int):
+
+OnNameExpected: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int):
+
+OnNameExpected: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback):
+
+OnNameExpected: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#stopGroupCall(int, long):
+
+OnNameExpected: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>):
+
+
+
+PackageLayering: android.util.FeatureFlagUtils:
+
+
+
+ParcelConstructor: android.os.IncidentManager.IncidentReport#IncidentReport(android.os.Parcel):
+
+ParcelConstructor: android.os.IncidentReportArgs#IncidentReportArgs(android.os.Parcel):
+
+ParcelConstructor: android.os.StrictMode.ViolationInfo#ViolationInfo(android.os.Parcel):
+
+ParcelConstructor: android.os.VibrationEffect.OneShot#OneShot(android.os.Parcel):
+
+ParcelConstructor: android.os.VibrationEffect.Prebaked#Prebaked(android.os.Parcel):
+
+ParcelConstructor: android.os.VibrationEffect.Waveform#Waveform(android.os.Parcel):
+
+ParcelConstructor: android.os.health.HealthStatsParceler#HealthStatsParceler(android.os.Parcel):
+
+ParcelConstructor: android.service.notification.SnoozeCriterion#SnoozeCriterion(android.os.Parcel):
+
+
+
+ParcelCreator: android.app.WindowConfiguration:
+
+ParcelCreator: android.net.metrics.ApfProgramEvent:
+
+ParcelCreator: android.net.metrics.ApfStats:
+
+ParcelCreator: android.net.metrics.DhcpClientEvent:
+
+ParcelCreator: android.net.metrics.DhcpErrorEvent:
+
+ParcelCreator: android.net.metrics.IpConnectivityLog.Event:
+
+ParcelCreator: android.net.metrics.IpManagerEvent:
+
+ParcelCreator: android.net.metrics.IpReachabilityEvent:
+
+ParcelCreator: android.net.metrics.NetworkEvent:
+
+ParcelCreator: android.net.metrics.RaEvent:
+
+ParcelCreator: android.net.metrics.ValidationProbeEvent:
+
+ParcelCreator: android.os.VibrationEffect.OneShot:
+
+ParcelCreator: android.os.VibrationEffect.Prebaked:
+
+ParcelCreator: android.os.VibrationEffect.Waveform:
+
+ParcelCreator: android.service.autofill.InternalOnClickAction:
+
+ParcelCreator: android.service.autofill.InternalSanitizer:
+
+ParcelCreator: android.service.autofill.InternalTransformation:
+
+ParcelCreator: android.service.autofill.InternalValidator:
+
+
+
+ParcelNotFinal: android.app.WindowConfiguration:
+
+ParcelNotFinal: android.net.metrics.IpConnectivityLog.Event:
+
+ParcelNotFinal: android.os.IncidentManager.IncidentReport:
+
+ParcelNotFinal: android.os.VibrationEffect.OneShot:
+
+ParcelNotFinal: android.os.VibrationEffect.Prebaked:
+
+ParcelNotFinal: android.os.VibrationEffect.Waveform:
+
+ParcelNotFinal: android.os.health.HealthStatsParceler:
+
+ParcelNotFinal: android.service.autofill.InternalOnClickAction:
+
+ParcelNotFinal: android.service.autofill.InternalSanitizer:
+
+ParcelNotFinal: android.service.autofill.InternalTransformation:
+
+ParcelNotFinal: android.service.autofill.InternalValidator:
+
+
+
+ProtectedMember: android.app.ActivityView#onVisibilityChanged(android.view.View, int):
+
+ProtectedMember: android.app.AppDetailsActivity#onCreate(android.os.Bundle):
+
+ProtectedMember: android.os.VibrationEffect#scale(int, float, int):
+
+ProtectedMember: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]):
+
+ProtectedMember: android.service.autofill.augmented.AugmentedAutofillService#dump(java.io.PrintWriter, String[]):
+
+ProtectedMember: android.service.contentcapture.ContentCaptureService#dump(java.io.FileDescriptor, java.io.PrintWriter, String[]):
+
+ProtectedMember: android.service.notification.NotificationAssistantService#attachBaseContext(android.content.Context):
+
+ProtectedMember: android.util.proto.ProtoStream#FIELD_TYPE_NAMES:
+
+ProtectedMember: android.view.View#resetResolvedDrawables():
+
+ProtectedMember: android.view.ViewGroup#resetResolvedDrawables():
+
+
+
+RawAidl: android.telephony.mbms.vendor.MbmsDownloadServiceBase:
+
+RawAidl: android.telephony.mbms.vendor.MbmsStreamingServiceBase:
+
+
+
+RethrowRemoteException: android.app.ActivityManager#resumeAppSwitches():
+
+RethrowRemoteException: android.os.HwBinder#getService(String, String):
+
+RethrowRemoteException: android.os.HwBinder#getService(String, String, boolean):
+
+RethrowRemoteException: android.os.HwBinder#onTransact(int, android.os.HwParcel, android.os.HwParcel, int):
+
+RethrowRemoteException: android.os.HwBinder#registerService(String):
+
+RethrowRemoteException: android.os.HwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int):
+
+RethrowRemoteException: android.os.IHwBinder#transact(int, android.os.HwParcel, android.os.HwParcel, int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#cancelDownload(android.telephony.mbms.DownloadRequest):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#dispose(int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#download(android.telephony.mbms.DownloadRequest):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#initialize(int, android.telephony.mbms.MbmsDownloadSessionCallback):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#listPendingDownloads(int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#removeStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#requestUpdateFileServices(int, java.util.List<java.lang.String>):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#resetDownloadKnowledge(android.telephony.mbms.DownloadRequest):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsDownloadServiceBase#setTempFileRootDirectory(int, String):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#dispose(int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsGroupCallServiceBase#initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#dispose(int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#getPlaybackUri(int, String):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#initialize(android.telephony.mbms.MbmsStreamingSessionCallback, int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#onTransact(int, android.os.Parcel, android.os.Parcel, int):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#requestUpdateStreamingServices(int, java.util.List<java.lang.String>):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#startStreaming(int, String, android.telephony.mbms.StreamingServiceCallback):
+
+RethrowRemoteException: android.telephony.mbms.vendor.MbmsStreamingServiceBase#stopStreaming(int, String):
+
+
+
+SamShouldBeLast: android.app.ActivityManager#addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int):
+
+SamShouldBeLast: android.app.role.RoleManager#addOnRoleHoldersChangedListenerAsUser(java.util.concurrent.Executor, android.app.role.OnRoleHoldersChangedListener, android.os.UserHandle):
+
+SamShouldBeLast: android.app.role.RoleManager#removeOnRoleHoldersChangedListenerAsUser(android.app.role.OnRoleHoldersChangedListener, android.os.UserHandle):
+
+SamShouldBeLast: android.database.sqlite.SQLiteDebug#dump(android.util.Printer, String[]):
+
+SamShouldBeLast: android.database.sqlite.SQLiteDirectCursorDriver#query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]):
+
+SamShouldBeLast: android.location.LocationManager#requestLocationUpdates(android.location.LocationRequest, java.util.concurrent.Executor, android.location.LocationListener):
+
+SamShouldBeLast: android.os.BugreportManager#startBugreport(android.os.ParcelFileDescriptor, android.os.ParcelFileDescriptor, android.os.BugreportParams, java.util.concurrent.Executor, android.os.BugreportManager.BugreportCallback):
+
+SamShouldBeLast: android.os.IHwBinder#linkToDeath(android.os.IHwBinder.DeathRecipient, long):
+
+SamShouldBeLast: android.os.StrictMode.ViolationInfo#dump(android.util.Printer, String):
+
+SamShouldBeLast: android.permission.PermissionControllerManager#getAppPermissions(String, android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, android.os.Handler):
+
+SamShouldBeLast: android.permission.PermissionControllerManager#revokeRuntimePermissions(java.util.Map<java.lang.String,java.util.List<java.lang.String>>, boolean, int, java.util.concurrent.Executor, android.permission.PermissionControllerManager.OnRevokeRuntimePermissionsCallback):
+
+SamShouldBeLast: android.service.autofill.CharSequenceTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+SamShouldBeLast: android.service.autofill.DateTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+SamShouldBeLast: android.service.autofill.ImageTransformation#apply(android.service.autofill.ValueFinder, android.widget.RemoteViews, int):
+
+SamShouldBeLast: android.service.autofill.InternalTransformation#batchApply(android.service.autofill.ValueFinder, android.widget.RemoteViews, java.util.ArrayList<android.util.Pair<java.lang.Integer,android.service.autofill.InternalTransformation>>):
+
+SamShouldBeLast: android.view.Choreographer#postCallback(int, Runnable, Object):
+
+SamShouldBeLast: android.view.Choreographer#postCallbackDelayed(int, Runnable, Object, long):
+
+SamShouldBeLast: android.view.Choreographer#removeCallbacks(int, Runnable, Object):
+
+SamShouldBeLast: android.view.ViewDebug#startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>):
+
+SamShouldBeLast: android.view.accessibility.AccessibilityManager#addAccessibilityServicesStateChangeListener(android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener, android.os.Handler):
+
+
+
+ServiceName: android.Manifest.permission#BIND_CELL_BROADCAST_SERVICE:
+
+ServiceName: android.app.AppOpsManager#OPSTR_BIND_ACCESSIBILITY_SERVICE:
+
+ServiceName: android.provider.Settings.Secure#ACCESSIBILITY_SHORTCUT_TARGET_SERVICE:
+
+ServiceName: android.provider.Settings.Secure#AUTOFILL_SERVICE:
+
+ServiceName: android.provider.Settings.Secure#VOICE_INTERACTION_SERVICE:
+
+
+
+SetterReturnsThis: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyFocusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyFocusListener):
+
+SetterReturnsThis: android.media.audiopolicy.AudioPolicy.Builder#setAudioPolicyStatusListener(android.media.audiopolicy.AudioPolicy.AudioPolicyStatusListener):
+
+
+
+StaticUtils: android.os.health.HealthKeys:
+
+StaticUtils: android.service.autofill.InternalTransformation:
+
+StaticUtils: android.telephony.mbms.vendor.VendorUtils:
+
+StaticUtils: android.util.FeatureFlagUtils:
+
+StaticUtils: android.util.proto.ProtoStream:
+
+StaticUtils: android.view.inputmethod.InputMethodSystemProperty:
+
+
+
+StreamFiles: android.os.Environment#buildPath(java.io.File, java.lang.String...):
+
+StreamFiles: android.os.FileUtils#contains(java.io.File, java.io.File):
+
+StreamFiles: android.provider.MediaStore#scanFile(android.content.Context, java.io.File):
+
+StreamFiles: android.provider.MediaStore#scanFileFromShell(android.content.Context, java.io.File):
+
+StreamFiles: android.provider.MediaStore#scanVolume(android.content.Context, java.io.File):
+
+
+
+UseParcelFileDescriptor: android.util.proto.ProtoOutputStream#ProtoOutputStream(java.io.FileDescriptor) parameter #0:
+
+
+
+UserHandle: android.app.admin.DevicePolicyManager#getOwnerInstalledCaCerts(android.os.UserHandle):
+
+UserHandle: android.app.role.RoleManager#addOnRoleHoldersChangedListenerAsUser(java.util.concurrent.Executor, android.app.role.OnRoleHoldersChangedListener, android.os.UserHandle):
+
+UserHandle: android.app.role.RoleManager#addRoleHolderAsUser(String, String, int, android.os.UserHandle, java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Boolean>):
+
+UserHandle: android.app.role.RoleManager#clearRoleHoldersAsUser(String, int, android.os.UserHandle, java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Boolean>):
+
+UserHandle: android.app.role.RoleManager#getRoleHoldersAsUser(String, android.os.UserHandle):
+
+UserHandle: android.app.role.RoleManager#removeOnRoleHoldersChangedListenerAsUser(android.app.role.OnRoleHoldersChangedListener, android.os.UserHandle):
+
+UserHandle: android.app.role.RoleManager#removeRoleHolderAsUser(String, String, int, android.os.UserHandle, java.util.concurrent.Executor, java.util.function.Consumer<java.lang.Boolean>):
+
+UserHandle: android.content.pm.PackageManager#getInstallReason(String, android.os.UserHandle):
+
+UserHandle: android.content.pm.PackageManager#getPermissionFlags(String, String, android.os.UserHandle):
+
+UserHandle: android.content.pm.PackageManager#grantRuntimePermission(String, String, android.os.UserHandle):
+
+UserHandle: android.content.pm.PackageManager#revokeRuntimePermission(String, String, android.os.UserHandle):
+
+UserHandle: android.content.pm.PackageManager#updatePermissionFlags(String, String, int, int, android.os.UserHandle):
+
+UserHandle: android.location.LocationManager#setLocationEnabledForUser(boolean, android.os.UserHandle):
+
+
+
+UserHandleName: android.app.ActivityView#startActivity(android.content.Intent, android.os.UserHandle):
+
+UserHandleName: android.content.AutofillOptions:
+
+UserHandleName: android.content.ContentCaptureOptions:
+
+UserHandleName: android.os.IncidentReportArgs:
+
+UserHandleName: android.provider.MediaStore#deleteContributedMedia(android.content.Context, String, android.os.UserHandle):
+
+UserHandleName: android.provider.MediaStore#getContributedMediaSize(android.content.Context, String, android.os.UserHandle):
+
+
+
+VisiblySynchronized: PsiClassObjectAccessExpression:
+
+VisiblySynchronized: PsiThisExpression:
+
+VisiblySynchronized: android.app.ActivityManager#addOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener, int):
+
+VisiblySynchronized: android.app.ActivityManager#removeOnUidImportanceListener(android.app.ActivityManager.OnUidImportanceListener):
+
+VisiblySynchronized: android.content.ContentProviderClient#setDetectNotResponding(long):
+
+VisiblySynchronized: android.content.res.AssetManager#getApkPaths():
+
+VisiblySynchronized: android.content.res.AssetManager#getOverlayableMap(String):
+
+VisiblySynchronized: android.os.MessageQueue#removeSyncBarrier(int):
+
diff --git a/cmds/incidentd/src/Section.cpp b/cmds/incidentd/src/Section.cpp
index 1572114c639f..f476fcf91bd5 100644
--- a/cmds/incidentd/src/Section.cpp
+++ b/cmds/incidentd/src/Section.cpp
@@ -546,16 +546,16 @@ status_t LogSection::BlockingCall(int pipeWriteFd) const {
;
android_log_list_element elem;
- lastTimestamp.tv_sec = msg.entry_v1.sec;
- lastTimestamp.tv_nsec = msg.entry_v1.nsec;
+ lastTimestamp.tv_sec = msg.entry.sec;
+ lastTimestamp.tv_nsec = msg.entry.nsec;
// format a BinaryLogEntry
uint64_t token = proto.start(LogProto::BINARY_LOGS);
- proto.write(BinaryLogEntry::SEC, msg.entry_v1.sec);
- proto.write(BinaryLogEntry::NANOSEC, msg.entry_v1.nsec);
- proto.write(BinaryLogEntry::UID, (int)msg.entry_v4.uid);
- proto.write(BinaryLogEntry::PID, msg.entry_v1.pid);
- proto.write(BinaryLogEntry::TID, msg.entry_v1.tid);
+ proto.write(BinaryLogEntry::SEC, (int32_t)msg.entry.sec);
+ proto.write(BinaryLogEntry::NANOSEC, (int32_t)msg.entry.nsec);
+ proto.write(BinaryLogEntry::UID, (int)msg.entry.uid);
+ proto.write(BinaryLogEntry::PID, msg.entry.pid);
+ proto.write(BinaryLogEntry::TID, (int32_t)msg.entry.tid);
proto.write(BinaryLogEntry::TAG_INDEX,
get4LE(reinterpret_cast<uint8_t const*>(msg.msg())));
do {
@@ -603,7 +603,7 @@ status_t LogSection::BlockingCall(int pipeWriteFd) const {
}
} else {
AndroidLogEntry entry;
- err = android_log_processLogBuffer(&msg.entry_v1, &entry);
+ err = android_log_processLogBuffer(&msg.entry, &entry);
if (err != NO_ERROR) {
ALOGW("[%s] fails to process to an entry.\n", this->name.string());
break;
diff --git a/cmds/statsd/benchmark/log_event_benchmark.cpp b/cmds/statsd/benchmark/log_event_benchmark.cpp
index 43addc28f074..26034695906b 100644
--- a/cmds/statsd/benchmark/log_event_benchmark.cpp
+++ b/cmds/statsd/benchmark/log_event_benchmark.cpp
@@ -54,9 +54,9 @@ static void getSimpleLogMsgData(log_msg* msg) {
write4Bytes(99 /* a value to log*/, &buffer);
buffer.push_back(EVENT_TYPE_LIST_STOP);
- msg->entry_v1.len = buffer.size();
+ msg->entry.len = buffer.size();
msg->entry.hdr_size = kLogMsgHeaderSize;
- msg->entry_v1.sec = time(nullptr);
+ msg->entry.sec = time(nullptr);
std::copy(buffer.begin(), buffer.end(), msg->buf + kLogMsgHeaderSize);
}
diff --git a/cmds/statsd/src/StatsLogProcessor.h b/cmds/statsd/src/StatsLogProcessor.h
index f0db1b0128a1..313e16d19b62 100644
--- a/cmds/statsd/src/StatsLogProcessor.h
+++ b/cmds/statsd/src/StatsLogProcessor.h
@@ -128,13 +128,13 @@ private:
std::unordered_map<ConfigKey, sp<MetricsManager>> mMetricsManagers;
- std::unordered_map<ConfigKey, long> mLastBroadcastTimes;
+ std::unordered_map<ConfigKey, int64_t> mLastBroadcastTimes;
// Last time we sent a broadcast to this uid that the active configs had changed.
- std::unordered_map<int, long> mLastActivationBroadcastTimes;
+ std::unordered_map<int, int64_t> mLastActivationBroadcastTimes;
// Tracks when we last checked the bytes consumed for each config key.
- std::unordered_map<ConfigKey, long> mLastByteSizeTimes;
+ std::unordered_map<ConfigKey, int64_t> mLastByteSizeTimes;
// Tracks which config keys has metric reports on disk
std::set<ConfigKey> mOnDiskDataConfigs;
@@ -205,7 +205,7 @@ private:
int64_t mLastTimestampSeen = 0;
- long mLastPullerCacheClearTimeSec = 0;
+ int64_t mLastPullerCacheClearTimeSec = 0;
// Last time we wrote data to disk.
int64_t mLastWriteTimeNs = 0;
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index 0ade53118d77..838561e3ae10 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -38,8 +38,8 @@ using std::vector;
LogEvent::LogEvent(log_msg& msg) {
mContext =
create_android_log_parser(msg.msg() + sizeof(uint32_t), msg.len() - sizeof(uint32_t));
- mLogdTimestampNs = msg.entry_v1.sec * NS_PER_SEC + msg.entry_v1.nsec;
- mLogUid = msg.entry_v4.uid;
+ mLogdTimestampNs = msg.entry.sec * NS_PER_SEC + msg.entry.nsec;
+ mLogUid = msg.entry.uid;
init(mContext);
if (mContext) {
// android_log_destroy will set mContext to NULL
diff --git a/config/dirty-image-objects b/config/dirty-image-objects
index ec2568dc4ad8..2dfe0197d898 100644
--- a/config/dirty-image-objects
+++ b/config/dirty-image-objects
@@ -255,7 +255,7 @@ com.android.internal.os.SomeArgs
com.android.internal.policy.DecorView
com.android.internal.statusbar.IStatusBarService
com.android.internal.telephony.AppSmsManager
-com.android.internal.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
+android.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
com.android.internal.telephony.CarrierActionAgent
com.android.internal.telephony.cat.CatService
com.android.internal.telephony.cat.IconLoader
diff --git a/config/hiddenapi-greylist-max-p.txt b/config/hiddenapi-greylist-max-p.txt
index 25d45b0e6570..351e71dd9538 100644
--- a/config/hiddenapi-greylist-max-p.txt
+++ b/config/hiddenapi-greylist-max-p.txt
@@ -1,57 +1,14 @@
Landroid/app/IInstrumentationWatcher$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IInstrumentationWatcher;
Landroid/app/ISearchManager$Stub;-><init>()V
Landroid/app/IUiModeManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IUiModeManager;
-Landroid/app/IUiModeManager;->disableCarMode(I)V
Landroid/bluetooth/IBluetooth$Stub;-><init>()V
Landroid/bluetooth/IBluetoothA2dp$Stub;-><init>()V
Landroid/content/IIntentReceiver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IIntentReceiver;
Landroid/content/IIntentSender$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IIntentSender;
-Landroid/net/IConnectivityManager;->getNetworkInfo(I)Landroid/net/NetworkInfo;
-Landroid/net/IConnectivityManager;->reportInetCondition(II)V
-Landroid/os/BatteryStats$Counter;-><init>()V
-Landroid/os/BatteryStats$HistoryItem;->clear()V
-Landroid/os/BatteryStats$HistoryItem;->next:Landroid/os/BatteryStats$HistoryItem;
-Landroid/os/BatteryStats$HistoryItem;->same(Landroid/os/BatteryStats$HistoryItem;)Z
-Landroid/os/BatteryStats$HistoryItem;->setTo(JBLandroid/os/BatteryStats$HistoryItem;)V
-Landroid/os/BatteryStats$HistoryItem;->setTo(Landroid/os/BatteryStats$HistoryItem;)V
-Landroid/os/BatteryStats$Timer;-><init>()V
-Landroid/os/BatteryStats$Uid$Pkg;-><init>()V
-Landroid/os/BatteryStats$Uid$Proc;-><init>()V
-Landroid/os/BatteryStats$Uid$Sensor;-><init>()V
-Landroid/os/BatteryStats$Uid$Wakelock;-><init>()V
-Landroid/os/BatteryStats;-><init>()V
-Landroid/os/BatteryStats;->getMobileRadioActiveTime(JI)J
-Landroid/os/BatteryStats;->getNetworkActivityBytes(II)J
-Landroid/os/CancellationSignal;->mCancelInProgress:Z
-Landroid/os/CancellationSignal;->mIsCanceled:Z
-Landroid/os/CancellationSignal;->mOnCancelListener:Landroid/os/CancellationSignal$OnCancelListener;
-Landroid/os/CancellationSignal;->mRemote:Landroid/os/ICancellationSignal;
-Landroid/os/CancellationSignal;->waitForCancelFinishedLocked()V
-Landroid/os/IPowerManager;->nap(J)V
-Landroid/os/Parcel;->mCreators:Ljava/util/HashMap;
-Landroid/os/PowerManager;->mHandler:Landroid/os/Handler;
-Landroid/os/Process;->sendSignalQuiet(II)V
-Landroid/os/Registrant;->getHandler()Landroid/os/Handler;
-Landroid/os/RegistrantList;->get(I)Ljava/lang/Object;
-Landroid/os/RemoteCallback;->mHandler:Landroid/os/Handler;
Landroid/os/storage/IObbActionListener$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IObbActionListener;
-Landroid/os/SystemProperties;->native_add_change_callback()V
-Landroid/os/SystemProperties;->native_get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
-Landroid/os/SystemProperties;->native_get_boolean(Ljava/lang/String;Z)Z
-Landroid/os/SystemProperties;->native_get_int(Ljava/lang/String;I)I
-Landroid/os/SystemProperties;->native_set(Ljava/lang/String;Ljava/lang/String;)V
-Landroid/os/UserHandle;->formatUid(Ljava/io/PrintWriter;I)V
-Landroid/os/WorkSource;->sGoneWork:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->sNewbWork:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->sTmpWorkSource:Landroid/os/WorkSource;
-Landroid/os/WorkSource;->updateLocked(Landroid/os/WorkSource;ZZ)Z
Landroid/service/carrier/ICarrierMessagingCallback$Stub;-><init>()V
-Landroid/service/carrier/ICarrierMessagingService;->filterSms(Landroid/service/carrier/MessagePdu;Ljava/lang/String;IILandroid/service/carrier/ICarrierMessagingCallback;)V
-Landroid/telephony/CarrierMessagingServiceManager;-><init>()V
Landroid/view/IGraphicsStats$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/view/IGraphicsStats$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IGraphicsStats;
-Landroid/view/IWindowManager;->setInTouchMode(Z)V
-Landroid/view/IWindowManager;->showStrictModeViolation(Z)V
Lcom/android/internal/R$styleable;->AndroidManifestActivityAlias:[I
Lcom/android/internal/R$styleable;->AndroidManifestGrantUriPermission:[I
Lcom/android/internal/R$styleable;->AndroidManifestInstrumentation:[I
@@ -70,10 +27,3 @@ Lcom/android/internal/R$styleable;->MenuView:[I
Lcom/android/internal/R$styleable;->Searchable:[I
Lcom/android/internal/R$styleable;->SearchableActionKey:[I
Lcom/android/internal/telephony/IPhoneSubInfo$Stub;-><init>()V
-Lcom/android/internal/telephony/ITelephony;->getDataActivity()I
-Lcom/android/internal/telephony/ITelephony;->getDataState()I
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCallForwardingChanged(Z)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyCellLocation(Landroid/os/Bundle;)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyDataActivity(I)V
-Lcom/android/internal/telephony/ITelephonyRegistry;->notifyOtaspChanged(II)V
-Lcom/android/internal/view/BaseIWindow;-><init>()V
diff --git a/config/hiddenapi-greylist.txt b/config/hiddenapi-greylist.txt
index e8b2648ad39d..2d3394be1ad0 100644
--- a/config/hiddenapi-greylist.txt
+++ b/config/hiddenapi-greylist.txt
@@ -1,6 +1,4 @@
Landroid/accessibilityservice/IAccessibilityServiceConnection$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accessibilityservice/IAccessibilityServiceConnection;
-Landroid/accounts/AccountManager$AmsTask;-><init>(Landroid/accounts/AccountManager;Landroid/app/Activity;Landroid/os/Handler;Landroid/accounts/AccountManagerCallback;)V
-Landroid/accounts/AccountManager$Future2Task;-><init>(Landroid/accounts/AccountManager;Landroid/os/Handler;Landroid/accounts/AccountManagerCallback;)V
Landroid/accounts/IAccountAuthenticator$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/accounts/IAccountAuthenticator$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Landroid/accounts/IAccountAuthenticator$Stub;-><init>()V
@@ -16,10 +14,6 @@ Landroid/accounts/IAccountManagerResponse$Stub$Proxy;-><init>(Landroid/os/IBinde
Landroid/accounts/IAccountManagerResponse$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Landroid/accounts/IAccountManagerResponse$Stub;-><init>()V
Landroid/accounts/IAccountManagerResponse$Stub;->asInterface(Landroid/os/IBinder;)Landroid/accounts/IAccountManagerResponse;
-Landroid/app/ActivityManagerNative;-><init>()V
-Landroid/app/ActivityThread$AppBindData;-><init>()V
-Landroid/app/ActivityThread$CreateServiceData;-><init>()V
-Landroid/app/ActivityThread$H;-><init>(Landroid/app/ActivityThread;)V
Landroid/app/admin/IDevicePolicyManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/admin/IDevicePolicyManager;
Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_packageHasActiveAdmins:I
Landroid/app/admin/IDevicePolicyManager$Stub;->TRANSACTION_removeActiveAdmin:I
@@ -35,8 +29,6 @@ Landroid/app/IActivityManager$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Landroid/app/IActivityManager$Stub$Proxy;->setActivityController(Landroid/app/IActivityController;Z)V
Landroid/app/IActivityManager$Stub$Proxy;->updatePersistentConfiguration(Landroid/content/res/Configuration;)V
Landroid/app/IActivityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IActivityManager;
-Landroid/app/IActivityManager;->finishReceiver(Landroid/os/IBinder;ILjava/lang/String;Landroid/os/Bundle;ZI)V
-Landroid/app/IActivityManager;->serviceDoneExecuting(Landroid/os/IBinder;III)V
Landroid/app/IAlarmManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/app/IAlarmManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/IAlarmManager;
Landroid/app/IAlarmManager$Stub;->TRANSACTION_remove:I
@@ -73,56 +65,25 @@ Landroid/app/job/IJobService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/app/job/IJobService$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Landroid/app/job/IJobService$Stub;-><init>()V
Landroid/app/job/IJobService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/job/IJobService;
-Landroid/app/PackageDeleteObserver;-><init>()V
-Landroid/app/PackageInstallObserver;-><init>()V
-Landroid/app/ResourcesManager$ActivityResources;-><init>()V
-Landroid/app/ResourcesManager;-><init>()V
-Landroid/app/TaskStackListener;-><init>()V
Landroid/app/trust/ITrustManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
-Landroid/app/UiAutomationConnection;-><init>()V
Landroid/app/usage/IUsageStatsManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/app/usage/IUsageStatsManager;
-Landroid/app/UserSwitchObserver;-><init>()V
Landroid/bluetooth/IBluetooth$Stub$Proxy;->getAddress()Ljava/lang/String;
Landroid/bluetooth/IBluetooth$Stub$Proxy;->getConnectionState(Landroid/bluetooth/BluetoothDevice;)I
Landroid/bluetooth/IBluetooth$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetooth;
Landroid/bluetooth/IBluetooth$Stub;->TRANSACTION_enable:I
-Landroid/bluetooth/IBluetooth;->fetchRemoteUuids(Landroid/bluetooth/BluetoothDevice;)Z
-Landroid/bluetooth/IBluetooth;->getAddress()Ljava/lang/String;
-Landroid/bluetooth/IBluetooth;->getRemoteAlias(Landroid/bluetooth/BluetoothDevice;)Ljava/lang/String;
-Landroid/bluetooth/IBluetooth;->isEnabled()Z
-Landroid/bluetooth/IBluetooth;->sendConnectionStateChange(Landroid/bluetooth/BluetoothDevice;III)V
Landroid/bluetooth/IBluetoothA2dp$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothA2dp;
-Landroid/bluetooth/IBluetoothA2dp;->connect(Landroid/bluetooth/BluetoothDevice;)Z
-Landroid/bluetooth/IBluetoothA2dp;->disconnect(Landroid/bluetooth/BluetoothDevice;)Z
-Landroid/bluetooth/IBluetoothA2dp;->getConnectedDevices()Ljava/util/List;
-Landroid/bluetooth/IBluetoothA2dp;->getConnectionState(Landroid/bluetooth/BluetoothDevice;)I
-Landroid/bluetooth/IBluetoothA2dp;->getDevicesMatchingConnectionStates([I)Ljava/util/List;
-Landroid/bluetooth/IBluetoothA2dp;->getPriority(Landroid/bluetooth/BluetoothDevice;)I
Landroid/bluetooth/IBluetoothCallback$Stub;-><init>()V
-Landroid/bluetooth/IBluetoothGatt;->registerClient(Landroid/os/ParcelUuid;Landroid/bluetooth/IBluetoothGattCallback;)V
-Landroid/bluetooth/IBluetoothGatt;->unregisterClient(I)V
Landroid/bluetooth/IBluetoothGattCallback$Stub;-><init>()V
Landroid/bluetooth/IBluetoothGattCallback$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothGattCallback;
Landroid/bluetooth/IBluetoothHeadset$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothHeadset;
-Landroid/bluetooth/IBluetoothHeadset;->connect(Landroid/bluetooth/BluetoothDevice;)Z
-Landroid/bluetooth/IBluetoothHeadset;->disconnect(Landroid/bluetooth/BluetoothDevice;)Z
-Landroid/bluetooth/IBluetoothHeadset;->getConnectedDevices()Ljava/util/List;
-Landroid/bluetooth/IBluetoothHeadset;->getConnectionState(Landroid/bluetooth/BluetoothDevice;)I
-Landroid/bluetooth/IBluetoothHeadset;->getPriority(Landroid/bluetooth/BluetoothDevice;)I
-Landroid/bluetooth/IBluetoothHeadset;->setPriority(Landroid/bluetooth/BluetoothDevice;I)Z
Landroid/bluetooth/IBluetoothHidDeviceCallback$Stub;-><init>()V
Landroid/bluetooth/IBluetoothManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/bluetooth/IBluetoothManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothManager;
Landroid/bluetooth/IBluetoothManager$Stub;->TRANSACTION_enable:I
-Landroid/bluetooth/IBluetoothManager;->getBluetoothGatt()Landroid/bluetooth/IBluetoothGatt;
-Landroid/bluetooth/IBluetoothManager;->registerStateChangeCallback(Landroid/bluetooth/IBluetoothStateChangeCallback;)V
-Landroid/bluetooth/IBluetoothManager;->unregisterStateChangeCallback(Landroid/bluetooth/IBluetoothStateChangeCallback;)V
Landroid/bluetooth/IBluetoothManagerCallback$Stub;-><init>()V
Landroid/bluetooth/IBluetoothPbap$Stub;->asInterface(Landroid/os/IBinder;)Landroid/bluetooth/IBluetoothPbap;
Landroid/bluetooth/IBluetoothStateChangeCallback$Stub;-><init>()V
Landroid/companion/ICompanionDeviceDiscoveryService$Stub;-><init>()V
-Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelected(Ljava/lang/String;ILjava/lang/String;)V
-Landroid/companion/ICompanionDeviceDiscoveryServiceCallback;->onDeviceSelectionCancel()V
Landroid/content/IClipboard$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/content/IClipboard$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/IClipboard;
Landroid/content/IContentService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
@@ -189,14 +150,8 @@ Landroid/content/pm/IPackageStatsObserver$Stub;-><init>()V
Landroid/content/pm/IPackageStatsObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IPackageStatsObserver;
Landroid/content/pm/IShortcutService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/content/pm/IShortcutService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/content/pm/IShortcutService;
-Landroid/content/res/ConfigurationBoundResourceCache;-><init>()V
-Landroid/content/res/DrawableCache;-><init>()V
-Landroid/content/UndoManager;-><init>()V
Landroid/database/IContentObserver$Stub;-><init>()V
Landroid/database/IContentObserver$Stub;->asInterface(Landroid/os/IBinder;)Landroid/database/IContentObserver;
-Landroid/database/IContentObserver;->onChange(ZLandroid/net/Uri;I)V
-Landroid/database/sqlite/SQLiteConnectionPool;->$assertionsDisabled:Z
-Landroid/database/sqlite/SQLiteDatabase;->$assertionsDisabled:Z
Landroid/hardware/display/IDisplayManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/display/IDisplayManager;
Landroid/hardware/fingerprint/IFingerprintService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/hardware/fingerprint/IFingerprintService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/hardware/fingerprint/IFingerprintService;
@@ -221,7 +176,6 @@ Landroid/location/ILocationManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/location/ILocationManager;
Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I
Landroid/location/INetInitiatedListener$Stub;-><init>()V
-Landroid/location/LocationManager$ListenerTransport;-><init>(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V
Landroid/Manifest$permission;->CAPTURE_SECURE_VIDEO_OUTPUT:Ljava/lang/String;
Landroid/Manifest$permission;->CAPTURE_VIDEO_OUTPUT:Ljava/lang/String;
Landroid/Manifest$permission;->READ_FRAME_BUFFER:Ljava/lang/String;
@@ -232,13 +186,9 @@ Landroid/media/IAudioService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/me
Landroid/media/IMediaRouterService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaRouterService;
Landroid/media/IMediaScannerListener$Stub;-><init>()V
Landroid/media/IMediaScannerService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IMediaScannerService;
-Landroid/media/IRingtonePlayer;->play(Landroid/os/IBinder;Landroid/net/Uri;Landroid/media/AudioAttributes;FZ)V
Landroid/media/IVolumeController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/IVolumeController;
-Landroid/media/MediaFile;-><init>()V
-Landroid/media/MediaScanner$MyMediaScannerClient;-><init>(Landroid/media/MediaScanner;)V
Landroid/media/session/ISessionManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/media/session/ISessionManager;
Landroid/media/tv/ITvRemoteProvider$Stub;-><init>()V
-Landroid/net/ConnectivityManager$PacketKeepaliveCallback;-><init>()V
Landroid/net/IConnectivityManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveLinkProperties()Landroid/net/LinkProperties;
Landroid/net/IConnectivityManager$Stub$Proxy;->getActiveNetworkInfo()Landroid/net/NetworkInfo;
@@ -256,12 +206,8 @@ Landroid/net/INetworkScoreService$Stub;->asInterface(Landroid/os/IBinder;)Landro
Landroid/net/INetworkStatsService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/net/INetworkStatsService$Stub$Proxy;->getMobileIfaces()[Ljava/lang/String;
Landroid/net/INetworkStatsService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/INetworkStatsService;
-Landroid/net/InterfaceConfiguration;-><init>()V
-Landroid/net/LinkProperties$ProvisioningChange;->values()[Landroid/net/LinkProperties$ProvisioningChange;
-Landroid/net/MobileLinkQualityInfo;-><init>()V
Landroid/net/nsd/INsdManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/nsd/INsdManager;
Landroid/net/sip/ISipSession$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/sip/ISipSession;
-Landroid/net/SntpClient;-><init>()V
Landroid/net/wifi/IWifiManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/net/wifi/IWifiManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiManager;
Landroid/net/wifi/IWifiManager$Stub;->TRANSACTION_getScanResults:I
@@ -271,16 +217,11 @@ Landroid/net/wifi/IWifiScanner$Stub;-><init>()V
Landroid/net/wifi/IWifiScanner$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/IWifiScanner;
Landroid/net/wifi/p2p/IWifiP2pManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/net/wifi/p2p/IWifiP2pManager;
Landroid/nfc/INfcAdapter$Stub;->TRANSACTION_enable:I
-Landroid/os/BatteryStats$Uid$Proc$ExcessivePower;-><init>()V
-Landroid/os/BatteryStats$Uid;-><init>()V
Landroid/os/IBatteryPropertiesRegistrar$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/os/IDeviceIdentifiersPolicyService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IDeviceIdentifiersPolicyService;
Landroid/os/IDeviceIdleController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IDeviceIdleController;
-Landroid/os/IDeviceIdleController;->getAppIdTempWhitelist()[I
-Landroid/os/IDeviceIdleController;->getFullPowerWhitelistExceptIdle()[Ljava/lang/String;
Landroid/os/INetworkManagementService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/os/INetworkManagementService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/INetworkManagementService;
-Landroid/os/INetworkManagementService;->listTetheredInterfaces()[Ljava/lang/String;
Landroid/os/IPermissionController$Stub$Proxy;->checkPermission(Ljava/lang/String;II)Z
Landroid/os/IPermissionController$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IPermissionController;
Landroid/os/IPowerManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
@@ -291,17 +232,12 @@ Landroid/os/IPowerManager$Stub;->TRANSACTION_goToSleep:I
Landroid/os/IRecoverySystem$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IRecoverySystem;
Landroid/os/IRemoteCallback$Stub;-><init>()V
Landroid/os/IUpdateEngine$Stub;-><init>()V
-Landroid/os/IUpdateEngineCallback;->onStatusUpdate(IF)V
Landroid/os/IUserManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/os/IUserManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IUserManager;
Landroid/os/IVibratorService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/IVibratorService;
-Landroid/os/Parcel$ReadWriteHelper;-><init>()V
-Landroid/os/RegistrantList;-><init>()V
-Landroid/os/ServiceManager;-><init>()V
Landroid/os/storage/IObbActionListener$Stub;-><init>()V
Landroid/os/storage/IStorageManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/os/storage/IStorageManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/os/storage/IStorageManager;
-Landroid/os/storage/StorageEventListener;-><init>()V
Landroid/R$styleable;->ActionBar:[I
Landroid/R$styleable;->ActionBar_background:I
Landroid/R$styleable;->ActionBar_backgroundSplit:I
@@ -568,18 +504,7 @@ Landroid/R$styleable;->Window_windowBackground:I
Landroid/R$styleable;->Window_windowFrame:I
Landroid/security/IKeyChainService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/IKeyChainService;
Landroid/security/keystore/IKeystoreService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/security/keystore/IKeystoreService;
-Landroid/security/keystore/IKeystoreService;->clear_uid(J)I
-Landroid/security/keystore/IKeystoreService;->del(Ljava/lang/String;I)I
-Landroid/security/keystore/IKeystoreService;->exist(Ljava/lang/String;I)I
-Landroid/security/keystore/IKeystoreService;->get(Ljava/lang/String;I)[B
-Landroid/security/keystore/IKeystoreService;->getState(I)I
-Landroid/security/keystore/IKeystoreService;->insert(Ljava/lang/String;[BII)I
-Landroid/security/keystore/IKeystoreService;->is_hardware_backed(Ljava/lang/String;)I
-Landroid/security/keystore/IKeystoreService;->list(Ljava/lang/String;I)[Ljava/lang/String;
-Landroid/security/keystore/IKeystoreService;->reset()I
-Landroid/security/keystore/IKeystoreService;->ungrant(Ljava/lang/String;I)I
Landroid/service/dreams/IDreamManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/dreams/IDreamManager;
-Landroid/service/dreams/IDreamManager;->getDreamComponents()[Landroid/content/ComponentName;
Landroid/service/euicc/IEuiccService$Stub;-><init>()V
Landroid/service/media/IMediaBrowserServiceCallbacks$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/media/IMediaBrowserServiceCallbacks;
Landroid/service/notification/INotificationListener$Stub;-><init>()V
@@ -587,18 +512,11 @@ Landroid/service/persistentdata/IPersistentDataBlockService$Stub;->asInterface(L
Landroid/service/vr/IVrManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/vr/IVrManager;
Landroid/service/wallpaper/IWallpaperConnection$Stub;-><init>()V
Landroid/service/wallpaper/IWallpaperService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/service/wallpaper/IWallpaperService;
-Landroid/telephony/ims/compat/feature/MMTelFeature;-><init>()V
-Landroid/telephony/ims/compat/ImsService;-><init>()V
-Landroid/telephony/ims/compat/stub/ImsCallSessionImplBase;-><init>()V
-Landroid/telephony/ims/compat/stub/ImsUtListenerImplBase;-><init>()V
Landroid/telephony/mbms/IMbmsStreamingSessionCallback$Stub;-><init>()V
Landroid/telephony/mbms/IStreamingServiceCallback$Stub;-><init>()V
Landroid/telephony/mbms/vendor/IMbmsStreamingService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/telephony/mbms/vendor/IMbmsStreamingService;
-Landroid/telephony/TelephonyManager$MultiSimVariants;->values()[Landroid/telephony/TelephonyManager$MultiSimVariants;
-Landroid/util/Singleton;-><init>()V
Landroid/view/accessibility/IAccessibilityManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/view/accessibility/IAccessibilityManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/accessibility/IAccessibilityManager;
-Landroid/view/AccessibilityIterators$AbstractTextSegmentIterator;-><init>()V
Landroid/view/autofill/IAutoFillManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/view/autofill/IAutoFillManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/autofill/IAutoFillManager;
Landroid/view/IAppTransitionAnimationSpecsFuture$Stub;-><init>()V
@@ -617,30 +535,10 @@ Landroid/view/IWindowManager$Stub$Proxy;->watchRotation(Landroid/view/IRotationW
Landroid/view/IWindowManager$Stub;-><init>()V
Landroid/view/IWindowManager$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowManager;
Landroid/view/IWindowSession$Stub;->asInterface(Landroid/os/IBinder;)Landroid/view/IWindowSession;
-Landroid/view/View$AttachInfo$InvalidateInfo;-><init>()V
-Landroid/view/View$CheckForLongPress;-><init>(Landroid/view/View;)V
-Landroid/view/View$ListenerInfo;-><init>()V
-Landroid/view/ViewTreeObserver$InternalInsetsInfo;-><init>()V
-Landroid/webkit/CacheManager$CacheResult;-><init>()V
Landroid/webkit/IWebViewUpdateService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Landroid/webkit/IWebViewUpdateService$Stub$Proxy;->waitForAndGetProvider()Landroid/webkit/WebViewProviderResponse;
Landroid/webkit/IWebViewUpdateService$Stub;->asInterface(Landroid/os/IBinder;)Landroid/webkit/IWebViewUpdateService;
-Landroid/widget/DigitalClock$FormatChangeObserver;-><init>(Landroid/widget/DigitalClock;)V
-Landroid/widget/QuickContactBadge$QueryHandler;-><init>(Landroid/widget/QuickContactBadge;Landroid/content/ContentResolver;)V
-Landroid/widget/RelativeLayout$DependencyGraph$Node;-><init>()V
-Landroid/widget/ScrollBarDrawable;-><init>()V
-Lcom/android/ims/ImsCall;->deflect(Ljava/lang/String;)V
-Lcom/android/ims/ImsCall;->isMultiparty()Z
-Lcom/android/ims/ImsCall;->reject(I)V
-Lcom/android/ims/ImsCall;->terminate(I)V
Lcom/android/ims/ImsConfigListener$Stub;-><init>()V
-Lcom/android/ims/ImsEcbm;->exitEmergencyCallbackMode()V
-Lcom/android/ims/ImsManager;->getConfigInterface()Lcom/android/ims/ImsConfig;
-Lcom/android/ims/ImsManager;->getInstance(Landroid/content/Context;I)Lcom/android/ims/ImsManager;
-Lcom/android/ims/ImsManager;->isEnhanced4gLteModeSettingEnabledByUser(Landroid/content/Context;)Z
-Lcom/android/ims/ImsManager;->isNonTtyOrTtyOnVolteEnabled(Landroid/content/Context;)Z
-Lcom/android/ims/ImsManager;->isVolteEnabledByPlatform(Landroid/content/Context;)Z
-Lcom/android/ims/ImsUtInterface;->queryCallForward(ILjava/lang/String;Landroid/os/Message;)V
Lcom/android/ims/internal/IImsCallSession$Stub;-><init>()V
Lcom/android/ims/internal/IImsCallSession$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsCallSession;
Lcom/android/ims/internal/IImsConfig$Stub;-><init>()V
@@ -649,13 +547,10 @@ Lcom/android/ims/internal/IImsService$Stub;-><init>()V
Lcom/android/ims/internal/IImsService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/ims/internal/IImsService;
Lcom/android/ims/internal/IImsUt$Stub;-><init>()V
Lcom/android/ims/internal/IImsVideoCallProvider$Stub;-><init>()V
-Lcom/android/ims/internal/ImsVideoCallProviderWrapper;-><init>(Lcom/android/ims/internal/IImsVideoCallProvider;)V
Lcom/android/ims/internal/uce/options/IOptionsService$Stub;-><init>()V
Lcom/android/ims/internal/uce/presence/IPresenceService$Stub;-><init>()V
Lcom/android/ims/internal/uce/uceservice/IUceListener$Stub;-><init>()V
Lcom/android/ims/internal/uce/uceservice/IUceService$Stub;-><init>()V
-Lcom/android/internal/app/AlertActivity;-><init>()V
-Lcom/android/internal/app/ChooserActivity;-><init>()V
Lcom/android/internal/app/IAppOpsCallback$Stub;-><init>()V
Lcom/android/internal/app/IAppOpsService$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/app/IAppOpsService$Stub$Proxy;->checkOperation(IILjava/lang/String;)I
@@ -684,35 +579,16 @@ Lcom/android/internal/app/IBatteryStats$Stub;->asInterface(Landroid/os/IBinder;)
Lcom/android/internal/app/IMediaContainerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IMediaContainerService;
Lcom/android/internal/app/IVoiceInteractionManagerService$Stub$Proxy;->showSessionFromSession(Landroid/os/IBinder;Landroid/os/Bundle;I)Z
Lcom/android/internal/app/IVoiceInteractionManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/app/IVoiceInteractionManagerService;
-Lcom/android/internal/app/ResolverActivity;-><init>()V
Lcom/android/internal/appwidget/IAppWidgetService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/appwidget/IAppWidgetService;
Lcom/android/internal/appwidget/IAppWidgetService$Stub;->TRANSACTION_bindAppWidgetId:I
Lcom/android/internal/backup/IBackupTransport$Stub;-><init>()V
-Lcom/android/internal/content/PackageMonitor;-><init>()V
-Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;-><init>()V
-Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;->requestorId:Ljava/lang/String;
-Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;->requestorIdEncoding:I
-Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;->text:Ljava/lang/String;
-Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;->textEncoding:I
-Lcom/android/internal/location/GpsNetInitiatedHandler;->decodeString(Ljava/lang/String;ZI)Ljava/lang/String;
-Lcom/android/internal/location/GpsNetInitiatedHandler;->handleNiNotification(Lcom/android/internal/location/GpsNetInitiatedHandler$GpsNiNotification;)V
-Lcom/android/internal/location/GpsNetInitiatedHandler;->mIsHexInput:Z
Lcom/android/internal/location/ILocationProvider$Stub;-><init>()V
Lcom/android/internal/location/ILocationProvider$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProvider;
-Lcom/android/internal/location/ILocationProvider;->sendExtraCommand(Ljava/lang/String;Landroid/os/Bundle;)V
-Lcom/android/internal/location/ILocationProvider;->setLocationProviderManager(Lcom/android/internal/location/ILocationProviderManager;)V
-Lcom/android/internal/location/ILocationProvider;->setRequest(Lcom/android/internal/location/ProviderRequest;Landroid/os/WorkSource;)V
Lcom/android/internal/location/ILocationProviderManager$Stub;-><init>()V
Lcom/android/internal/location/ILocationProviderManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/location/ILocationProviderManager;
-Lcom/android/internal/logging/MetricsLogger;-><init>()V
-Lcom/android/internal/net/LegacyVpnInfo;-><init>()V
-Lcom/android/internal/net/VpnConfig;-><init>()V
-Lcom/android/internal/os/BaseCommand;-><init>()V
-Lcom/android/internal/os/BatterySipper$DrainType;->values()[Lcom/android/internal/os/BatterySipper$DrainType;
Lcom/android/internal/os/IDropBoxManagerService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/os/IDropBoxManagerService;
Lcom/android/internal/policy/IKeyguardService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardService;
Lcom/android/internal/policy/IKeyguardStateCallback$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/policy/IKeyguardStateCallback;
-Lcom/android/internal/preference/YesNoPreference;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
Lcom/android/internal/R$anim;->fade_in:I
Lcom/android/internal/R$array;->config_autoBrightnessLcdBacklightValues:I
Lcom/android/internal/R$array;->config_autoBrightnessLevels:I
@@ -1157,211 +1033,9 @@ Lcom/android/internal/statusbar/IStatusBar$Stub;->asInterface(Landroid/os/IBinde
Lcom/android/internal/statusbar/IStatusBarService$Stub;-><init>()V
Lcom/android/internal/statusbar/IStatusBarService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/statusbar/IStatusBarService;
Lcom/android/internal/telecom/ITelecomService$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telecom/ITelecomService;
-Lcom/android/internal/telephony/Call$State;->ALERTING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->DIALING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->DISCONNECTED:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->DISCONNECTING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->HOLDING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->IDLE:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->INCOMING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->values()[Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call$State;->WAITING:Lcom/android/internal/telephony/Call$State;
-Lcom/android/internal/telephony/Call;-><init>()V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery$CallerInfoAsyncQueryHandler;-><init>(Lcom/android/internal/telephony/CallerInfoAsyncQuery;Landroid/content/Context;)V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery$CookieWrapper;-><init>()V
-Lcom/android/internal/telephony/CallerInfoAsyncQuery;->release()V
-Lcom/android/internal/telephony/CallForwardInfo;-><init>()V
-Lcom/android/internal/telephony/CallTracker;-><init>()V
-Lcom/android/internal/telephony/cat/AppInterface$CommandType;->values()[Lcom/android/internal/telephony/cat/AppInterface$CommandType;
-Lcom/android/internal/telephony/cat/ResponseData;-><init>()V
-Lcom/android/internal/telephony/cat/ResultCode;->values()[Lcom/android/internal/telephony/cat/ResultCode;
-Lcom/android/internal/telephony/cat/RilMessageDecoder;->mCurrentRilMessage:Lcom/android/internal/telephony/cat/RilMessage;
-Lcom/android/internal/telephony/cat/RilMessageDecoder;->sendCmdForExecution(Lcom/android/internal/telephony/cat/RilMessage;)V
-Lcom/android/internal/telephony/cat/RilMessageDecoder;->sendStartDecodingMessageParams(Lcom/android/internal/telephony/cat/RilMessage;)V
-Lcom/android/internal/telephony/cat/ValueObject;-><init>()V
-Lcom/android/internal/telephony/cat/ValueParser;->retrieveDeviceIdentities(Lcom/android/internal/telephony/cat/ComprehensionTlv;)Lcom/android/internal/telephony/cat/DeviceIdentities;
-Lcom/android/internal/telephony/cdma/sms/BearerData$CodingException;-><init>(Ljava/lang/String;)V
-Lcom/android/internal/telephony/cdma/sms/BearerData$TimeStamp;-><init>()V
-Lcom/android/internal/telephony/cdma/sms/BearerData;-><init>()V
-Lcom/android/internal/telephony/cdma/sms/BearerData;->countAsciiSeptets(Ljava/lang/CharSequence;Z)I
-Lcom/android/internal/telephony/cdma/sms/BearerData;->decodeUserDataPayload(Lcom/android/internal/telephony/cdma/sms/UserData;Z)V
-Lcom/android/internal/telephony/cdma/sms/BearerData;->displayMode:I
-Lcom/android/internal/telephony/cdma/sms/BearerData;->encode(Lcom/android/internal/telephony/cdma/sms/BearerData;)[B
-Lcom/android/internal/telephony/cdma/sms/BearerData;->encode7bitAscii(Ljava/lang/String;Z)[B
-Lcom/android/internal/telephony/cdma/sms/BearerData;->getBitsForNumFields(II)I
-Lcom/android/internal/telephony/cdma/sms/BearerData;->hasUserDataHeader:Z
-Lcom/android/internal/telephony/cdma/sms/BearerData;->messageId:I
-Lcom/android/internal/telephony/cdma/sms/BearerData;->msgCenterTimeStamp:Lcom/android/internal/telephony/cdma/sms/BearerData$TimeStamp;
-Lcom/android/internal/telephony/cdma/sms/BearerData;->priority:I
-Lcom/android/internal/telephony/cdma/sms/BearerData;->priorityIndicatorSet:Z
-Lcom/android/internal/telephony/cdma/sms/BearerData;->userData:Lcom/android/internal/telephony/cdma/sms/UserData;
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;-><init>()V
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;->digitMode:I
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;->numberMode:I
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;->numberOfDigits:I
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;->numberPlan:I
-Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;->parse(Ljava/lang/String;)Lcom/android/internal/telephony/cdma/sms/CdmaSmsAddress;
-Lcom/android/internal/telephony/cdma/sms/SmsEnvelope;-><init>()V
-Lcom/android/internal/telephony/cdma/sms/SmsEnvelope;->bearerData:[B
-Lcom/android/internal/telephony/cdma/sms/SmsEnvelope;->serviceCategory:I
-Lcom/android/internal/telephony/cdma/sms/SmsEnvelope;->teleService:I
-Lcom/android/internal/telephony/cdma/sms/UserData;-><init>()V
-Lcom/android/internal/telephony/cdma/sms/UserData;->charToAscii:Landroid/util/SparseIntArray;
-Lcom/android/internal/telephony/cdma/sms/UserData;->msgEncoding:I
-Lcom/android/internal/telephony/cdma/sms/UserData;->msgEncodingSet:Z
-Lcom/android/internal/telephony/cdma/sms/UserData;->numFields:I
-Lcom/android/internal/telephony/cdma/sms/UserData;->payload:[B
-Lcom/android/internal/telephony/cdma/sms/UserData;->payloadStr:Ljava/lang/String;
-Lcom/android/internal/telephony/cdma/sms/UserData;->userDataHeader:Lcom/android/internal/telephony/SmsHeader;
-Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;-><init>()V
-Lcom/android/internal/telephony/cdma/SmsMessage;-><init>()V
-Lcom/android/internal/telephony/cdma/SmsMessage;->calculateLength(Ljava/lang/CharSequence;ZZ)Lcom/android/internal/telephony/GsmAlphabet$TextEncodingDetails;
-Lcom/android/internal/telephony/cdma/SmsMessage;->createFromEfRecord(I[B)Lcom/android/internal/telephony/cdma/SmsMessage;
-Lcom/android/internal/telephony/cdma/SmsMessage;->createFromPdu([B)Lcom/android/internal/telephony/cdma/SmsMessage;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getIncomingSmsFingerprint()[B
-Lcom/android/internal/telephony/cdma/SmsMessage;->getMessageType()I
-Lcom/android/internal/telephony/cdma/SmsMessage;->getNextMessageId()I
-Lcom/android/internal/telephony/cdma/SmsMessage;->getNumOfVoicemails()I
-Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Lcom/android/internal/telephony/cdma/sms/UserData;Z)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Lcom/android/internal/telephony/cdma/sms/UserData;ZI)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;I[BZ)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/android/internal/telephony/SmsHeader;)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLcom/android/internal/telephony/SmsHeader;I)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/cdma/SmsMessage;->getTeleService()I
-Lcom/android/internal/telephony/cdma/SmsMessage;->isStatusReportMessage()Z
-Lcom/android/internal/telephony/cdma/SmsMessage;->mBearerData:Lcom/android/internal/telephony/cdma/sms/BearerData;
-Lcom/android/internal/telephony/cdma/SmsMessage;->mEnvelope:Lcom/android/internal/telephony/cdma/sms/SmsEnvelope;
-Lcom/android/internal/telephony/cdma/SmsMessage;->parseSms()V
-Lcom/android/internal/telephony/cdma/SmsMessage;->privateGetSubmitPdu(Ljava/lang/String;ZLcom/android/internal/telephony/cdma/sms/UserData;)Lcom/android/internal/telephony/cdma/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/DctConstants$Activity;->DATAIN:Lcom/android/internal/telephony/DctConstants$Activity;
-Lcom/android/internal/telephony/DctConstants$Activity;->DATAINANDOUT:Lcom/android/internal/telephony/DctConstants$Activity;
-Lcom/android/internal/telephony/DctConstants$Activity;->DATAOUT:Lcom/android/internal/telephony/DctConstants$Activity;
-Lcom/android/internal/telephony/DctConstants$Activity;->DORMANT:Lcom/android/internal/telephony/DctConstants$Activity;
-Lcom/android/internal/telephony/DctConstants$Activity;->values()[Lcom/android/internal/telephony/DctConstants$Activity;
-Lcom/android/internal/telephony/DctConstants$State;->CONNECTED:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->CONNECTING:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->DISCONNECTING:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->FAILED:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->IDLE:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->RETRYING:Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DctConstants$State;->values()[Lcom/android/internal/telephony/DctConstants$State;
-Lcom/android/internal/telephony/DriverCall$State;->values()[Lcom/android/internal/telephony/DriverCall$State;
-Lcom/android/internal/telephony/gsm/GsmCellBroadcastHandler$SmsCbConcatInfo;-><init>(Lcom/android/internal/telephony/gsm/SmsCbHeader;Landroid/telephony/SmsCbLocation;)V
-Lcom/android/internal/telephony/gsm/GsmCellBroadcastHandler$SmsCbConcatInfo;->matchesLocation(Ljava/lang/String;II)Z
-Lcom/android/internal/telephony/gsm/GsmCellBroadcastHandler;->mSmsCbPageMap:Ljava/util/HashMap;
-Lcom/android/internal/telephony/gsm/GsmInboundSmsHandler;->acknowledgeLastIncomingSms(ZILandroid/os/Message;)V
-Lcom/android/internal/telephony/gsm/GsmMmiCode;-><init>(Lcom/android/internal/telephony/GsmCdmaPhone;Lcom/android/internal/telephony/uicc/UiccCardApplication;)V
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->getCLIRMode()I
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->getScString()Ljava/lang/CharSequence;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isActivate()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isDeactivate()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isErasure()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isInterrogate()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isRegister()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isServiceCodeCallBarring(Ljava/lang/String;)Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isServiceCodeCallForwarding(Ljava/lang/String;)Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->isTemporaryModeCLIR()Z
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->makeEmptyNull(Ljava/lang/String;)Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mContext:Landroid/content/Context;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mDialingNumber:Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mIccRecords:Lcom/android/internal/telephony/uicc/IccRecords;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mPhone:Lcom/android/internal/telephony/GsmCdmaPhone;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mSc:Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mSia:Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mSib:Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->mSic:Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->newFromDialString(Ljava/lang/String;Lcom/android/internal/telephony/GsmCdmaPhone;Lcom/android/internal/telephony/uicc/UiccCardApplication;)Lcom/android/internal/telephony/gsm/GsmMmiCode;
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->processCode()V
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->siToServiceClass(Ljava/lang/String;)I
-Lcom/android/internal/telephony/gsm/GsmMmiCode;->sPatternSuppService:Ljava/util/regex/Pattern;
-Lcom/android/internal/telephony/gsm/GsmSmsAddress;-><init>([BII)V
-Lcom/android/internal/telephony/gsm/GsmSmsAddress;->isCphsVoiceMessageClear()Z
-Lcom/android/internal/telephony/gsm/GsmSmsAddress;->isCphsVoiceMessageSet()Z
-Lcom/android/internal/telephony/gsm/GsmSMSDispatcher;->getFormat()Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/GsmSMSDispatcher;->mGsmInboundSmsHandler:Lcom/android/internal/telephony/gsm/GsmInboundSmsHandler;
-Lcom/android/internal/telephony/gsm/GsmSMSDispatcher;->sendSms(Lcom/android/internal/telephony/SMSDispatcher$SmsTracker;)V
-Lcom/android/internal/telephony/gsm/SimTlv;-><init>([BII)V
-Lcom/android/internal/telephony/gsm/SimTlv;->getData()[B
-Lcom/android/internal/telephony/gsm/SimTlv;->getTag()I
-Lcom/android/internal/telephony/gsm/SimTlv;->isValidObject()Z
-Lcom/android/internal/telephony/gsm/SimTlv;->mHasValidTlvObject:Z
-Lcom/android/internal/telephony/gsm/SimTlv;->nextObject()Z
-Lcom/android/internal/telephony/gsm/SmsCbHeader;-><init>([B)V
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->getGeographicalScope()I
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->getNumberOfPages()I
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->getPageIndex()I
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->getSerialNumber()I
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->getServiceCategory()I
-Lcom/android/internal/telephony/gsm/SmsCbHeader;->mMessageIdentifier:I
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;-><init>([B)V
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->getByte()I
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->getUserData()[B
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->getUserDataUCS2(I)Ljava/lang/String;
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->mCur:I
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->mPdu:[B
-Lcom/android/internal/telephony/gsm/SmsMessage$PduParser;->mUserDataSeptetPadding:I
-Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;-><init>()V
-Lcom/android/internal/telephony/gsm/SmsMessage;-><init>()V
-Lcom/android/internal/telephony/gsm/SmsMessage;->calculateLength(Ljava/lang/CharSequence;Z)Lcom/android/internal/telephony/GsmAlphabet$TextEncodingDetails;
-Lcom/android/internal/telephony/gsm/SmsMessage;->createFromEfRecord(I[B)Lcom/android/internal/telephony/gsm/SmsMessage;
-Lcom/android/internal/telephony/gsm/SmsMessage;->createFromPdu([B)Lcom/android/internal/telephony/gsm/SmsMessage;
-Lcom/android/internal/telephony/gsm/SmsMessage;->encodeUCS2(Ljava/lang/String;[B)[B
-Lcom/android/internal/telephony/gsm/SmsMessage;->getStatus()I
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z[B)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z[BIII)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPdu(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Z[BIIII)Lcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;
-Lcom/android/internal/telephony/gsm/SmsMessage;->getSubmitPduHead(Ljava/lang/String;Ljava/lang/String;BZLcom/android/internal/telephony/gsm/SmsMessage$SubmitPdu;)Ljava/io/ByteArrayOutputStream;
-Lcom/android/internal/telephony/gsm/SmsMessage;->isMWIClearMessage()Z
-Lcom/android/internal/telephony/gsm/SmsMessage;->isMwiDontStore()Z
-Lcom/android/internal/telephony/gsm/SmsMessage;->isMWISetMessage()Z
-Lcom/android/internal/telephony/gsm/SmsMessage;->isStatusReportMessage()Z
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->loadEfFilesFromUsim()Ljava/util/ArrayList;
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->log(Ljava/lang/String;)V
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->mFh:Lcom/android/internal/telephony/uicc/IccFileHandler;
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->mLock:Ljava/lang/Object;
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->mPhoneBookRecords:Ljava/util/ArrayList;
-Lcom/android/internal/telephony/gsm/UsimPhoneBookManager;->reset()V
-Lcom/android/internal/telephony/GsmAlphabet$TextEncodingDetails;-><init>()V
-Lcom/android/internal/telephony/GsmCdmaConnection$MyHandler;-><init>(Lcom/android/internal/telephony/GsmCdmaConnection;Landroid/os/Looper;)V
-Lcom/android/internal/telephony/IccCardConstants$State;->ABSENT:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->CARD_IO_ERROR:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->NETWORK_LOCKED:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->NOT_READY:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->PERM_DISABLED:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->PIN_REQUIRED:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->PUK_REQUIRED:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->READY:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->UNKNOWN:Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccCardConstants$State;->values()[Lcom/android/internal/telephony/IccCardConstants$State;
-Lcom/android/internal/telephony/IccProvider;-><init>()V
Lcom/android/internal/telephony/IIccPhoneBook$Stub$Proxy;->mRemote:Landroid/os/IBinder;
Lcom/android/internal/telephony/IIccPhoneBook$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IIccPhoneBook;
-Lcom/android/internal/telephony/IIccPhoneBook;->getAdnRecordsInEf(I)Ljava/util/List;
-Lcom/android/internal/telephony/IIccPhoneBook;->getAdnRecordsInEfForSubscriber(II)Ljava/util/List;
-Lcom/android/internal/telephony/IIccPhoneBook;->getAdnRecordsSize(I)[I
-Lcom/android/internal/telephony/IIccPhoneBook;->getAdnRecordsSizeForSubscriber(II)[I
-Lcom/android/internal/telephony/IIccPhoneBook;->updateAdnRecordsInEfBySearch(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z
Lcom/android/internal/telephony/IMms$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IMms;
-Lcom/android/internal/telephony/imsphone/ImsExternalCallTracker$ExternalCallStateListener;-><init>(Lcom/android/internal/telephony/imsphone/ImsExternalCallTracker;)V
-Lcom/android/internal/telephony/imsphone/ImsExternalCallTracker$ExternalConnectionListener;-><init>(Lcom/android/internal/telephony/imsphone/ImsExternalCallTracker;)V
-Lcom/android/internal/telephony/imsphone/ImsPhone;->notifyCallForwardingIndicator()V
-Lcom/android/internal/telephony/imsphone/ImsPhone;->notifyPreciseCallStateChanged()V
-Lcom/android/internal/telephony/imsphone/ImsPhoneCall;->getImsCall()Lcom/android/ims/ImsCall;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->findConnection(Lcom/android/ims/ImsCall;)Lcom/android/internal/telephony/imsphone/ImsPhoneConnection;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->getEcbmInterface()Lcom/android/ims/ImsEcbm;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->mCallExpectedToResume:Lcom/android/ims/ImsCall;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->mImsCallListener:Lcom/android/ims/ImsCall$Listener;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->mImsManager:Lcom/android/ims/ImsManager;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->mUssdSession:Lcom/android/ims/ImsCall;
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->processCallStateChange(Lcom/android/ims/ImsCall;Lcom/android/internal/telephony/Call$State;I)V
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->processCallStateChange(Lcom/android/ims/ImsCall;Lcom/android/internal/telephony/Call$State;IZ)V
-Lcom/android/internal/telephony/imsphone/ImsPhoneCallTracker;->setVideoCallProvider(Lcom/android/internal/telephony/imsphone/ImsPhoneConnection;Lcom/android/ims/ImsCall;)V
-Lcom/android/internal/telephony/imsphone/ImsPhoneConnection$MyHandler;-><init>(Lcom/android/internal/telephony/imsphone/ImsPhoneConnection;Landroid/os/Looper;)V
-Lcom/android/internal/telephony/imsphone/ImsPhoneConnection;->mImsCall:Lcom/android/ims/ImsCall;
-Lcom/android/internal/telephony/imsphone/ImsPhoneConnection;->update(Lcom/android/ims/ImsCall;Lcom/android/internal/telephony/Call$State;)Z
-Lcom/android/internal/telephony/InboundSmsHandler$SmsBroadcastReceiver;-><init>(Lcom/android/internal/telephony/InboundSmsHandler;Lcom/android/internal/telephony/InboundSmsTracker;)V
Lcom/android/internal/telephony/IPhoneStateListener$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IPhoneStateListener;
Lcom/android/internal/telephony/IPhoneSubInfo$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/telephony/IPhoneSubInfo$Stub$Proxy;->getDeviceId(Ljava/lang/String;)Ljava/lang/String;
@@ -1383,371 +1057,9 @@ Lcom/android/internal/telephony/ITelephony$Stub;->TRANSACTION_getDeviceId:I
Lcom/android/internal/telephony/ITelephonyRegistry$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/telephony/ITelephonyRegistry$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/ITelephonyRegistry;
Lcom/android/internal/telephony/IWapPushManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/telephony/IWapPushManager;
-Lcom/android/internal/telephony/PhoneConstants$DataState;->CONNECTED:Lcom/android/internal/telephony/PhoneConstants$DataState;
-Lcom/android/internal/telephony/PhoneConstants$DataState;->CONNECTING:Lcom/android/internal/telephony/PhoneConstants$DataState;
-Lcom/android/internal/telephony/PhoneConstants$DataState;->DISCONNECTED:Lcom/android/internal/telephony/PhoneConstants$DataState;
-Lcom/android/internal/telephony/PhoneConstants$DataState;->SUSPENDED:Lcom/android/internal/telephony/PhoneConstants$DataState;
-Lcom/android/internal/telephony/PhoneConstants$DataState;->values()[Lcom/android/internal/telephony/PhoneConstants$DataState;
-Lcom/android/internal/telephony/PhoneConstants$State;->IDLE:Lcom/android/internal/telephony/PhoneConstants$State;
-Lcom/android/internal/telephony/PhoneConstants$State;->OFFHOOK:Lcom/android/internal/telephony/PhoneConstants$State;
-Lcom/android/internal/telephony/PhoneConstants$State;->RINGING:Lcom/android/internal/telephony/PhoneConstants$State;
-Lcom/android/internal/telephony/PhoneConstants$State;->values()[Lcom/android/internal/telephony/PhoneConstants$State;
-Lcom/android/internal/telephony/PhoneConstants;->PRESENTATION_ALLOWED:I
-Lcom/android/internal/telephony/PhoneConstants;->PRESENTATION_PAYPHONE:I
-Lcom/android/internal/telephony/PhoneConstants;->PRESENTATION_RESTRICTED:I
-Lcom/android/internal/telephony/PhoneConstants;->PRESENTATION_UNKNOWN:I
-Lcom/android/internal/telephony/RILConstants;->PREFERRED_NETWORK_MODE:I
-Lcom/android/internal/telephony/sip/SipPhone$SipCall;->hold()V
-Lcom/android/internal/telephony/sip/SipPhone$SipCall;->switchWith(Lcom/android/internal/telephony/sip/SipPhone$SipCall;)V
-Lcom/android/internal/telephony/sip/SipPhone$SipCall;->unhold()V
-Lcom/android/internal/telephony/sip/SipPhone;->log(Ljava/lang/String;)V
-Lcom/android/internal/telephony/sip/SipPhone;->loge(Ljava/lang/String;)V
-Lcom/android/internal/telephony/sip/SipPhone;->mBackgroundCall:Lcom/android/internal/telephony/sip/SipPhone$SipCall;
-Lcom/android/internal/telephony/sip/SipPhone;->mForegroundCall:Lcom/android/internal/telephony/sip/SipPhone$SipCall;
-Lcom/android/internal/telephony/Sms7BitEncodingTranslator;->DBG:Z
-Lcom/android/internal/telephony/Sms7BitEncodingTranslator;->mTranslationTableCDMA:Landroid/util/SparseIntArray;
-Lcom/android/internal/telephony/Sms7BitEncodingTranslator;->mTranslationTableCommon:Landroid/util/SparseIntArray;
-Lcom/android/internal/telephony/Sms7BitEncodingTranslator;->mTranslationTableGSM:Landroid/util/SparseIntArray;
-Lcom/android/internal/telephony/SmsApplication$SmsApplicationData;->mApplicationName:Ljava/lang/String;
-Lcom/android/internal/telephony/SmsApplication;->configurePreferredActivity(Landroid/content/pm/PackageManager;Landroid/content/ComponentName;I)V
-Lcom/android/internal/telephony/SmsApplication;->getApplicationCollection(Landroid/content/Context;)Ljava/util/Collection;
-Lcom/android/internal/telephony/SmsApplication;->getDefaultMmsApplication(Landroid/content/Context;Z)Landroid/content/ComponentName;
-Lcom/android/internal/telephony/SmsApplication;->getDefaultRespondViaMessageApplication(Landroid/content/Context;Z)Landroid/content/ComponentName;
-Lcom/android/internal/telephony/SmsApplication;->getDefaultSmsApplication(Landroid/content/Context;Z)Landroid/content/ComponentName;
-Lcom/android/internal/telephony/SmsApplication;->getSmsApplicationData(Ljava/lang/String;Landroid/content/Context;)Lcom/android/internal/telephony/SmsApplication$SmsApplicationData;
-Lcom/android/internal/telephony/SmsApplication;->isDefaultSmsApplication(Landroid/content/Context;Ljava/lang/String;)Z
-Lcom/android/internal/telephony/SmsApplication;->setDefaultApplication(Ljava/lang/String;Landroid/content/Context;)V
-Lcom/android/internal/telephony/SmsApplication;->shouldWriteMessageForPackage(Ljava/lang/String;Landroid/content/Context;)Z
-Lcom/android/internal/telephony/SMSDispatcher$DataSmsSender;-><init>(Lcom/android/internal/telephony/SMSDispatcher;Lcom/android/internal/telephony/SMSDispatcher$SmsTracker;)V
-Lcom/android/internal/telephony/SMSDispatcher$MultipartSmsSender;-><init>(Lcom/android/internal/telephony/SMSDispatcher;Ljava/util/ArrayList;[Lcom/android/internal/telephony/SMSDispatcher$SmsTracker;)V
-Lcom/android/internal/telephony/SMSDispatcher$MultipartSmsSenderCallback;-><init>(Lcom/android/internal/telephony/SMSDispatcher;Lcom/android/internal/telephony/SMSDispatcher$MultipartSmsSender;)V
-Lcom/android/internal/telephony/SMSDispatcher$SmsSenderCallback;-><init>(Lcom/android/internal/telephony/SMSDispatcher;Lcom/android/internal/telephony/SMSDispatcher$SmsSender;)V
-Lcom/android/internal/telephony/SMSDispatcher$TextSmsSender;-><init>(Lcom/android/internal/telephony/SMSDispatcher;Lcom/android/internal/telephony/SMSDispatcher$SmsTracker;)V
-Lcom/android/internal/telephony/SmsHeader$ConcatRef;-><init>()V
-Lcom/android/internal/telephony/SmsHeader$PortAddrs;-><init>()V
-Lcom/android/internal/telephony/SmsMessageBase;-><init>()V
-Lcom/android/internal/telephony/TelephonyProperties;->PROPERTY_ICC_OPERATOR_NUMERIC:Ljava/lang/String;
-Lcom/android/internal/telephony/test/InterpreterEx;-><init>(Ljava/lang/String;)V
-Lcom/android/internal/telephony/test/SimulatedCommands;->acceptCall(Landroid/os/Message;)V
-Lcom/android/internal/telephony/test/SimulatedCommands;->mDcSuccess:Z
-Lcom/android/internal/telephony/test/SimulatedCommands;->resultFail(Landroid/os/Message;Ljava/lang/Object;Ljava/lang/Throwable;)V
-Lcom/android/internal/telephony/test/SimulatedCommands;->resultSuccess(Landroid/os/Message;Ljava/lang/Object;)V
-Lcom/android/internal/telephony/test/SimulatedCommands;->simulatedCallState:Lcom/android/internal/telephony/test/SimulatedGsmCallState;
-Lcom/android/internal/telephony/test/SimulatedCommands;->unimplemented(Landroid/os/Message;)V
-Lcom/android/internal/telephony/test/SimulatedCommandsVerifier;->getInstance()Lcom/android/internal/telephony/test/SimulatedCommandsVerifier;
-Lcom/android/internal/telephony/test/SimulatedCommandsVerifier;->setCallForward(IIILjava/lang/String;ILandroid/os/Message;)V
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->conference()Z
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->onChld(CC)Z
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->releaseActiveAcceptHeldOrWaiting()Z
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->releaseHeldOrUDUB()Z
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->separateCall(I)Z
-Lcom/android/internal/telephony/test/SimulatedGsmCallState;->switchActiveAndHeldOrWaiting()Z
-Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$AppState;->values()[Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$AppState;
-Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$AppType;->values()[Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$AppType;
-Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$PersoSubState;->values()[Lcom/android/internal/telephony/uicc/IccCardApplicationStatus$PersoSubState;
-Lcom/android/internal/telephony/uicc/IccCardApplicationStatus;-><init>()V
-Lcom/android/internal/telephony/uicc/IccRefreshResponse;-><init>()V
-Lcom/android/internal/telephony/uicc/IccUtils;->adnStringFieldToString([BII)Ljava/lang/String;
-Lcom/android/internal/telephony/uicc/IccUtils;->bcdToString([BII)Ljava/lang/String;
-Lcom/android/internal/telephony/uicc/IccUtils;->bytesToHexString([B)Ljava/lang/String;
-Lcom/android/internal/telephony/uicc/IccUtils;->cdmaBcdByteToInt(B)I
-Lcom/android/internal/telephony/uicc/IccUtils;->cdmaBcdToString([BII)Ljava/lang/String;
-Lcom/android/internal/telephony/uicc/IccUtils;->gsmBcdByteToInt(B)I
-Lcom/android/internal/telephony/uicc/IccUtils;->hexCharToInt(C)I
-Lcom/android/internal/telephony/uicc/IccUtils;->hexStringToBytes(Ljava/lang/String;)[B
-Lcom/android/internal/telephony/uicc/IccUtils;->networkNameToString([BII)Ljava/lang/String;
-Lcom/android/internal/telephony/uicc/IccUtils;->parseToBnW([BI)Landroid/graphics/Bitmap;
-Lcom/android/internal/telephony/uicc/IccUtils;->parseToRGB([BIZ)Landroid/graphics/Bitmap;
-Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;->values()[Lcom/android/internal/telephony/uicc/SIMRecords$GetSpnFsmState;
Lcom/android/internal/textservice/ITextServicesManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
-Lcom/android/internal/util/MemInfoReader;-><init>()V
Lcom/android/internal/view/IInputMethodManager$Stub$Proxy;-><init>(Landroid/os/IBinder;)V
Lcom/android/internal/view/IInputMethodManager$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/view/IInputMethodManager;
Lcom/android/internal/view/IInputMethodSession$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/view/IInputMethodSession;
Lcom/android/internal/widget/ILockSettings$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/ILockSettings;
Lcom/android/internal/widget/IRemoteViewsFactory$Stub;->asInterface(Landroid/os/IBinder;)Lcom/android/internal/widget/IRemoteViewsFactory;
-Lcom/android/internal/widget/PointerLocationView$PointerState;-><init>()V
-Lcom/android/server/net/BaseNetworkObserver;-><init>()V
-Lcom/android/server/ResettableTimeout$T;-><init>(Lcom/android/server/ResettableTimeout;)V
-Lcom/google/android/gles_jni/EGLImpl;-><init>()V
-Lcom/google/android/gles_jni/GLImpl;-><init>()V
-Lcom/google/android/mms/ContentType;->getAudioTypes()Ljava/util/ArrayList;
-Lcom/google/android/mms/ContentType;->getImageTypes()Ljava/util/ArrayList;
-Lcom/google/android/mms/ContentType;->getVideoTypes()Ljava/util/ArrayList;
-Lcom/google/android/mms/ContentType;->isAudioType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isDrmType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isImageType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isSupportedAudioType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isSupportedImageType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isSupportedType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isSupportedVideoType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isTextType(Ljava/lang/String;)Z
-Lcom/google/android/mms/ContentType;->isVideoType(Ljava/lang/String;)Z
-Lcom/google/android/mms/InvalidHeaderValueException;-><init>(Ljava/lang/String;)V
-Lcom/google/android/mms/MmsException;-><init>()V
-Lcom/google/android/mms/MmsException;-><init>(Ljava/lang/String;)V
-Lcom/google/android/mms/MmsException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
-Lcom/google/android/mms/MmsException;-><init>(Ljava/lang/Throwable;)V
-Lcom/google/android/mms/pdu/AcknowledgeInd;-><init>(I[B)V
-Lcom/google/android/mms/pdu/AcknowledgeInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/AcknowledgeInd;->setReportAllowed(I)V
-Lcom/google/android/mms/pdu/AcknowledgeInd;->setTransactionId([B)V
-Lcom/google/android/mms/pdu/Base64;->decodeBase64([B)[B
-Lcom/google/android/mms/pdu/CharacterSets;->getMibEnumValue(Ljava/lang/String;)I
-Lcom/google/android/mms/pdu/CharacterSets;->getMimeName(I)Ljava/lang/String;
-Lcom/google/android/mms/pdu/DeliveryInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/DeliveryInd;->getDate()J
-Lcom/google/android/mms/pdu/DeliveryInd;->getMessageId()[B
-Lcom/google/android/mms/pdu/DeliveryInd;->getStatus()I
-Lcom/google/android/mms/pdu/DeliveryInd;->getTo()[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/EncodedStringValue;-><init>(I[B)V
-Lcom/google/android/mms/pdu/EncodedStringValue;-><init>(Ljava/lang/String;)V
-Lcom/google/android/mms/pdu/EncodedStringValue;-><init>([B)V
-Lcom/google/android/mms/pdu/EncodedStringValue;->appendTextString([B)V
-Lcom/google/android/mms/pdu/EncodedStringValue;->concat([Lcom/google/android/mms/pdu/EncodedStringValue;)Ljava/lang/String;
-Lcom/google/android/mms/pdu/EncodedStringValue;->copy(Lcom/google/android/mms/pdu/EncodedStringValue;)Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/EncodedStringValue;->encodeStrings([Ljava/lang/String;)[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/EncodedStringValue;->extract(Ljava/lang/String;)[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/EncodedStringValue;->getCharacterSet()I
-Lcom/google/android/mms/pdu/EncodedStringValue;->getString()Ljava/lang/String;
-Lcom/google/android/mms/pdu/EncodedStringValue;->getTextString()[B
-Lcom/google/android/mms/pdu/EncodedStringValue;->setCharacterSet(I)V
-Lcom/google/android/mms/pdu/EncodedStringValue;->setTextString([B)V
-Lcom/google/android/mms/pdu/GenericPdu;-><init>()V
-Lcom/google/android/mms/pdu/GenericPdu;->getFrom()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/GenericPdu;->getMessageType()I
-Lcom/google/android/mms/pdu/GenericPdu;->getPduHeaders()Lcom/google/android/mms/pdu/PduHeaders;
-Lcom/google/android/mms/pdu/GenericPdu;->mPduHeaders:Lcom/google/android/mms/pdu/PduHeaders;
-Lcom/google/android/mms/pdu/GenericPdu;->setFrom(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/GenericPdu;->setMessageType(I)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;-><init>()V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;-><init>(Lcom/google/android/mms/pdu/PduHeaders;Lcom/google/android/mms/pdu/PduBody;)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->addTo(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->getBody()Lcom/google/android/mms/pdu/PduBody;
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->getDate()J
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->getPriority()I
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->getSubject()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->getTo()[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->setBody(Lcom/google/android/mms/pdu/PduBody;)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->setDate(J)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->setPriority(I)V
-Lcom/google/android/mms/pdu/MultimediaMessagePdu;->setSubject(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/NotificationInd;-><init>()V
-Lcom/google/android/mms/pdu/NotificationInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/NotificationInd;->getContentClass()I
-Lcom/google/android/mms/pdu/NotificationInd;->getContentLocation()[B
-Lcom/google/android/mms/pdu/NotificationInd;->getDeliveryReport()I
-Lcom/google/android/mms/pdu/NotificationInd;->getExpiry()J
-Lcom/google/android/mms/pdu/NotificationInd;->getFrom()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/NotificationInd;->getMessageClass()[B
-Lcom/google/android/mms/pdu/NotificationInd;->getMessageSize()J
-Lcom/google/android/mms/pdu/NotificationInd;->getSubject()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/NotificationInd;->getTransactionId()[B
-Lcom/google/android/mms/pdu/NotificationInd;->setContentClass(I)V
-Lcom/google/android/mms/pdu/NotificationInd;->setContentLocation([B)V
-Lcom/google/android/mms/pdu/NotificationInd;->setDeliveryReport(I)V
-Lcom/google/android/mms/pdu/NotificationInd;->setExpiry(J)V
-Lcom/google/android/mms/pdu/NotificationInd;->setFrom(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/NotificationInd;->setMessageClass([B)V
-Lcom/google/android/mms/pdu/NotificationInd;->setMessageSize(J)V
-Lcom/google/android/mms/pdu/NotificationInd;->setSubject(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/NotificationInd;->setTransactionId([B)V
-Lcom/google/android/mms/pdu/NotifyRespInd;-><init>(I[BI)V
-Lcom/google/android/mms/pdu/NotifyRespInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/NotifyRespInd;->setReportAllowed(I)V
-Lcom/google/android/mms/pdu/NotifyRespInd;->setStatus(I)V
-Lcom/google/android/mms/pdu/NotifyRespInd;->setTransactionId([B)V
-Lcom/google/android/mms/pdu/PduBody;-><init>()V
-Lcom/google/android/mms/pdu/PduBody;->addPart(ILcom/google/android/mms/pdu/PduPart;)V
-Lcom/google/android/mms/pdu/PduBody;->addPart(Lcom/google/android/mms/pdu/PduPart;)Z
-Lcom/google/android/mms/pdu/PduBody;->getPart(I)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduBody;->getPartByContentId(Ljava/lang/String;)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduBody;->getPartByContentLocation(Ljava/lang/String;)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduBody;->getPartByFileName(Ljava/lang/String;)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduBody;->getPartByName(Ljava/lang/String;)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduBody;->getPartIndex(Lcom/google/android/mms/pdu/PduPart;)I
-Lcom/google/android/mms/pdu/PduBody;->getPartsNum()I
-Lcom/google/android/mms/pdu/PduBody;->removePart(I)Lcom/google/android/mms/pdu/PduPart;
-Lcom/google/android/mms/pdu/PduComposer$BufferStack;->copy()V
-Lcom/google/android/mms/pdu/PduComposer$BufferStack;->mark()Lcom/google/android/mms/pdu/PduComposer$PositionMarker;
-Lcom/google/android/mms/pdu/PduComposer$BufferStack;->newbuf()V
-Lcom/google/android/mms/pdu/PduComposer$BufferStack;->pop()V
-Lcom/google/android/mms/pdu/PduComposer$PositionMarker;->getLength()I
-Lcom/google/android/mms/pdu/PduComposer;-><init>(Landroid/content/Context;Lcom/google/android/mms/pdu/GenericPdu;)V
-Lcom/google/android/mms/pdu/PduComposer;->appendEncodedString(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/PduComposer;->appendHeader(I)I
-Lcom/google/android/mms/pdu/PduComposer;->appendLongInteger(J)V
-Lcom/google/android/mms/pdu/PduComposer;->appendOctet(I)V
-Lcom/google/android/mms/pdu/PduComposer;->appendQuotedString(Ljava/lang/String;)V
-Lcom/google/android/mms/pdu/PduComposer;->appendQuotedString([B)V
-Lcom/google/android/mms/pdu/PduComposer;->appendShortInteger(I)V
-Lcom/google/android/mms/pdu/PduComposer;->appendTextString(Ljava/lang/String;)V
-Lcom/google/android/mms/pdu/PduComposer;->appendTextString([B)V
-Lcom/google/android/mms/pdu/PduComposer;->appendUintvarInteger(J)V
-Lcom/google/android/mms/pdu/PduComposer;->appendValueLength(J)V
-Lcom/google/android/mms/pdu/PduComposer;->arraycopy([BII)V
-Lcom/google/android/mms/pdu/PduComposer;->make()[B
-Lcom/google/android/mms/pdu/PduComposer;->mContentTypeMap:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduComposer;->mMessage:Ljava/io/ByteArrayOutputStream;
-Lcom/google/android/mms/pdu/PduComposer;->mPdu:Lcom/google/android/mms/pdu/GenericPdu;
-Lcom/google/android/mms/pdu/PduComposer;->mPduHeader:Lcom/google/android/mms/pdu/PduHeaders;
-Lcom/google/android/mms/pdu/PduComposer;->mPosition:I
-Lcom/google/android/mms/pdu/PduComposer;->mResolver:Landroid/content/ContentResolver;
-Lcom/google/android/mms/pdu/PduComposer;->mStack:Lcom/google/android/mms/pdu/PduComposer$BufferStack;
-Lcom/google/android/mms/pdu/PduContentTypes;->contentTypes:[Ljava/lang/String;
-Lcom/google/android/mms/pdu/PduHeaders;-><init>()V
-Lcom/google/android/mms/pdu/PduHeaders;->appendEncodedStringValue(Lcom/google/android/mms/pdu/EncodedStringValue;I)V
-Lcom/google/android/mms/pdu/PduHeaders;->getEncodedStringValue(I)Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/PduHeaders;->getEncodedStringValues(I)[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/PduHeaders;->getLongInteger(I)J
-Lcom/google/android/mms/pdu/PduHeaders;->getOctet(I)I
-Lcom/google/android/mms/pdu/PduHeaders;->getTextString(I)[B
-Lcom/google/android/mms/pdu/PduHeaders;->setEncodedStringValue(Lcom/google/android/mms/pdu/EncodedStringValue;I)V
-Lcom/google/android/mms/pdu/PduHeaders;->setLongInteger(JI)V
-Lcom/google/android/mms/pdu/PduHeaders;->setOctet(II)V
-Lcom/google/android/mms/pdu/PduParser;->$assertionsDisabled:Z
-Lcom/google/android/mms/pdu/PduParser;-><init>([BZ)V
-Lcom/google/android/mms/pdu/PduParser;->checkPartPosition(Lcom/google/android/mms/pdu/PduPart;)I
-Lcom/google/android/mms/pdu/PduParser;->log(Ljava/lang/String;)V
-Lcom/google/android/mms/pdu/PduParser;->parse()Lcom/google/android/mms/pdu/GenericPdu;
-Lcom/google/android/mms/pdu/PduParser;->parseContentType(Ljava/io/ByteArrayInputStream;Ljava/util/HashMap;)[B
-Lcom/google/android/mms/pdu/PduParser;->parsePartHeaders(Ljava/io/ByteArrayInputStream;Lcom/google/android/mms/pdu/PduPart;I)Z
-Lcom/google/android/mms/pdu/PduParser;->parseShortInteger(Ljava/io/ByteArrayInputStream;)I
-Lcom/google/android/mms/pdu/PduParser;->parseUnsignedInt(Ljava/io/ByteArrayInputStream;)I
-Lcom/google/android/mms/pdu/PduParser;->parseValueLength(Ljava/io/ByteArrayInputStream;)I
-Lcom/google/android/mms/pdu/PduParser;->parseWapString(Ljava/io/ByteArrayInputStream;I)[B
-Lcom/google/android/mms/pdu/PduPart;-><init>()V
-Lcom/google/android/mms/pdu/PduPart;->generateLocation()Ljava/lang/String;
-Lcom/google/android/mms/pdu/PduPart;->getCharset()I
-Lcom/google/android/mms/pdu/PduPart;->getContentDisposition()[B
-Lcom/google/android/mms/pdu/PduPart;->getContentId()[B
-Lcom/google/android/mms/pdu/PduPart;->getContentLocation()[B
-Lcom/google/android/mms/pdu/PduPart;->getContentTransferEncoding()[B
-Lcom/google/android/mms/pdu/PduPart;->getContentType()[B
-Lcom/google/android/mms/pdu/PduPart;->getData()[B
-Lcom/google/android/mms/pdu/PduPart;->getDataLength()I
-Lcom/google/android/mms/pdu/PduPart;->getDataUri()Landroid/net/Uri;
-Lcom/google/android/mms/pdu/PduPart;->getFilename()[B
-Lcom/google/android/mms/pdu/PduPart;->getName()[B
-Lcom/google/android/mms/pdu/PduPart;->setCharset(I)V
-Lcom/google/android/mms/pdu/PduPart;->setContentDisposition([B)V
-Lcom/google/android/mms/pdu/PduPart;->setContentId([B)V
-Lcom/google/android/mms/pdu/PduPart;->setContentLocation([B)V
-Lcom/google/android/mms/pdu/PduPart;->setContentTransferEncoding([B)V
-Lcom/google/android/mms/pdu/PduPart;->setContentType([B)V
-Lcom/google/android/mms/pdu/PduPart;->setData([B)V
-Lcom/google/android/mms/pdu/PduPart;->setDataUri(Landroid/net/Uri;)V
-Lcom/google/android/mms/pdu/PduPart;->setFilename([B)V
-Lcom/google/android/mms/pdu/PduPart;->setName([B)V
-Lcom/google/android/mms/pdu/PduPersister;->ADDRESS_FIELDS:[I
-Lcom/google/android/mms/pdu/PduPersister;->CHARSET_COLUMN_NAME_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->ENCODED_STRING_COLUMN_NAME_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->getByteArrayFromPartColumn(Landroid/database/Cursor;I)[B
-Lcom/google/android/mms/pdu/PduPersister;->getBytes(Ljava/lang/String;)[B
-Lcom/google/android/mms/pdu/PduPersister;->getIntegerFromPartColumn(Landroid/database/Cursor;I)Ljava/lang/Integer;
-Lcom/google/android/mms/pdu/PduPersister;->getPartContentType(Lcom/google/android/mms/pdu/PduPart;)Ljava/lang/String;
-Lcom/google/android/mms/pdu/PduPersister;->getPduPersister(Landroid/content/Context;)Lcom/google/android/mms/pdu/PduPersister;
-Lcom/google/android/mms/pdu/PduPersister;->getPendingMessages(J)Landroid/database/Cursor;
-Lcom/google/android/mms/pdu/PduPersister;->load(Landroid/net/Uri;)Lcom/google/android/mms/pdu/GenericPdu;
-Lcom/google/android/mms/pdu/PduPersister;->loadRecipients(ILjava/util/HashSet;Ljava/util/HashMap;Z)V
-Lcom/google/android/mms/pdu/PduPersister;->LONG_COLUMN_NAME_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->mContentResolver:Landroid/content/ContentResolver;
-Lcom/google/android/mms/pdu/PduPersister;->mContext:Landroid/content/Context;
-Lcom/google/android/mms/pdu/PduPersister;->MESSAGE_BOX_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->move(Landroid/net/Uri;Landroid/net/Uri;)Landroid/net/Uri;
-Lcom/google/android/mms/pdu/PduPersister;->mTelephonyManager:Landroid/telephony/TelephonyManager;
-Lcom/google/android/mms/pdu/PduPersister;->OCTET_COLUMN_NAME_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->PART_PROJECTION:[Ljava/lang/String;
-Lcom/google/android/mms/pdu/PduPersister;->PDU_CACHE_INSTANCE:Lcom/google/android/mms/util/PduCache;
-Lcom/google/android/mms/pdu/PduPersister;->persist(Lcom/google/android/mms/pdu/GenericPdu;Landroid/net/Uri;ZZLjava/util/HashMap;)Landroid/net/Uri;
-Lcom/google/android/mms/pdu/PduPersister;->persistAddress(JI[Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/PduPersister;->persistPart(Lcom/google/android/mms/pdu/PduPart;JLjava/util/HashMap;)Landroid/net/Uri;
-Lcom/google/android/mms/pdu/PduPersister;->TEXT_STRING_COLUMN_NAME_MAP:Ljava/util/HashMap;
-Lcom/google/android/mms/pdu/PduPersister;->toIsoString([B)Ljava/lang/String;
-Lcom/google/android/mms/pdu/PduPersister;->updateAddress(JI[Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/PduPersister;->updateHeaders(Landroid/net/Uri;Lcom/google/android/mms/pdu/SendReq;)V
-Lcom/google/android/mms/pdu/PduPersister;->updateParts(Landroid/net/Uri;Lcom/google/android/mms/pdu/PduBody;Ljava/util/HashMap;)V
-Lcom/google/android/mms/pdu/QuotedPrintable;->decodeQuotedPrintable([B)[B
-Lcom/google/android/mms/pdu/ReadOrigInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/ReadOrigInd;->getMessageId()[B
-Lcom/google/android/mms/pdu/ReadOrigInd;->getReadStatus()I
-Lcom/google/android/mms/pdu/ReadRecInd;-><init>(Lcom/google/android/mms/pdu/EncodedStringValue;[BII[Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/ReadRecInd;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/ReadRecInd;->getMessageId()[B
-Lcom/google/android/mms/pdu/ReadRecInd;->setDate(J)V
-Lcom/google/android/mms/pdu/RetrieveConf;-><init>()V
-Lcom/google/android/mms/pdu/RetrieveConf;-><init>(Lcom/google/android/mms/pdu/PduHeaders;Lcom/google/android/mms/pdu/PduBody;)V
-Lcom/google/android/mms/pdu/RetrieveConf;->addCc(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/RetrieveConf;->getCc()[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/RetrieveConf;->getContentType()[B
-Lcom/google/android/mms/pdu/RetrieveConf;->getDeliveryReport()I
-Lcom/google/android/mms/pdu/RetrieveConf;->getFrom()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/RetrieveConf;->getMessageClass()[B
-Lcom/google/android/mms/pdu/RetrieveConf;->getMessageId()[B
-Lcom/google/android/mms/pdu/RetrieveConf;->getReadReport()I
-Lcom/google/android/mms/pdu/RetrieveConf;->getRetrieveStatus()I
-Lcom/google/android/mms/pdu/RetrieveConf;->getRetrieveText()Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/RetrieveConf;->getTransactionId()[B
-Lcom/google/android/mms/pdu/RetrieveConf;->setContentType([B)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setDeliveryReport(I)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setFrom(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setMessageClass([B)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setMessageId([B)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setReadReport(I)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setRetrieveStatus(I)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setRetrieveText(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/RetrieveConf;->setTransactionId([B)V
-Lcom/google/android/mms/pdu/SendConf;-><init>()V
-Lcom/google/android/mms/pdu/SendConf;-><init>(Lcom/google/android/mms/pdu/PduHeaders;)V
-Lcom/google/android/mms/pdu/SendConf;->getMessageId()[B
-Lcom/google/android/mms/pdu/SendConf;->getResponseStatus()I
-Lcom/google/android/mms/pdu/SendConf;->getTransactionId()[B
-Lcom/google/android/mms/pdu/SendReq;-><init>()V
-Lcom/google/android/mms/pdu/SendReq;-><init>(Lcom/google/android/mms/pdu/PduHeaders;Lcom/google/android/mms/pdu/PduBody;)V
-Lcom/google/android/mms/pdu/SendReq;->addBcc(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/SendReq;->addCc(Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/SendReq;->getBcc()[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/SendReq;->getCc()[Lcom/google/android/mms/pdu/EncodedStringValue;
-Lcom/google/android/mms/pdu/SendReq;->getContentType()[B
-Lcom/google/android/mms/pdu/SendReq;->getDeliveryReport()I
-Lcom/google/android/mms/pdu/SendReq;->getExpiry()J
-Lcom/google/android/mms/pdu/SendReq;->getMessageClass()[B
-Lcom/google/android/mms/pdu/SendReq;->getMessageSize()J
-Lcom/google/android/mms/pdu/SendReq;->getReadReport()I
-Lcom/google/android/mms/pdu/SendReq;->getTransactionId()[B
-Lcom/google/android/mms/pdu/SendReq;->setBcc([Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/SendReq;->setCc([Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/SendReq;->setContentType([B)V
-Lcom/google/android/mms/pdu/SendReq;->setDeliveryReport(I)V
-Lcom/google/android/mms/pdu/SendReq;->setExpiry(J)V
-Lcom/google/android/mms/pdu/SendReq;->setMessageClass([B)V
-Lcom/google/android/mms/pdu/SendReq;->setMessageSize(J)V
-Lcom/google/android/mms/pdu/SendReq;->setReadReport(I)V
-Lcom/google/android/mms/pdu/SendReq;->setTo([Lcom/google/android/mms/pdu/EncodedStringValue;)V
-Lcom/google/android/mms/pdu/SendReq;->setTransactionId([B)V
-Lcom/google/android/mms/util/AbstractCache;-><init>()V
-Lcom/google/android/mms/util/AbstractCache;->get(Ljava/lang/Object;)Ljava/lang/Object;
-Lcom/google/android/mms/util/AbstractCache;->purge(Ljava/lang/Object;)Ljava/lang/Object;
-Lcom/google/android/mms/util/AbstractCache;->purgeAll()V
-Lcom/google/android/mms/util/AbstractCache;->put(Ljava/lang/Object;Ljava/lang/Object;)Z
-Lcom/google/android/mms/util/DownloadDrmHelper;->isDrmConvertNeeded(Ljava/lang/String;)Z
-Lcom/google/android/mms/util/DownloadDrmHelper;->modifyDrmFwLockFileExtension(Ljava/lang/String;)Ljava/lang/String;
-Lcom/google/android/mms/util/DrmConvertSession;->close(Ljava/lang/String;)I
-Lcom/google/android/mms/util/DrmConvertSession;->convert([BI)[B
-Lcom/google/android/mms/util/DrmConvertSession;->open(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/mms/util/DrmConvertSession;
-Lcom/google/android/mms/util/PduCache;-><init>()V
-Lcom/google/android/mms/util/PduCache;->getInstance()Lcom/google/android/mms/util/PduCache;
-Lcom/google/android/mms/util/PduCache;->isUpdating(Landroid/net/Uri;)Z
-Lcom/google/android/mms/util/PduCache;->purge(Landroid/net/Uri;)Lcom/google/android/mms/util/PduCacheEntry;
-Lcom/google/android/mms/util/PduCache;->purgeAll()V
-Lcom/google/android/mms/util/PduCacheEntry;-><init>(Lcom/google/android/mms/pdu/GenericPdu;IJ)V
-Lcom/google/android/mms/util/PduCacheEntry;->getMessageBox()I
-Lcom/google/android/mms/util/PduCacheEntry;->getPdu()Lcom/google/android/mms/pdu/GenericPdu;
-Lcom/google/android/mms/util/PduCacheEntry;->getThreadId()J
-Lcom/google/android/mms/util/SqliteWrapper;->checkSQLiteException(Landroid/content/Context;Landroid/database/sqlite/SQLiteException;)V
-Lcom/google/android/mms/util/SqliteWrapper;->delete(Landroid/content/Context;Landroid/content/ContentResolver;Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I
-Lcom/google/android/mms/util/SqliteWrapper;->insert(Landroid/content/Context;Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/content/ContentValues;)Landroid/net/Uri;
-Lcom/google/android/mms/util/SqliteWrapper;->query(Landroid/content/Context;Landroid/content/ContentResolver;Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
-Lcom/google/android/mms/util/SqliteWrapper;->requery(Landroid/content/Context;Landroid/database/Cursor;)Z
-Lcom/google/android/mms/util/SqliteWrapper;->update(Landroid/content/Context;Landroid/content/ContentResolver;Landroid/net/Uri;Landroid/content/ContentValues;Ljava/lang/String;[Ljava/lang/String;)I
-Lcom/google/android/util/AbstractMessageParser$Token$Type;->values()[Lcom/google/android/util/AbstractMessageParser$Token$Type;
diff --git a/config/preloaded-classes b/config/preloaded-classes
index b4fd031bf5a2..eb3879fdb50e 100644
--- a/config/preloaded-classes
+++ b/config/preloaded-classes
@@ -4695,7 +4695,7 @@ com.android.internal.telephony.CallManager$CallManagerHandler
com.android.internal.telephony.CallManager
com.android.internal.telephony.CallStateException
com.android.internal.telephony.CallTracker
-com.android.internal.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
+android.telephony.CallerInfoAsyncQuery$OnQueryCompleteListener
com.android.internal.telephony.CarrierActionAgent$1
com.android.internal.telephony.CarrierActionAgent
com.android.internal.telephony.CarrierAppUtils
@@ -4835,7 +4835,6 @@ com.android.internal.telephony.PhoneConstantConversions
com.android.internal.telephony.PhoneConstants$DataState
com.android.internal.telephony.PhoneConstants$State
com.android.internal.telephony.PhoneFactory
-com.android.internal.telephony.PhoneInternalInterface$DataActivityState
com.android.internal.telephony.PhoneInternalInterface
com.android.internal.telephony.PhoneNotifier
com.android.internal.telephony.PhoneStateIntentReceiver
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index f4e465ab3adb..2d7adf3cfef2 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -2257,6 +2257,8 @@ public class AccountManager {
}
private abstract class AmsTask extends FutureTask<Bundle> implements AccountManagerFuture<Bundle> {
+
+
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
final IAccountManagerResponse mResponse;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
diff --git a/core/java/android/animation/FloatEvaluator.java b/core/java/android/animation/FloatEvaluator.java
index 9463aa12d116..ae90e37d4c71 100644
--- a/core/java/android/animation/FloatEvaluator.java
+++ b/core/java/android/animation/FloatEvaluator.java
@@ -24,7 +24,7 @@ public class FloatEvaluator implements TypeEvaluator<Number> {
/**
* This function returns the result of linearly interpolating the start and end values, with
* <code>fraction</code> representing the proportion between the start and end values. The
- * calculation is a simple parametric calculation: <code>result = x0 + t * (v1 - v0)</code>,
+ * calculation is a simple parametric calculation: <code>result = x0 + t * (x1 - x0)</code>,
* where <code>x0</code> is <code>startValue</code>, <code>x1</code> is <code>endValue</code>,
* and <code>t</code> is <code>fraction</code>.
*
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index 37509e18ba6f..607ef185ae60 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -25,6 +25,11 @@ import android.os.IBinder;
*/
@Deprecated
public abstract class ActivityManagerNative {
+
+ @UnsupportedAppUsage
+ public ActivityManagerNative() {
+ }
+
/**
* Cast a Binder object into an activity manager interface, generating
* a proxy if needed.
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index f0dcc51c746a..4e8bee24052e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -714,6 +714,9 @@ public final class ActivityThread extends ClientTransactionHandler {
static final class CreateServiceData {
@UnsupportedAppUsage
+ CreateServiceData() {
+ }
+ @UnsupportedAppUsage
IBinder token;
@UnsupportedAppUsage
ServiceInfo info;
@@ -755,6 +758,9 @@ public final class ActivityThread extends ClientTransactionHandler {
static final class AppBindData {
@UnsupportedAppUsage
+ AppBindData() {
+ }
+ @UnsupportedAppUsage
LoadedApk info;
@UnsupportedAppUsage
String processName;
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index b915473cf34e..69be171ee46e 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -72,6 +72,7 @@ import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructStat;
+import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.Log;
@@ -1330,6 +1331,19 @@ class ContextImpl extends Context {
}
@Override
+ public void sendOrderedBroadcast(Intent intent, String receiverPermission,
+ String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler,
+ int initialCode, String initialData, @Nullable Bundle initialExtras) {
+ int intAppOp = AppOpsManager.OP_NONE;
+ if (!TextUtils.isEmpty(receiverAppOp)) {
+ intAppOp = AppOpsManager.strOpToOp(receiverAppOp);
+ }
+ sendOrderedBroadcastAsUser(intent, getUser(),
+ receiverPermission, intAppOp, resultReceiver, scheduler, initialCode, initialData,
+ initialExtras);
+ }
+
+ @Override
@Deprecated
public void sendStickyBroadcast(Intent intent) {
warnIfCallingFromSystemProcess();
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
index 48ca71690a1b..feaddda044c4 100644
--- a/core/java/android/app/IActivityManager.aidl
+++ b/core/java/android/app/IActivityManager.aidl
@@ -122,6 +122,7 @@ interface IActivityManager {
in String resultData, in Bundle map, in String[] requiredPermissions,
int appOp, in Bundle options, boolean serialized, boolean sticky, int userId);
void unbroadcastIntent(in IApplicationThread caller, in Intent intent, int userId);
+ @UnsupportedAppUsage
oneway void finishReceiver(in IBinder who, int resultCode, in String resultData, in Bundle map,
boolean abortBroadcast, int flags);
void attachApplication(in IApplicationThread app, long startSeq);
@@ -211,6 +212,7 @@ interface IActivityManager {
@UnsupportedAppUsage
ParceledListSlice getRecentTasks(int maxNum, int flags, int userId);
+ @UnsupportedAppUsage
oneway void serviceDoneExecuting(in IBinder token, int type, int startId, int res);
@UnsupportedAppUsage
IIntentSender getIntentSender(int type, in String packageName, in IBinder token,
diff --git a/core/java/android/app/IUiModeManager.aidl b/core/java/android/app/IUiModeManager.aidl
index cae54b6c0611..f2c9f615c03f 100644
--- a/core/java/android/app/IUiModeManager.aidl
+++ b/core/java/android/app/IUiModeManager.aidl
@@ -30,6 +30,7 @@ interface IUiModeManager {
/**
* Disables the car mode.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void disableCarMode(int flags);
/**
diff --git a/core/java/android/app/PackageDeleteObserver.java b/core/java/android/app/PackageDeleteObserver.java
index 20ae84ca8c39..b7b0b192e7ae 100644
--- a/core/java/android/app/PackageDeleteObserver.java
+++ b/core/java/android/app/PackageDeleteObserver.java
@@ -22,6 +22,11 @@ import android.content.pm.IPackageDeleteObserver2;
/** {@hide} */
public class PackageDeleteObserver {
+
+ @UnsupportedAppUsage
+ public PackageDeleteObserver() {
+ }
+
private final IPackageDeleteObserver2.Stub mBinder = new IPackageDeleteObserver2.Stub() {
@Override
public void onUserActionRequired(Intent intent) {
diff --git a/core/java/android/app/PackageInstallObserver.java b/core/java/android/app/PackageInstallObserver.java
index 507ebe566d46..50031e0e4d35 100644
--- a/core/java/android/app/PackageInstallObserver.java
+++ b/core/java/android/app/PackageInstallObserver.java
@@ -23,6 +23,11 @@ import android.os.Bundle;
/** {@hide} */
public class PackageInstallObserver {
+
+ @UnsupportedAppUsage
+ public PackageInstallObserver() {
+ }
+
private final IPackageInstallObserver2.Stub mBinder = new IPackageInstallObserver2.Stub() {
@Override
public void onUserActionRequired(Intent intent) {
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java
index 40cb29fc80ab..e9ae60f23cf2 100644
--- a/core/java/android/app/ResourcesManager.java
+++ b/core/java/android/app/ResourcesManager.java
@@ -145,6 +145,9 @@ public class ResourcesManager {
* Resources and base configuration override associated with an Activity.
*/
private static class ActivityResources {
+ @UnsupportedAppUsage
+ private ActivityResources() {
+ }
public final Configuration overrideConfig = new Configuration();
public final ArrayList<WeakReference<Resources>> activityResources = new ArrayList<>();
}
@@ -164,6 +167,10 @@ public class ResourcesManager {
mAdjustedDisplays = new ArrayMap<>();
@UnsupportedAppUsage
+ public ResourcesManager() {
+ }
+
+ @UnsupportedAppUsage
public static ResourcesManager getInstance() {
synchronized (ResourcesManager.class) {
if (sResourcesManager == null) {
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index d29cf80bd74e..2301b0e0b68f 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -157,6 +157,7 @@ import android.os.health.SystemHealthManager;
import android.os.image.DynamicSystemManager;
import android.os.image.IDynamicSystemService;
import android.os.storage.StorageManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.permission.PermissionControllerManager;
import android.permission.PermissionManager;
import android.print.IPrintManager;
@@ -172,6 +173,7 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccCardManager;
import android.telephony.euicc.EuiccManager;
+import android.telephony.ims.ImsManager;
import android.telephony.ims.RcsMessageManager;
import android.util.ArrayMap;
import android.util.Log;
@@ -607,6 +609,13 @@ final class SystemServiceRegistry {
return new TelephonyManager(ctx.getOuterContext());
}});
+ registerService(Context.TELEPHONY_REGISTRY_SERVICE, TelephonyRegistryManager.class,
+ new CachedServiceFetcher<TelephonyRegistryManager>() {
+ @Override
+ public TelephonyRegistryManager createService(ContextImpl ctx) {
+ return new TelephonyRegistryManager();
+ }});
+
registerService(Context.TELEPHONY_SUBSCRIPTION_SERVICE, SubscriptionManager.class,
new CachedServiceFetcher<SubscriptionManager>() {
@Override
@@ -622,6 +631,14 @@ final class SystemServiceRegistry {
}
});
+ registerService(Context.TELEPHONY_IMS_SERVICE, ImsManager.class,
+ new CachedServiceFetcher<ImsManager>() {
+ @Override
+ public ImsManager createService(ContextImpl ctx) {
+ return new ImsManager(ctx.getOuterContext());
+ }
+ });
+
registerService(Context.CARRIER_CONFIG_SERVICE, CarrierConfigManager.class,
new CachedServiceFetcher<CarrierConfigManager>() {
@Override
diff --git a/core/java/android/app/TaskStackListener.java b/core/java/android/app/TaskStackListener.java
index b4b7df970493..50130400deab 100644
--- a/core/java/android/app/TaskStackListener.java
+++ b/core/java/android/app/TaskStackListener.java
@@ -30,6 +30,11 @@ import android.os.RemoteException;
* @hide
*/
public abstract class TaskStackListener extends ITaskStackListener.Stub {
+
+ @UnsupportedAppUsage
+ public TaskStackListener() {
+ }
+
@Override
@UnsupportedAppUsage
public void onTaskStackChanged() throws RemoteException {
diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java
index dc07df8d7a87..f251b3eb4a15 100644
--- a/core/java/android/app/UiAutomationConnection.java
+++ b/core/java/android/app/UiAutomationConnection.java
@@ -40,6 +40,8 @@ import android.view.WindowContentFrameStats;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import libcore.io.IoUtils;
import java.io.FileInputStream;
@@ -87,6 +89,10 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
private int mOwningUid;
+ @UnsupportedAppUsage
+ public UiAutomationConnection() {
+ }
+
@Override
public void connect(IAccessibilityServiceClient client, int flags) {
if (client == null) {
diff --git a/core/java/android/app/UserSwitchObserver.java b/core/java/android/app/UserSwitchObserver.java
index 25b243d95fa1..2f8ee744bfd6 100644
--- a/core/java/android/app/UserSwitchObserver.java
+++ b/core/java/android/app/UserSwitchObserver.java
@@ -24,6 +24,11 @@ import android.os.RemoteException;
* @hide
*/
public class UserSwitchObserver extends IUserSwitchObserver.Stub {
+
+ @UnsupportedAppUsage
+ public UserSwitchObserver() {
+ }
+
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) throws RemoteException {
if (reply != null) {
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index e7ba85ad5d9e..566b38738dc1 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -1189,13 +1189,11 @@ public final class BluetoothAdapter {
/**
* Factory reset bluetooth settings.
*
- * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED}
- * permission
- *
* @return true to indicate that the config file was successfully cleared
* @hide
*/
- @UnsupportedAppUsage
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH_PRIVILEGED)
public boolean factoryReset() {
try {
mServiceLock.readLock().lock();
@@ -1214,13 +1212,12 @@ public final class BluetoothAdapter {
/**
* Get the UUIDs supported by the local Bluetooth adapter.
*
- * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
- *
* @return the UUIDs supported by the local Bluetooth Adapter.
* @hide
*/
@UnsupportedAppUsage
- public ParcelUuid[] getUuids() {
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
+ public @NonNull ParcelUuid[] getUuids() {
if (getState() != STATE_ON) {
return null;
}
@@ -1476,7 +1473,6 @@ public final class BluetoothAdapter {
* will return false. After turning on Bluetooth,
* wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON}
* to get the updated value.
- * <p>Requires {@link android.Manifest.permission#WRITE_SECURE_SETTINGS}
* <p>Applications cannot set the scan mode. They should use
* <code>startActivityForResult(
* BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE})
@@ -1488,8 +1484,8 @@ public final class BluetoothAdapter {
* @return true if the scan mode was set, false otherwise
* @hide
*/
- @UnsupportedAppUsage(publicAlternatives = "Use {@link #ACTION_REQUEST_DISCOVERABLE}, which "
- + "shows UI that confirms the user wants to go into discoverable mode.")
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public boolean setScanMode(@ScanMode int mode, int duration) {
if (getState() != STATE_ON) {
return false;
@@ -1507,9 +1503,34 @@ public final class BluetoothAdapter {
return false;
}
- /** @hide */
- @UnsupportedAppUsage
- public boolean setScanMode(int mode) {
+ /**
+ * Set the Bluetooth scan mode of the local Bluetooth adapter.
+ * <p>The Bluetooth scan mode determines if the local adapter is
+ * connectable and/or discoverable from remote Bluetooth devices.
+ * <p>For privacy reasons, discoverable mode is automatically turned off
+ * after <code>duration</code> seconds. For example, 120 seconds should be
+ * enough for a remote device to initiate and complete its discovery
+ * process.
+ * <p>Valid scan mode values are:
+ * {@link #SCAN_MODE_NONE},
+ * {@link #SCAN_MODE_CONNECTABLE},
+ * {@link #SCAN_MODE_CONNECTABLE_DISCOVERABLE}.
+ * <p>If Bluetooth state is not {@link #STATE_ON}, this API
+ * will return false. After turning on Bluetooth,
+ * wait for {@link #ACTION_STATE_CHANGED} with {@link #STATE_ON}
+ * to get the updated value.
+ * <p>Applications cannot set the scan mode. They should use
+ * <code>startActivityForResult(
+ * BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE})
+ * </code>instead.
+ *
+ * @param mode valid scan mode
+ * @return true if the scan mode was set, false otherwise
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
+ public boolean setScanMode(@ScanMode int mode) {
if (getState() != STATE_ON) {
return false;
}
@@ -1562,6 +1583,8 @@ public final class BluetoothAdapter {
* been called recently.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(Manifest.permission.BLUETOOTH)
public long getDiscoveryEndMillis() {
try {
mServiceLock.readLock().lock();
@@ -2060,7 +2083,7 @@ public final class BluetoothAdapter {
* BluetoothProfile}.
* @hide
*/
- public List<Integer> getSupportedProfiles() {
+ public @NonNull List<Integer> getSupportedProfiles() {
final ArrayList<Integer> supportedProfiles = new ArrayList<Integer>();
try {
diff --git a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
index 5f73e551d57c..c9dc019bd2f2 100644
--- a/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
+++ b/core/java/android/companion/ICompanionDeviceDiscoveryServiceCallback.aidl
@@ -18,6 +18,8 @@ package android.companion;
/** @hide */
interface ICompanionDeviceDiscoveryServiceCallback {
+ @UnsupportedAppUsage
oneway void onDeviceSelected(String packageName, int userId, String deviceAddress);
+ @UnsupportedAppUsage
oneway void onDeviceSelectionCancel();
}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 56d34e3d3ccf..d1cc0868b174 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2398,6 +2398,44 @@ public abstract class Context {
@Nullable String initialData, @Nullable Bundle initialExtras);
/**
+ * Version of
+ * {@link #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String,
+ * Bundle)} that allows you to specify the App Op to enforce restrictions on which receivers
+ * the broadcast will be sent to.
+ *
+ * <p>See {@link BroadcastReceiver} for more information on Intent broadcasts.
+ *
+ * @param intent The Intent to broadcast; all receivers matching this
+ * Intent will receive the broadcast.
+ * @param receiverPermission String naming a permissions that
+ * a receiver must hold in order to receive your broadcast.
+ * If null, no permission is required.
+ * @param receiverAppOp The app op associated with the broadcast. If null, no appOp is
+ * required. If both receiverAppOp and receiverPermission are non-null,
+ * a receiver must have both of them to
+ * receive the broadcast
+ * @param resultReceiver Your own BroadcastReceiver to treat as the final
+ * receiver of the broadcast.
+ * @param scheduler A custom Handler with which to schedule the
+ * resultReceiver callback; if null it will be
+ * scheduled in the Context's main thread.
+ * @param initialCode An initial value for the result code. Often
+ * Activity.RESULT_OK.
+ * @param initialData An initial value for the result data. Often
+ * null.
+ * @param initialExtras An initial value for the result extras. Often
+ * null.
+ *
+ * @see #sendOrderedBroadcast(Intent, String, BroadcastReceiver, Handler, int, String, Bundle)
+ */
+ public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent,
+ @Nullable String receiverPermission, @Nullable String receiverAppOp,
+ @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler,
+ int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) {
+ throw new RuntimeException("Not implemented. Must override in a subclass.");
+ }
+
+ /**
* <p>Perform a {@link #sendBroadcast(Intent)} that is "sticky," meaning the
* Intent you are sending stays around after the broadcast is complete,
* so that others can quickly retrieve that data through the return
@@ -4696,6 +4734,13 @@ public abstract class Context {
/**
* Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.telephony.ims.ImsManager}.
+ * @hide
+ */
+ public static final String TELEPHONY_IMS_SERVICE = "telephony_ims";
+
+ /**
+ * Use with {@link #getSystemService(String)} to retrieve an
* {@link android.telephony.ims.RcsMessageManager}.
* @hide
*/
@@ -4709,6 +4754,14 @@ public abstract class Context {
public static final String DYNAMIC_SYSTEM_SERVICE = "dynamic_system";
/**
+ * Use with {@link #getSystemService(String)} to retrieve an
+ * {@link android.os.telephony.TelephonyRegistryManager}.
+ * @hide
+ */
+ @SystemApi
+ public static final String TELEPHONY_REGISTRY_SERVICE = "telephony_registry";
+
+ /**
* Determine whether the given permission is allowed for a particular
* process and user ID running in the system.
*
diff --git a/core/java/android/content/ContextWrapper.java b/core/java/android/content/ContextWrapper.java
index 0859f97e81a1..6c33f6dfea98 100644
--- a/core/java/android/content/ContextWrapper.java
+++ b/core/java/android/content/ContextWrapper.java
@@ -16,6 +16,9 @@
package android.content;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
@@ -61,12 +64,12 @@ public class ContextWrapper extends Context {
public ContextWrapper(Context base) {
mBase = base;
}
-
+
/**
* Set the base context for this ContextWrapper. All calls will then be
* delegated to the base context. Throws
* IllegalStateException if a base context has already been set.
- *
+ *
* @param base The new base context for this wrapper.
*/
protected void attachBaseContext(Context base) {
@@ -117,7 +120,7 @@ public class ContextWrapper extends Context {
public Context getApplicationContext() {
return mBase.getApplicationContext();
}
-
+
@Override
public void setTheme(int resid) {
mBase.setTheme(resid);
@@ -162,7 +165,7 @@ public class ContextWrapper extends Context {
public ApplicationInfo getApplicationInfo() {
return mBase.getApplicationInfo();
}
-
+
@Override
public String getPackageResourcePath() {
return mBase.getPackageResourcePath();
@@ -202,13 +205,13 @@ public class ContextWrapper extends Context {
@Override
public FileInputStream openFileInput(String name)
- throws FileNotFoundException {
+ throws FileNotFoundException {
return mBase.openFileInput(name);
}
@Override
public FileOutputStream openFileOutput(String name, int mode)
- throws FileNotFoundException {
+ throws FileNotFoundException {
return mBase.openFileOutput(name, mode);
}
@@ -442,7 +445,7 @@ public class ContextWrapper extends Context {
mBase.startIntentSender(intent, fillInIntent, flagsMask,
flagsValues, extraFlags, options);
}
-
+
@Override
public void sendBroadcast(Intent intent) {
mBase.sendBroadcast(intent);
@@ -487,9 +490,9 @@ public class ContextWrapper extends Context {
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, BroadcastReceiver resultReceiver,
- Handler scheduler, int initialCode, String initialData,
- Bundle initialExtras) {
+ Intent intent, String receiverPermission, BroadcastReceiver resultReceiver,
+ Handler scheduler, int initialCode, String initialData,
+ Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission,
resultReceiver, scheduler, initialCode,
initialData, initialExtras);
@@ -499,7 +502,8 @@ public class ContextWrapper extends Context {
@SystemApi
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, Bundle options, BroadcastReceiver resultReceiver,
+ Intent intent, String receiverPermission, Bundle options,
+ BroadcastReceiver resultReceiver,
Handler scheduler, int initialCode, String initialData,
Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission,
@@ -510,9 +514,9 @@ public class ContextWrapper extends Context {
/** @hide */
@Override
public void sendOrderedBroadcast(
- Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver,
- Handler scheduler, int initialCode, String initialData,
- Bundle initialExtras) {
+ Intent intent, String receiverPermission, int appOp, BroadcastReceiver resultReceiver,
+ Handler scheduler, int initialCode, String initialData,
+ Bundle initialExtras) {
mBase.sendOrderedBroadcast(intent, receiverPermission, appOp,
resultReceiver, scheduler, initialCode,
initialData, initialExtras);
@@ -570,6 +574,15 @@ public class ContextWrapper extends Context {
}
@Override
+ public void sendOrderedBroadcast(@RequiresPermission @NonNull Intent intent,
+ @Nullable String receiverPermission, @Nullable String receiverAppOp,
+ @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler,
+ int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) {
+ mBase.sendOrderedBroadcast(intent, receiverPermission, receiverAppOp, resultReceiver,
+ scheduler, initialCode, initialData, initialExtras);
+ }
+
+ @Override
@Deprecated
public void sendStickyBroadcast(Intent intent) {
mBase.sendStickyBroadcast(intent);
diff --git a/core/java/android/content/SyncStats.java b/core/java/android/content/SyncStats.java
index 03b2250edee1..9596a6016c44 100644
--- a/core/java/android/content/SyncStats.java
+++ b/core/java/android/content/SyncStats.java
@@ -58,7 +58,7 @@ public class SyncStats implements Parcelable {
* attempted to update or delete a version of a resource on the server. This is expected
* to clear itself automatically once the new state is retrieved from the server,
* though it may remain until the user intervenes manually, perhaps by clearing the
- * local storage and starting over frmo scratch. This is considered a hard error.
+ * local storage and starting over from scratch. This is considered a hard error.
*/
public long numConflictDetectedExceptions;
diff --git a/core/java/android/content/UndoManager.java b/core/java/android/content/UndoManager.java
index f6a0d771bf4c..f9c58d624a2f 100644
--- a/core/java/android/content/UndoManager.java
+++ b/core/java/android/content/UndoManager.java
@@ -18,8 +18,6 @@ package android.content;
import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
-import android.os.Parcelable;
-import android.os.ParcelableParcel;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -88,6 +86,10 @@ public class UndoManager {
public static final int MERGE_MODE_ANY = 2;
@UnsupportedAppUsage
+ public UndoManager() {
+ }
+
+ @UnsupportedAppUsage
public UndoOwner getOwner(String tag, Object data) {
if (tag == null) {
throw new NullPointerException("tag can't be null");
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 0aff881ad6db..a81d7ec915d4 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -620,21 +620,6 @@ public class PackageParser {
}
/**
- * Generate and return the {@link PackageInfo} for a parsed package.
- *
- * @param p the parsed package.
- * @param flags indicating which optional information is included.
- */
- @UnsupportedAppUsage
- public static PackageInfo generatePackageInfo(PackageParser.Package p,
- int gids[], int flags, long firstInstallTime, long lastUpdateTime,
- Set<String> grantedPermissions, PackageUserState state) {
-
- return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
- grantedPermissions, state, UserHandle.getCallingUserId());
- }
-
- /**
* Returns true if the package is installed and not hidden, or if the caller
* explicitly wanted all uninstalled and hidden packages as well.
* @param appInfo The applicationInfo of the app being checked.
@@ -660,8 +645,45 @@ public class PackageParser {
return checkUseInstalledOrHidden(0, state, null);
}
+ /**
+ * Generate and return the {@link PackageInfo} for a parsed package.
+ *
+ * @param p the parsed package.
+ * @param flags indicating which optional information is included.
+ */
+ @UnsupportedAppUsage
+ public static PackageInfo generatePackageInfo(PackageParser.Package p,
+ int[] gids, int flags, long firstInstallTime, long lastUpdateTime,
+ Set<String> grantedPermissions, PackageUserState state) {
+
+ return generatePackageInfo(p, gids, flags, firstInstallTime, lastUpdateTime,
+ grantedPermissions, state, UserHandle.getCallingUserId());
+ }
+
@UnsupportedAppUsage
public static PackageInfo generatePackageInfo(PackageParser.Package p,
+ int[] gids, int flags, long firstInstallTime, long lastUpdateTime,
+ Set<String> grantedPermissions, PackageUserState state, int userId) {
+
+ return generatePackageInfo(p, null, gids, flags, firstInstallTime, lastUpdateTime,
+ grantedPermissions, state, userId);
+ }
+
+ /**
+ * PackageInfo generator specifically for apex files.
+ *
+ * @param pkg Package to generate info from. Should be derived from an apex.
+ * @param apexInfo Apex info relating to the package.
+ * @return PackageInfo
+ * @throws PackageParserException
+ */
+ public static PackageInfo generatePackageInfo(
+ PackageParser.Package pkg, ApexInfo apexInfo, int flags) {
+ return generatePackageInfo(pkg, apexInfo, EmptyArray.INT, flags, 0, 0,
+ Collections.emptySet(), new PackageUserState(), UserHandle.getCallingUserId());
+ }
+
+ private static PackageInfo generatePackageInfo(PackageParser.Package p, ApexInfo apexInfo,
int gids[], int flags, long firstInstallTime, long lastUpdateTime,
Set<String> grantedPermissions, PackageUserState state, int userId) {
if (!checkUseInstalledOrHidden(flags, state, p.applicationInfo) || !p.isMatch(flags)) {
@@ -808,8 +830,27 @@ public class PackageParser {
}
}
}
+
+ if (apexInfo != null) {
+ File apexFile = new File(apexInfo.modulePath);
+
+ pi.applicationInfo.sourceDir = apexFile.getPath();
+ pi.applicationInfo.publicSourceDir = apexFile.getPath();
+ if (apexInfo.isFactory) {
+ pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
+ } else {
+ pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM;
+ }
+ if (apexInfo.isActive) {
+ pi.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED;
+ } else {
+ pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_INSTALLED;
+ }
+ pi.isApex = true;
+ }
+
// deprecated method of getting signing certificates
- if ((flags&PackageManager.GET_SIGNATURES) != 0) {
+ if ((flags & PackageManager.GET_SIGNATURES) != 0) {
if (p.mSigningDetails.hasPastSigningCertificates()) {
// Package has included signing certificate rotation information. Return the oldest
// cert so that programmatic checks keep working even if unaware of key rotation.
@@ -8397,61 +8438,4 @@ public class PackageParser {
}
}
- // TODO(b/129261524): Clean up API
- /**
- * PackageInfo parser specifically for apex files.
- * NOTE: It will collect certificates
- *
- * @param apexInfo
- * @return PackageInfo
- * @throws PackageParserException
- */
- public static PackageInfo generatePackageInfoFromApex(ApexInfo apexInfo, int flags)
- throws PackageParserException {
- PackageParser pp = new PackageParser();
- File apexFile = new File(apexInfo.modulePath);
- final Package p = pp.parsePackage(apexFile, flags, false);
- PackageUserState state = new PackageUserState();
- PackageInfo pi = generatePackageInfo(p, EmptyArray.INT, flags, 0, 0,
- Collections.emptySet(), state);
- pi.applicationInfo.sourceDir = apexFile.getPath();
- pi.applicationInfo.publicSourceDir = apexFile.getPath();
- if (apexInfo.isFactory) {
- pi.applicationInfo.flags |= ApplicationInfo.FLAG_SYSTEM;
- } else {
- pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_SYSTEM;
- }
- if (apexInfo.isActive) {
- pi.applicationInfo.flags |= ApplicationInfo.FLAG_INSTALLED;
- } else {
- pi.applicationInfo.flags &= ~ApplicationInfo.FLAG_INSTALLED;
- }
- pi.isApex = true;
-
- // Collect certificates
- if ((flags & PackageManager.GET_SIGNING_CERTIFICATES) != 0) {
- collectCertificates(p, apexFile, false);
- // Keep legacy mechanism for handling signatures. While this is deprecated, it's
- // still part of the public API and needs to be maintained
- if (p.mSigningDetails.hasPastSigningCertificates()) {
- // Package has included signing certificate rotation information. Return
- // the oldest cert so that programmatic checks keep working even if unaware
- // of key rotation.
- pi.signatures = new Signature[1];
- pi.signatures[0] = p.mSigningDetails.pastSigningCertificates[0];
- } else if (p.mSigningDetails.hasSignatures()) {
- // otherwise keep old behavior
- int numberOfSigs = p.mSigningDetails.signatures.length;
- pi.signatures = new Signature[numberOfSigs];
- System.arraycopy(p.mSigningDetails.signatures, 0, pi.signatures, 0, numberOfSigs);
- }
- if (p.mSigningDetails != SigningDetails.UNKNOWN) {
- // only return a valid SigningInfo if there is signing information to report
- pi.signingInfo = new SigningInfo(p.mSigningDetails);
- } else {
- pi.signingInfo = null;
- }
- }
- return pi;
- }
}
diff --git a/core/java/android/content/res/ConfigurationBoundResourceCache.java b/core/java/android/content/res/ConfigurationBoundResourceCache.java
index 3af395a4fc19..848790f46734 100644
--- a/core/java/android/content/res/ConfigurationBoundResourceCache.java
+++ b/core/java/android/content/res/ConfigurationBoundResourceCache.java
@@ -26,6 +26,11 @@ import android.content.pm.ActivityInfo.Config;
* @hide For internal use only.
*/
public class ConfigurationBoundResourceCache<T> extends ThemedResourceCache<ConstantState<T>> {
+
+ @UnsupportedAppUsage
+ public ConfigurationBoundResourceCache() {
+ }
+
/**
* If the resource is cached, creates and returns a new instance of it.
*
diff --git a/core/java/android/content/res/DrawableCache.java b/core/java/android/content/res/DrawableCache.java
index d4f0ca5f8ebf..90604b8d536a 100644
--- a/core/java/android/content/res/DrawableCache.java
+++ b/core/java/android/content/res/DrawableCache.java
@@ -23,6 +23,11 @@ import android.graphics.drawable.Drawable;
* Class which can be used to cache Drawable resources against a theme.
*/
class DrawableCache extends ThemedResourceCache<Drawable.ConstantState> {
+
+ @UnsupportedAppUsage
+ DrawableCache() {
+ }
+
/**
* If the resource is cached, creates and returns a new instance of it.
*
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index b79cf6566987..38df317575d7 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -360,8 +360,9 @@ public class TypedArray {
/**
* Retrieve the boolean value for the attribute at <var>index</var>.
* <p>
- * If the attribute is an integer value, this method will return whether
- * it is equal to zero. If the attribute is not a boolean or integer value,
+ * If the attribute is an integer value, this method returns false if the
+ * attribute is equal to zero, and true otherwise.
+ * If the attribute is not a boolean or integer value,
* this method will attempt to coerce it to an integer using
* {@link Integer#decode(String)} and return whether it is equal to zero.
*
diff --git a/core/java/android/database/IContentObserver.aidl b/core/java/android/database/IContentObserver.aidl
index 22dc9fed59c4..623556695341 100644
--- a/core/java/android/database/IContentObserver.aidl
+++ b/core/java/android/database/IContentObserver.aidl
@@ -29,5 +29,6 @@ interface IContentObserver
* observed. selfUpdate is true if the update was caused by a call to
* commit on the cursor that is being observed.
*/
+ @UnsupportedAppUsage
oneway void onChange(boolean selfUpdate, in Uri uri, int userId);
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index cfa3934b0cae..75af41cb2b54 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -1763,6 +1763,10 @@ public class ConnectivityManager {
/** @hide */
public static class PacketKeepaliveCallback {
+ @UnsupportedAppUsage
+ public PacketKeepaliveCallback() {
+ }
+
/** The requested keepalive was successfully started. */
@UnsupportedAppUsage
public void onStarted() {}
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index 61648dc7f1d8..5f662f914919 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -52,6 +52,7 @@ interface IConnectivityManager
@UnsupportedAppUsage
NetworkInfo getActiveNetworkInfo();
NetworkInfo getActiveNetworkInfoForUid(int uid, boolean ignoreBlocked);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
NetworkInfo getNetworkInfo(int networkType);
NetworkInfo getNetworkInfoForUid(in Network network, int uid, boolean ignoreBlocked);
@UnsupportedAppUsage
@@ -112,6 +113,7 @@ interface IConnectivityManager
int setUsbTethering(boolean enable, String callerPkg);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void reportInetCondition(int networkType, int percentage);
void reportNetworkConnectivity(in Network network, boolean hasConnectivity);
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index c97b37b55c78..c9a999cfdf17 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -40,6 +40,10 @@ public class InterfaceConfiguration implements Parcelable {
private static final String[] EMPTY_STRING_ARRAY = new String[0];
+ @UnsupportedAppUsage
+ public InterfaceConfiguration() {
+ }
+
@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index 3ec0aeac472b..0706e755d133 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -111,6 +111,8 @@ public final class LinkProperties implements Parcelable {
/**
* @hide
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Landroid/net/LinkProperties$ProvisioningChange;")
public enum ProvisioningChange {
@UnsupportedAppUsage
STILL_NOT_PROVISIONED,
diff --git a/core/java/android/net/MobileLinkQualityInfo.java b/core/java/android/net/MobileLinkQualityInfo.java
index 06c739d6cf95..a10a14d750d8 100644
--- a/core/java/android/net/MobileLinkQualityInfo.java
+++ b/core/java/android/net/MobileLinkQualityInfo.java
@@ -40,6 +40,10 @@ public class MobileLinkQualityInfo extends LinkQualityInfo {
private int mLteRssnr = UNKNOWN_INT;
private int mLteCqi = UNKNOWN_INT;
+ @UnsupportedAppUsage
+ public MobileLinkQualityInfo() {
+ }
+
/**
* Implement the Parcelable interface.
* @hide
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index 43ea5891d7f7..ff4bf2d3474c 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.NonNull;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Build;
@@ -418,7 +419,16 @@ public abstract class NetworkAgent extends Handler {
if (score < 0) {
throw new IllegalArgumentException("Score must be >= 0");
}
- queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, score, 0);
+ final NetworkScore ns = new NetworkScore();
+ ns.putIntExtension(NetworkScore.LEGACY_SCORE, score);
+ updateScore(ns);
+ }
+
+ /**
+ * Called by the bearer code when it has a new NetworkScore for this network.
+ */
+ public void updateScore(@NonNull NetworkScore ns) {
+ queueOrSendMessage(EVENT_NETWORK_SCORE_CHANGED, new NetworkScore(ns));
}
/**
diff --git a/core/java/android/net/NetworkScore.java b/core/java/android/net/NetworkScore.java
new file mode 100644
index 000000000000..1ab63352401c
--- /dev/null
+++ b/core/java/android/net/NetworkScore.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.net;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.os.Bundle;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import java.util.Objects;
+
+/**
+ * Object representing the quality of a network as perceived by the user.
+ *
+ * A NetworkScore object represents the characteristics of a network that affects how good the
+ * network is considered for a particular use.
+ * @hide
+ */
+public final class NetworkScore implements Parcelable {
+
+ // The key of bundle which is used to get the legacy network score of NetworkAgentInfo.
+ // TODO: Remove this when the transition to NetworkScore is over.
+ public static final String LEGACY_SCORE = "LEGACY_SCORE";
+ @NonNull
+ private final Bundle mExtensions;
+
+ public NetworkScore() {
+ mExtensions = new Bundle();
+ }
+
+ public NetworkScore(@NonNull NetworkScore source) {
+ mExtensions = new Bundle(source.mExtensions);
+ }
+
+ /**
+ * Put the value of parcelable inside the bundle by key.
+ */
+ public void putExtension(@Nullable String key, @Nullable Parcelable value) {
+ mExtensions.putParcelable(key, value);
+ }
+
+ /**
+ * Put the value of int inside the bundle by key.
+ */
+ public void putIntExtension(@Nullable String key, int value) {
+ mExtensions.putInt(key, value);
+ }
+
+ /**
+ * Get the value of non primitive type by key.
+ */
+ public <T extends Parcelable> T getExtension(@Nullable String key) {
+ return mExtensions.getParcelable(key);
+ }
+
+ /**
+ * Get the value of int by key.
+ */
+ public int getIntExtension(@Nullable String key) {
+ return mExtensions.getInt(key);
+ }
+
+ /**
+ * Remove the entry by given key.
+ */
+ public void removeExtension(@Nullable String key) {
+ mExtensions.remove(key);
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
+ synchronized (this) {
+ dest.writeBundle(mExtensions);
+ }
+ }
+
+ public static final @NonNull Creator<NetworkScore> CREATOR = new Creator<NetworkScore>() {
+ @Override
+ public NetworkScore createFromParcel(@NonNull Parcel in) {
+ return new NetworkScore(in);
+ }
+
+ @Override
+ public NetworkScore[] newArray(int size) {
+ return new NetworkScore[size];
+ }
+ };
+
+ private NetworkScore(@NonNull Parcel in) {
+ mExtensions = in.readBundle();
+ }
+
+ // TODO: Modify this method once new fields are added into this class.
+ @Override
+ public boolean equals(@Nullable Object obj) {
+ if (!(obj instanceof NetworkScore)) {
+ return false;
+ }
+ final NetworkScore other = (NetworkScore) obj;
+ return bundlesEqual(mExtensions, other.mExtensions);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 29;
+ for (String key : mExtensions.keySet()) {
+ final Object value = mExtensions.get(key);
+ // The key may be null, so call Objects.hash() is safer.
+ result += 31 * value.hashCode() + 37 * Objects.hash(key);
+ }
+ return result;
+ }
+
+ // mExtensions won't be null since the constructor will create it.
+ private boolean bundlesEqual(@NonNull Bundle bundle1, @NonNull Bundle bundle2) {
+ if (bundle1 == bundle2) {
+ return true;
+ }
+
+ // This is unlikely but it's fine to add this clause here.
+ if (null == bundle1 || null == bundle2) {
+ return false;
+ }
+
+ if (bundle1.size() != bundle2.size()) {
+ return false;
+ }
+
+ for (String key : bundle1.keySet()) {
+ final Object value1 = bundle1.get(key);
+ final Object value2 = bundle2.get(key);
+ if (!Objects.equals(value1, value2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/core/java/android/net/SntpClient.java b/core/java/android/net/SntpClient.java
index a55d9d00414f..f9c2defc0377 100644
--- a/core/java/android/net/SntpClient.java
+++ b/core/java/android/net/SntpClient.java
@@ -78,6 +78,10 @@ public class SntpClient {
}
}
+ @UnsupportedAppUsage
+ public SntpClient() {
+ }
+
/**
* Sends an SNTP request to the given host and processes the response.
*
diff --git a/core/java/android/net/nsd/NsdManager.java b/core/java/android/net/nsd/NsdManager.java
index 535bf675cd0e..64f20b839a63 100644
--- a/core/java/android/net/nsd/NsdManager.java
+++ b/core/java/android/net/nsd/NsdManager.java
@@ -49,8 +49,8 @@ import java.util.concurrent.CountDownLatch;
* limited to a local network over Multicast DNS. DNS service discovery is described at
* http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt
*
- * <p> The API is asynchronous and responses to requests from an application are on listener
- * callbacks on a seperate internal thread.
+ * <p> The API is asynchronous, and responses to requests from an application are on listener
+ * callbacks on a separate internal thread.
*
* <p> There are three main operations the API supports - registration, discovery and resolution.
* <pre>
diff --git a/core/java/android/net/util/SocketUtils.java b/core/java/android/net/util/SocketUtils.java
index 489a2922f70e..e9ea99f84f90 100644
--- a/core/java/android/net/util/SocketUtils.java
+++ b/core/java/android/net/util/SocketUtils.java
@@ -77,7 +77,9 @@ public final class SocketUtils {
/**
* Make a socket address that packet socket can send packets to.
+ * @deprecated Use {@link #makePacketSocketAddress(int, int, byte[])} instead.
*/
+ @Deprecated
@NonNull
public static SocketAddress makePacketSocketAddress(int ifIndex, @NonNull byte[] hwAddr) {
return new PacketSocketAddress(
@@ -87,6 +89,18 @@ public final class SocketUtils {
}
/**
+ * Make a socket address that packet socket can send packets to.
+ */
+ @NonNull
+ public static SocketAddress makePacketSocketAddress(int protocol, int ifIndex,
+ @NonNull byte[] hwAddr) {
+ return new PacketSocketAddress(
+ protocol /* sll_protocol */,
+ ifIndex /* sll_ifindex */,
+ hwAddr /* sll_addr */);
+ }
+
+ /**
* @see IoBridge#closeAndSignalBlockedThreads(FileDescriptor)
*/
public static void closeSocket(@Nullable FileDescriptor fd) throws IOException {
diff --git a/core/java/android/os/AsyncTask.java b/core/java/android/os/AsyncTask.java
index d259f386ea77..b37e176ddb6e 100644
--- a/core/java/android/os/AsyncTask.java
+++ b/core/java/android/os/AsyncTask.java
@@ -38,9 +38,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * <p>AsyncTask enables proper and easy use of the UI thread. This class allows you
- * to perform background operations and publish results on the UI thread without
- * having to manipulate threads and/or handlers.</p>
+ * <p>AsyncTask was intended to enable proper and easy use of the UI thread. However, the most
+ * common use case was for integrating into UI, and that would cause Context leaks, missed
+ * callbacks, or crashes on configuration changes. It also has inconsistent behavior on different
+ * versions of the platform, swallows exceptions from {@code doInBackground}, and does not provide
+ * much utility over using {@link Executor}s directly.</p>
*
* <p>AsyncTask is designed to be a helper class around {@link Thread} and {@link Handler}
* and does not constitute a generic threading framework. AsyncTasks should ideally be
@@ -188,7 +190,12 @@ import java.util.concurrent.atomic.AtomicInteger;
* <p>If you truly want parallel execution, you can invoke
* {@link #executeOnExecutor(java.util.concurrent.Executor, Object[])} with
* {@link #THREAD_POOL_EXECUTOR}.</p>
+ *
+ * @deprecated Use the standard <code>java.util.concurrent</code> or
+ * <a href="https://developer.android.com/topic/libraries/architecture/coroutines">
+ * Kotlin concurrency utilities</a> instead.
*/
+@Deprecated
public abstract class AsyncTask<Params, Progress, Result> {
private static final String LOG_TAG = "AsyncTask";
@@ -240,7 +247,13 @@ public abstract class AsyncTask<Params, Progress, Result> {
/**
* An {@link Executor} that can be used to execute tasks in parallel.
+ *
+ * @deprecated Using a single thread pool for a general purpose results in suboptimal behavior
+ * for different tasks. Small, CPU-bound tasks benefit from a bounded pool and queueing, and
+ * long-running blocking tasks, such as network operations, benefit from many threads. Use or
+ * create an {@link Executor} configured for your use case.
*/
+ @Deprecated
public static final Executor THREAD_POOL_EXECUTOR;
static {
@@ -254,7 +267,10 @@ public abstract class AsyncTask<Params, Progress, Result> {
/**
* An {@link Executor} that executes tasks one at a time in serial
* order. This serialization is global to a particular process.
+ *
+ * @deprecated Globally serializing tasks results in excessive queuing for unrelated operations.
*/
+ @Deprecated
public static final Executor SERIAL_EXECUTOR = new SerialExecutor();
private static final int MESSAGE_POST_RESULT = 0x1;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index ecd16dd1f612..387775b7ccdc 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -66,6 +66,10 @@ import java.util.Map;
public abstract class BatteryStats implements Parcelable {
private static final String TAG = "BatteryStats";
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public BatteryStats() {
+ }
+
private static final boolean LOCAL_LOGV = false;
/** Fetching RPM stats is too slow to do each time screen changes, so disable it. */
protected static final boolean SCREEN_OFF_RPM_STATS_ENABLED = false;
@@ -407,6 +411,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Counter {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Counter() {
+ }
+
/**
* Returns the count associated with this Counter for the
* selected type of statistics.
@@ -516,6 +524,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Timer {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Timer() {
+ }
+
/**
* Returns the count associated with this Timer for the
* selected type of statistics.
@@ -631,6 +643,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Uid {
+ @UnsupportedAppUsage
+ public Uid() {
+ }
+
/**
* Returns a mapping containing wakelock statistics.
*
@@ -671,6 +687,11 @@ public abstract class BatteryStats implements Parcelable {
* The statistics associated with a particular wake lock.
*/
public static abstract class Wakelock {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Wakelock(){
+ }
+
@UnsupportedAppUsage
public abstract Timer getWakeTime(int type);
}
@@ -948,6 +969,11 @@ public abstract class BatteryStats implements Parcelable {
public abstract void getDeferredJobsLineLocked(StringBuilder sb, int which);
public static abstract class Sensor {
+
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Sensor() {
+ }
+
/*
* FIXME: it's not correct to use this magic value because it
* could clash with a sensor handle (which are defined by
@@ -978,7 +1004,16 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Proc {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Proc() {
+ }
+
public static class ExcessivePower {
+
+ @UnsupportedAppUsage
+ public ExcessivePower() {
+ }
+
public static final int TYPE_WAKE = 1;
public static final int TYPE_CPU = 2;
@@ -1053,6 +1088,10 @@ public abstract class BatteryStats implements Parcelable {
*/
public static abstract class Pkg {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public Pkg() {
+ }
+
/**
* Returns information about all wakeup alarms that have been triggered for this
* package. The mapping keys are tag names for the alarms, the counter contains
@@ -1555,6 +1594,7 @@ public abstract class BatteryStats implements Parcelable {
}
public final static class HistoryItem implements Parcelable {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public HistoryItem next;
// The time of this event in milliseconds, as per SystemClock.elapsedRealtime().
@@ -1877,6 +1917,7 @@ public abstract class BatteryStats implements Parcelable {
numReadInts += (src.dataPosition()-start)/4;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void clear() {
time = 0;
cmd = CMD_NULL;
@@ -1897,12 +1938,14 @@ public abstract class BatteryStats implements Parcelable {
eventTag = null;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(HistoryItem o) {
time = o.time;
cmd = o.cmd;
setToCommon(o);
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public void setTo(long time, byte cmd, HistoryItem o) {
this.time = time;
this.cmd = cmd;
@@ -1958,6 +2001,7 @@ public abstract class BatteryStats implements Parcelable {
&& currentTime == o.currentTime;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public boolean same(HistoryItem o) {
if (!sameNonEvent(o) || eventCode != o.eventCode) {
return false;
@@ -2340,6 +2384,7 @@ public abstract class BatteryStats implements Parcelable {
*
* {@hide}
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getMobileRadioActiveTime(long elapsedRealtimeUs, int which);
/**
@@ -2700,6 +2745,7 @@ public abstract class BatteryStats implements Parcelable {
public static final int NETWORK_WIFI_BG_TX_DATA = 9;
public static final int NUM_NETWORK_ACTIVITY_TYPES = NETWORK_WIFI_BG_TX_DATA + 1;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public abstract long getNetworkActivityBytes(int type, int which);
public abstract long getNetworkActivityPackets(int type, int which);
diff --git a/core/java/android/os/BinderProxy.java b/core/java/android/os/BinderProxy.java
index 97c0a13e7a2b..c35b05f10498 100644
--- a/core/java/android/os/BinderProxy.java
+++ b/core/java/android/os/BinderProxy.java
@@ -241,31 +241,36 @@ public final class BinderProxy implements IBinder {
}
Map<String, Integer> counts = new HashMap<>();
- for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
- if (a != null) {
- for (WeakReference<BinderProxy> weakRef : a) {
- BinderProxy bp = weakRef.get();
- String key;
- if (bp == null) {
- key = "<cleared weak-ref>";
- } else {
- try {
- key = bp.getInterfaceDescriptor();
- if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
- key = "<proxy to dead node>";
- }
- } catch (Throwable t) {
- key = "<exception during getDescriptor>";
- }
- }
- Integer i = counts.get(key);
- if (i == null) {
- counts.put(key, 1);
- } else {
- counts.put(key, i + 1);
+ final ArrayList<WeakReference<BinderProxy>> proxiesToQuery =
+ new ArrayList<WeakReference<BinderProxy>>();
+ synchronized (sProxyMap) {
+ for (ArrayList<WeakReference<BinderProxy>> a : mMainIndexValues) {
+ if (a != null) {
+ proxiesToQuery.addAll(a);
+ }
+ }
+ }
+ for (WeakReference<BinderProxy> weakRef : proxiesToQuery) {
+ BinderProxy bp = weakRef.get();
+ String key;
+ if (bp == null) {
+ key = "<cleared weak-ref>";
+ } else {
+ try {
+ key = bp.getInterfaceDescriptor();
+ if ((key == null || key.isEmpty()) && !bp.isBinderAlive()) {
+ key = "<proxy to dead node>";
}
+ } catch (Throwable t) {
+ key = "<exception during getDescriptor>";
}
}
+ Integer i = counts.get(key);
+ if (i == null) {
+ counts.put(key, 1);
+ } else {
+ counts.put(key, i + 1);
+ }
}
Map.Entry<String, Integer>[] sorted = counts.entrySet().toArray(
new Map.Entry[counts.size()]);
@@ -354,9 +359,7 @@ public final class BinderProxy implements IBinder {
* @hide
*/
public static InterfaceCount[] getSortedInterfaceCounts(int num) {
- synchronized (sProxyMap) {
- return sProxyMap.getSortedInterfaceCounts(num);
- }
+ return sProxyMap.getSortedInterfaceCounts(num);
}
/**
@@ -376,10 +379,8 @@ public final class BinderProxy implements IBinder {
*/
public static void dumpProxyDebugInfo() {
if (Build.IS_DEBUGGABLE) {
- synchronized (sProxyMap) {
- sProxyMap.dumpProxyInterfaceCounts();
- sProxyMap.dumpPerUidProxyCounts();
- }
+ sProxyMap.dumpProxyInterfaceCounts();
+ sProxyMap.dumpPerUidProxyCounts();
}
}
diff --git a/core/java/android/os/CancellationSignal.java b/core/java/android/os/CancellationSignal.java
index e8053d5d275d..99fb9982e706 100644
--- a/core/java/android/os/CancellationSignal.java
+++ b/core/java/android/os/CancellationSignal.java
@@ -18,13 +18,19 @@ package android.os;
import android.os.ICancellationSignal;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* Provides the ability to cancel an operation in progress.
*/
public final class CancellationSignal {
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mIsCanceled;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private OnCancelListener mOnCancelListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private ICancellationSignal mRemote;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean mCancelInProgress;
/**
@@ -152,6 +158,7 @@ public final class CancellationSignal {
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private void waitForCancelFinishedLocked() {
while (mCancelInProgress) {
try {
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index 154e8cd5a2d5..4ed7b17d1549 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -1690,6 +1690,8 @@ public final class Debug
* such runtime statistic exists.
*
* <p>The following table lists the runtime statistics that the runtime supports.
+ * All statistics are approximate. Individual allocations may not be immediately reflected
+ * in the results.
* Note runtime statistics may be added or removed in a future API level.</p>
*
* <table>
diff --git a/core/java/android/os/IDeviceIdleController.aidl b/core/java/android/os/IDeviceIdleController.aidl
index aa255bf660d5..8a7a594f0b80 100644
--- a/core/java/android/os/IDeviceIdleController.aidl
+++ b/core/java/android/os/IDeviceIdleController.aidl
@@ -31,11 +31,13 @@ interface IDeviceIdleController {
String[] getSystemPowerWhitelistExceptIdle();
String[] getSystemPowerWhitelist();
String[] getUserPowerWhitelist();
+ @UnsupportedAppUsage
String[] getFullPowerWhitelistExceptIdle();
String[] getFullPowerWhitelist();
int[] getAppIdWhitelistExceptIdle();
int[] getAppIdWhitelist();
int[] getAppIdUserWhitelist();
+ @UnsupportedAppUsage
int[] getAppIdTempWhitelist();
boolean isPowerSaveWhitelistExceptIdleApp(String name);
boolean isPowerSaveWhitelistApp(String name);
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index 9b8a40a6cab0..0cce19222d27 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -184,6 +184,7 @@ interface INetworkManagementService
/**
* Returns a list of currently tethered interfaces
*/
+ @UnsupportedAppUsage
String[] listTetheredInterfaces();
/**
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index e1d605e1c99d..185693e8e6e0 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -47,6 +47,7 @@ interface IPowerManager
void wakeUp(long time, int reason, String details, String opPackageName);
@UnsupportedAppUsage
void goToSleep(long time, int reason, int flags);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void nap(long time);
@UnsupportedAppUsage
boolean isInteractive();
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index dbe3c93738b8..041f31d67a3e 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -364,6 +364,11 @@ public final class Parcel {
* @hide
*/
public static class ReadWriteHelper {
+
+ @UnsupportedAppUsage
+ public ReadWriteHelper() {
+ }
+
public static final ReadWriteHelper DEFAULT = new ReadWriteHelper();
/**
@@ -3148,6 +3153,7 @@ public final class Parcel {
// Cache of previously looked up CREATOR.createFromParcel() methods for
// particular classes. Keys are the names of the classes, values are
// Method objects.
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static final HashMap<ClassLoader,HashMap<String,Parcelable.Creator<?>>>
mCreators = new HashMap<>();
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 2fff595d7150..ab4d424ac053 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -824,6 +824,7 @@ public final class PowerManager {
final Context mContext;
@UnsupportedAppUsage
final IPowerManager mService;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
final Handler mHandler;
IThermalService mThermalService;
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index f85297627d76..8d74fc5d962c 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -1003,6 +1003,7 @@ public class Process {
* your own log, or the Android Illuminati will find you some night and
* beat you up.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static final native void sendSignalQuiet(int pid, int signal);
/** @hide */
diff --git a/core/java/android/os/Registrant.java b/core/java/android/os/Registrant.java
index 8fb123aa3da4..572b975fbafd 100644
--- a/core/java/android/os/Registrant.java
+++ b/core/java/android/os/Registrant.java
@@ -114,6 +114,7 @@ public class Registrant
}
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public Handler
getHandler()
{
diff --git a/core/java/android/os/RegistrantList.java b/core/java/android/os/RegistrantList.java
index 6e562ffc88ea..9c017dfff967 100644
--- a/core/java/android/os/RegistrantList.java
+++ b/core/java/android/os/RegistrantList.java
@@ -17,7 +17,6 @@
package android.os;
import android.annotation.UnsupportedAppUsage;
-import android.os.Handler;
import java.util.ArrayList;
@@ -27,6 +26,10 @@ public class RegistrantList
ArrayList registrants = new ArrayList(); // of Registrant
@UnsupportedAppUsage
+ public RegistrantList() {
+ }
+
+ @UnsupportedAppUsage
public synchronized void
add(Handler h, int what, Object obj)
{
@@ -70,6 +73,7 @@ public class RegistrantList
return registrants.size();
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public synchronized Object
get(int index)
{
diff --git a/core/java/android/os/RemoteCallback.java b/core/java/android/os/RemoteCallback.java
index 047ba1d20056..da58d0fac160 100644
--- a/core/java/android/os/RemoteCallback.java
+++ b/core/java/android/os/RemoteCallback.java
@@ -21,6 +21,8 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* @hide
*/
@@ -33,6 +35,7 @@ public final class RemoteCallback implements Parcelable {
}
private final OnResultListener mListener;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private final Handler mHandler;
private final IRemoteCallback mCallback;
diff --git a/core/java/android/os/ServiceManager.java b/core/java/android/os/ServiceManager.java
index 9a9b0306063b..bf9225a2780a 100644
--- a/core/java/android/os/ServiceManager.java
+++ b/core/java/android/os/ServiceManager.java
@@ -102,6 +102,10 @@ public final class ServiceManager {
});
@UnsupportedAppUsage
+ public ServiceManager() {
+ }
+
+ @UnsupportedAppUsage
private static IServiceManager getIServiceManager() {
if (sServiceManager != null) {
return sServiceManager;
diff --git a/core/java/android/os/ServiceManagerNative.java b/core/java/android/os/ServiceManagerNative.java
index f641731fa08f..124b6c6f7377 100644
--- a/core/java/android/os/ServiceManagerNative.java
+++ b/core/java/android/os/ServiceManagerNative.java
@@ -86,6 +86,10 @@ class ServiceManagerProxy implements IServiceManager {
throw new RemoteException();
}
+ public boolean isDeclared(String name) throws RemoteException {
+ throw new RemoteException();
+ }
+
/**
* Same as mServiceManager but used by apps.
*
diff --git a/core/java/android/os/SystemProperties.java b/core/java/android/os/SystemProperties.java
index a6e5972faa55..8b0ffe155fc3 100644
--- a/core/java/android/os/SystemProperties.java
+++ b/core/java/android/os/SystemProperties.java
@@ -95,12 +95,17 @@ public class SystemProperties {
@UnsupportedAppUsage
private static native String native_get(String key);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native String native_get(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native int native_get_int(String key, int def);
@UnsupportedAppUsage
private static native long native_get_long(String key, long def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native boolean native_get_boolean(String key, boolean def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_set(String key, String def);
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private static native void native_add_change_callback();
private static native void native_report_sysprop_change();
diff --git a/core/java/android/os/UserHandle.java b/core/java/android/os/UserHandle.java
index d70ba9921bfd..4e17f7e92013 100644
--- a/core/java/android/os/UserHandle.java
+++ b/core/java/android/os/UserHandle.java
@@ -354,6 +354,7 @@ public final class UserHandle implements Parcelable {
* components -- user, app, isolated, etc.
* @hide
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static void formatUid(PrintWriter pw, int uid) {
if (uid < Process.FIRST_APPLICATION_UID) {
pw.print(uid);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index af9e592f9036..e92e435fa733 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2370,6 +2370,8 @@ public class UserManager {
/**
* Return the number of users currently created on the device.
+ * <p>This API is not for use by third-party apps. It requires the {@code MANAGE_USERS}
+ * permission.</p>
*/
public int getUserCount() {
List<UserInfo> users = getUsers();
diff --git a/core/java/android/os/WorkSource.java b/core/java/android/os/WorkSource.java
index 634b2baf098a..9cc9aac490c7 100644
--- a/core/java/android/os/WorkSource.java
+++ b/core/java/android/os/WorkSource.java
@@ -40,14 +40,17 @@ public class WorkSource implements Parcelable {
* The WorkSource object itself is not thread safe, but we need to
* hold sTmpWorkSource lock while working with these statics.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static final WorkSource sTmpWorkSource = new WorkSource(0);
/**
* For returning newbie work from a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sNewbWork;
/**
* For returning gone work form a modification operation.
*/
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
static WorkSource sGoneWork;
/**
@@ -620,6 +623,7 @@ public class WorkSource implements Parcelable {
return changed;
}
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
private boolean updateLocked(WorkSource other, boolean set, boolean returnNewbs) {
if (mNames == null && other.mNames == null) {
return updateUidsLocked(other, set, returnNewbs);
diff --git a/core/java/android/os/image/DynamicSystemManager.java b/core/java/android/os/image/DynamicSystemManager.java
index 77fd946f7ccb..0e00d5e9b7bf 100644
--- a/core/java/android/os/image/DynamicSystemManager.java
+++ b/core/java/android/os/image/DynamicSystemManager.java
@@ -104,16 +104,17 @@ public class DynamicSystemManager {
* Start DynamicSystem installation. This call may take an unbounded amount of time. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if the partition is read only, e.g. system.
* @return {@code true} if the call succeeds. {@code false} either the device does not contain
* enough space or a DynamicSystem is currently in use where the {@link #isInUse} would be
* true.
*/
@RequiresPermission(android.Manifest.permission.MANAGE_DYNAMIC_SYSTEM)
- public Session startInstallation(long systemSize, long userdataSize) {
+ public Session startInstallation(String name, long size, boolean readOnly) {
try {
- if (mService.startInstallation(systemSize, userdataSize)) {
+ if (mService.startInstallation(name, size, readOnly)) {
return new Session();
} else {
return null;
diff --git a/core/java/android/os/image/IDynamicSystemService.aidl b/core/java/android/os/image/IDynamicSystemService.aidl
index a6de170b5ce5..75f67854743f 100644
--- a/core/java/android/os/image/IDynamicSystemService.aidl
+++ b/core/java/android/os/image/IDynamicSystemService.aidl
@@ -24,11 +24,12 @@ interface IDynamicSystemService
* Start DynamicSystem installation. This call may take 60~90 seconds. The caller
* may use another thread to call the getStartProgress() to get the progress.
*
- * @param systemSize system size in bytes
- * @param userdataSize userdata size in bytes
+ * @param name The DSU partition name
+ * @param size Size of the DSU image in bytes
+ * @param readOnly True if this partition is readOnly
* @return true if the call succeeds
*/
- boolean startInstallation(long systemSize, long userdataSize);
+ boolean startInstallation(@utf8InCpp String name, long size, boolean readOnly);
/**
* Query the progress of the current installation operation. This can be called while
diff --git a/core/java/android/os/storage/StorageEventListener.java b/core/java/android/os/storage/StorageEventListener.java
index 4aa0b08ae358..39d5b4529745 100644
--- a/core/java/android/os/storage/StorageEventListener.java
+++ b/core/java/android/os/storage/StorageEventListener.java
@@ -24,6 +24,11 @@ import android.annotation.UnsupportedAppUsage;
* @hide
*/
public class StorageEventListener {
+
+ @UnsupportedAppUsage
+ public StorageEventListener() {
+ }
+
/**
* Called when the detection state of a USB Mass Storage host has changed.
* @param connected true if the USB mass storage is connected.
diff --git a/core/java/android/os/telephony/TelephonyRegistryManager.java b/core/java/android/os/telephony/TelephonyRegistryManager.java
new file mode 100644
index 000000000000..b67409988da0
--- /dev/null
+++ b/core/java/android/os/telephony/TelephonyRegistryManager.java
@@ -0,0 +1,548 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.os.telephony;
+
+import android.annotation.SystemApi;
+import android.net.LinkProperties;
+import android.net.NetworkCapabilities;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telephony.Annotation;
+import android.telephony.Annotation.ApnType;
+import android.telephony.Annotation.CallState;
+import android.telephony.Annotation.DataActivityType;
+import android.telephony.Annotation.DataFailureCause;
+import android.telephony.Annotation.DataState;
+import android.telephony.Annotation.NetworkType;
+import android.telephony.Annotation.RadioPowerState;
+import android.telephony.Annotation.SimActivationState;
+import android.telephony.Annotation.SrvccState;
+import android.telephony.CallQuality;
+import android.telephony.CellInfo;
+import android.telephony.DisconnectCause;
+import android.telephony.PhoneCapability;
+import android.telephony.PreciseCallState.State;
+import android.telephony.ServiceState;
+import android.telephony.SignalStrength;
+import android.telephony.TelephonyManager;
+import android.telephony.data.ApnSetting;
+import android.telephony.ims.ImsReasonInfo;
+import com.android.internal.telephony.ITelephonyRegistry;
+import java.util.List;
+
+/**
+ * A centralized place to notify telephony related status changes, e.g, {@link ServiceState} update
+ * or {@link PhoneCapability} changed. This might trigger callback from applications side through
+ * {@link android.telephony.PhoneStateListener}
+ *
+ * TODO: limit API access to only carrier apps with certain permissions or apps running on
+ * privileged UID.
+ *
+ * @hide
+ */
+@SystemApi
+public class TelephonyRegistryManager {
+
+ private static final String TAG = "TelephonyRegistryManager";
+ private static ITelephonyRegistry sRegistry;
+
+ /** @hide **/
+ public TelephonyRegistryManager() {
+ if (sRegistry == null) {
+ sRegistry = ITelephonyRegistry.Stub.asInterface(
+ ServiceManager.getService("telephony.registry"));
+ }
+ }
+
+ /**
+ * Informs the system of an intentional upcoming carrier network change by a carrier app.
+ * This call only used to allow the system to provide alternative UI while telephony is
+ * performing an action that may result in intentional, temporary network lack of connectivity.
+ * <p>
+ * Based on the active parameter passed in, this method will either show or hide the alternative
+ * UI. There is no timeout associated with showing this UX, so a carrier app must be sure to
+ * call with active set to false sometime after calling with it set to {@code true}.
+ * <p>
+ * Requires Permission: calling app has carrier privileges.
+ *
+ * @param active Whether the carrier network change is or shortly will be
+ * active. Set this value to true to begin showing alternative UI and false to stop.
+ * @see TelephonyManager#hasCarrierPrivileges
+ */
+ public void notifyCarrierNetworkChange(boolean active) {
+ try {
+ sRegistry.notifyCarrierNetworkChange(active);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify call state changed on certain subscription.
+ *
+ * @param subId for which call state changed.
+ * @param slotIndex for which call state changed. Can be derived from subId except when subId is
+ * invalid.
+ * @param state latest call state. e.g, offhook, ringing
+ * @param incomingNumer incoming phone number.
+ *
+ * @hide
+ */
+ public void notifyCallStateChanged(int subId, int slotIndex, @CallState int state,
+ String incomingNumer) {
+ try {
+ sRegistry.notifyCallState(slotIndex, subId, state, incomingNumer);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link ServiceState} update on certain subscription.
+ *
+ * @param subId for which the service state changed.
+ * @param slotIndex for which the service state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param state service state e.g, in service, out of service or roaming status.
+ *
+ * @hide
+ */
+ public void notifyServiceStateChanged(int subId, int slotIndex, ServiceState state) {
+ try {
+ sRegistry.notifyServiceStateForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify {@link SignalStrength} update on certain subscription.
+ *
+ * @param subId for which the signalstrength changed.
+ * @param slotIndex for which the signalstrength changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param signalStrength e.g, signalstrength level {@see SignalStrength#getLevel()}
+ *
+ * @hide
+ */
+ public void notifySignalStrengthChanged(int subId, int slotIndex,
+ SignalStrength signalStrength) {
+ try {
+ sRegistry.notifySignalStrengthForPhoneId(slotIndex, subId, signalStrength);
+ } catch (RemoteException ex) {
+ // system server crash
+ }
+ }
+
+ /**
+ * Notify changes to the message-waiting indicator on certain subscription. e.g, The status bar
+ * uses message waiting indicator to determine when to display the voicemail icon.
+ *
+ * @param subId for which message waiting indicator changed.
+ * @param slotIndex for which message waiting indicator changed. Can be derived from subId
+ * except when subId is invalid.
+ * @param msgWaitingInd {@code true} indicates there is message-waiting indicator, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyMessageWaitingChanged(int subId, int slotIndex, boolean msgWaitingInd) {
+ try {
+ sRegistry.notifyMessageWaitingChangedForPhoneId(slotIndex, subId, msgWaitingInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to the call-forwarding status on certain subscription.
+ *
+ * @param subId for which call forwarding status changed.
+ * @param callForwardInd {@code true} indicates there is call forwarding, {@code false}
+ * otherwise.
+ *
+ * @hide
+ */
+ public void notifyCallForwardingChanged(int subId, boolean callForwardInd) {
+ try {
+ sRegistry.notifyCallForwardingChangedForSubscriber(subId, callForwardInd);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to activity state changes on certain subscription.
+ *
+ * @param subId for which data activity state changed.
+ * @param dataActivityType indicates the latest data activity type e.g, {@link
+ * TelephonyManager#DATA_ACTIVITY_IN}
+ *
+ * @hide
+ */
+ public void notifyDataActivityChanged(int subId, @DataActivityType int dataActivityType) {
+ try {
+ sRegistry.notifyDataActivityForSubscriber(subId, dataActivityType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify changes to default (Internet) data connection state on certain subscription.
+ *
+ * @param subId for which data connection state changed.
+ * @param slotIndex for which data connections state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state latest data connection state, e.g,
+ * @param isDataConnectivityPossible indicates if data is allowed
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param linkProperties {@link LinkProperties} associated with this data connection.
+ * @param networkCapabilities {@link NetworkCapabilities} associated with this data connection.
+ * @param networkType associated with this data connection.
+ * @param roaming {@code true} indicates in roaming, {@false} otherwise.
+ * @see TelephonyManager#DATA_DISCONNECTED
+ * @see TelephonyManager#isDataConnectivityPossible()
+ *
+ * @hide
+ */
+ public void notifyDataConnectionForSubscriber(int slotIndex, int subId, @DataState int state,
+ boolean isDataConnectivityPossible,
+ @ApnType String apn, String apnType, LinkProperties linkProperties,
+ NetworkCapabilities networkCapabilities, int networkType, boolean roaming) {
+ try {
+ sRegistry.notifyDataConnectionForSubscriber(slotIndex, subId, state,
+ isDataConnectivityPossible,
+ apn, apnType, linkProperties, networkCapabilities, networkType, roaming);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CallQuality} change on certain subscription.
+ *
+ * @param subId for which call quality state changed.
+ * @param slotIndex for which call quality state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param callQuality Information about call quality e.g, call quality level
+ * @param networkType associated with this data connection. e.g, LTE
+ *
+ * @hide
+ */
+ public void notifyCallQualityChanged(int subId, int slotIndex, CallQuality callQuality,
+ @NetworkType int networkType) {
+ try {
+ sRegistry.notifyCallQualityChanged(callQuality, slotIndex, subId, networkType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify emergency number list changed on certain subscription.
+ *
+ * @param subId for which emergency number list changed.
+ * @param slotIndex for which emergency number list changed. Can be derived from subId except
+ * when subId is invalid.
+ *
+ * @hide
+ */
+ public void notifyEmergencyNumberList(int subId, int slotIndex) {
+ try {
+ sRegistry.notifyEmergencyNumberList(slotIndex, subId);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify radio power state changed on certain subscription.
+ *
+ * @param subId for which radio power state changed.
+ * @param slotIndex for which radio power state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param radioPowerState the current modem radio state.
+ *
+ * @hide
+ */
+ public void notifyRadioPowerStateChanged(int subId, int slotIndex,
+ @RadioPowerState int radioPowerState) {
+ try {
+ sRegistry.notifyRadioPowerStateChanged(slotIndex, subId, radioPowerState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link PhoneCapability} changed.
+ *
+ * @param phoneCapability the capability of the modem group.
+ *
+ * @hide
+ */
+ public void notifyPhoneCapabilityChanged(PhoneCapability phoneCapability) {
+ try {
+ sRegistry.notifyPhoneCapabilityChanged(phoneCapability);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data activation state changed on certain subscription.
+ * @see TelephonyManager#getDataActivationState()
+ *
+ * @param subId for which data activation state changed.
+ * @param slotIndex for which data activation state changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyDataActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_DATA, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify voice activation state changed on certain subscription.
+ * @see TelephonyManager#getVoiceActivationState()
+ *
+ * @param subId for which voice activation state changed.
+ * @param slotIndex for which voice activation state changed. Can be derived from subId except
+ * subId is invalid.
+ * @param activationState sim activation state e.g, activated.
+ *
+ * @hide
+ */
+ public void notifyVoiceActivationStateChanged(int subId, int slotIndex,
+ @SimActivationState int activationState) {
+ try {
+ sRegistry.notifySimActivationStateChangedForPhoneId(slotIndex, subId,
+ TelephonyManager.SIM_ACTIVATION_TYPE_VOICE, activationState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify User mobile data state changed on certain subscription. e.g, mobile data is enabled
+ * or disabled.
+ *
+ * @param subId for which mobile data state has changed.
+ * @param slotIndex for which mobile data state has changed. Can be derived from subId except
+ * when subId is invalid.
+ * @param state {@code true} indicates mobile data is enabled/on. {@code false} otherwise.
+ *
+ * @hide
+ */
+ public void notifyUserMobileDataStateChanged(int slotIndex, int subId, boolean state) {
+ try {
+ sRegistry.notifyUserMobileDataStateChangedForPhoneId(slotIndex, subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO: this is marked as deprecated, can we move this one safely?
+ *
+ * @param subId
+ * @param slotIndex
+ * @param rawData
+ *
+ * @hide
+ */
+ public void notifyOemHookRawEventForSubscriber(int subId, int slotIndex, byte[] rawData) {
+ try {
+ sRegistry.notifyOemHookRawEventForSubscriber(slotIndex, subId, rawData);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify IMS call disconnect causes which contains {@link android.telephony.ims.ImsReasonInfo}.
+ *
+ * @param subId for which ims call disconnect.
+ * @param imsReasonInfo the reason for ims call disconnect.
+ *
+ * @hide
+ */
+ public void notifyImsDisconnectCause(int subId, ImsReasonInfo imsReasonInfo) {
+ try {
+ sRegistry.notifyImsDisconnectCause(subId, imsReasonInfo);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise data connection failed cause on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction failed. Can be derived from subId except when
+ * subId is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN.
+ * @param apn the APN {@link ApnSetting#getApnName()} of this data connection.
+ * @param failCause data fail cause.
+ *
+ * @hide
+ */
+ public void notifyPreciseDataConnectionFailed(int subId, int slotIndex, String apnType,
+ String apn, @DataFailureCause int failCause) {
+ try {
+ sRegistry.notifyPreciseDataConnectionFailed(slotIndex, subId, apnType, apn, failCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify single Radio Voice Call Continuity (SRVCC) state change for the currently active call
+ * on certain subscription.
+ *
+ * @param subId for which srvcc state changed.
+ * @param state srvcc state
+ *
+ * @hide
+ */
+ public void notifySrvccStateChanged(int subId, @SrvccState int state) {
+ try {
+ sRegistry.notifySrvccStateChanged(subId, state);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify over the air sim provisioning(OTASP) mode changed on certain subscription.
+ *
+ * @param subId for which otasp mode changed.
+ * @param otaspMode latest mode for OTASP e.g, OTASP needed.
+ *
+ * @hide
+ */
+ public void notifyOtaspChanged(int subId, int otaspMode) {
+ try {
+ sRegistry.notifyOtaspChanged(subId, otaspMode);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify precise call state changed on certain subscription, including foreground, background
+ * and ringcall states.
+ *
+ * @param subId for which precise call state changed.
+ * @param slotIndex for which precise call state changed. Can be derived from subId except when
+ * subId is invalid.
+ * @param ringCallPreciseState ringCall state.
+ * @param foregroundCallPreciseState foreground call state.
+ * @param backgroundCallPreciseState background call state.
+ *
+ * @hide
+ */
+ public void notifyPreciseCallState(int subId, int slotIndex, @State int ringCallPreciseState,
+ @State int foregroundCallPreciseState, @State int backgroundCallPreciseState) {
+ try {
+ sRegistry.notifyPreciseCallState(slotIndex, subId, ringCallPreciseState,
+ foregroundCallPreciseState, backgroundCallPreciseState);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify call disconnect causes which contains {@link DisconnectCause} and {@link
+ * android.telephony.PreciseDisconnectCause}.
+ *
+ * @param subId for which call disconnected.
+ * @param slotIndex for which call disconnected. Can be derived from subId except when subId is
+ * invalid.
+ * @param cause {@link DisconnectCause} for the disconnected call.
+ * @param preciseCause {@link android.telephony.PreciseDisconnectCause} for the disconnected
+ * call.
+ *
+ * @hide
+ */
+ public void notifyDisconnectCause(int slotIndex, int subId, int cause, int preciseCause) {
+ try {
+ sRegistry.notifyDisconnectCause(slotIndex, subId, cause, preciseCause);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify data connection failed on certain subscription.
+ *
+ * @param subId for which data connection failed.
+ * @param slotIndex for which data conenction faled. Can be derived from subId except when subId
+ * is invalid.
+ * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN. Note each data
+ * connection can support multiple anyTypes.
+ *
+ * @hide
+ */
+ public void notifyDataConnectionFailed(int subId, int slotIndex, String apnType) {
+ try {
+ sRegistry.notifyDataConnectionFailedForSubscriber(slotIndex, subId, apnType);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * TODO change from bundle to CellLocation?
+ * @hide
+ */
+ public void notifyCellLocation(int subId, Bundle cellLocation) {
+ try {
+ sRegistry.notifyCellLocationForSubscriber(subId, cellLocation);
+ } catch (RemoteException ex) {
+ // system process is dead
+ }
+ }
+
+ /**
+ * Notify {@link CellInfo} changed on certain subscription. e.g, when an observed cell info has
+ * changed or new cells have been added or removed on the given subscription.
+ *
+ * @param subId for which cellinfo changed.
+ * @param cellInfo A list of cellInfo associated with the given subscription.
+ *
+ * @hide
+ */
+ public void notifyCellInfoChanged(int subId, List<CellInfo> cellInfo) {
+ try {
+ sRegistry.notifyCellInfoForSubscriber(subId, cellInfo);
+ } catch (RemoteException ex) {
+
+ }
+ }
+
+}
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index 0827fd6e725e..3d54ba10ef0c 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -35,6 +35,7 @@ import android.provider.ContactsContract.CommonDataKinds.Callable;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.DataUsageFeedback;
+import android.telecom.CallerInfo;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -42,7 +43,6 @@ import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
-import com.android.internal.telephony.CallerInfo;
import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -728,10 +728,11 @@ public class CallLog {
String accountAddress = getLogAccountAddress(context, accountHandle);
int numberPresentation = getLogNumberPresentation(number, presentation);
+ String name = (ci != null) ? ci.getName() : "";
if (numberPresentation != PRESENTATION_ALLOWED) {
number = "";
if (ci != null) {
- ci.name = "";
+ name = "";
}
}
@@ -760,9 +761,7 @@ public class CallLog {
values.put(PHONE_ACCOUNT_ID, accountId);
values.put(PHONE_ACCOUNT_ADDRESS, accountAddress);
values.put(NEW, Integer.valueOf(1));
- if ((ci != null) && (ci.name != null)) {
- values.put(CACHED_NAME, ci.name);
- }
+ values.put(CACHED_NAME, name);
values.put(ADD_FOR_ALL_USERS, addForAllUsers ? 1 : 0);
if (callType == MISSED_TYPE) {
@@ -773,7 +772,7 @@ public class CallLog {
values.put(CALL_SCREENING_APP_NAME, charSequenceToString(callScreeningAppName));
values.put(CALL_SCREENING_COMPONENT_NAME, callScreeningComponentName);
- if ((ci != null) && (ci.contactIdOrZero > 0)) {
+ if ((ci != null) && (ci.getContactId() > 0)) {
// Update usage information for the number associated with the contact ID.
// We need to use both the number and the ID for obtaining a data ID since other
// contacts may have the same number.
@@ -787,17 +786,18 @@ public class CallLog {
cursor = resolver.query(Phone.CONTENT_URI,
new String[] { Phone._ID },
Phone.CONTACT_ID + " =? AND " + Phone.NORMALIZED_NUMBER + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero),
+ new String[] { String.valueOf(ci.getContactId()),
normalizedPhoneNumber},
null);
} else {
- final String phoneNumber = ci.phoneNumber != null ? ci.phoneNumber : number;
+ final String phoneNumber = ci.getPhoneNumber() != null
+ ? ci.getPhoneNumber() : number;
cursor = resolver.query(
Uri.withAppendedPath(Callable.CONTENT_FILTER_URI,
Uri.encode(phoneNumber)),
new String[] { Phone._ID },
Phone.CONTACT_ID + " =?",
- new String[] { String.valueOf(ci.contactIdOrZero) },
+ new String[] { String.valueOf(ci.getContactId()) },
null);
}
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index ee36dfe56fc4..eb2c61cbac84 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -8962,6 +8962,14 @@ public final class Settings {
private static final Validator AWARE_LOCK_ENABLED_VALIDATOR = BOOLEAN_VALIDATOR;
/**
+ * Controls whether tap gesture is enabled.
+ * @hide
+ */
+ public static final String TAP_GESTURE = "tap_gesture";
+
+ private static final Validator TAP_GESTURE_VALIDATOR = BOOLEAN_VALIDATOR;
+
+ /**
* This are the settings to be backed up.
*
* NOTE: Settings are backed up and restored in the order they appear
@@ -9294,6 +9302,7 @@ public final class Settings {
VALIDATORS.put(AWARE_LOCK_ENABLED, AWARE_LOCK_ENABLED_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_GESTURE_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
VALIDATORS.put(AWARE_TAP_PAUSE_TOUCH_COUNT, NON_NEGATIVE_INTEGER_VALIDATOR);
+ VALIDATORS.put(TAP_GESTURE, TAP_GESTURE_VALIDATOR);
}
/**
diff --git a/core/java/android/provider/SettingsStringUtil.java b/core/java/android/provider/SettingsStringUtil.java
index a3dc9471a1d0..9e495dd775dc 100644
--- a/core/java/android/provider/SettingsStringUtil.java
+++ b/core/java/android/provider/SettingsStringUtil.java
@@ -126,7 +126,7 @@ public class SettingsStringUtil {
@Override
protected String itemToString(ComponentName item) {
- return item.flattenToString();
+ return item != null ? item.flattenToString() : "null";
}
public static String add(String delimitedElements, ComponentName element) {
diff --git a/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java b/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java
new file mode 100644
index 000000000000..de90b94d7535
--- /dev/null
+++ b/core/java/android/service/carrier/CarrierMessagingServiceWrapper.java
@@ -0,0 +1,389 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.service.carrier;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.net.Uri;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.List;
+
+/**
+ * Provides basic structure for platform to connect to the carrier messaging service.
+ * <p>
+ * <code>
+ * CarrierMessagingServiceWrapper carrierMessagingServiceWrapper =
+ * new CarrierMessagingServiceWrapperImpl();
+ * if (carrierMessagingServiceWrapper.bindToCarrierMessagingService(context, carrierPackageName)) {
+ * // wait for onServiceReady callback
+ * } else {
+ * // Unable to bind: handle error.
+ * }
+ * </code>
+ * <p> Upon completion {@link #disposeConnection} should be called to unbind the
+ * CarrierMessagingService.
+ * @hide
+ */
+@SystemApi
+public abstract class CarrierMessagingServiceWrapper {
+ // Populated by bindToCarrierMessagingService. bindToCarrierMessagingService must complete
+ // prior to calling disposeConnection so that mCarrierMessagingServiceConnection is initialized.
+ private volatile CarrierMessagingServiceConnection mCarrierMessagingServiceConnection;
+
+ private volatile ICarrierMessagingService mICarrierMessagingService;
+
+ /**
+ * Binds to the carrier messaging service under package {@code carrierPackageName}. This method
+ * should be called exactly once.
+ *
+ * @param context the context
+ * @param carrierPackageName the carrier package name
+ * @return true upon successfully binding to a carrier messaging service, false otherwise
+ * @hide
+ */
+ @SystemApi
+ public boolean bindToCarrierMessagingService(@NonNull Context context,
+ @NonNull String carrierPackageName) {
+ Preconditions.checkState(mCarrierMessagingServiceConnection == null);
+
+ Intent intent = new Intent(CarrierMessagingService.SERVICE_INTERFACE);
+ intent.setPackage(carrierPackageName);
+ mCarrierMessagingServiceConnection = new CarrierMessagingServiceConnection();
+ return context.bindService(intent, mCarrierMessagingServiceConnection,
+ Context.BIND_AUTO_CREATE);
+ }
+
+ /**
+ * Unbinds the carrier messaging service. This method should be called exactly once.
+ *
+ * @param context the context
+ * @hide
+ */
+ @SystemApi
+ public void disposeConnection(@NonNull Context context) {
+ Preconditions.checkNotNull(mCarrierMessagingServiceConnection);
+ context.unbindService(mCarrierMessagingServiceConnection);
+ mCarrierMessagingServiceConnection = null;
+ }
+
+ /**
+ * Implemented by subclasses to use the carrier messaging service once it is ready.
+ * @hide
+ */
+ @SystemApi
+ public abstract void onServiceReady();
+
+ /**
+ * Called when connection with service is established.
+ *
+ * @param carrierMessagingService the carrier messaing service interface
+ */
+ private void onServiceReady(ICarrierMessagingService carrierMessagingService) {
+ mICarrierMessagingService = carrierMessagingService;
+ onServiceReady();
+ }
+
+ /**
+ * Request filtering an incoming SMS message.
+ * The service will call callback.onFilterComplete with the filtering result.
+ *
+ * @param pdu the PDUs of the message
+ * @param format the format of the PDUs, typically "3gpp" or "3gpp2"
+ * @param destPort the destination port of a data SMS. It will be -1 for text SMS
+ * @param subId SMS subscription ID of the SIM
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void filterSms(@NonNull MessagePdu pdu, @NonNull String format, int destPort,
+ int subId, @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.filterSms(pdu, format, destPort, subId,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new text SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendSmsComplete} with the send
+ * status.
+ *
+ * @param text the text to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendTextSms(@NonNull String text, int subId, @NonNull String destAddress,
+ int sendSmsFlag, @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendTextSms(text, subId, destAddress, sendSmsFlag,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new data SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendSmsComplete} with the send
+ * status.
+ *
+ * @param data the data to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param destPort port number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendDataSms(@NonNull byte[] data, int subId, @NonNull String destAddress,
+ int destPort, int sendSmsFlag,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendDataSms(data, subId, destAddress, destPort,
+ sendSmsFlag, new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new multi-part text SMS from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendMultipartSmsComplete}
+ * with the send status.
+ *
+ * @param parts the parts of the multi-part text SMS to send
+ * @param subId SMS subscription ID of the SIM
+ * @param destAddress phone number of the recipient of the message
+ * @param sendSmsFlag flag for sending SMS
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendMultipartTextSms(@NonNull List<String> parts, int subId,
+ @NonNull String destAddress, int sendSmsFlag,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendMultipartTextSms(parts, subId, destAddress,
+ sendSmsFlag, new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request sending a new MMS PDU from the device.
+ * The service will call {@link ICarrierMessagingCallback#onSendMmsComplete} with the send
+ * status.
+ *
+ * @param pduUri the content provider URI of the PDU to send
+ * @param subId SMS subscription ID of the SIM
+ * @param location the optional URI to send this MMS PDU. If this is {code null},
+ * the PDU should be sent to the default MMSC URL.
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void sendMms(@NonNull Uri pduUri, int subId, @NonNull Uri location,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.sendMms(pduUri, subId, location,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * Request downloading a new MMS.
+ * The service will call {@link ICarrierMessagingCallback#onDownloadMmsComplete} with the
+ * download status.
+ *
+ * @param pduUri the content provider URI of the PDU to be downloaded.
+ * @param subId SMS subscription ID of the SIM
+ * @param location the URI of the message to be downloaded.
+ * @param callback the callback to notify upon completion
+ * @hide
+ */
+ @SystemApi
+ public void downloadMms(@NonNull Uri pduUri, int subId, @NonNull Uri location,
+ @NonNull final CarrierMessagingCallbackWrapper callback) {
+ if (mICarrierMessagingService != null) {
+ try {
+ mICarrierMessagingService.downloadMms(pduUri, subId, location,
+ new CarrierMessagingCallbackWrapperInternal(callback));
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ /**
+ * A basic {@link ServiceConnection}.
+ */
+ private final class CarrierMessagingServiceConnection implements ServiceConnection {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ onServiceReady(ICarrierMessagingService.Stub.asInterface(service));
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+ }
+
+ /**
+ * Callback wrapper used for response to requests exposed by
+ * {@link CarrierMessagingServiceWrapper}.
+ * @hide
+ */
+ @SystemApi
+ public abstract static class CarrierMessagingCallbackWrapper {
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#filterSms}.
+ * @param result a bitmask integer to indicate how the incoming text SMS should be handled
+ * by the platform. Bits set can be
+ * {@link CarrierMessagingService#RECEIVE_OPTIONS_DROP} and
+ * {@link CarrierMessagingService#
+ * RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE}.
+ * {@see CarrierMessagingService#onReceiveTextSms}.
+ * @hide
+ */
+ @SystemApi
+ public void onFilterComplete(int result) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendTextSms} and
+ * {@link CarrierMessagingServiceWrapper#sendDataSms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param messageRef message reference of the just-sent message. This field is applicable
+ * only if result is {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendSmsComplete(int result, int messageRef) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendMultipartTextSms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param messageRefs an array of message references, one for each part of the
+ * multipart SMS. This field is applicable only if result is
+ * {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendMultipartSmsComplete(int result, @Nullable int[] messageRefs) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#sendMms}.
+ * @param result send status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @param sendConfPdu a possibly {code null} SendConf PDU, which confirms that the message
+ * was sent. sendConfPdu is ignored if the {@code result} is not
+ * {@link CarrierMessagingService#SEND_STATUS_OK}.
+ * @hide
+ */
+ @SystemApi
+ public void onSendMmsComplete(int result, @Nullable byte[] sendConfPdu) {
+
+ }
+
+ /**
+ * Response callback for {@link CarrierMessagingServiceWrapper#downloadMms}.
+ * @param result download status, one of {@link CarrierMessagingService#SEND_STATUS_OK},
+ * {@link CarrierMessagingService#SEND_STATUS_RETRY_ON_CARRIER_NETWORK},
+ * and {@link CarrierMessagingService#SEND_STATUS_ERROR}.
+ * @hide
+ */
+ @SystemApi
+ public void onDownloadMmsComplete(int result) {
+
+ }
+ }
+
+ private final class CarrierMessagingCallbackWrapperInternal
+ extends ICarrierMessagingCallback.Stub {
+ CarrierMessagingCallbackWrapper mCarrierMessagingCallbackWrapper;
+
+ CarrierMessagingCallbackWrapperInternal(CarrierMessagingCallbackWrapper callback) {
+ mCarrierMessagingCallbackWrapper = callback;
+ }
+
+ @Override
+ public void onFilterComplete(int result) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onFilterComplete(result);
+ }
+
+ @Override
+ public void onSendSmsComplete(int result, int messageRef) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendSmsComplete(result, messageRef);
+ }
+
+ @Override
+ public void onSendMultipartSmsComplete(int result, int[] messageRefs)
+ throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendMultipartSmsComplete(result, messageRefs);
+ }
+
+ @Override
+ public void onSendMmsComplete(int result, byte[] sendConfPdu) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onSendMmsComplete(result, sendConfPdu);
+ }
+
+ @Override
+ public void onDownloadMmsComplete(int result) throws RemoteException {
+ mCarrierMessagingCallbackWrapper.onDownloadMmsComplete(result);
+ }
+ }
+}
diff --git a/core/java/android/service/carrier/CarrierService.java b/core/java/android/service/carrier/CarrierService.java
index aeb186b00686..9184d6d51f44 100644
--- a/core/java/android/service/carrier/CarrierService.java
+++ b/core/java/android/service/carrier/CarrierService.java
@@ -16,17 +16,15 @@ package android.service.carrier;
import android.annotation.CallSuper;
import android.app.Service;
+import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.PersistableBundle;
-import android.os.RemoteException;
import android.os.ResultReceiver;
-import android.os.ServiceManager;
+import android.os.telephony.TelephonyRegistryManager;
import android.util.Log;
-import com.android.internal.telephony.ITelephonyRegistry;
-
/**
* A service that exposes carrier-specific functionality to the system.
* <p>
@@ -55,16 +53,10 @@ public abstract class CarrierService extends Service {
public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";
- private static ITelephonyRegistry sRegistry;
-
private final ICarrierService.Stub mStubWrapper;
public CarrierService() {
mStubWrapper = new ICarrierServiceWrapper();
- if (sRegistry == null) {
- sRegistry = ITelephonyRegistry.Stub.asInterface(
- ServiceManager.getService("telephony.registry"));
- }
}
/**
@@ -122,9 +114,12 @@ public abstract class CarrierService extends Service {
* @see android.telephony.TelephonyManager#hasCarrierPrivileges
*/
public final void notifyCarrierNetworkChange(boolean active) {
- try {
- if (sRegistry != null) sRegistry.notifyCarrierNetworkChange(active);
- } catch (RemoteException | NullPointerException ex) {}
+ TelephonyRegistryManager telephonyRegistryMgr =
+ (TelephonyRegistryManager) this.getSystemService(
+ Context.TELEPHONY_REGISTRY_SERVICE);
+ if (telephonyRegistryMgr != null) {
+ telephonyRegistryMgr.notifyCarrierNetworkChange(active);
+ }
}
/**
diff --git a/core/java/android/service/carrier/ICarrierMessagingService.aidl b/core/java/android/service/carrier/ICarrierMessagingService.aidl
index 2d96c3da6487..c4dfb57bb6a0 100644
--- a/core/java/android/service/carrier/ICarrierMessagingService.aidl
+++ b/core/java/android/service/carrier/ICarrierMessagingService.aidl
@@ -36,6 +36,7 @@ oneway interface ICarrierMessagingService {
* @param subId SMS subscription ID of the SIM
* @param callback the callback to notify upon completion
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void filterSms(
in MessagePdu pdu, String format, int destPort, int subId,
in ICarrierMessagingCallback callback);
diff --git a/core/java/android/service/dreams/IDreamManager.aidl b/core/java/android/service/dreams/IDreamManager.aidl
index d3f2a70029f7..d254ffdb6986 100644
--- a/core/java/android/service/dreams/IDreamManager.aidl
+++ b/core/java/android/service/dreams/IDreamManager.aidl
@@ -29,6 +29,7 @@ interface IDreamManager {
void awaken();
@UnsupportedAppUsage
void setDreamComponents(in ComponentName[] componentNames);
+ @UnsupportedAppUsage
ComponentName[] getDreamComponents();
ComponentName getDefaultDreamComponent();
void testDream(in ComponentName componentName);
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index ff8b13506201..12c25806d666 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -15,6 +15,8 @@
*/
package android.service.euicc;
+import static android.telephony.euicc.EuiccCardManager.ResetOption;
+
import android.annotation.CallSuper;
import android.annotation.IntDef;
import android.annotation.NonNull;
@@ -503,7 +505,7 @@ public abstract class EuiccService extends Service {
String nickname);
/**
- * Erase all of the subscriptions on the device.
+ * Erase all operational subscriptions on the device.
*
* <p>This is intended to be used for device resets. As such, the reset should be performed even
* if an active SIM must be deactivated in order to access the eUICC.
@@ -512,10 +514,31 @@ public abstract class EuiccService extends Service {
* @return the result of the erase operation. May be one of the predefined {@code RESULT_}
* constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}.
* @see android.telephony.euicc.EuiccManager#eraseSubscriptions
+ *
+ * @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
+ * and use {@link #onEraseSubscriptionsWithOptions(int, int)} instead
*/
+ @Deprecated
public abstract int onEraseSubscriptions(int slotId);
/**
+ * Erase specific subscriptions on the device.
+ *
+ * <p>This is intended to be used for device resets. As such, the reset should be performed even
+ * if an active SIM must be deactivated in order to access the eUICC.
+ *
+ * @param slotIndex index of the SIM slot to use for the operation.
+ * @param options flag for specific group of subscriptions to erase
+ * @return the result of the erase operation. May be one of the predefined {@code RESULT_}
+ * constants or any implementation-specific code starting with {@link #RESULT_FIRST_USER}.
+ * @see android.telephony.euicc.EuiccManager#eraseSubscriptionsWithOptions
+ */
+ public int onEraseSubscriptionsWithOptions(int slotIndex, @ResetOption int options) {
+ throw new UnsupportedOperationException(
+ "This method must be overridden to enable the ResetOption parameter");
+ }
+
+ /**
* Ensure that subscriptions will be retained on the next factory reset.
*
* <p>Called directly before a factory reset. Assumes that a normal factory reset will lead to
@@ -751,6 +774,23 @@ public abstract class EuiccService extends Service {
}
@Override
+ public void eraseSubscriptionsWithOptions(
+ int slotIndex, @ResetOption int options, IEraseSubscriptionsCallback callback) {
+ mExecutor.execute(new Runnable() {
+ @Override
+ public void run() {
+ int result = EuiccService.this.onEraseSubscriptionsWithOptions(
+ slotIndex, options);
+ try {
+ callback.onComplete(result);
+ } catch (RemoteException e) {
+ // Can't communicate with the phone process; ignore.
+ }
+ }
+ });
+ }
+
+ @Override
public void retainSubscriptionsForFactoryReset(int slotId,
IRetainSubscriptionsForFactoryResetCallback callback) {
mExecutor.execute(new Runnable() {
diff --git a/core/java/android/service/euicc/IEuiccService.aidl b/core/java/android/service/euicc/IEuiccService.aidl
index c2cdf093706f..2acc47aae919 100644
--- a/core/java/android/service/euicc/IEuiccService.aidl
+++ b/core/java/android/service/euicc/IEuiccService.aidl
@@ -52,6 +52,8 @@ oneway interface IEuiccService {
void updateSubscriptionNickname(int slotId, String iccid, String nickname,
in IUpdateSubscriptionNicknameCallback callback);
void eraseSubscriptions(int slotId, in IEraseSubscriptionsCallback callback);
+ void eraseSubscriptionsWithOptions(
+ int slotIndex, int options, in IEraseSubscriptionsCallback callback);
void retainSubscriptionsForFactoryReset(
int slotId, in IRetainSubscriptionsForFactoryResetCallback callback);
} \ No newline at end of file
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index b44c9d59ebe5..93e3ea44f7c7 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -1514,6 +1514,7 @@ public abstract class NotificationListenerService extends Service {
private ArrayList<Notification.Action> mSmartActions;
private ArrayList<CharSequence> mSmartReplies;
private boolean mCanBubble;
+ private boolean mVisuallyInterruptive;
private static final int PARCEL_VERSION = 2;
@@ -1545,6 +1546,7 @@ public abstract class NotificationListenerService extends Service {
out.writeTypedList(mSmartActions, flags);
out.writeCharSequenceList(mSmartReplies);
out.writeBoolean(mCanBubble);
+ out.writeBoolean(mVisuallyInterruptive);
}
/** @hide */
@@ -1577,6 +1579,7 @@ public abstract class NotificationListenerService extends Service {
mSmartActions = in.createTypedArrayList(Notification.Action.CREATOR);
mSmartReplies = in.readCharSequenceList();
mCanBubble = in.readBoolean();
+ mVisuallyInterruptive = in.readBoolean();
}
@@ -1764,6 +1767,11 @@ public abstract class NotificationListenerService extends Service {
}
/** @hide */
+ public boolean visuallyInterruptive() {
+ return mVisuallyInterruptive;
+ }
+
+ /** @hide */
public boolean isNoisy() {
return mNoisy;
}
@@ -1779,7 +1787,8 @@ public abstract class NotificationListenerService extends Service {
ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge,
int userSentiment, boolean hidden, long lastAudiblyAlertedMs,
boolean noisy, ArrayList<Notification.Action> smartActions,
- ArrayList<CharSequence> smartReplies, boolean canBubble) {
+ ArrayList<CharSequence> smartReplies, boolean canBubble,
+ boolean visuallyInterruptive) {
mKey = key;
mRank = rank;
mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW;
@@ -1800,6 +1809,7 @@ public abstract class NotificationListenerService extends Service {
mSmartActions = smartActions;
mSmartReplies = smartReplies;
mCanBubble = canBubble;
+ mVisuallyInterruptive = visuallyInterruptive;
}
/**
@@ -1824,7 +1834,8 @@ public abstract class NotificationListenerService extends Service {
other.mNoisy,
other.mSmartActions,
other.mSmartReplies,
- other.mCanBubble);
+ other.mCanBubble,
+ other.mVisuallyInterruptive);
}
/**
diff --git a/core/java/android/util/Singleton.java b/core/java/android/util/Singleton.java
index 33135e6fd62c..15c6b5b5d7f8 100644
--- a/core/java/android/util/Singleton.java
+++ b/core/java/android/util/Singleton.java
@@ -26,6 +26,11 @@ import android.annotation.UnsupportedAppUsage;
* @hide
*/
public abstract class Singleton<T> {
+
+ @UnsupportedAppUsage
+ public Singleton() {
+ }
+
@UnsupportedAppUsage
private T mInstance;
diff --git a/core/java/android/view/AccessibilityIterators.java b/core/java/android/view/AccessibilityIterators.java
index 54cfc00cb5b3..5f9bf39fb3dd 100644
--- a/core/java/android/view/AccessibilityIterators.java
+++ b/core/java/android/view/AccessibilityIterators.java
@@ -47,6 +47,10 @@ public final class AccessibilityIterators {
public static abstract class AbstractTextSegmentIterator implements TextSegmentIterator {
@UnsupportedAppUsage
+ public AbstractTextSegmentIterator() {
+ }
+
+ @UnsupportedAppUsage
protected String mText;
private final int[] mSegment = new int[2];
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 39792ce58367..1c3294858db8 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -151,6 +151,7 @@ interface IWindowManager
float getCurrentAnimatorScale();
// For testing
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void setInTouchMode(boolean showFocus);
// For StrictMode flashing a red border on violations from the UI
@@ -158,6 +159,7 @@ interface IWindowManager
// Manager uses that to determine whether or not the red border should
// actually be shown. (it will be ignored that pid doesn't have windows
// on screen)
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void showStrictModeViolation(boolean on);
// Proxy to set the system property for whether the flashing
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index c6536bb71cba..8bbfd7441d0a 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -492,7 +492,7 @@ import java.util.function.Predicate;
*
* <p>
* To initiate a layout, call {@link #requestLayout}. This method is typically
- * called by a view on itself when it believes that is can no longer fit within
+ * called by a view on itself when it believes that it can no longer fit within
* its current bounds.
* </p>
*
@@ -2850,7 +2850,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Default for the root view. The gravity determines the text alignment, ALIGN_NORMAL,
- * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph’s text direction.
+ * ALIGN_CENTER, or ALIGN_OPPOSITE, which are relative to each paragraph's text direction.
*
* Use with {@link #setTextAlignment(int)}
*/
@@ -2878,7 +2878,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
public static final int TEXT_ALIGNMENT_CENTER = 4;
/**
- * Align to the start of the view, which is ALIGN_LEFT if the view’s resolved
+ * Align to the start of the view, which is ALIGN_LEFT if the view's resolved
* layoutDirection is LTR, and ALIGN_RIGHT otherwise.
*
* Use with {@link #setTextAlignment(int)}
@@ -2886,7 +2886,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
public static final int TEXT_ALIGNMENT_VIEW_START = 5;
/**
- * Align to the end of the view, which is ALIGN_RIGHT if the view’s resolved
+ * Align to the end of the view, which is ALIGN_RIGHT if the view's resolved
* layoutDirection is LTR, and ALIGN_LEFT otherwise.
*
* Use with {@link #setTextAlignment(int)}
@@ -3689,7 +3689,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* if the user swipes from the top of the screen.
* <p>When system bars are hidden in immersive mode, they can be revealed temporarily with
* system gestures, such as swiping from the top of the screen. These transient system bars
- * will overlay app’s content, may have some degree of transparency, and will automatically
+ * will overlay app's content, may have some degree of transparency, and will automatically
* hide after a short timeout.
* </p><p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_FULLSCREEN} and
* {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only has an effect when used in combination
@@ -4555,6 +4555,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
static class ListenerInfo {
+
+ @UnsupportedAppUsage
+ ListenerInfo() {
+ }
+
/**
* Listener used to dispatch focus change events.
* This field should be made private, so it is hidden from the SDK.
@@ -10293,7 +10298,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
}
/**
- * Gets the unique identifier of the window in which this View reseides.
+ * Gets the unique identifier of the window in which this View resides.
*
* @return The window accessibility id.
*
@@ -26391,7 +26396,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Returns the over-scroll mode for this view. The result will be
- * one of {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
+ * one of {@link #OVER_SCROLL_ALWAYS}, {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
* (allow over-scrolling only if the view content is larger than the container),
* or {@link #OVER_SCROLL_NEVER}.
*
@@ -26408,7 +26413,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Set the over-scroll mode for this view. Valid over-scroll modes are
- * {@link #OVER_SCROLL_ALWAYS} (default), {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
+ * {@link #OVER_SCROLL_ALWAYS}, {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}
* (allow over-scrolling only if the view content is larger than the container),
* or {@link #OVER_SCROLL_NEVER}.
*
@@ -27842,6 +27847,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
private int mClassification;
+ @UnsupportedAppUsage
+ private CheckForLongPress() {
+ }
+
@Override
public void run() {
if ((mOriginalPressedState == isPressed()) && (mParent != null)
@@ -28327,6 +28336,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* whenever possible.
*/
static class InvalidateInfo {
+
+ @UnsupportedAppUsage
+ InvalidateInfo() {
+ }
+
private static final int POOL_LIMIT = 10;
private static final SynchronizedPool<InvalidateInfo> sPool =
diff --git a/core/java/android/view/ViewDebug.java b/core/java/android/view/ViewDebug.java
index 8a1fd62c0201..c67fca59fe97 100644
--- a/core/java/android/view/ViewDebug.java
+++ b/core/java/android/view/ViewDebug.java
@@ -870,6 +870,94 @@ public class ViewDebug {
return null;
}
+ private static class StreamingPictureCallbackHandler implements AutoCloseable,
+ HardwareRenderer.PictureCapturedCallback, Runnable {
+ private final HardwareRenderer mRenderer;
+ private final Callable<OutputStream> mCallback;
+ private final Executor mExecutor;
+ private final ReentrantLock mLock = new ReentrantLock(false);
+ private final ArrayDeque<byte[]> mQueue = new ArrayDeque<>(3);
+ private final ByteArrayOutputStream mByteStream = new ByteArrayOutputStream();
+ private boolean mStopListening;
+ private Thread mRenderThread;
+
+ private StreamingPictureCallbackHandler(HardwareRenderer renderer,
+ Callable<OutputStream> callback, Executor executor) {
+ mRenderer = renderer;
+ mCallback = callback;
+ mExecutor = executor;
+ mRenderer.setPictureCaptureCallback(this);
+ }
+
+ @Override
+ public void close() {
+ mLock.lock();
+ mStopListening = true;
+ mLock.unlock();
+ mRenderer.setPictureCaptureCallback(null);
+ }
+
+ @Override
+ public void onPictureCaptured(Picture picture) {
+ mLock.lock();
+ if (mStopListening) {
+ mLock.unlock();
+ mRenderer.setPictureCaptureCallback(null);
+ return;
+ }
+ if (mRenderThread == null) {
+ mRenderThread = Thread.currentThread();
+ }
+ boolean needsInvoke = true;
+ if (mQueue.size() == 3) {
+ mQueue.removeLast();
+ needsInvoke = false;
+ }
+ picture.writeToStream(mByteStream);
+ mQueue.add(mByteStream.toByteArray());
+ mByteStream.reset();
+ mLock.unlock();
+
+ if (needsInvoke) {
+ mExecutor.execute(this);
+ }
+ }
+
+ @Override
+ public void run() {
+ mLock.lock();
+ final byte[] picture = mQueue.poll();
+ final boolean isStopped = mStopListening;
+ mLock.unlock();
+ if (Thread.currentThread() == mRenderThread) {
+ close();
+ throw new IllegalStateException(
+ "ViewDebug#startRenderingCommandsCapture must be given an executor that "
+ + "invokes asynchronously");
+ }
+ if (isStopped) {
+ return;
+ }
+ OutputStream stream = null;
+ try {
+ stream = mCallback.call();
+ } catch (Exception ex) {
+ Log.w("ViewDebug", "Aborting rendering commands capture "
+ + "because callback threw exception", ex);
+ }
+ if (stream != null) {
+ try {
+ stream.write(picture);
+ } catch (IOException ex) {
+ Log.w("ViewDebug", "Aborting rendering commands capture "
+ + "due to IOException writing to output stream", ex);
+ }
+ } else {
+ close();
+ }
+ }
+ }
+
/**
* Begins capturing the entire rendering commands for the view tree referenced by the given
* view. The view passed may be any View in the tree as long as it is attached. That is,
@@ -915,18 +1003,7 @@ public class ViewDebug {
}
final HardwareRenderer renderer = attachInfo.mThreadedRenderer;
if (renderer != null) {
- return new PictureCallbackHandler(renderer, (picture -> {
- try {
- OutputStream stream = callback.call();
- if (stream != null) {
- picture.writeToStream(stream);
- return true;
- }
- } catch (Exception ex) {
- // fall through
- }
- return false;
- }), executor);
+ return new StreamingPictureCallbackHandler(renderer, callback, executor);
}
return null;
}
diff --git a/core/java/android/view/ViewTreeObserver.java b/core/java/android/view/ViewTreeObserver.java
index 9a5f4c9cc8b9..c72baca0b93b 100644
--- a/core/java/android/view/ViewTreeObserver.java
+++ b/core/java/android/view/ViewTreeObserver.java
@@ -218,6 +218,11 @@ public final class ViewTreeObserver {
* @hide
*/
public final static class InternalInsetsInfo {
+
+ @UnsupportedAppUsage
+ public InternalInsetsInfo() {
+ }
+
/**
* Offsets from the frame of the window at which the content of
* windows behind it should be placed.
diff --git a/core/java/android/view/animation/AnimationUtils.java b/core/java/android/view/animation/AnimationUtils.java
index c877b9cec812..f5b074674454 100644
--- a/core/java/android/view/animation/AnimationUtils.java
+++ b/core/java/android/view/animation/AnimationUtils.java
@@ -127,7 +127,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The animation object referenced by the specified id
* @throws NotFoundException when the animation cannot be loaded
*/
public static Animation loadAnimation(Context context, @AnimRes int id)
@@ -208,7 +208,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The animation controller object referenced by the specified id
* @throws NotFoundException when the layout animation controller cannot be loaded
*/
public static LayoutAnimationController loadLayoutAnimation(Context context, @AnimRes int id)
@@ -331,7 +331,7 @@ public class AnimationUtils {
*
* @param context Application context used to access resources
* @param id The resource id of the animation to load
- * @return The animation object reference by the specified id
+ * @return The interpolator object referenced by the specified id
* @throws NotFoundException
*/
public static Interpolator loadInterpolator(Context context, @AnimRes @InterpolatorRes int id)
@@ -361,7 +361,7 @@ public class AnimationUtils {
*
* @param res The resources
* @param id The resource id of the animation to load
- * @return The interpolator object reference by the specified id
+ * @return The interpolator object referenced by the specified id
* @throws NotFoundException
* @hide
*/
diff --git a/core/java/android/webkit/CacheManager.java b/core/java/android/webkit/CacheManager.java
index 563e00e3ca6a..7e067197ced8 100644
--- a/core/java/android/webkit/CacheManager.java
+++ b/core/java/android/webkit/CacheManager.java
@@ -50,6 +50,11 @@ public final class CacheManager {
*/
@Deprecated
public static class CacheResult {
+
+ @UnsupportedAppUsage
+ public CacheResult() {
+ }
+
// these fields are saved to the database
@UnsupportedAppUsage
int httpStatusCode;
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 23d12374453f..3824c22a40a7 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -22,7 +22,10 @@ import android.net.WebAddress;
/**
* Manages the cookies used by an application's {@link WebView} instances.
- * Cookies are manipulated according to RFC2109.
+ * <p>
+ * CookieManager represents cookies as strings in the same format as the
+ * HTTP {@code Cookie} and {@code Set-Cookie} header fields (defined in
+ * <a href="https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03">RFC6265bis</a>).
*/
public abstract class CookieManager {
/**
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index 4db630808ef1..f8522edb7dcd 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -71,11 +71,24 @@ public class WebChromeClient {
}
/**
- * Notify the host application that the current page has entered full
- * screen mode. The host application must show the custom View which
- * contains the web contents &mdash; video or other HTML content &mdash;
- * in full screen mode. Also see "Full screen support" documentation on
- * {@link WebView}.
+ * Notify the host application that the current page has entered full screen mode. After this
+ * call, web content will no longer be rendered in the WebView, but will instead be rendered
+ * in {@code view}. The host application should add this View to a Window which is configured
+ * with {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN} flag in order to
+ * actually display this web content full screen.
+ *
+ * <p>The application may explicitly exit fullscreen mode by invoking {@code callback} (ex. when
+ * the user presses the back button). However, this is generally not necessary as the web page
+ * will often show its own UI to close out of fullscreen. Regardless of how the WebView exits
+ * fullscreen mode, WebView will invoke {@link #onHideCustomView()}, signaling for the
+ * application to remove the custom View.
+ *
+ * <p>If this method is not overridden, WebView will report to the web page it does not support
+ * fullscreen mode and will not honor the web page's request to run in fullscreen mode.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onHideCustomView()}.
+ *
* @param view is the View object to be shown.
* @param callback invoke this callback to request the page to exit
* full screen mode.
@@ -98,10 +111,13 @@ public class WebChromeClient {
CustomViewCallback callback) {};
/**
- * Notify the host application that the current page has exited full
- * screen mode. The host application must hide the custom View, ie. the
- * View passed to {@link #onShowCustomView} when the content entered fullscreen.
- * Also see "Full screen support" documentation on {@link WebView}.
+ * Notify the host application that the current page has exited full screen mode. The host
+ * application must hide the custom View (the View which was previously passed to {@link
+ * #onShowCustomView(View, CustomViewCallback) onShowCustomView()}). After this call, web
+ * content will render in the original WebView again.
+ *
+ * <p class="note"><b>Note:</b> if overriding this method, the application must also override
+ * {@link #onShowCustomView(View, CustomViewCallback) onShowCustomView()}.
*/
public void onHideCustomView() {}
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 7282008f7e3a..2895621f962a 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -328,6 +328,9 @@ public abstract class WebSettings {
* <p>
* The built-in mechanisms are the only currently supported zoom
* mechanisms, so it is recommended that this setting is always enabled.
+ * However, on-screen zoom controls are deprecated in Android (see
+ * {@link android.widget.ZoomButtonsController}) so it's recommended to
+ * disable {@link #setDisplayZoomControls}.
*
* @param enabled whether the WebView should use its built-in zoom mechanisms
*/
@@ -347,7 +350,9 @@ public abstract class WebSettings {
/**
* Sets whether the WebView should display on-screen zoom controls when
* using the built-in zoom mechanisms. See {@link #setBuiltInZoomControls}.
- * The default is {@code true}.
+ * The default is {@code true}. However, on-screen zoom controls are deprecated
+ * in Android (see {@link android.widget.ZoomButtonsController}) so it's
+ * recommended to set this to {@code false}.
*
* @param enabled whether the WebView should display on-screen zoom controls
*/
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 2f44d6ee88b1..b732b7eeaa01 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -120,10 +120,6 @@ import java.util.function.Predicate;
* <a href="{@docRoot}training/improving-layouts/smooth-scrolling.html">
* Making ListView Scrolling Smooth</a> for more ways to ensure a smooth user experience.</p>
*
- * <p>For a more complete example of creating a custom adapter, see the
- * <a href="{@docRoot}samples/CustomChoiceList/index.html">
- * Custom Choice List</a> sample app.</p>
- *
* <p>To specify an action when a user clicks or taps on a single list item, see
* <a href="{@docRoot}guide/topics/ui/declaring-layout.html#HandlingUserSelections">
* Handling click events</a>.</p>
diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java
index 6b324a541c42..facb7d09f250 100644
--- a/core/java/android/widget/RelativeLayout.java
+++ b/core/java/android/widget/RelativeLayout.java
@@ -36,7 +36,6 @@ import android.view.ViewGroup;
import android.view.ViewHierarchyEncoder;
import android.view.accessibility.AccessibilityEvent;
import android.view.inspector.InspectableProperty;
-import android.view.inspector.InspectionCompanion;
import android.view.inspector.PropertyMapper;
import android.view.inspector.PropertyReader;
import android.widget.RemoteViews.RemoteView;
@@ -73,7 +72,7 @@ import java.util.TreeSet;
*
* <p>This behavior has been preserved for apps that set <code>android:targetSdkVersion="17"</code>
* or older in their manifest's <code>uses-sdk</code> tag for compatibility. Apps targeting SDK
- * version 18 or newer will receive the correct behavior</p>
+ * version 18 or newer will receive the correct behavior.</p>
*
* <p>See the <a href="{@docRoot}guide/topics/ui/layout/relative.html">Relative
* Layout</a> guide.</p>
@@ -2026,6 +2025,11 @@ public class RelativeLayout extends ViewGroup {
* A node with no dependent is considered a root of the graph.
*/
static class Node {
+
+ @UnsupportedAppUsage
+ Node() {
+ }
+
/**
* The view representing this node in the layout.
*/
diff --git a/core/java/android/widget/ScrollBarDrawable.java b/core/java/android/widget/ScrollBarDrawable.java
index 1bed32ecf347..a5d3e45323a4 100644
--- a/core/java/android/widget/ScrollBarDrawable.java
+++ b/core/java/android/widget/ScrollBarDrawable.java
@@ -60,6 +60,10 @@ public class ScrollBarDrawable extends Drawable implements Drawable.Callback {
private ColorFilter mColorFilter;
private boolean mHasSetColorFilter;
+ @UnsupportedAppUsage
+ public ScrollBarDrawable() {
+ }
+
/**
* Indicate whether the horizontal scrollbar track should always be drawn
* regardless of the extent. Defaults to false.
diff --git a/core/java/com/android/internal/app/AlertActivity.java b/core/java/com/android/internal/app/AlertActivity.java
index 0b08099b51ed..7307de5146f8 100644
--- a/core/java/com/android/internal/app/AlertActivity.java
+++ b/core/java/com/android/internal/app/AlertActivity.java
@@ -34,6 +34,10 @@ import android.view.accessibility.AccessibilityEvent;
*/
public abstract class AlertActivity extends Activity implements DialogInterface {
+ @UnsupportedAppUsage
+ public AlertActivity() {
+ }
+
/**
* The model for the alert.
*
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index cae1f3831b4a..102ba5c2ec5e 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -26,6 +26,7 @@ import android.animation.ValueAnimator;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.UnsupportedAppUsage;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.prediction.AppPredictionContext;
@@ -141,6 +142,9 @@ import java.util.Set;
public class ChooserActivity extends ResolverActivity {
private static final String TAG = "ChooserActivity";
+ @UnsupportedAppUsage
+ public ChooserActivity() {
+ }
/**
* Boolean extra to change the following behavior: Normally, ChooserActivity finishes itself
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 068056f091d7..c7d2547a24f4 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -101,6 +101,10 @@ import java.util.Set;
@UiThread
public class ResolverActivity extends Activity {
+ @UnsupportedAppUsage
+ public ResolverActivity() {
+ }
+
// Temporary flag for new chooser delegate behavior.
boolean mEnableChooserDelegate = true;
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeConfig.java b/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
index fd2ada08edc1..36bc22906695 100644
--- a/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
+++ b/core/java/com/android/internal/compat/CompatibilityChangeConfig.java
@@ -49,6 +49,18 @@ public final class CompatibilityChangeConfig implements Parcelable {
return mChangeConfig.forceDisabledSet();
}
+ /**
+ * Returns if a change is enabled or disabled in this config.
+ */
+ public boolean isChangeEnabled(long changeId) {
+ if (mChangeConfig.isForceEnabled(changeId)) {
+ return true;
+ } else if (mChangeConfig.isForceDisabled(changeId)) {
+ return false;
+ }
+ throw new IllegalStateException("Change " + changeId + " is not defined.");
+ }
+
private CompatibilityChangeConfig(Parcel in) {
long[] enabledArray = in.createLongArray();
long[] disabledArray = in.createLongArray();
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl b/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl
new file mode 100644
index 000000000000..3bc72771f99c
--- /dev/null
+++ b/core/java/com/android/internal/compat/CompatibilityChangeInfo.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.compat;
+
+parcelable CompatibilityChangeInfo;
diff --git a/core/java/com/android/internal/compat/CompatibilityChangeInfo.java b/core/java/com/android/internal/compat/CompatibilityChangeInfo.java
new file mode 100644
index 000000000000..e48e2df4043c
--- /dev/null
+++ b/core/java/com/android/internal/compat/CompatibilityChangeInfo.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.internal.compat;
+
+import android.annotation.Nullable;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * This class is a parcelable version of {@link com.android.server.compat.Change}.
+ *
+ * @hide
+ */
+public class CompatibilityChangeInfo implements Parcelable {
+ private final long mChangeId;
+ private final @Nullable String mName;
+ private final int mEnableAfterTargetSdk;
+ private final boolean mDisabled;
+
+ public long getId() {
+ return mChangeId;
+ }
+
+ @Nullable
+ public String getName() {
+ return mName;
+ }
+
+ public int getEnableAfterTargetSdk() {
+ return mEnableAfterTargetSdk;
+ }
+
+ public boolean getDisabled() {
+ return mDisabled;
+ }
+
+ public CompatibilityChangeInfo(
+ Long changeId, String name, int enableAfterTargetSdk, boolean disabled) {
+ this.mChangeId = changeId;
+ this.mName = name;
+ this.mEnableAfterTargetSdk = enableAfterTargetSdk;
+ this.mDisabled = disabled;
+ }
+
+ private CompatibilityChangeInfo(Parcel in) {
+ mChangeId = in.readLong();
+ mName = in.readString();
+ mEnableAfterTargetSdk = in.readInt();
+ mDisabled = in.readBoolean();
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeLong(mChangeId);
+ dest.writeString(mName);
+ dest.writeInt(mEnableAfterTargetSdk);
+ dest.writeBoolean(mDisabled);
+ }
+
+ public static final Parcelable.Creator<CompatibilityChangeInfo> CREATOR =
+ new Parcelable.Creator<CompatibilityChangeInfo>() {
+
+ @Override
+ public CompatibilityChangeInfo createFromParcel(Parcel in) {
+ return new CompatibilityChangeInfo(in);
+ }
+
+ @Override
+ public CompatibilityChangeInfo[] newArray(int size) {
+ return new CompatibilityChangeInfo[size];
+ }
+ };
+}
diff --git a/core/java/com/android/internal/compat/IPlatformCompat.aidl b/core/java/com/android/internal/compat/IPlatformCompat.aidl
index 8391ad2f12c2..5857642cbd4e 100644
--- a/core/java/com/android/internal/compat/IPlatformCompat.aidl
+++ b/core/java/com/android/internal/compat/IPlatformCompat.aidl
@@ -17,8 +17,10 @@
package com.android.internal.compat;
import android.content.pm.ApplicationInfo;
+import java.util.Map;
parcelable CompatibilityChangeConfig;
+parcelable CompatibilityChangeInfo;
/**
* Platform private API for talking with the PlatformCompat service.
@@ -146,4 +148,21 @@ interface IPlatformCompat
*
*/
void clearOverrides(in String packageName);
+
+ /**
+ * Get configs for an application.
+ *
+ * @param appInfo The application whose config will be returned.
+ *
+ * @return A {@link CompatibilityChangeConfig}, representing whether a change is enabled for
+ * the given app or not.
+ */
+ CompatibilityChangeConfig getAppConfig(in ApplicationInfo appInfo);
+
+ /**
+ * List all compatibility changes.
+ *
+ * @return An array of {@link CompatChangeInfo} known to the service.
+ */
+ CompatibilityChangeInfo[] listAllChanges();
}
diff --git a/core/java/com/android/internal/content/PackageMonitor.java b/core/java/com/android/internal/content/PackageMonitor.java
index c928f3f39f03..5d7d3af8750a 100644
--- a/core/java/com/android/internal/content/PackageMonitor.java
+++ b/core/java/com/android/internal/content/PackageMonitor.java
@@ -27,6 +27,7 @@ import android.os.Handler;
import android.os.Looper;
import android.os.UserHandle;
import android.util.Slog;
+
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.Preconditions;
@@ -72,6 +73,10 @@ public abstract class PackageMonitor extends android.content.BroadcastReceiver {
String[] mTempArray = new String[1];
@UnsupportedAppUsage
+ public PackageMonitor() {
+ }
+
+ @UnsupportedAppUsage
public void register(Context context, Looper thread, boolean externalStorage) {
register(context, thread, null, externalStorage);
}
diff --git a/core/java/com/android/internal/logging/MetricsLogger.java b/core/java/com/android/internal/logging/MetricsLogger.java
index a691a2403f37..f916cf64564d 100644
--- a/core/java/com/android/internal/logging/MetricsLogger.java
+++ b/core/java/com/android/internal/logging/MetricsLogger.java
@@ -41,6 +41,10 @@ public class MetricsLogger {
private static MetricsLogger sMetricsLogger;
+ @UnsupportedAppUsage
+ public MetricsLogger() {
+ }
+
private static MetricsLogger getLogger() {
if (sMetricsLogger == null) {
sMetricsLogger = new MetricsLogger();
diff --git a/core/java/com/android/internal/net/LegacyVpnInfo.java b/core/java/com/android/internal/net/LegacyVpnInfo.java
index 9ee97108ce49..2ad9759b1f68 100644
--- a/core/java/com/android/internal/net/LegacyVpnInfo.java
+++ b/core/java/com/android/internal/net/LegacyVpnInfo.java
@@ -45,6 +45,10 @@ public class LegacyVpnInfo implements Parcelable {
public int state = -1;
public PendingIntent intent;
+ @UnsupportedAppUsage
+ public LegacyVpnInfo() {
+ }
+
@Override
public int describeContents() {
return 0;
diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java
index 65b974ba8b42..e6be54964705 100644
--- a/core/java/com/android/internal/net/VpnConfig.java
+++ b/core/java/com/android/internal/net/VpnConfig.java
@@ -108,6 +108,10 @@ public class VpnConfig implements Parcelable {
public Network[] underlyingNetworks;
public ProxyInfo proxyInfo;
+ @UnsupportedAppUsage
+ public VpnConfig() {
+ }
+
public void updateAllowedFamilies(InetAddress address) {
if (address instanceof Inet4Address) {
allowIPv4 = true;
diff --git a/core/java/com/android/internal/os/BaseCommand.java b/core/java/com/android/internal/os/BaseCommand.java
index 278f40660ee9..5ba662913529 100644
--- a/core/java/com/android/internal/os/BaseCommand.java
+++ b/core/java/com/android/internal/os/BaseCommand.java
@@ -40,6 +40,10 @@ public abstract class BaseCommand {
private String[] mRawArgs;
+ @UnsupportedAppUsage
+ public BaseCommand() {
+ }
+
/**
* Call to run the command.
*/
diff --git a/core/java/com/android/internal/os/BatterySipper.java b/core/java/com/android/internal/os/BatterySipper.java
index 02c9542fa40d..b1fc369835c6 100644
--- a/core/java/com/android/internal/os/BatterySipper.java
+++ b/core/java/com/android/internal/os/BatterySipper.java
@@ -134,6 +134,8 @@ public class BatterySipper implements Comparable<BatterySipper> {
// This list must be kept current with atoms.proto (frameworks/base/cmds/statsd/src/atoms.proto)
// so the ordinal values (and therefore the order) must never change.
// ****************
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/os/BatterySipper$DrainType;")
public enum DrainType {
AMBIENT_DISPLAY,
@UnsupportedAppUsage
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 46e041b3f33e..3d91c37272ad 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -114,6 +114,13 @@ public final class Zygote {
*/
public static final int DEBUG_IGNORE_APP_SIGNAL_HANDLER = 1 << 17;
+ /**
+ * Disable runtime access to {@link android.annotation.TestApi} annotated members.
+ *
+ * <p>This only takes effect if Hidden API access restrictions are enabled as well.
+ */
+ public static final int DISABLE_TEST_API_ENFORCEMENT_POLICY = 1 << 18;
+
/** No external storage should be mounted. */
public static final int MOUNT_EXTERNAL_NONE = IVold.REMOUNT_MODE_NONE;
/** Default external storage should be mounted. */
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 72d24645a2e7..ad4c6dd7a92b 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -248,6 +248,18 @@ public class ZygoteInit {
InputStream is;
try {
+ // If we are profiling the boot image, avoid preloading classes.
+ // Can't use device_config since we are the zygote.
+ String prop = SystemProperties.get(
+ "persist.device_config.runtime_native_boot.profilebootclasspath", "");
+ // Might be empty if the property is unset since the default is "".
+ if (prop.length() == 0) {
+ prop = SystemProperties.get("dalvik.vm.profilebootclasspath", "");
+ }
+ if ("true".equals(prop)) {
+ return;
+ }
+
is = new FileInputStream(PRELOADED_CLASSES);
} catch (FileNotFoundException e) {
Log.e(TAG, "Couldn't find " + PRELOADED_CLASSES + ".");
diff --git a/core/java/com/android/internal/preference/YesNoPreference.java b/core/java/com/android/internal/preference/YesNoPreference.java
index 7abf416bf0af..94ef619f286a 100644
--- a/core/java/com/android/internal/preference/YesNoPreference.java
+++ b/core/java/com/android/internal/preference/YesNoPreference.java
@@ -23,6 +23,8 @@ import android.os.Parcelable;
import android.preference.DialogPreference;
import android.util.AttributeSet;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* The {@link YesNoPreference} is a preference to show a dialog with Yes and No
* buttons.
@@ -40,6 +42,7 @@ public class YesNoPreference extends DialogPreference {
this(context, attrs, defStyleAttr, 0);
}
+ @UnsupportedAppUsage
public YesNoPreference(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.yesNoPreferenceStyle);
}
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index 630916ebeecb..c1d129b66e7a 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -24,6 +24,10 @@ public final class MemInfoReader {
final long[] mInfos = new long[Debug.MEMINFO_COUNT];
@UnsupportedAppUsage
+ public MemInfoReader() {
+ }
+
+ @UnsupportedAppUsage
public void readMemInfo() {
// Permit disk reads here, as /proc/meminfo isn't really "on
// disk" and should be fast. TODO: make BlockGuard ignore
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index f9cdf3d0be61..f5a9fde97159 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -16,9 +16,11 @@
package com.android.internal.view;
+import android.annotation.UnsupportedAppUsage;
import android.graphics.Point;
import android.graphics.Rect;
import android.hardware.input.InputManager;
+import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
@@ -37,6 +39,10 @@ public class BaseIWindow extends IWindow.Stub {
private IWindowSession mSession;
public int mSeq;
+ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
+ public BaseIWindow() {
+ }
+
public void setSession(IWindowSession session) {
mSession = session;
}
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index d48034b66266..1f5b0701d2a7 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -91,6 +91,10 @@ public class PointerLocationView extends View implements InputDeviceListener,
private VelocityTracker.Estimator mEstimator = new VelocityTracker.Estimator();
private VelocityTracker.Estimator mAltEstimator = new VelocityTracker.Estimator();
+ @UnsupportedAppUsage
+ public PointerState() {
+ }
+
public void clearTrace() {
mTraceCount = 0;
}
diff --git a/core/java/com/android/server/net/BaseNetworkObserver.java b/core/java/com/android/server/net/BaseNetworkObserver.java
index a0740eee5df6..e1a10a5805f5 100644
--- a/core/java/com/android/server/net/BaseNetworkObserver.java
+++ b/core/java/com/android/server/net/BaseNetworkObserver.java
@@ -28,6 +28,11 @@ import android.net.RouteInfo;
* @hide
*/
public class BaseNetworkObserver extends INetworkManagementEventObserver.Stub {
+
+ @UnsupportedAppUsage
+ public BaseNetworkObserver() {
+ }
+
@Override
public void interfaceStatusChanged(String iface, boolean up) {
// default no-op
diff --git a/core/java/com/google/android/util/AbstractMessageParser.java b/core/java/com/google/android/util/AbstractMessageParser.java
index 9d12f82aeb75..00fcb16f6d3a 100644
--- a/core/java/com/google/android/util/AbstractMessageParser.java
+++ b/core/java/com/google/android/util/AbstractMessageParser.java
@@ -17,13 +17,14 @@
package com.google.android.util;
import android.annotation.UnsupportedAppUsage;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.Set;
-import java.util.List;
/**
*
@@ -653,8 +654,9 @@ public abstract class AbstractMessageParser {
/** Represents a unit of parsed output. */
public static abstract class Token {
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/google/android/util/AbstractMessageParser$Token$Type;")
public enum Type {
-
@UnsupportedAppUsage
HTML ("html"),
@UnsupportedAppUsage
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index bb5780558bdf..3704ccdfb8ea 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -59,6 +59,10 @@ FileDescriptorWhitelist* FileDescriptorWhitelist::Get() {
return instance_;
}
+static bool IsArtMemfd(const std::string& path) {
+ return android::base::StartsWith(path, "/memfd:/boot-image-methods.art");
+}
+
bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
// Check the static whitelist path.
for (const auto& whitelist_path : kPathWhitelist) {
@@ -87,6 +91,11 @@ bool FileDescriptorWhitelist::IsAllowed(const std::string& path) const {
return true;
}
+ // the in-memory file created by ART through memfd_create is allowed.
+ if (IsArtMemfd(path)) {
+ return true;
+ }
+
// Whitelist files needed for Runtime Resource Overlay, like these:
// /system/vendor/overlay/framework-res.apk
// /system/vendor/overlay-subdir/pg/framework-res.apk
@@ -312,6 +321,11 @@ void FileDescriptorInfo::ReopenOrDetach(fail_fn_t fail_fn) const {
return DetachSocket(fail_fn);
}
+ // Children can directly use the in-memory file created by ART through memfd_create.
+ if (IsArtMemfd(file_path)) {
+ return;
+ }
+
// NOTE: This might happen if the file was unlinked after being opened.
// It's a common pattern in the case of temporary files and the like but
// we should not allow such usage from the zygote.
@@ -531,6 +545,10 @@ FileDescriptorTable::FileDescriptorTable(
}
void FileDescriptorTable::RestatInternal(std::set<int>& open_fds, fail_fn_t fail_fn) {
+ // ART creates a file through memfd for optimization purposes. We make sure
+ // there is at most one being created.
+ bool art_memfd_seen = false;
+
// Iterate through the list of file descriptors we've already recorded
// and check whether :
//
@@ -563,6 +581,14 @@ void FileDescriptorTable::RestatInternal(std::set<int>& open_fds, fail_fn_t fail
// FD.
}
+ if (IsArtMemfd(it->second->file_path)) {
+ if (art_memfd_seen) {
+ fail_fn("ART fd already seen: " + it->second->file_path);
+ } else {
+ art_memfd_seen = true;
+ }
+ }
+
++it;
// Finally, remove the FD from the set of open_fds. We do this last because
diff --git a/core/proto/OWNERS b/core/proto/OWNERS
index 6ab0fc91d744..74ced8921799 100644
--- a/core/proto/OWNERS
+++ b/core/proto/OWNERS
@@ -3,8 +3,10 @@
# Metrics
joeo@google.com
singhtejinder@google.com
+yanmin@google.com
yaochen@google.com
yro@google.com
+zhouwenjie@google.com
# Settings UI
per-file settings_enums.proto=tmfang@google.com
diff --git a/core/proto/android/app/settings_enums.proto b/core/proto/android/app/settings_enums.proto
index f817c9bec3f5..0ccef6ea17c8 100644
--- a/core/proto/android/app/settings_enums.proto
+++ b/core/proto/android/app/settings_enums.proto
@@ -2406,4 +2406,9 @@ enum PageId {
// CATEGORY: SETTINGS
// OS: Q
SETTINGS_AWARE_DISPLAY = 1750;
+
+ // OPEN: Settings > System > Input & Gesture > tap gesture
+ // CATEGORY: SETTINGS
+ // OS: Q
+ SETTINGS_GESTURE_TAP = 1751;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 9aacbe65e480..1f20d7afb983 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -497,6 +497,7 @@
<protected-broadcast android:name="android.telephony.action.CARRIER_CONFIG_CHANGED" />
<protected-broadcast android:name="android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED" />
<protected-broadcast android:name="android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED" />
+ <protected-broadcast android:name="android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED" />
<protected-broadcast android:name="android.telephony.action.SECRET_CODE" />
<protected-broadcast android:name="android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION" />
<protected-broadcast android:name="android.telephony.action.SUBSCRIPTION_PLANS_CHANGED" />
diff --git a/core/res/res/values-mcc208-mnc10-fr/strings.xml b/core/res/res/values-mcc208-mnc10-fr/strings.xml
new file mode 100644
index 000000000000..a1a2c8f4887f
--- /dev/null
+++ b/core/res/res/values-mcc208-mnc10-fr/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="wifi_calling_off_summary" msgid="8720659586041656098">Utiliser les appels Wi-Fi lorsque le service est disponible</string>
+</resources>
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index ea62c980ca17..7dc0788d0f3e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -448,7 +448,7 @@
</string-array>
<!-- Package name for the default CellBroadcastService module [DO NOT TRANSLATE] -->
- <string name="cellbroadcast_default_package" translatable="false">com.android.cellbroadcastreceiver
+ <string name="cellbroadcast_default_package" translatable="false">com.android.cellbroadcastservice
</string>
<!-- If the mobile hotspot feature requires provisioning, a package name and class name
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 55271258c882..cbeca16758f6 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -4858,10 +4858,10 @@
<string name="confirm_battery_saver">OK</string>
<!-- [CHAR_LIMIT=NONE] Battery saver: Feature description, with a "learn more" link. -->
- <string name="battery_saver_description_with_learn_more">Battery Saver turns off or restricts background activity, some visual effects \u0026 other high-power features to extend battery life. <annotation id="url">Learn More</annotation></string>
+ <string name="battery_saver_description_with_learn_more">To extend battery life, Battery Saver:\n&#183;Turns on Dark theme\n&#183;Turns off or restricts background activity, some visual effects, and other features like \u201cHey Google\u201d\n\n<annotation id="url">Learn more</annotation></string>
<!-- [CHAR_LIMIT=NONE] Battery saver: Feature description, without a "learn more" link. -->
- <string name="battery_saver_description">Battery Saver turns off or restricts background activity, some visual effects \u0026 other high-power features to extend battery life.</string>
+ <string name="battery_saver_description">To extend battery life, Battery Saver:\n&#183;Turns on Dark theme\n&#183;Turns off or restricts background activity, some visual effects, and other features like \u201cHey Google\u201d</string>
<!-- [CHAR_LIMIT=NONE] Data saver: Feature description -->
<string name="data_saver_description">To help reduce data usage, Data Saver prevents some apps from sending or receiving data in the background. An app you’re currently using can access data, but may do so less frequently. This may mean, for example, that images don’t display until you tap them.</string>
diff --git a/core/tests/coretests/src/android/content/pm/PackageParserTest.java b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
index 58c43ac2cf91..5e41355601e4 100644
--- a/core/tests/coretests/src/android/content/pm/PackageParserTest.java
+++ b/core/tests/coretests/src/android/content/pm/PackageParserTest.java
@@ -508,7 +508,12 @@ public class PackageParserTest {
apexInfo.modulePath = apexFile.getPath();
apexInfo.versionCode = 191000070;
int flags = PackageManager.GET_META_DATA | PackageManager.GET_SIGNING_CERTIFICATES;
- PackageInfo pi = PackageParser.generatePackageInfoFromApex(apexInfo, flags);
+
+ PackageParser pp = new PackageParser();
+ Package p = pp.parsePackage(apexFile, flags, false);
+ PackageParser.collectCertificates(p, false);
+ PackageInfo pi = PackageParser.generatePackageInfo(p, apexInfo, flags);
+
assertEquals("com.google.android.tzdata", pi.applicationInfo.packageName);
assertTrue(pi.applicationInfo.enabled);
assertEquals(28, pi.applicationInfo.targetSdkVersion);
diff --git a/core/tests/coretests/src/android/provider/SettingsBackupTest.java b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
index bdb58f63d044..b7b02a3d61f1 100644
--- a/core/tests/coretests/src/android/provider/SettingsBackupTest.java
+++ b/core/tests/coretests/src/android/provider/SettingsBackupTest.java
@@ -731,6 +731,7 @@ public class SettingsBackupTest {
Settings.Secure.SILENCE_GESTURE,
Settings.Secure.DOZE_WAKE_LOCK_SCREEN_GESTURE,
Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
+ Settings.Secure.TAP_GESTURE,
Settings.Secure.FACE_UNLOCK_RE_ENROLL);
@Test
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index 14011373d2ed..80f3cc68221f 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -49,6 +49,12 @@ applications that come with the platform
<permission name="android.permission.START_ACTIVITIES_FROM_BACKGROUND"/>
</privapp-permissions>
+ <privapp-permissions package="com.android.cellbroadcastservice">
+ <permission name="android.permission.MODIFY_PHONE_STATE"/>
+ <permission name="android.permission.READ_PRIVILEGED_PHONE_STATE"/>
+ <permission name="android.permission.RECEIVE_EMERGENCY_BROADCAST"/>
+ </privapp-permissions>
+
<privapp-permissions package="com.android.externalstorage">
<permission name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<permission name="android.permission.WRITE_MEDIA_STORAGE"/>
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index b7316ab03618..109d8631284d 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -1114,7 +1114,7 @@ public class Paint {
* Return the width for stroking.
* <p />
* A value of 0 strokes in hairline mode.
- * Hairlines always draws a single pixel independent of the canva's matrix.
+ * Hairlines always draws a single pixel independent of the canvas's matrix.
*
* @return the paint's stroke width, used whenever the paint's style is
* Stroke or StrokeAndFill.
@@ -1126,7 +1126,7 @@ public class Paint {
/**
* Set the width for stroking.
* Pass 0 to stroke in hairline mode.
- * Hairlines always draws a single pixel independent of the canva's matrix.
+ * Hairlines always draws a single pixel independent of the canvas's matrix.
*
* @param width set the paint's stroke width, used whenever the paint's
* style is Stroke or StrokeAndFill.
@@ -1958,8 +1958,8 @@ public class Paint {
* <code>
* Paint paint = new Paint();
* paint.setStartHyphenEdit(Paint.START_HYPHEN_EDIT_INSERT_HYPHEN);
- * paint.measureText("abc", 0, 3); // Returns the width of "‐abc"
- * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "‐abc"
+ * paint.measureText("abc", 0, 3); // Returns the width of "-abc"
+ * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "-abc"
* </code>
* </pre>
*
@@ -1985,8 +1985,8 @@ public class Paint {
* <code>
* Paint paint = new Paint();
* paint.setEndHyphenEdit(Paint.END_HYPHEN_EDIT_INSERT_HYPHEN);
- * paint.measureText("abc", 0, 3); // Returns the width of "abc‐"
- * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "abc‐"
+ * paint.measureText("abc", 0, 3); // Returns the width of "abc-"
+ * Canvas.drawText("abc", 0, 3, 0f, 0f, paint); // Draws "abc-"
* </code>
* </pre>
*
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index f51848e5691a..4c08a3829934 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -234,9 +234,6 @@ cc_defaults {
"protos/graphicsstats.proto",
],
- // Allow implicit fallthroughs in HardwareBitmapUploader.cpp until they are fixed.
- cflags: ["-Wno-implicit-fallthrough"],
-
proto: {
export_proto_headers: true,
},
diff --git a/libs/hwui/HardwareBitmapUploader.cpp b/libs/hwui/HardwareBitmapUploader.cpp
index 9bb6031b76ac..b64588e0dcd2 100644
--- a/libs/hwui/HardwareBitmapUploader.cpp
+++ b/libs/hwui/HardwareBitmapUploader.cpp
@@ -302,6 +302,7 @@ static FormatInfo determineFormat(const SkBitmap& skBitmap, bool usingGL) {
switch (skBitmap.info().colorType()) {
case kRGBA_8888_SkColorType:
formatInfo.isSupported = true;
+ [[fallthrough]];
// ARGB_4444 is upconverted to RGBA_8888
case kARGB_4444_SkColorType:
formatInfo.pixelFormat = PIXEL_FORMAT_RGBA_8888;
diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
index e8905143eb37..f9b2fe057995 100644
--- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
+++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
@@ -37,6 +37,8 @@ import com.android.internal.R;
import com.android.internal.notification.SystemNotificationChannels;
import com.android.internal.telephony.GsmAlphabet;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.io.UnsupportedEncodingException;
import java.util.concurrent.TimeUnit;
@@ -115,6 +117,7 @@ public class GpsNetInitiatedHandler {
private final INetInitiatedListener mNetInitiatedListener;
// Set to true if string from HAL is encoded as Hex, e.g., "3F0039"
+ @UnsupportedAppUsage
static private boolean mIsHexInput = true;
// End time of emergency call, and extension, if set
@@ -123,6 +126,9 @@ public class GpsNetInitiatedHandler {
public static class GpsNiNotification
{
+ @android.annotation.UnsupportedAppUsage
+ public GpsNiNotification() {
+ }
public int notificationId;
public int niType;
public boolean needNotify;
@@ -130,9 +136,13 @@ public class GpsNetInitiatedHandler {
public boolean privacyOverride;
public int timeout;
public int defaultResponse;
+ @UnsupportedAppUsage
public String requestorId;
+ @UnsupportedAppUsage
public String text;
+ @UnsupportedAppUsage
public int requestorIdEncoding;
+ @UnsupportedAppUsage
public int textEncoding;
};
@@ -258,6 +268,7 @@ public class GpsNetInitiatedHandler {
}
// Handles NI events from HAL
+ @UnsupportedAppUsage
public void handleNiNotification(GpsNiNotification notif) {
if (DEBUG) Log.d(TAG, "in handleNiNotification () :"
+ " notificationId: " + notif.notificationId
@@ -539,6 +550,7 @@ public class GpsNetInitiatedHandler {
* set to -1, and <code> isHex </code> can be false.
* @return the decoded string
*/
+ @UnsupportedAppUsage
static private String decodeString(String original, boolean isHex, int coding)
{
if (coding == GPS_ENC_NONE || coding == GPS_ENC_UNKNOWN) {
diff --git a/location/java/com/android/internal/location/ILocationProvider.aidl b/location/java/com/android/internal/location/ILocationProvider.aidl
index a5716304f0d8..8ae972bde4f9 100644
--- a/location/java/com/android/internal/location/ILocationProvider.aidl
+++ b/location/java/com/android/internal/location/ILocationProvider.aidl
@@ -29,10 +29,13 @@ import com.android.internal.location.ProviderRequest;
*/
interface ILocationProvider {
+ @UnsupportedAppUsage
oneway void setLocationProviderManager(in ILocationProviderManager manager);
+ @UnsupportedAppUsage
oneway void setRequest(in ProviderRequest request, in WorkSource ws);
+ @UnsupportedAppUsage
oneway void sendExtraCommand(String command, in Bundle extras);
// --- deprecated and will be removed the future ---
diff --git a/location/lib/Android.bp b/location/lib/Android.bp
index fe0f669508eb..cd45e8e6ffa6 100644
--- a/location/lib/Android.bp
+++ b/location/lib/Android.bp
@@ -17,10 +17,8 @@
java_sdk_library {
name: "com.android.location.provider",
srcs: ["java/**/*.java"],
- api_srcs: [":framework-all-sources"],
libs: [
"androidx.annotation_annotation",
- "framework-all",
],
api_packages: ["com.android.location.provider"],
}
diff --git a/media/java/android/media/IRingtonePlayer.aidl b/media/java/android/media/IRingtonePlayer.aidl
index c038f36206f6..02fa94c845a6 100644
--- a/media/java/android/media/IRingtonePlayer.aidl
+++ b/media/java/android/media/IRingtonePlayer.aidl
@@ -27,6 +27,7 @@ import android.os.UserHandle;
*/
interface IRingtonePlayer {
/** Used for Ringtone.java playback */
+ @UnsupportedAppUsage
oneway void play(IBinder token, in Uri uri, in AudioAttributes aa, float volume, boolean looping);
oneway void playWithVolumeShaping(IBinder token, in Uri uri, in AudioAttributes aa,
float volume, boolean looping, in @nullable VolumeShaper.Configuration volumeShaperConfig);
diff --git a/media/java/android/media/Image.java b/media/java/android/media/Image.java
index 70a343f4de01..7ba122baeca1 100644
--- a/media/java/android/media/Image.java
+++ b/media/java/android/media/Image.java
@@ -395,7 +395,7 @@ public abstract class Image implements AutoCloseable {
* <p>The row stride for this color plane, in bytes.</p>
*
* <p>This is the distance between the start of two consecutive rows of
- * pixels in the image. Note that row stried is undefined for some formats
+ * pixels in the image. Note that row stride is undefined for some formats
* such as
* {@link android.graphics.ImageFormat#RAW_PRIVATE RAW_PRIVATE},
* and calling getRowStride on images of these formats will
diff --git a/media/java/android/media/ImageWriter.java b/media/java/android/media/ImageWriter.java
index f813d1b68419..7bc2b31b16fa 100644
--- a/media/java/android/media/ImageWriter.java
+++ b/media/java/android/media/ImageWriter.java
@@ -192,13 +192,15 @@ public class ImageWriter implements AutoCloseable {
mMaxImages = maxImages;
- if (format == ImageFormat.UNKNOWN) {
- format = SurfaceUtils.getSurfaceFormat(surface);
- }
// Note that the underlying BufferQueue is working in synchronous mode
// to avoid dropping any buffers.
mNativeContext = nativeInit(new WeakReference<>(this), surface, maxImages, format);
+ // nativeInit internally overrides UNKNOWN format. So does surface format query after
+ // nativeInit and before getEstimatedNativeAllocBytes().
+ if (format == ImageFormat.UNKNOWN) {
+ format = SurfaceUtils.getSurfaceFormat(surface);
+ }
// Estimate the native buffer allocation size and register it so it gets accounted for
// during GC. Note that this doesn't include the buffers required by the buffer queue
// itself and the buffers requested by the producer.
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 510ee442f852..c9d79784004c 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -1702,20 +1702,22 @@ final public class MediaCodec {
break;
}
case EVENT_FRAME_RENDERED:
- synchronized (mListenerLock) {
- Map<String, Object> map = (Map<String, Object>)msg.obj;
- for (int i = 0; ; ++i) {
- Object mediaTimeUs = map.get(i + "-media-time-us");
- Object systemNano = map.get(i + "-system-nano");
- if (mediaTimeUs == null || systemNano == null
- || mOnFrameRenderedListener == null) {
- break;
- }
- mOnFrameRenderedListener.onFrameRendered(
- mCodec, (long)mediaTimeUs, (long)systemNano);
+ Map<String, Object> map = (Map<String, Object>)msg.obj;
+ for (int i = 0; ; ++i) {
+ Object mediaTimeUs = map.get(i + "-media-time-us");
+ Object systemNano = map.get(i + "-system-nano");
+ OnFrameRenderedListener onFrameRenderedListener;
+ synchronized (mListenerLock) {
+ onFrameRenderedListener = mOnFrameRenderedListener;
}
- break;
+ if (mediaTimeUs == null || systemNano == null
+ || onFrameRenderedListener == null) {
+ break;
+ }
+ onFrameRenderedListener.onFrameRendered(
+ mCodec, (long)mediaTimeUs, (long)systemNano);
}
+ break;
default:
{
break;
diff --git a/media/java/android/media/MediaFile.java b/media/java/android/media/MediaFile.java
index 09221a37cb13..c4eb0310f292 100644
--- a/media/java/android/media/MediaFile.java
+++ b/media/java/android/media/MediaFile.java
@@ -79,6 +79,10 @@ public class MediaFile {
@UnsupportedAppUsage
private static final HashMap<Integer, String> sFormatToMimeTypeMap = new HashMap<>();
+ @UnsupportedAppUsage
+ public MediaFile() {
+ }
+
/** @deprecated file types no longer exist */
@Deprecated
@UnsupportedAppUsage
diff --git a/media/java/android/media/tv/OWNER b/media/java/android/media/tv/OWNER
new file mode 100644
index 000000000000..64c0bb53e894
--- /dev/null
+++ b/media/java/android/media/tv/OWNER
@@ -0,0 +1,5 @@
+amyjojo@google.com
+nchalko@google.com
+shubang@google.com
+quxiangfang@google.com
+
diff --git a/media/jni/Android.bp b/media/jni/Android.bp
index e6c1c67b98e5..f873eeb9aa00 100644
--- a/media/jni/Android.bp
+++ b/media/jni/Android.bp
@@ -100,13 +100,14 @@ cc_library_shared {
"android_media_Utils.cpp",
],
+ header_libs: [
+ "libgui_headers",
+ ],
+
shared_libs: [
"liblog",
- "libgui",
- "libnativewindow",
"libui",
"libutils",
- "android.hidl.token@1.0-utils",
],
include_dirs: [
diff --git a/media/jni/OWNERS b/media/jni/OWNERS
index bb91d4b26ecc..f1b0237d9008 100644
--- a/media/jni/OWNERS
+++ b/media/jni/OWNERS
@@ -1,2 +1,5 @@
# extra for MTP related files
per-file android_mtp_*.cpp=marcone@google.com,jsharkey@android.com,jameswei@google.com,rmojumder@google.com
+
+# extra for TV related files
+per-file android_media_tv_*=nchalko@google.com,quxiangfang@google.com
diff --git a/media/jni/audioeffect/Android.bp b/media/jni/audioeffect/Android.bp
index 09c546ab0065..41ab6703a579 100644
--- a/media/jni/audioeffect/Android.bp
+++ b/media/jni/audioeffect/Android.bp
@@ -6,6 +6,7 @@ cc_library_shared {
"android_media_SourceDefaultEffect.cpp",
"android_media_StreamDefaultEffect.cpp",
"android_media_Visualizer.cpp",
+ "Visualizer.cpp",
],
shared_libs: [
@@ -14,10 +15,12 @@ cc_library_shared {
"libutils",
"libandroid_runtime",
"libnativehelper",
- "libmedia",
"libaudioclient",
+ "libaudioutils",
],
+ version_script: "exports.lds",
+
cflags: [
"-Wall",
"-Werror",
diff --git a/media/jni/audioeffect/Visualizer.cpp b/media/jni/audioeffect/Visualizer.cpp
new file mode 100644
index 000000000000..83f3b6ed6217
--- /dev/null
+++ b/media/jni/audioeffect/Visualizer.cpp
@@ -0,0 +1,446 @@
+/*
+**
+** Copyright 2010, 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.
+*/
+
+
+//#define LOG_NDEBUG 0
+#define LOG_TAG "Visualizer"
+#include <utils/Log.h>
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <limits.h>
+
+#include <audio_utils/fixedfft.h>
+#include <utils/Thread.h>
+
+#include "Visualizer.h"
+
+namespace android {
+
+// ---------------------------------------------------------------------------
+
+Visualizer::Visualizer (const String16& opPackageName,
+ int32_t priority,
+ effect_callback_t cbf,
+ void* user,
+ audio_session_t sessionId)
+ : AudioEffect(SL_IID_VISUALIZATION, opPackageName, NULL, priority, cbf, user, sessionId),
+ mCaptureRate(CAPTURE_RATE_DEF),
+ mCaptureSize(CAPTURE_SIZE_DEF),
+ mSampleRate(44100000),
+ mScalingMode(VISUALIZER_SCALING_MODE_NORMALIZED),
+ mMeasurementMode(MEASUREMENT_MODE_NONE),
+ mCaptureCallBack(NULL),
+ mCaptureCbkUser(NULL)
+{
+ initCaptureSize();
+}
+
+Visualizer::~Visualizer()
+{
+ ALOGV("Visualizer::~Visualizer()");
+ setEnabled(false);
+ setCaptureCallBack(NULL, NULL, 0, 0);
+}
+
+void Visualizer::release()
+{
+ ALOGV("Visualizer::release()");
+ setEnabled(false);
+ Mutex::Autolock _l(mCaptureLock);
+
+ mCaptureThread.clear();
+ mCaptureCallBack = NULL;
+ mCaptureCbkUser = NULL;
+ mCaptureFlags = 0;
+ mCaptureRate = 0;
+}
+
+status_t Visualizer::setEnabled(bool enabled)
+{
+ Mutex::Autolock _l(mCaptureLock);
+
+ sp<CaptureThread> t = mCaptureThread;
+ if (t != 0) {
+ if (enabled) {
+ if (t->exitPending()) {
+ mCaptureLock.unlock();
+ if (t->requestExitAndWait() == WOULD_BLOCK) {
+ mCaptureLock.lock();
+ ALOGE("Visualizer::enable() called from thread");
+ return INVALID_OPERATION;
+ }
+ mCaptureLock.lock();
+ }
+ }
+ t->mLock.lock();
+ }
+
+ status_t status = AudioEffect::setEnabled(enabled);
+
+ if (t != 0) {
+ if (enabled && status == NO_ERROR) {
+ t->run("Visualizer");
+ } else {
+ t->requestExit();
+ }
+ }
+
+ if (t != 0) {
+ t->mLock.unlock();
+ }
+
+ return status;
+}
+
+status_t Visualizer::setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags,
+ uint32_t rate)
+{
+ if (rate > CAPTURE_RATE_MAX) {
+ return BAD_VALUE;
+ }
+ Mutex::Autolock _l(mCaptureLock);
+
+ if (mEnabled) {
+ return INVALID_OPERATION;
+ }
+
+ if (mCaptureThread != 0) {
+ mCaptureLock.unlock();
+ mCaptureThread->requestExitAndWait();
+ mCaptureLock.lock();
+ }
+
+ mCaptureThread.clear();
+ mCaptureCallBack = cbk;
+ mCaptureCbkUser = user;
+ mCaptureFlags = flags;
+ mCaptureRate = rate;
+
+ if (cbk != NULL) {
+ mCaptureThread = new CaptureThread(this, rate, ((flags & CAPTURE_CALL_JAVA) != 0));
+ }
+ ALOGV("setCaptureCallBack() rate: %d thread %p flags 0x%08x",
+ rate, mCaptureThread.get(), mCaptureFlags);
+ return NO_ERROR;
+}
+
+status_t Visualizer::setCaptureSize(uint32_t size)
+{
+ if (size > VISUALIZER_CAPTURE_SIZE_MAX ||
+ size < VISUALIZER_CAPTURE_SIZE_MIN ||
+ popcount(size) != 1) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+ if (mEnabled) {
+ return INVALID_OPERATION;
+ }
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
+ *((int32_t *)p->data + 1)= size;
+ status_t status = setParameter(p);
+
+ ALOGV("setCaptureSize size %d status %d p->status %d", size, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mCaptureSize = size;
+ }
+ }
+
+ return status;
+}
+
+status_t Visualizer::setScalingMode(uint32_t mode) {
+ if ((mode != VISUALIZER_SCALING_MODE_NORMALIZED)
+ && (mode != VISUALIZER_SCALING_MODE_AS_PLAYED)) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_SCALING_MODE;
+ *((int32_t *)p->data + 1)= mode;
+ status_t status = setParameter(p);
+
+ ALOGV("setScalingMode mode %d status %d p->status %d", mode, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mScalingMode = mode;
+ }
+ }
+
+ return status;
+}
+
+status_t Visualizer::setMeasurementMode(uint32_t mode) {
+ if ((mode != MEASUREMENT_MODE_NONE)
+ //Note: needs to be handled as a mask when more measurement modes are added
+ && ((mode & MEASUREMENT_MODE_PEAK_RMS) != mode)) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock _l(mCaptureLock);
+
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_MEASUREMENT_MODE;
+ *((int32_t *)p->data + 1)= mode;
+ status_t status = setParameter(p);
+
+ ALOGV("setMeasurementMode mode %d status %d p->status %d", mode, status, p->status);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ if (status == NO_ERROR) {
+ mMeasurementMode = mode;
+ }
+ }
+ return status;
+}
+
+status_t Visualizer::getIntMeasurements(uint32_t type, uint32_t number, int32_t *measurements) {
+ if (mMeasurementMode == MEASUREMENT_MODE_NONE) {
+ ALOGE("Cannot retrieve int measurements, no measurement mode set");
+ return INVALID_OPERATION;
+ }
+ if (!(mMeasurementMode & type)) {
+ // measurement type has not been set on this Visualizer
+ ALOGE("Cannot retrieve int measurements, requested measurement mode 0x%x not set(0x%x)",
+ type, mMeasurementMode);
+ return INVALID_OPERATION;
+ }
+ // only peak+RMS measurement supported
+ if ((type != MEASUREMENT_MODE_PEAK_RMS)
+ // for peak+RMS measurement, the results are 2 int32_t values
+ || (number != 2)) {
+ ALOGE("Cannot retrieve int measurements, MEASUREMENT_MODE_PEAK_RMS returns 2 ints, not %d",
+ number);
+ return BAD_VALUE;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint32_t replySize = number * sizeof(int32_t);
+ status = command(VISUALIZER_CMD_MEASURE,
+ sizeof(uint32_t) /*cmdSize*/,
+ &type /*cmdData*/,
+ &replySize, measurements);
+ ALOGV("getMeasurements() command returned %d", status);
+ if ((status == NO_ERROR) && (replySize == 0)) {
+ status = NOT_ENOUGH_DATA;
+ }
+ } else {
+ ALOGV("getMeasurements() disabled");
+ return INVALID_OPERATION;
+ }
+ return status;
+}
+
+status_t Visualizer::getWaveForm(uint8_t *waveform)
+{
+ if (waveform == NULL) {
+ return BAD_VALUE;
+ }
+ if (mCaptureSize == 0) {
+ return NO_INIT;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint32_t replySize = mCaptureSize;
+ status = command(VISUALIZER_CMD_CAPTURE, 0, NULL, &replySize, waveform);
+ ALOGV("getWaveForm() command returned %d", status);
+ if ((status == NO_ERROR) && (replySize == 0)) {
+ status = NOT_ENOUGH_DATA;
+ }
+ } else {
+ ALOGV("getWaveForm() disabled");
+ memset(waveform, 0x80, mCaptureSize);
+ }
+ return status;
+}
+
+status_t Visualizer::getFft(uint8_t *fft)
+{
+ if (fft == NULL) {
+ return BAD_VALUE;
+ }
+ if (mCaptureSize == 0) {
+ return NO_INIT;
+ }
+
+ status_t status = NO_ERROR;
+ if (mEnabled) {
+ uint8_t buf[mCaptureSize];
+ status = getWaveForm(buf);
+ if (status == NO_ERROR) {
+ status = doFft(fft, buf);
+ }
+ } else {
+ memset(fft, 0, mCaptureSize);
+ }
+ return status;
+}
+
+status_t Visualizer::doFft(uint8_t *fft, uint8_t *waveform)
+{
+ int32_t workspace[mCaptureSize >> 1];
+ int32_t nonzero = 0;
+
+ for (uint32_t i = 0; i < mCaptureSize; i += 2) {
+ workspace[i >> 1] =
+ ((waveform[i] ^ 0x80) << 24) | ((waveform[i + 1] ^ 0x80) << 8);
+ nonzero |= workspace[i >> 1];
+ }
+
+ if (nonzero) {
+ fixed_fft_real(mCaptureSize >> 1, workspace);
+ }
+
+ for (uint32_t i = 0; i < mCaptureSize; i += 2) {
+ short tmp = workspace[i >> 1] >> 21;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i] = tmp;
+ tmp = workspace[i >> 1];
+ tmp >>= 5;
+ while (tmp > 127 || tmp < -128) tmp >>= 1;
+ fft[i + 1] = tmp;
+ }
+
+ return NO_ERROR;
+}
+
+void Visualizer::periodicCapture()
+{
+ Mutex::Autolock _l(mCaptureLock);
+ ALOGV("periodicCapture() %p mCaptureCallBack %p mCaptureFlags 0x%08x",
+ this, mCaptureCallBack, mCaptureFlags);
+ if (mCaptureCallBack != NULL &&
+ (mCaptureFlags & (CAPTURE_WAVEFORM|CAPTURE_FFT)) &&
+ mCaptureSize != 0) {
+ uint8_t waveform[mCaptureSize];
+ status_t status = getWaveForm(waveform);
+ if (status != NO_ERROR) {
+ return;
+ }
+ uint8_t fft[mCaptureSize];
+ if (mCaptureFlags & CAPTURE_FFT) {
+ status = doFft(fft, waveform);
+ }
+ if (status != NO_ERROR) {
+ return;
+ }
+ uint8_t *wavePtr = NULL;
+ uint8_t *fftPtr = NULL;
+ uint32_t waveSize = 0;
+ uint32_t fftSize = 0;
+ if (mCaptureFlags & CAPTURE_WAVEFORM) {
+ wavePtr = waveform;
+ waveSize = mCaptureSize;
+ }
+ if (mCaptureFlags & CAPTURE_FFT) {
+ fftPtr = fft;
+ fftSize = mCaptureSize;
+ }
+ mCaptureCallBack(mCaptureCbkUser, waveSize, wavePtr, fftSize, fftPtr, mSampleRate);
+ }
+}
+
+uint32_t Visualizer::initCaptureSize()
+{
+ uint32_t buf32[sizeof(effect_param_t) / sizeof(uint32_t) + 2];
+ effect_param_t *p = (effect_param_t *)buf32;
+
+ p->psize = sizeof(uint32_t);
+ p->vsize = sizeof(uint32_t);
+ *(int32_t *)p->data = VISUALIZER_PARAM_CAPTURE_SIZE;
+ status_t status = getParameter(p);
+
+ if (status == NO_ERROR) {
+ status = p->status;
+ }
+
+ uint32_t size = 0;
+ if (status == NO_ERROR) {
+ size = *((int32_t *)p->data + 1);
+ }
+ mCaptureSize = size;
+
+ ALOGV("initCaptureSize size %d status %d", mCaptureSize, status);
+
+ return size;
+}
+
+void Visualizer::controlStatusChanged(bool controlGranted) {
+ if (controlGranted) {
+ // this Visualizer instance regained control of the effect, reset the scaling mode
+ // and capture size as has been cached through it.
+ ALOGV("controlStatusChanged(true) causes effect parameter reset:");
+ ALOGV(" scaling mode reset to %d", mScalingMode);
+ setScalingMode(mScalingMode);
+ ALOGV(" capture size reset to %d", mCaptureSize);
+ setCaptureSize(mCaptureSize);
+ }
+ AudioEffect::controlStatusChanged(controlGranted);
+}
+
+//-------------------------------------------------------------------------
+
+Visualizer::CaptureThread::CaptureThread(Visualizer* receiver, uint32_t captureRate,
+ bool bCanCallJava)
+ : Thread(bCanCallJava), mReceiver(receiver)
+{
+ mSleepTimeUs = 1000000000 / captureRate;
+ ALOGV("CaptureThread cstor %p captureRate %d mSleepTimeUs %d", this, captureRate, mSleepTimeUs);
+}
+
+bool Visualizer::CaptureThread::threadLoop()
+{
+ ALOGV("CaptureThread %p enter", this);
+ sp<Visualizer> receiver = mReceiver.promote();
+ if (receiver == NULL) {
+ return false;
+ }
+ while (!exitPending())
+ {
+ usleep(mSleepTimeUs);
+ receiver->periodicCapture();
+ }
+ ALOGV("CaptureThread %p exiting", this);
+ return false;
+}
+
+} // namespace android
diff --git a/media/jni/audioeffect/Visualizer.h b/media/jni/audioeffect/Visualizer.h
new file mode 100644
index 000000000000..d4672a95c6d8
--- /dev/null
+++ b/media/jni/audioeffect/Visualizer.h
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef ANDROID_MEDIA_VISUALIZER_H
+#define ANDROID_MEDIA_VISUALIZER_H
+
+#include <media/AudioEffect.h>
+#include <system/audio_effects/effect_visualizer.h>
+#include <utils/Thread.h>
+
+/**
+ * The Visualizer class enables application to retrieve part of the currently playing audio for
+ * visualization purpose. It is not an audio recording interface and only returns partial and low
+ * quality audio content. However, to protect privacy of certain audio data (e.g voice mail) the use
+ * of the visualizer requires the permission android.permission.RECORD_AUDIO.
+ * The audio session ID passed to the constructor indicates which audio content should be
+ * visualized:
+ * - If the session is 0, the audio output mix is visualized
+ * - If the session is not 0, the audio from a particular MediaPlayer or AudioTrack
+ * using this audio session is visualized
+ * Two types of representation of audio content can be captured:
+ * - Waveform data: consecutive 8-bit (unsigned) mono samples by using the getWaveForm() method
+ * - Frequency data: 8-bit magnitude FFT by using the getFft() method
+ *
+ * The length of the capture can be retrieved or specified by calling respectively
+ * getCaptureSize() and setCaptureSize() methods. Note that the size of the FFT
+ * is half of the specified capture size but both sides of the spectrum are returned yielding in a
+ * number of bytes equal to the capture size. The capture size must be a power of 2 in the range
+ * returned by getMinCaptureSize() and getMaxCaptureSize().
+ * In addition to the polling capture mode, a callback mode is also available by installing a
+ * callback function by use of the setCaptureCallBack() method. The rate at which the callback
+ * is called as well as the type of data returned is specified.
+ * Before capturing data, the Visualizer must be enabled by calling the setEnabled() method.
+ * When data capture is not needed any more, the Visualizer should be disabled.
+ */
+
+
+namespace android {
+
+// ----------------------------------------------------------------------------
+
+class Visualizer: public AudioEffect {
+public:
+
+ enum callback_flags {
+ CAPTURE_WAVEFORM = 0x00000001, // capture callback returns a PCM wave form
+ CAPTURE_FFT = 0x00000002, // apture callback returns a frequency representation
+ CAPTURE_CALL_JAVA = 0x00000004 // the callback thread can call java
+ };
+
+
+ /* Constructor.
+ * See AudioEffect constructor for details on parameters.
+ */
+ Visualizer(const String16& opPackageName,
+ int32_t priority = 0,
+ effect_callback_t cbf = NULL,
+ void* user = NULL,
+ audio_session_t sessionId = AUDIO_SESSION_OUTPUT_MIX);
+
+ ~Visualizer();
+
+ // Declared 'final' because we call this in ~Visualizer().
+ status_t setEnabled(bool enabled) final;
+
+ // maximum capture size in samples
+ static uint32_t getMaxCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MAX; }
+ // minimum capture size in samples
+ static uint32_t getMinCaptureSize() { return VISUALIZER_CAPTURE_SIZE_MIN; }
+ // maximum capture rate in millihertz
+ static uint32_t getMaxCaptureRate() { return CAPTURE_RATE_MAX; }
+
+ // callback used to return periodic PCM or FFT captures to the application. Either one or both
+ // types of data are returned (PCM and FFT) according to flags indicated when installing the
+ // callback. When a type of data is not present, the corresponding size (waveformSize or
+ // fftSize) is 0.
+ typedef void (*capture_cbk_t)(void* user,
+ uint32_t waveformSize,
+ uint8_t *waveform,
+ uint32_t fftSize,
+ uint8_t *fft,
+ uint32_t samplingrate);
+
+ // install a callback to receive periodic captures. The capture rate is specified in milliHertz
+ // and the capture format is according to flags (see callback_flags).
+ status_t setCaptureCallBack(capture_cbk_t cbk, void* user, uint32_t flags, uint32_t rate);
+
+ // set the capture size capture size must be a power of two in the range
+ // [VISUALIZER_CAPTURE_SIZE_MAX. VISUALIZER_CAPTURE_SIZE_MIN]
+ // must be called when the visualizer is not enabled
+ status_t setCaptureSize(uint32_t size);
+ uint32_t getCaptureSize() { return mCaptureSize; }
+
+ // returns the capture rate indicated when installing the callback
+ uint32_t getCaptureRate() { return mCaptureRate; }
+
+ // returns the sampling rate of the audio being captured
+ uint32_t getSamplingRate() { return mSampleRate; }
+
+ // set the way volume affects the captured data
+ // mode must one of VISUALIZER_SCALING_MODE_NORMALIZED,
+ // VISUALIZER_SCALING_MODE_AS_PLAYED
+ status_t setScalingMode(uint32_t mode);
+ uint32_t getScalingMode() { return mScalingMode; }
+
+ // set which measurements are done on the audio buffers processed by the effect.
+ // valid measurements (mask): MEASUREMENT_MODE_PEAK_RMS
+ status_t setMeasurementMode(uint32_t mode);
+ uint32_t getMeasurementMode() { return mMeasurementMode; }
+
+ // return a set of int32_t measurements
+ status_t getIntMeasurements(uint32_t type, uint32_t number, int32_t *measurements);
+
+ // return a capture in PCM 8 bit unsigned format. The size of the capture is equal to
+ // getCaptureSize()
+ status_t getWaveForm(uint8_t *waveform);
+
+ // return a capture in FFT 8 bit signed format. The size of the capture is equal to
+ // getCaptureSize() but the length of the FFT is half of the size (both parts of the spectrum
+ // are returned
+ status_t getFft(uint8_t *fft);
+ void release();
+
+protected:
+ // from IEffectClient
+ virtual void controlStatusChanged(bool controlGranted);
+
+private:
+
+ static const uint32_t CAPTURE_RATE_MAX = 20000;
+ static const uint32_t CAPTURE_RATE_DEF = 10000;
+ static const uint32_t CAPTURE_SIZE_DEF = VISUALIZER_CAPTURE_SIZE_MAX;
+
+ /* internal class to handle the callback */
+ class CaptureThread : public Thread
+ {
+ public:
+ CaptureThread(Visualizer* visualizer, uint32_t captureRate, bool bCanCallJava = false);
+
+ private:
+ friend class Visualizer;
+ virtual bool threadLoop();
+ wp<Visualizer> mReceiver;
+ Mutex mLock;
+ uint32_t mSleepTimeUs;
+ };
+
+ status_t doFft(uint8_t *fft, uint8_t *waveform);
+ void periodicCapture();
+ uint32_t initCaptureSize();
+
+ Mutex mCaptureLock;
+ uint32_t mCaptureRate;
+ uint32_t mCaptureSize;
+ uint32_t mSampleRate;
+ uint32_t mScalingMode;
+ uint32_t mMeasurementMode;
+ capture_cbk_t mCaptureCallBack;
+ void *mCaptureCbkUser;
+ sp<CaptureThread> mCaptureThread;
+ uint32_t mCaptureFlags;
+};
+
+
+}; // namespace android
+
+#endif // ANDROID_MEDIA_VISUALIZER_H
diff --git a/media/jni/audioeffect/android_media_Visualizer.cpp b/media/jni/audioeffect/android_media_Visualizer.cpp
index 45de36ed3e4d..1362433bb26e 100644
--- a/media/jni/audioeffect/android_media_Visualizer.cpp
+++ b/media/jni/audioeffect/android_media_Visualizer.cpp
@@ -24,7 +24,7 @@
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
#include <utils/threads.h>
-#include "media/Visualizer.h"
+#include "Visualizer.h"
#include <nativehelper/ScopedUtfChars.h>
diff --git a/media/jni/audioeffect/exports.lds b/media/jni/audioeffect/exports.lds
new file mode 100644
index 000000000000..70491f451c0c
--- /dev/null
+++ b/media/jni/audioeffect/exports.lds
@@ -0,0 +1,6 @@
+{
+ global:
+ *;
+ local:
+ *android10Visualizer*;
+};
diff --git a/media/jni/soundpool/Android.bp b/media/jni/soundpool/Android.bp
index 35b7b01e207c..7403181a47f4 100644
--- a/media/jni/soundpool/Android.bp
+++ b/media/jni/soundpool/Android.bp
@@ -7,6 +7,10 @@ cc_library_shared {
"SoundPoolThread.cpp",
],
+ header_libs: [
+ "libmedia_headers",
+ ],
+
shared_libs: [
"liblog",
"libcutils",
diff --git a/media/lib/signer/Android.bp b/media/lib/signer/Android.bp
index 6b03e4de57d7..3b2578754087 100644
--- a/media/lib/signer/Android.bp
+++ b/media/lib/signer/Android.bp
@@ -17,7 +17,5 @@
java_sdk_library {
name: "com.android.mediadrm.signer",
srcs: ["java/**/*.java"],
- api_srcs: [":framework-all-sources"],
- libs: ["framework-all"],
api_packages: ["com.android.mediadrm.signer"],
}
diff --git a/mms/OWNERS b/mms/OWNERS
new file mode 100644
index 000000000000..ba00d5d75010
--- /dev/null
+++ b/mms/OWNERS
@@ -0,0 +1,14 @@
+set noparent
+
+tgunn@google.com
+breadley@google.com
+hallliu@google.com
+rgreenwalt@google.com
+amitmahajan@google.com
+fionaxu@google.com
+jackyu@google.com
+jminjie@google.com
+satk@google.com
+shuoq@google.com
+refuhoo@google.com
+nazaninb@google.com
diff --git a/mms/java/android/telephony/MmsManager.java b/mms/java/android/telephony/MmsManager.java
new file mode 100644
index 000000000000..4bcf04691652
--- /dev/null
+++ b/mms/java/android/telephony/MmsManager.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony;
+
+import android.app.ActivityThread;
+import android.app.PendingIntent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+
+import com.android.internal.telephony.IMms;
+
+/**
+ * Manages MMS operations such as sending multimedia messages.
+ * Get this object by calling the static method {@link #getInstance()}.
+ * @hide
+ */
+public class MmsManager {
+ private static final String TAG = "MmsManager";
+
+ /** Singleton object constructed during class initialization. */
+ private static final MmsManager sInstance = new MmsManager();
+
+ /**
+ * Get the MmsManager singleton instance.
+ *
+ * @return the {@link MmsManager} singleton instance.
+ */
+ public static MmsManager getInstance() {
+ return sInstance;
+ }
+
+ /**
+ * Send an MMS message
+ *
+ * @param subId the subscription id
+ * @param contentUri the content Uri from which the message pdu will be read
+ * @param locationUrl the optional location url where message should be sent to
+ * @param configOverrides the carrier-specific messaging configuration values to override for
+ * sending the message.
+ * @param sentIntent if not NULL this <code>PendingIntent</code> is broadcast when the message
+ * is successfully sent, or failed
+ */
+ public void sendMultimediaMessage(int subId, Uri contentUri, String locationUrl,
+ Bundle configOverrides, PendingIntent sentIntent) {
+ try {
+ final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
+ if (iMms == null) {
+ return;
+ }
+
+ iMms.sendMessage(subId, ActivityThread.currentPackageName(), contentUri,
+ locationUrl, configOverrides, sentIntent);
+ } catch (RemoteException e) {
+ // Ignore it
+ }
+ }
+
+ /**
+ * Download an MMS message from carrier by a given location URL
+ *
+ * @param subId the subscription id
+ * @param locationUrl the location URL of the MMS message to be downloaded, usually obtained
+ * from the MMS WAP push notification
+ * @param contentUri the content uri to which the downloaded pdu will be written
+ * @param configOverrides the carrier-specific messaging configuration values to override for
+ * downloading the message.
+ * @param downloadedIntent if not NULL this <code>PendingIntent</code> is
+ * broadcast when the message is downloaded, or the download is failed
+ * @throws IllegalArgumentException if locationUrl or contentUri is empty
+ */
+ public void downloadMultimediaMessage(int subId, String locationUrl, Uri contentUri,
+ Bundle configOverrides, PendingIntent downloadedIntent) {
+ try {
+ final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
+ if (iMms == null) {
+ return;
+ }
+ iMms.downloadMessage(subId, ActivityThread.currentPackageName(),
+ locationUrl, contentUri, configOverrides, downloadedIntent);
+ } catch (RemoteException e) {
+ // Ignore it
+ }
+ }
+
+ /**
+ * Get carrier-dependent configuration values.
+ *
+ * @param subId the subscription id
+ * @return bundle key/values pairs of configuration values
+ */
+ public Bundle getCarrierConfigValues(int subId) {
+ try {
+ IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
+ if (iMms != null) {
+ return iMms.getCarrierConfigValues(subId);
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ return null;
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/IMms.aidl b/mms/java/com/android/internal/telephony/IMms.aidl
index fa5073ef1c7e..fa5073ef1c7e 100644
--- a/telephony/java/com/android/internal/telephony/IMms.aidl
+++ b/mms/java/com/android/internal/telephony/IMms.aidl
diff --git a/opengl/java/com/google/android/gles_jni/EGLImpl.java b/opengl/java/com/google/android/gles_jni/EGLImpl.java
index 41fb07228791..f94f69f0fd3f 100644
--- a/opengl/java/com/google/android/gles_jni/EGLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLImpl.java
@@ -16,12 +16,18 @@
package com.google.android.gles_jni;
-import javax.microedition.khronos.egl.*;
-
import android.graphics.SurfaceTexture;
import android.view.Surface;
-import android.view.SurfaceView;
import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
public class EGLImpl implements EGL10 {
private EGLContextImpl mContext = new EGLContextImpl(-1);
@@ -50,6 +56,10 @@ public class EGLImpl implements EGL10 {
/** @hide **/
public static native int getInitCount(EGLDisplay display);
+ @UnsupportedAppUsage
+ public EGLImpl() {
+ }
+
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list) {
long eglContextId = _eglCreateContext(display, config, share_context, attrib_list);
if (eglContextId == 0) {
diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java
index d4c0c8049dad..2a8d07f03148 100644
--- a/opengl/java/com/google/android/gles_jni/GLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/GLImpl.java
@@ -26,7 +26,10 @@ import android.os.Build;
import android.os.UserHandle;
import android.util.Log;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.nio.Buffer;
+
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL10Ext;
import javax.microedition.khronos.opengles.GL11;
@@ -56,6 +59,7 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
private boolean have_OES_framebuffer_object;
private boolean have_OES_texture_cube_map;
+ @UnsupportedAppUsage
public GLImpl() {
}
diff --git a/packages/CarSystemUI/res/layout/super_status_bar.xml b/packages/CarSystemUI/res/layout/super_status_bar.xml
index 0b346260896a..7fee8051c472 100644
--- a/packages/CarSystemUI/res/layout/super_status_bar.xml
+++ b/packages/CarSystemUI/res/layout/super_status_bar.xml
@@ -42,14 +42,6 @@
</com.android.systemui.statusbar.BackDropView>
<com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_for_bubble"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no"
- sysui:ignoreRightInset="true"
- />
-
- <com.android.systemui.statusbar.ScrimView
android:id="@+id/scrim_behind"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml
index 467c4a41893d..cbf22870af96 100644
--- a/packages/CarSystemUI/res/values/config.xml
+++ b/packages/CarSystemUI/res/values/config.xml
@@ -40,4 +40,19 @@
slots that may be reused for things like IME control. -->
<integer name="config_maxNotificationIcons">0</integer>
+ <!--
+ Initial alpha percent value for the background when the notification
+ shade is open. Should be a number between, and inclusive, 0 and 100.
+ If the number is 0, then the background alpha starts off fully
+ transparent. If the number if 100, then the background alpha starts off
+ fully opaque. -->
+ <integer name="config_initialNotificationBackgroundAlpha">0</integer>
+ <!--
+ Final alpha percent value for the background when the notification
+ shade is fully open. Should be a number between, and inclusive, 0 and
+ 100. If this value is smaller than
+ config_initialNotificationBackgroundAlpha, the background will default
+ to a constant alpha percent value using the initial alpha. -->
+ <integer name="config_finalNotificationBackgroundAlpha">100</integer>
+
</resources>
diff --git a/packages/CarSystemUI/res/values/integers_car.xml b/packages/CarSystemUI/res/values/integers_car.xml
index fb67b302a4ae..d6c16cb4180b 100644
--- a/packages/CarSystemUI/res/values/integers_car.xml
+++ b/packages/CarSystemUI/res/values/integers_car.xml
@@ -34,4 +34,7 @@
<!-- The delay before the unlock dialog pops up -->
<integer name="unlock_dialog_delay_ms">0</integer>
+ <!-- Timeout values in milliseconds for displaying volume dialog-->
+ <integer name="car_volume_dialog_display_normal_timeout">3000</integer>
+ <integer name="car_volume_dialog_display_hovering_timeout">16000</integer>
</resources>
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
index b7aa496b3d5d..1a1a8ea501bb 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java
@@ -26,7 +26,6 @@ import android.car.Car;
import android.car.drivingstate.CarDrivingStateEvent;
import android.car.drivingstate.CarUxRestrictionsManager;
import android.car.hardware.power.CarPowerManager.CarPowerStateListener;
-import android.car.trust.CarTrustAgentEnrollmentManager;
import android.content.Context;
import android.graphics.PixelFormat;
import android.graphics.Rect;
@@ -101,6 +100,9 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
private float mOpeningVelocity = DEFAULT_FLING_VELOCITY;
private float mClosingVelocity = DEFAULT_FLING_VELOCITY;
+ private float mBackgroundAlphaDiff;
+ private float mInitialBackgroundAlpha;
+
private TaskStackListenerImpl mTaskStackListener;
private FullscreenUserSwitcher mFullscreenUserSwitcher;
@@ -179,6 +181,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
private boolean mHideNavBarForKeyboard;
private boolean mBottomNavBarVisible;
+ private CarUxRestrictionManagerWrapper mCarUxRestrictionManagerWrapper;
+
private final CarPowerStateListener mCarPowerStateListener =
(int state) -> {
// When the car powers on, clear all notifications and mute/unread states.
@@ -214,6 +218,25 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
// created.
mHvacController = new HvacController(mContext);
+ // Notification bar related setup.
+ mInitialBackgroundAlpha = (float) mContext.getResources().getInteger(
+ R.integer.config_initialNotificationBackgroundAlpha) / 100;
+ if (mInitialBackgroundAlpha < 0 || mInitialBackgroundAlpha > 100) {
+ throw new RuntimeException(
+ "Unable to setup notification bar due to incorrect initial background alpha"
+ + " percentage");
+ }
+ float finalBackgroundAlpha = Math.max(
+ mInitialBackgroundAlpha,
+ (float) mContext.getResources().getInteger(
+ R.integer.config_finalNotificationBackgroundAlpha) / 100);
+ if (finalBackgroundAlpha < 0 || finalBackgroundAlpha > 100) {
+ throw new RuntimeException(
+ "Unable to setup notification bar due to incorrect final background alpha"
+ + " percentage");
+ }
+ mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha;
+
super.start();
mTaskStackListener = new TaskStackListenerImpl();
mActivityManagerWrapper = ActivityManagerWrapper.getInstance();
@@ -245,14 +268,16 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
}
});
+ // Used by onDrivingStateChanged and it can be called inside
+ // DrivingStateHelper.connectToCarService()
+ mSwitchToGuestTimer = new SwitchToGuestTimer(mContext);
+
// Register a listener for driving state changes.
mDrivingStateHelper = new DrivingStateHelper(mContext, this::onDrivingStateChanged);
mDrivingStateHelper.connectToCarService();
mPowerManagerHelper = new PowerManagerHelper(mContext, mCarPowerStateListener);
mPowerManagerHelper.connectToCarService();
-
- mSwitchToGuestTimer = new SwitchToGuestTimer(mContext);
}
private void restartNavBarsIfNecessary() {
@@ -454,13 +479,23 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
animateCollapsePanels();
}
});
- Car car = Car.createCar(mContext);
- CarUxRestrictionsManager carUxRestrictionsManager = (CarUxRestrictionsManager)
- car.getCarManager(Car.CAR_UX_RESTRICTION_SERVICE);
+
CarNotificationListener carNotificationListener = new CarNotificationListener();
- CarUxRestrictionManagerWrapper carUxRestrictionManagerWrapper =
- new CarUxRestrictionManagerWrapper();
- carUxRestrictionManagerWrapper.setCarUxRestrictionsManager(carUxRestrictionsManager);
+ mCarUxRestrictionManagerWrapper = new CarUxRestrictionManagerWrapper();
+ // This can take time if car service is not ready up to this time.
+ // TODO(b/142808072) Refactor CarUxRestrictionManagerWrapper to allow setting
+ // CarUxRestrictionsManager later and switch to Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT.
+ Car.createCar(mContext, /* handler= */ null, Car.CAR_WAIT_TIMEOUT_WAIT_FOREVER,
+ (car, ready) -> {
+ if (!ready) {
+ return;
+ }
+ CarUxRestrictionsManager carUxRestrictionsManager =
+ (CarUxRestrictionsManager)
+ car.getCarManager(Car.CAR_UX_RESTRICTION_SERVICE);
+ mCarUxRestrictionManagerWrapper.setCarUxRestrictionsManager(
+ carUxRestrictionsManager);
+ });
mNotificationDataManager = new NotificationDataManager();
mNotificationDataManager.setOnUnseenCountUpdateListener(
@@ -489,7 +524,7 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
mNotificationClickHandlerFactory, mNotificationDataManager);
mNotificationClickHandlerFactory.setNotificationDataManager(mNotificationDataManager);
- carNotificationListener.registerAsSystemService(mContext, carUxRestrictionManagerWrapper,
+ carNotificationListener.registerAsSystemService(mContext, mCarUxRestrictionManagerWrapper,
carHeadsUpNotificationManager, mNotificationDataManager);
mNotificationView = mStatusBarWindow.findViewById(R.id.notification_view);
@@ -589,7 +624,7 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
mNotificationView,
PreprocessingManager.getInstance(mContext),
carNotificationListener,
- carUxRestrictionManagerWrapper,
+ mCarUxRestrictionManagerWrapper,
mNotificationDataManager);
mNotificationViewController.enable();
}
@@ -1039,12 +1074,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
UserSwitcherController userSwitcherController =
Dependency.get(UserSwitcherController.class);
if (userSwitcherController.useFullscreenUserSwitcher()) {
- Car car = Car.createCar(mContext);
- CarTrustAgentEnrollmentManager enrollmentManager = (CarTrustAgentEnrollmentManager) car
- .getCarManager(Car.CAR_TRUST_AGENT_ENROLLMENT_SERVICE);
mFullscreenUserSwitcher = new FullscreenUserSwitcher(this,
- mStatusBarWindow.findViewById(R.id.fullscreen_user_switcher_stub),
- enrollmentManager, mContext);
+ mStatusBarWindow.findViewById(R.id.fullscreen_user_switcher_stub), mContext);
} else {
super.createUserSwitcher();
}
@@ -1155,17 +1186,22 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt
mHandleBar.setTranslationY(height - mHandleBar.getHeight() - lp.bottomMargin);
}
if (mNotificationView.getHeight() > 0) {
- // Calculates the alpha value for the background based on how much of the notification
- // shade is visible to the user. When the notification shade is completely open then
- // alpha value will be 1.
- float alpha = (float) height / mNotificationView.getHeight();
Drawable background = mNotificationView.getBackground().mutate();
-
- background.setAlpha((int) (alpha * 255));
+ background.setAlpha((int) (getBackgroundAlpha(height) * 255));
mNotificationView.setBackground(background);
}
}
+ /**
+ * Calculates the alpha value for the background based on how much of the notification
+ * shade is visible to the user. When the notification shade is completely open then
+ * alpha value will be 1.
+ */
+ private float getBackgroundAlpha(int height) {
+ return mInitialBackgroundAlpha +
+ ((float) height / mNotificationView.getHeight() * mBackgroundAlphaDiff);
+ }
+
private void calculatePercentageFromBottom(float height) {
if (mNotificationView.getHeight() > 0) {
mPercentageFromBottom = (int) Math.abs(
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/DrivingStateHelper.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/DrivingStateHelper.java
index a4424260fef5..cd87e78e4be9 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/DrivingStateHelper.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/DrivingStateHelper.java
@@ -17,14 +17,11 @@
package com.android.systemui.statusbar.car;
import android.car.Car;
-import android.car.CarNotConnectedException;
+import android.car.Car.CarServiceLifecycleListener;
import android.car.drivingstate.CarDrivingStateEvent;
import android.car.drivingstate.CarDrivingStateManager;
import android.car.drivingstate.CarDrivingStateManager.CarDrivingStateEventListener;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.ServiceConnection;
-import android.os.IBinder;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -55,16 +52,11 @@ public class DrivingStateHelper {
if (mDrivingStateManager == null) {
return false;
}
- try {
- CarDrivingStateEvent currentState = mDrivingStateManager.getCurrentCarDrivingState();
- if (currentState != null) {
- return currentState.eventValue == CarDrivingStateEvent.DRIVING_STATE_IDLING
- || currentState.eventValue == CarDrivingStateEvent.DRIVING_STATE_MOVING;
- }
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Cannot determine current driving state. Car not connected", e);
+ CarDrivingStateEvent currentState = mDrivingStateManager.getCurrentCarDrivingState();
+ if (currentState != null) {
+ return currentState.eventValue == CarDrivingStateEvent.DRIVING_STATE_IDLING
+ || currentState.eventValue == CarDrivingStateEvent.DRIVING_STATE_MOVING;
}
-
return false; // Default to false.
}
@@ -72,55 +64,25 @@ public class DrivingStateHelper {
* Establishes connection with the Car service.
*/
public void connectToCarService() {
- mCar = Car.createCar(mContext, mCarConnectionListener);
- if (mCar != null) {
- mCar.connect();
- }
+ mCar = Car.createCar(mContext, /* handler= */ null, Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT,
+ mCarServiceLifecycleListener);
}
- /**
- * Disconnects from Car service and cleans up listeners.
- */
- public void disconnectFromCarService() {
- if (mCar != null) {
- mCar.disconnect();
+ private final CarServiceLifecycleListener mCarServiceLifecycleListener = (car, ready) -> {
+ if (!ready) {
+ return;
}
- }
-
- private final ServiceConnection mCarConnectionListener =
- new ServiceConnection() {
- public void onServiceConnected(ComponentName name, IBinder service) {
- logD("Car Service connected");
- try {
- mDrivingStateManager = (CarDrivingStateManager) mCar.getCarManager(
- Car.CAR_DRIVING_STATE_SERVICE);
- if (mDrivingStateManager != null) {
- mDrivingStateManager.registerListener(mDrivingStateHandler);
- mDrivingStateHandler.onDrivingStateChanged(
- mDrivingStateManager.getCurrentCarDrivingState());
- } else {
- Log.e(TAG, "CarDrivingStateService service not available");
- }
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car not connected", e);
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- destroyDrivingStateManager();
- }
- };
-
- private void destroyDrivingStateManager() {
- try {
- if (mDrivingStateManager != null) {
- mDrivingStateManager.unregisterListener();
- }
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Error unregistering listeners", e);
+ logD("Car Service connected");
+ mDrivingStateManager = (CarDrivingStateManager) car.getCarManager(
+ Car.CAR_DRIVING_STATE_SERVICE);
+ if (mDrivingStateManager != null) {
+ mDrivingStateManager.registerListener(mDrivingStateHandler);
+ mDrivingStateHandler.onDrivingStateChanged(
+ mDrivingStateManager.getCurrentCarDrivingState());
+ } else {
+ Log.e(TAG, "CarDrivingStateService service not available");
}
- }
+ };
private void logD(String message) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
index 0f7c1ee8ea7e..31aced02b15e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/FullscreenUserSwitcher.java
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.car;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.car.Car;
import android.car.trust.CarTrustAgentEnrollmentManager;
import android.car.userlib.CarUserManagerHelper;
import android.content.BroadcastReceiver;
@@ -50,7 +51,7 @@ public class FullscreenUserSwitcher {
private final CarStatusBar mStatusBar;
private final Context mContext;
private final UserManager mUserManager;
- private final CarTrustAgentEnrollmentManager mEnrollmentManager;
+ private CarTrustAgentEnrollmentManager mEnrollmentManager;
private CarTrustAgentUnlockDialogHelper mUnlockDialogHelper;
private UserGridRecyclerView.UserRecord mSelectedUser;
private CarUserManagerHelper mCarUserManagerHelper;
@@ -64,13 +65,11 @@ public class FullscreenUserSwitcher {
mContext.unregisterReceiver(mUserUnlockReceiver);
}
};
+ private final Car mCar;
-
- public FullscreenUserSwitcher(CarStatusBar statusBar, ViewStub containerStub,
- CarTrustAgentEnrollmentManager enrollmentManager, Context context) {
+ public FullscreenUserSwitcher(CarStatusBar statusBar, ViewStub containerStub, Context context) {
mStatusBar = statusBar;
mParent = containerStub.inflate();
- mEnrollmentManager = enrollmentManager;
mContext = context;
View container = mParent.findViewById(R.id.container);
@@ -86,6 +85,15 @@ public class FullscreenUserSwitcher {
mUnlockDialogHelper = new CarTrustAgentUnlockDialogHelper(mContext);
mUserManager = mContext.getSystemService(UserManager.class);
+ mCar = Car.createCar(mContext, /* handler= */ null, Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT,
+ (car, ready) -> {
+ if (!ready) {
+ return;
+ }
+ mEnrollmentManager = (CarTrustAgentEnrollmentManager) car
+ .getCarManager(Car.CAR_TRUST_AGENT_ENROLLMENT_SERVICE);
+ });
+
mShortAnimDuration = container.getResources()
.getInteger(android.R.integer.config_shortAnimTime);
IntentFilter filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED);
@@ -201,6 +209,9 @@ public class FullscreenUserSwitcher {
}
private boolean hasTrustedDevice(int uid) {
+ if (mEnrollmentManager == null) { // car service not ready, so it cannot be available.
+ return false;
+ }
return !mEnrollmentManager.getEnrolledDeviceInfoForUser(uid).isEmpty();
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/PowerManagerHelper.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/PowerManagerHelper.java
index 8de1439c3306..a27dd341d449 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/PowerManagerHelper.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/PowerManagerHelper.java
@@ -18,13 +18,10 @@ package com.android.systemui.statusbar.car;
import android.annotation.NonNull;
import android.car.Car;
-import android.car.CarNotConnectedException;
+import android.car.Car.CarServiceLifecycleListener;
import android.car.hardware.power.CarPowerManager;
import android.car.hardware.power.CarPowerManager.CarPowerStateListener;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.ServiceConnection;
-import android.os.IBinder;
import android.util.Log;
/**
@@ -39,55 +36,30 @@ public class PowerManagerHelper {
private Car mCar;
private CarPowerManager mCarPowerManager;
- private final ServiceConnection mCarConnectionListener =
- new ServiceConnection() {
- public void onServiceConnected(ComponentName name, IBinder service) {
- Log.d(TAG, "Car Service connected");
- try {
- mCarPowerManager = (CarPowerManager) mCar.getCarManager(Car.POWER_SERVICE);
- if (mCarPowerManager != null) {
- mCarPowerManager.setListener(mCarPowerStateListener);
- } else {
- Log.e(TAG, "CarPowerManager service not available");
- }
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car not connected", e);
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- destroyCarPowerManager();
- }
- };
+ private final CarServiceLifecycleListener mCarServiceLifecycleListener;
PowerManagerHelper(Context context, @NonNull CarPowerStateListener listener) {
mContext = context;
mCarPowerStateListener = listener;
+ mCarServiceLifecycleListener = (car, ready) -> {
+ if (!ready) {
+ return;
+ }
+ Log.d(TAG, "Car Service connected");
+ mCarPowerManager = (CarPowerManager) car.getCarManager(Car.POWER_SERVICE);
+ if (mCarPowerManager != null) {
+ mCarPowerManager.setListener(mCarPowerStateListener);
+ } else {
+ Log.e(TAG, "CarPowerManager service not available");
+ }
+ };
}
/**
* Connect to Car service.
*/
void connectToCarService() {
- mCar = Car.createCar(mContext, mCarConnectionListener);
- if (mCar != null) {
- mCar.connect();
- }
- }
-
- /**
- * Disconnects from Car service.
- */
- void disconnectFromCarService() {
- if (mCar != null) {
- mCar.disconnect();
- }
- }
-
- private void destroyCarPowerManager() {
- if (mCarPowerManager != null) {
- mCarPowerManager.clearListener();
- }
+ mCar = Car.createCar(mContext, /* handler= */ null, Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT,
+ mCarServiceLifecycleListener);
}
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
index 30429eda7be7..a8515f94517e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/hvac/HvacController.java
@@ -20,15 +20,13 @@ import static android.car.VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL;
import static android.car.VehiclePropertyIds.HVAC_TEMPERATURE_DISPLAY_UNITS;
import android.car.Car;
+import android.car.Car.CarServiceLifecycleListener;
import android.car.VehicleUnit;
import android.car.hardware.CarPropertyValue;
import android.car.hardware.hvac.CarHvacManager;
import android.car.hardware.hvac.CarHvacManager.CarHvacEventCallback;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.ServiceConnection;
import android.os.Handler;
-import android.os.IBinder;
import android.util.Log;
import java.util.ArrayList;
@@ -52,6 +50,7 @@ public class HvacController {
private Car mCar;
private CarHvacManager mHvacManager;
private HashMap<HvacKey, List<TemperatureView>> mTempComponents = new HashMap<>();
+
/**
* Callback for getting changes from {@link CarHvacManager} and setting the UI elements to
* match.
@@ -83,39 +82,17 @@ public class HvacController {
+ " zone: " + zone);
}
};
- /**
- * If the connection to car service goes away then restart it.
- */
- private final IBinder.DeathRecipient mRestart = new IBinder.DeathRecipient() {
- @Override
- public void binderDied() {
- Log.d(TAG, "Death of HVAC triggering a restart");
- if (mCar != null) {
- mCar.disconnect();
- }
- destroyHvacManager();
- mHandler.postDelayed(() -> mCar.connect(), BIND_TO_HVAC_RETRY_DELAY);
- }
- };
- /**
- * Registers callbacks and initializes components upon connection.
- */
- private ServiceConnection mServiceConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- try {
- service.linkToDeath(mRestart, 0);
- mHvacManager = (CarHvacManager) mCar.getCarManager(Car.HVAC_SERVICE);
- mHvacManager.registerCallback(mHardwareCallback);
- initComponents();
- } catch (Exception e) {
- Log.e(TAG, "Failed to correctly connect to HVAC", e);
- }
- }
- @Override
- public void onServiceDisconnected(ComponentName name) {
- destroyHvacManager();
+ private final CarServiceLifecycleListener mCarServiceLifecycleListener = (car, ready) -> {
+ if (!ready) {
+ return;
+ }
+ try {
+ mHvacManager = (CarHvacManager) car.getCarManager(Car.HVAC_SERVICE);
+ mHvacManager.registerCallback(mHardwareCallback);
+ initComponents();
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to correctly connect to HVAC", e);
}
};
@@ -129,18 +106,8 @@ public class HvacController {
*/
public void connectToCarService() {
mHandler = new Handler();
- mCar = Car.createCar(mContext, mServiceConnection, mHandler);
- if (mCar != null) {
- // note: this connect call handles the retries
- mCar.connect();
- }
- }
-
- private void destroyHvacManager() {
- if (mHvacManager != null) {
- mHvacManager.unregisterCallback(mHardwareCallback);
- mHvacManager = null;
- }
+ mCar = Car.createCar(mContext, /* handler= */ mHandler, Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT,
+ mCarServiceLifecycleListener);
}
/**
diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
index 22c7c7a3d6af..09223e8ff4c3 100644
--- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
+++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java
@@ -24,12 +24,10 @@ import android.annotation.Nullable;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.car.Car;
-import android.car.CarNotConnectedException;
+import android.car.Car.CarServiceLifecycleListener;
import android.car.media.CarAudioManager;
-import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.ServiceConnection;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Color;
@@ -39,7 +37,6 @@ import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.os.Debug;
import android.os.Handler;
-import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.util.AttributeSet;
@@ -65,7 +62,6 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
/**
@@ -79,8 +75,6 @@ public class CarVolumeDialogImpl implements VolumeDialog {
private static final String XML_TAG_VOLUME_ITEMS = "carVolumeItems";
private static final String XML_TAG_VOLUME_ITEM = "item";
- private static final int HOVERING_TIMEOUT = 16000;
- private static final int NORMAL_TIMEOUT = 3000;
private static final int LISTVIEW_ANIMATION_DURATION_IN_MILLIS = 250;
private static final int DISMISS_DELAY_IN_MILLIS = 50;
private static final int ARROW_FADE_IN_START_DELAY_IN_MILLIS = 100;
@@ -94,12 +88,23 @@ public class CarVolumeDialogImpl implements VolumeDialog {
// Volume items in the RecyclerView.
private final List<CarVolumeItem> mCarVolumeLineItems = new ArrayList<>();
private final KeyguardManager mKeyguard;
+ private final int mNormalTimeout;
+ private final int mHoveringTimeout;
+
private Window mWindow;
private CustomDialog mDialog;
private RecyclerView mListView;
private CarVolumeItemAdapter mVolumeItemsAdapter;
private Car mCar;
private CarAudioManager mCarAudioManager;
+ private boolean mHovering;
+ private int mCurrentlyDisplayingGroupId;
+ private int mPreviouslyDisplayingGroupId;
+ private boolean mShowing;
+ private boolean mDismissing;
+ private boolean mExpanded;
+ private View mExpandIcon;
+
private final CarAudioManager.CarVolumeCallback mVolumeChangeCallback =
new CarAudioManager.CarVolumeCallback() {
@Override
@@ -129,6 +134,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
volumeItem.progress = value;
}
if ((flags & AudioManager.FLAG_SHOW_UI) != 0) {
+ mPreviouslyDisplayingGroupId = mCurrentlyDisplayingGroupId;
mCurrentlyDisplayingGroupId = groupId;
mHandler.obtainMessage(H.SHOW,
Events.SHOW_REASON_VOLUME_CHANGED).sendToTarget();
@@ -140,81 +146,47 @@ public class CarVolumeDialogImpl implements VolumeDialog {
// ignored
}
};
- private boolean mHovering;
- private int mCurrentlyDisplayingGroupId;
- private boolean mShowing;
- private boolean mDismissing;
- private boolean mExpanded;
- private View mExpandIcon;
- private final ServiceConnection mServiceConnection = new ServiceConnection() {
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- try {
- mExpanded = false;
- mCarAudioManager = (CarAudioManager) mCar.getCarManager(Car.AUDIO_SERVICE);
- int volumeGroupCount = mCarAudioManager.getVolumeGroupCount();
- // Populates volume slider items from volume groups to UI.
- for (int groupId = 0; groupId < volumeGroupCount; groupId++) {
- VolumeItem volumeItem = getVolumeItemForUsages(
- mCarAudioManager.getUsagesForVolumeGroupId(groupId));
- mAvailableVolumeItems.add(volumeItem);
- // The first one is the default item.
- if (groupId == 0) {
- setuptListItem(0);
- }
- }
- // If list is already initiated, update its content.
- if (mVolumeItemsAdapter != null) {
- mVolumeItemsAdapter.notifyDataSetChanged();
- }
- mCarAudioManager.registerCarVolumeCallback(mVolumeChangeCallback);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
+ private final CarServiceLifecycleListener mCarServiceLifecycleListener = (car, ready) -> {
+ if (!ready) {
+ return;
+ }
+ mExpanded = false;
+ mCarAudioManager = (CarAudioManager) car.getCarManager(Car.AUDIO_SERVICE);
+ int volumeGroupCount = mCarAudioManager.getVolumeGroupCount();
+ // Populates volume slider items from volume groups to UI.
+ for (int groupId = 0; groupId < volumeGroupCount; groupId++) {
+ VolumeItem volumeItem = getVolumeItemForUsages(
+ mCarAudioManager.getUsagesForVolumeGroupId(groupId));
+ mAvailableVolumeItems.add(volumeItem);
+ // The first one is the default item.
+ if (groupId == 0) {
+ clearAllAndSetupDefaultCarVolumeLineItem(0);
}
}
- /**
- * This does not get called when service is properly disconnected.
- * So we need to also handle cleanups in destroy().
- */
- @Override
- public void onServiceDisconnected(ComponentName name) {
- cleanupAudioManager();
+ // If list is already initiated, update its content.
+ if (mVolumeItemsAdapter != null) {
+ mVolumeItemsAdapter.notifyDataSetChanged();
}
+ mCarAudioManager.registerCarVolumeCallback(mVolumeChangeCallback);
};
- private void setuptListItem(int groupId) {
- mCarVolumeLineItems.clear();
- VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
- volumeItem.defaultItem = true;
- addCarVolumeListItem(volumeItem, /* volumeGroupId = */ groupId,
- R.drawable.car_ic_keyboard_arrow_down, new ExpandIconListener()
- );
- }
-
public CarVolumeDialogImpl(Context context) {
mContext = context;
mKeyguard = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
- mCar = Car.createCar(mContext, mServiceConnection);
+ mNormalTimeout = mContext.getResources().getInteger(
+ R.integer.car_volume_dialog_display_normal_timeout);
+ mHoveringTimeout = mContext.getResources().getInteger(
+ R.integer.car_volume_dialog_display_hovering_timeout);
}
private static int getSeekbarValue(CarAudioManager carAudioManager, int volumeGroupId) {
- try {
- return carAudioManager.getGroupVolume(volumeGroupId);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
- }
- return 0;
+ return carAudioManager.getGroupVolume(volumeGroupId);
}
private static int getMaxSeekbarValue(CarAudioManager carAudioManager, int volumeGroupId) {
- try {
- return carAudioManager.getGroupMaxVolume(volumeGroupId);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
- }
- return 0;
+ return carAudioManager.getGroupMaxVolume(volumeGroupId);
}
/**
@@ -224,18 +196,21 @@ public class CarVolumeDialogImpl implements VolumeDialog {
@Override
public void init(int windowType, Callback callback) {
initDialog();
-
- mCar.connect();
+ mCar = Car.createCar(mContext, /* handler= */ null, Car.CAR_WAIT_TIMEOUT_DO_NOT_WAIT,
+ mCarServiceLifecycleListener);
}
@Override
public void destroy() {
- mHandler.removeCallbacksAndMessages(null);
+ mHandler.removeCallbacksAndMessages(/* token= */ null);
cleanupAudioManager();
// unregisterVolumeCallback is not being called when disconnect car, so we manually cleanup
// audio manager beforehand.
- mCar.disconnect();
+ if (mCar != null) {
+ mCar.disconnect();
+ mCar = null;
+ }
}
private void initDialog() {
@@ -303,19 +278,36 @@ public class CarVolumeDialogImpl implements VolumeDialog {
mHandler.removeMessages(H.SHOW);
mHandler.removeMessages(H.DISMISS);
+
rescheduleTimeoutH();
+
// Refresh the data set before showing.
mVolumeItemsAdapter.notifyDataSetChanged();
+
if (mShowing) {
+ if (mPreviouslyDisplayingGroupId == mCurrentlyDisplayingGroupId || mExpanded) {
+ return;
+ }
+
+ clearAllAndSetupDefaultCarVolumeLineItem(mCurrentlyDisplayingGroupId);
return;
}
+
mShowing = true;
- setuptListItem(mCurrentlyDisplayingGroupId);
+ clearAllAndSetupDefaultCarVolumeLineItem(mCurrentlyDisplayingGroupId);
mDialog.show();
Events.writeEvent(mContext, Events.EVENT_SHOW_DIALOG, reason, mKeyguard.isKeyguardLocked());
}
- private void rescheduleTimeoutH() {
+ private void clearAllAndSetupDefaultCarVolumeLineItem(int groupId) {
+ mCarVolumeLineItems.clear();
+ VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
+ volumeItem.defaultItem = true;
+ addCarVolumeListItem(volumeItem, /* volumeGroupId = */ groupId,
+ R.drawable.car_ic_keyboard_arrow_down, new ExpandIconListener());
+ }
+
+ protected void rescheduleTimeoutH() {
mHandler.removeMessages(H.DISMISS);
final int timeout = computeTimeoutH();
mHandler.sendMessageDelayed(mHandler
@@ -327,7 +319,7 @@ public class CarVolumeDialogImpl implements VolumeDialog {
}
private int computeTimeoutH() {
- return mHovering ? HOVERING_TIMEOUT : NORMAL_TIMEOUT;
+ return mHovering ? mHoveringTimeout : mNormalTimeout;
}
private void dismissH(int reason) {
@@ -389,12 +381,13 @@ public class CarVolumeDialogImpl implements VolumeDialog {
if (XML_TAG_VOLUME_ITEM.equals(parser.getName())) {
TypedArray item = mContext.getResources().obtainAttributes(
attrs, R.styleable.carVolumeItems_item);
- int usage = item.getInt(R.styleable.carVolumeItems_item_usage, -1);
+ int usage = item.getInt(R.styleable.carVolumeItems_item_usage,
+ /* defValue= */ -1);
if (usage >= 0) {
VolumeItem volumeItem = new VolumeItem();
volumeItem.rank = rank;
- volumeItem.icon = item.getResourceId(R.styleable.carVolumeItems_item_icon,
- 0);
+ volumeItem.icon = item.getResourceId(
+ R.styleable.carVolumeItems_item_icon, /* defValue= */ 0);
mVolumeItems.put(usage, volumeItem);
rank++;
}
@@ -419,22 +412,22 @@ public class CarVolumeDialogImpl implements VolumeDialog {
return result;
}
- private CarVolumeItem addCarVolumeListItem(VolumeItem volumeItem, int volumeGroupId,
- int supplementalIconId,
+ private CarVolumeItem createCarVolumeListItem(VolumeItem volumeItem, int volumeGroupId,
+ Drawable supplementalIcon, int seekbarProgressValue,
@Nullable View.OnClickListener supplementalIconOnClickListener) {
CarVolumeItem carVolumeItem = new CarVolumeItem();
carVolumeItem.setMax(getMaxSeekbarValue(mCarAudioManager, volumeGroupId));
- int color = mContext.getResources().getColor(R.color.car_volume_dialog_tint);
- int progress = getSeekbarValue(mCarAudioManager, volumeGroupId);
- carVolumeItem.setProgress(progress);
+ carVolumeItem.setProgress(seekbarProgressValue);
carVolumeItem.setOnSeekBarChangeListener(
new CarVolumeDialogImpl.VolumeSeekBarChangeListener(volumeGroupId,
mCarAudioManager));
- Drawable primaryIcon = mContext.getResources().getDrawable(volumeItem.icon);
+ carVolumeItem.setGroupId(volumeGroupId);
+
+ int color = mContext.getColor(R.color.car_volume_dialog_tint);
+ Drawable primaryIcon = mContext.getDrawable(volumeItem.icon);
primaryIcon.mutate().setTint(color);
carVolumeItem.setPrimaryIcon(primaryIcon);
- if (supplementalIconId != 0) {
- Drawable supplementalIcon = mContext.getResources().getDrawable(supplementalIconId);
+ if (supplementalIcon != null) {
supplementalIcon.mutate().setTint(color);
carVolumeItem.setSupplementalIcon(supplementalIcon,
/* showSupplementalIconDivider= */ true);
@@ -443,21 +436,23 @@ public class CarVolumeDialogImpl implements VolumeDialog {
carVolumeItem.setSupplementalIcon(/* drawable= */ null,
/* showSupplementalIconDivider= */ false);
}
- carVolumeItem.setGroupId(volumeGroupId);
- mCarVolumeLineItems.add(carVolumeItem);
+
volumeItem.carVolumeItem = carVolumeItem;
- volumeItem.progress = progress;
+ volumeItem.progress = seekbarProgressValue;
+
return carVolumeItem;
}
- private VolumeItem findVolumeItem(CarVolumeItem targetItem) {
- for (int i = 0; i < mVolumeItems.size(); ++i) {
- VolumeItem volumeItem = mVolumeItems.valueAt(i);
- if (volumeItem.carVolumeItem == targetItem) {
- return volumeItem;
- }
- }
- return null;
+ private CarVolumeItem addCarVolumeListItem(VolumeItem volumeItem, int volumeGroupId,
+ int supplementalIconId,
+ @Nullable View.OnClickListener supplementalIconOnClickListener) {
+ int seekbarProgressValue = getSeekbarValue(mCarAudioManager, volumeGroupId);
+ Drawable supplementalIcon = supplementalIconId == 0 ? null : mContext.getDrawable(
+ supplementalIconId);
+ CarVolumeItem carVolumeItem = createCarVolumeListItem(volumeItem, volumeGroupId,
+ supplementalIcon, seekbarProgressValue, supplementalIconOnClickListener);
+ mCarVolumeLineItems.add(carVolumeItem);
+ return carVolumeItem;
}
private void cleanupAudioManager() {
@@ -553,21 +548,15 @@ public class CarVolumeDialogImpl implements VolumeDialog {
for (int groupId = 0; groupId < mAvailableVolumeItems.size(); ++groupId) {
if (groupId != mCurrentlyDisplayingGroupId) {
VolumeItem volumeItem = mAvailableVolumeItems.get(groupId);
- addCarVolumeListItem(volumeItem, groupId, 0, null);
+ addCarVolumeListItem(volumeItem, groupId, /* supplementalIconId= */ 0,
+ /* supplementalIconOnClickListener= */ null);
}
}
inAnimator = AnimatorInflater.loadAnimator(
mContext, R.anim.car_arrow_fade_in_rotate_up);
} else {
- // Only keeping the default stream if it is not expended.
- Iterator itr = mCarVolumeLineItems.iterator();
- while (itr.hasNext()) {
- CarVolumeItem carVolumeItem = (CarVolumeItem) itr.next();
- if (carVolumeItem.getGroupId() != mCurrentlyDisplayingGroupId) {
- itr.remove();
- }
- }
+ clearAllAndSetupDefaultCarVolumeLineItem(mCurrentlyDisplayingGroupId);
inAnimator = AnimatorInflater.loadAnimator(
mContext, R.anim.car_arrow_fade_in_rotate_down);
}
@@ -605,18 +594,14 @@ public class CarVolumeDialogImpl implements VolumeDialog {
// sent back down again.
return;
}
- try {
- if (mCarAudioManager == null) {
- Log.w(TAG, "Ignoring volume change event because the car isn't connected");
- return;
- }
- mAvailableVolumeItems.get(mVolumeGroupId).progress = progress;
- mAvailableVolumeItems.get(
- mVolumeGroupId).carVolumeItem.setProgress(progress);
- mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0);
- } catch (CarNotConnectedException e) {
- Log.e(TAG, "Car is not connected!", e);
+ if (mCarAudioManager == null) {
+ Log.w(TAG, "Ignoring volume change event because the car isn't connected");
+ return;
}
+ mAvailableVolumeItems.get(mVolumeGroupId).progress = progress;
+ mAvailableVolumeItems.get(
+ mVolumeGroupId).carVolumeItem.setProgress(progress);
+ mCarAudioManager.setGroupVolume(mVolumeGroupId, progress, 0);
}
@Override
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index cf286bdbde96..738c4257d2c5 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -99,11 +99,13 @@ class InstallationAsyncTask extends AsyncTask<String, Long, Throwable> {
// init input stream before calling startInstallation(), which takes 90 seconds.
initInputStream();
- Thread thread = new Thread(() -> {
- mInstallationSession =
- mDynSystem.startInstallation(mSystemSize, mUserdataSize);
- });
-
+ Thread thread =
+ new Thread(
+ () -> {
+ mDynSystem.startInstallation("userdata", mUserdataSize, false);
+ mInstallationSession =
+ mDynSystem.startInstallation("system", mSystemSize, true);
+ });
thread.start();
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index 11b0487a64b2..047ac5984fe3 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -173,6 +173,8 @@
<uses-permission android:name="android.permission.MANAGE_WIFI_WHEN_WIRELESS_CONSENT_REQUIRED" />
<!-- Permission needed to invoke DynamicSystem (AOT) -->
<uses-permission android:name="android.permission.INSTALL_DYNAMIC_SYSTEM" />
+ <!-- Used to clean up heap dumps on boot. -->
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CONTROL_KEYGUARD" />
@@ -201,7 +203,7 @@
<!-- Permission required to test ExplicitHealthCheckServiceImpl. -->
<uses-permission android:name="android.permission.BIND_EXPLICIT_HEALTH_CHECK_SERVICE" />
-
+
<!-- Permission required for CTS test - CrossProfileAppsHostSideTest -->
<uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES"/>
@@ -231,12 +233,25 @@
</intent-filter>
</provider>
+ <provider android:name=".HeapDumpProvider"
+ android:authorities="com.android.shell.heapdump"
+ android:grantUriPermissions="true"
+ android:exported="true" />
+
<activity
android:name=".BugreportWarningActivity"
android:finishOnCloseSystemDialogs="true"
android:excludeFromRecents="true"
android:exported="false" />
+ <activity android:name=".HeapDumpActivity"
+ android:theme="@*android:style/Theme.Translucent.NoTitleBar"
+ android:label="@*android:string/dump_heap_title"
+ android:finishOnCloseSystemDialogs="true"
+ android:noHistory="true"
+ android:excludeFromRecents="true"
+ android:exported="false" />
+
<receiver
android:name=".BugreportReceiver"
android:permission="android.permission.DUMP">
@@ -254,6 +269,16 @@
</intent-filter>
</receiver>
+ <receiver
+ android:name=".HeapDumpReceiver"
+ android:permission="android.permission.DUMP">
+ <intent-filter>
+ <action android:name="android.intent.action.BOOT_COMPLETED" />
+ <action android:name="com.android.internal.intent.action.HEAP_DUMP_FINISHED" />
+ <action android:name="com.android.shell.action.DELETE_HEAP_DUMP" />
+ </intent-filter>
+ </receiver>
+
<service
android:name=".BugreportProgressService"
android:exported="false"/>
diff --git a/packages/Shell/src/com/android/shell/BugreportProgressService.java b/packages/Shell/src/com/android/shell/BugreportProgressService.java
index 857cb2af41f6..29c61ee70f7d 100644
--- a/packages/Shell/src/com/android/shell/BugreportProgressService.java
+++ b/packages/Shell/src/com/android/shell/BugreportProgressService.java
@@ -1410,7 +1410,7 @@ public class BugreportProgressService extends Service {
return false;
}
- private static boolean isTv(Context context) {
+ static boolean isTv(Context context) {
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
}
diff --git a/packages/Shell/src/com/android/shell/HeapDumpActivity.java b/packages/Shell/src/com/android/shell/HeapDumpActivity.java
new file mode 100644
index 000000000000..0ff0d3353041
--- /dev/null
+++ b/packages/Shell/src/com/android/shell/HeapDumpActivity.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.shell;
+
+import static com.android.shell.HeapDumpProvider.makeUri;
+import static com.android.shell.HeapDumpReceiver.ACTION_DELETE_HEAP_DUMP;
+import static com.android.shell.HeapDumpReceiver.EXTRA_IS_USER_INITIATED;
+import static com.android.shell.HeapDumpReceiver.EXTRA_PROCESS_NAME;
+import static com.android.shell.HeapDumpReceiver.EXTRA_REPORT_PACKAGE;
+import static com.android.shell.HeapDumpReceiver.EXTRA_SIZE_BYTES;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.AlertDialog;
+import android.content.ActivityNotFoundException;
+import android.content.ClipData;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Process;
+import android.util.DebugUtils;
+import android.util.Log;
+
+import com.android.internal.R;
+
+/**
+ * This activity is displayed when the system has collected a heap dump.
+ */
+public class HeapDumpActivity extends Activity {
+ private static final String TAG = "HeapDumpActivity";
+
+ static final String KEY_URI = "uri";
+
+ private AlertDialog mDialog;
+ private Uri mDumpUri;
+ private boolean mHandled = false;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ String process = getIntent().getStringExtra(EXTRA_PROCESS_NAME);
+ long size = getIntent().getLongExtra(EXTRA_SIZE_BYTES, 0);
+ final boolean isUserInitiated = getIntent().getBooleanExtra(EXTRA_IS_USER_INITIATED, false);
+ final int uid = getIntent().getIntExtra(Intent.EXTRA_UID, 0);
+ final boolean isSystemProcess = uid == Process.SYSTEM_UID;
+ mDumpUri = makeUri(process);
+ final String procDisplayName = isSystemProcess
+ ? getString(com.android.internal.R.string.android_system_label)
+ : process;
+
+ final Intent sendIntent = new Intent();
+ ClipData clip = ClipData.newUri(getContentResolver(), "Heap Dump", mDumpUri);
+ sendIntent.setClipData(clip);
+ sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ sendIntent.setType(clip.getDescription().getMimeType(0));
+ sendIntent.putExtra(Intent.EXTRA_STREAM, mDumpUri);
+
+ String directLaunchPackage = getIntent().getStringExtra(EXTRA_REPORT_PACKAGE);
+ if (directLaunchPackage != null) {
+ sendIntent.setAction(ActivityManager.ACTION_REPORT_HEAP_LIMIT);
+ sendIntent.setPackage(directLaunchPackage);
+ try {
+ startActivity(sendIntent);
+ mHandled = true;
+ finish();
+ return;
+ } catch (ActivityNotFoundException e) {
+ Log.e(TAG, "Unable to direct launch to " + directLaunchPackage, e);
+ }
+ }
+
+ final int messageId;
+ if (isUserInitiated) {
+ messageId = com.android.internal.R.string.dump_heap_ready_text;
+ } else if (isSystemProcess) {
+ messageId = com.android.internal.R.string.dump_heap_system_text;
+ } else {
+ messageId = com.android.internal.R.string.dump_heap_text;
+ }
+ mDialog = new AlertDialog.Builder(this, android.R.style.Theme_Material_Light_Dialog_Alert)
+ .setTitle(com.android.internal.R.string.dump_heap_title)
+ .setMessage(getString(messageId, procDisplayName,
+ DebugUtils.sizeValueToString(size, null)))
+ .setNegativeButton(android.R.string.cancel, (dialog, which) -> {
+ mHandled = true;
+ finish();
+ })
+ .setNeutralButton(R.string.delete, (dialog, which) -> {
+ mHandled = true;
+ Intent deleteIntent = new Intent(ACTION_DELETE_HEAP_DUMP);
+ deleteIntent.setClass(getApplicationContext(), HeapDumpReceiver.class);
+ deleteIntent.putExtra(KEY_URI, mDumpUri.toString());
+ sendBroadcast(deleteIntent);
+ finish();
+ })
+ .setPositiveButton(android.R.string.ok, (dialog, which) -> {
+ mHandled = true;
+ sendIntent.setAction(Intent.ACTION_SEND);
+ sendIntent.setPackage(null);
+ startActivity(Intent.createChooser(sendIntent,
+ getText(com.android.internal.R.string.dump_heap_title)));
+ finish();
+ })
+ .show();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ if (!isChangingConfigurations()) {
+ if (!mHandled) {
+ Intent deleteIntent = new Intent(ACTION_DELETE_HEAP_DUMP);
+ deleteIntent.setClass(getApplicationContext(), HeapDumpReceiver.class);
+ deleteIntent.putExtra(KEY_URI, mDumpUri.toString());
+ sendBroadcast(deleteIntent);
+ }
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (mDialog != null) {
+ mDialog.dismiss();
+ }
+ }
+}
diff --git a/packages/Shell/src/com/android/shell/HeapDumpProvider.java b/packages/Shell/src/com/android/shell/HeapDumpProvider.java
new file mode 100644
index 000000000000..3eceb9118b12
--- /dev/null
+++ b/packages/Shell/src/com/android/shell/HeapDumpProvider.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.shell;
+
+import android.annotation.NonNull;
+import android.content.ContentProvider;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Binder;
+import android.os.ParcelFileDescriptor;
+import android.os.Process;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/** ContentProvider to write and access heap dumps. */
+public class HeapDumpProvider extends ContentProvider {
+ private static final String FILENAME_SUFFIX = "_javaheap.bin";
+ private static final Object sLock = new Object();
+
+ private File mRoot;
+
+ @Override
+ public boolean onCreate() {
+ synchronized (sLock) {
+ mRoot = new File(getContext().createCredentialProtectedStorageContext().getFilesDir(),
+ "heapdumps");
+ return mRoot.mkdir();
+ }
+ }
+
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
+ String sortOrder) {
+ return null;
+ }
+
+ @Override
+ public String getType(Uri uri) {
+ return "application/octet-stream";
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues values) {
+ throw new UnsupportedOperationException("Insert not allowed.");
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ String path = sanitizePath(uri.getEncodedPath());
+ String tag = Uri.decode(path);
+ return (new File(mRoot, tag)).delete() ? 1 : 0;
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException("Update not allowed.");
+ }
+
+ @Override
+ public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
+ String path = sanitizePath(uri.getEncodedPath());
+ String tag = Uri.decode(path);
+ final int pMode;
+ if (Binder.getCallingUid() == Process.SYSTEM_UID) {
+ pMode = ParcelFileDescriptor.MODE_CREATE
+ | ParcelFileDescriptor.MODE_TRUNCATE
+ | ParcelFileDescriptor.MODE_WRITE_ONLY;
+ } else {
+ pMode = ParcelFileDescriptor.MODE_READ_ONLY;
+ }
+
+ synchronized (sLock) {
+ return ParcelFileDescriptor.open(new File(mRoot, tag), pMode);
+ }
+ }
+
+ @NonNull
+ static Uri makeUri(@NonNull String procName) {
+ return Uri.parse("content://com.android.shell.heapdump/" + procName + FILENAME_SUFFIX);
+ }
+
+ private String sanitizePath(String path) {
+ return path.replaceAll("[^a-zA-Z0-9_.]", "");
+ }
+}
diff --git a/packages/Shell/src/com/android/shell/HeapDumpReceiver.java b/packages/Shell/src/com/android/shell/HeapDumpReceiver.java
new file mode 100644
index 000000000000..858c521eaed5
--- /dev/null
+++ b/packages/Shell/src/com/android/shell/HeapDumpReceiver.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.shell;
+
+import static com.android.shell.BugreportProgressService.isTv;
+
+import android.annotation.Nullable;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.AsyncTask;
+import android.os.FileUtils;
+import android.os.Process;
+import android.text.format.DateUtils;
+import android.util.Log;
+
+import java.io.File;
+
+/**
+ * Receiver that handles finished heap dumps.
+ */
+public class HeapDumpReceiver extends BroadcastReceiver {
+ private static final String TAG = "HeapDumpReceiver";
+
+ /**
+ * Broadcast action to determine when to delete a specific dump heap. Must include a {@link
+ * HeapDumpActivity#KEY_URI} String extra.
+ */
+ static final String ACTION_DELETE_HEAP_DUMP = "com.android.shell.action.DELETE_HEAP_DUMP";
+
+ /** Broadcast sent when heap dump collection has been completed. */
+ private static final String ACTION_HEAP_DUMP_FINISHED =
+ "com.android.internal.intent.action.HEAP_DUMP_FINISHED";
+
+ /** The process we are reporting */
+ static final String EXTRA_PROCESS_NAME = "com.android.internal.extra.heap_dump.PROCESS_NAME";
+
+ /** The size limit the process reached. */
+ static final String EXTRA_SIZE_BYTES = "com.android.internal.extra.heap_dump.SIZE_BYTES";
+
+ /** Whether the user initiated the dump or not. */
+ static final String EXTRA_IS_USER_INITIATED =
+ "com.android.internal.extra.heap_dump.IS_USER_INITIATED";
+
+ /** Optional name of package to directly launch. */
+ static final String EXTRA_REPORT_PACKAGE =
+ "com.android.internal.extra.heap_dump.REPORT_PACKAGE";
+
+ private static final String NOTIFICATION_CHANNEL_ID = "heapdumps";
+ private static final int NOTIFICATION_ID = 2019;
+
+ /**
+ * Always keep heap dumps taken in the last week.
+ */
+ private static final long MIN_KEEP_AGE_MS = DateUtils.WEEK_IN_MILLIS;
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(TAG, "onReceive(): " + intent);
+ final String action = intent.getAction();
+ if (action == null) {
+ Log.e(TAG, "null action received");
+ return;
+ }
+ switch (action) {
+ case Intent.ACTION_BOOT_COMPLETED:
+ cleanupOldFiles(context);
+ break;
+ case ACTION_DELETE_HEAP_DUMP:
+ deleteHeapDump(context, intent.getStringExtra(HeapDumpActivity.KEY_URI));
+ break;
+ case ACTION_HEAP_DUMP_FINISHED:
+ showDumpNotification(context, intent);
+ break;
+ }
+ }
+
+ private void cleanupOldFiles(Context context) {
+ final PendingResult result = goAsync();
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ Log.d(TAG, "Deleting from " + new File(context.getFilesDir(), "heapdumps"));
+ FileUtils.deleteOlderFiles(new File(context.getFilesDir(), "heapdumps"), 0,
+ MIN_KEEP_AGE_MS);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Couldn't delete old files", e);
+ }
+ result.finish();
+ return null;
+ }
+ }.execute();
+ }
+
+ private void deleteHeapDump(Context context, @Nullable final String uri) {
+ if (uri == null) {
+ Log.e(TAG, "null URI for delete heap dump intent");
+ return;
+ }
+ final PendingResult result = goAsync();
+ new AsyncTask<Void, Void, Void>() {
+ @Override
+ protected Void doInBackground(Void... params) {
+ context.getContentResolver().delete(Uri.parse(uri), null, null);
+ result.finish();
+ return null;
+ }
+ }.execute();
+ }
+
+ private void showDumpNotification(Context context, Intent intent) {
+ final boolean isUserInitiated = intent.getBooleanExtra(
+ EXTRA_IS_USER_INITIATED, false);
+ final String procName = intent.getStringExtra(EXTRA_PROCESS_NAME);
+ final int uid = intent.getIntExtra(Intent.EXTRA_UID, 0);
+
+ final String reportPackage = intent.getStringExtra(
+ EXTRA_REPORT_PACKAGE);
+ final long size = intent.getLongExtra(EXTRA_SIZE_BYTES, 0);
+
+ if (procName == null) {
+ Log.e(TAG, "No process name sent over");
+ return;
+ }
+
+ NotificationManager nm = NotificationManager.from(context);
+ nm.createNotificationChannel(
+ new NotificationChannel(NOTIFICATION_CHANNEL_ID,
+ "Heap dumps",
+ NotificationManager.IMPORTANCE_DEFAULT));
+
+ final int titleId = isUserInitiated
+ ? com.android.internal.R.string.dump_heap_ready_notification
+ : com.android.internal.R.string.dump_heap_notification;
+ final String procDisplayName = uid == Process.SYSTEM_UID
+ ? context.getString(com.android.internal.R.string.android_system_label)
+ : procName;
+ String text = context.getString(titleId, procDisplayName);
+
+ Intent shareIntent = new Intent();
+ shareIntent.setClassName(context, HeapDumpActivity.class.getName());
+ shareIntent.putExtra(EXTRA_PROCESS_NAME, procName);
+ shareIntent.putExtra(EXTRA_SIZE_BYTES, size);
+ shareIntent.putExtra(EXTRA_IS_USER_INITIATED, isUserInitiated);
+ shareIntent.putExtra(Intent.EXTRA_UID, uid);
+ if (reportPackage != null) {
+ shareIntent.putExtra(EXTRA_REPORT_PACKAGE, reportPackage);
+ }
+ final Notification.Builder builder = new Notification.Builder(context,
+ NOTIFICATION_CHANNEL_ID)
+ .setSmallIcon(
+ isTv(context) ? R.drawable.ic_bug_report_black_24dp
+ : com.android.internal.R.drawable.stat_sys_adb)
+ .setLocalOnly(true)
+ .setColor(context.getColor(
+ com.android.internal.R.color.system_notification_accent_color))
+ .setContentTitle(text)
+ .setTicker(text)
+ .setAutoCancel(true)
+ .setContentText(context.getText(
+ com.android.internal.R.string.dump_heap_notification_detail))
+ .setContentIntent(PendingIntent.getActivity(context, 2, shareIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT));
+
+ Log.v(TAG, "Creating share heap dump notification");
+ NotificationManager.from(context).notify(NOTIFICATION_ID, builder.build());
+ }
+}
diff --git a/packages/SystemUI/legacy/recents/res/values/config.xml b/packages/SystemUI/legacy/recents/res/values/config.xml
index 2ff9abf4003d..0fbb623d2ba0 100644
--- a/packages/SystemUI/legacy/recents/res/values/config.xml
+++ b/packages/SystemUI/legacy/recents/res/values/config.xml
@@ -26,6 +26,14 @@
(package/class) -->
<string name="config_recentsComponent" translatable="false">com.android.systemui.recents.LegacyRecentsImpl</string>
+ <!-- SystemUI Services (per user): The classes of the stuff to start for each user. This is a subset of the config_systemUIServiceComponents -->
+ <string-array name="config_systemUIServiceComponentsPerUser" translatable="false">
+ <item>com.android.systemui.Dependency$DependencyCreator</item>
+ <item>com.android.systemui.util.NotificationChannels</item>
+ <item>com.android.systemui.statusbar.CommandQueue$CommandQueueStart</item>
+ <item>com.android.systemui.recents.Recents</item>
+ </string-array>
+
<!-- Whether recents should use hardware layers for its taskviews. This flag can be enabled
for devices where the java drawing of round rects may be slow -->
<bool name="config_recents_use_hardware_layers">false</bool>
diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java
index a150de95fcf0..a572110c6b9d 100644
--- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java
+++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java
@@ -195,6 +195,7 @@ public class LegacyRecentsImpl implements RecentsImplementation {
mContext.getColor(R.color.recents_task_bar_default_background_color);
final int defaultTaskViewBackgroundColor =
mContext.getColor(R.color.recents_task_view_default_background_color);
+ getComponent(Recents.class).putComponent(LegacyRecentsImpl.class, this);
sDebugFlags = new RecentsDebugFlags();
sSystemServicesProxy = SystemServicesProxy.getInstance(mContext);
sConfiguration = new RecentsConfiguration(mContext);
diff --git a/packages/SystemUI/res/layout/super_status_bar.xml b/packages/SystemUI/res/layout/super_status_bar.xml
index 9716a00a7f72..a91493003bb5 100644
--- a/packages/SystemUI/res/layout/super_status_bar.xml
+++ b/packages/SystemUI/res/layout/super_status_bar.xml
@@ -44,7 +44,7 @@
</com.android.systemui.statusbar.BackDropView>
<com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_for_bubble"
+ android:id="@+id/scrim_behind"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
@@ -56,14 +56,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content" />
- <com.android.systemui.statusbar.ScrimView
- android:id="@+id/scrim_behind"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:importantForAccessibility="no"
- sysui:ignoreRightInset="true"
- />
-
<include layout="@layout/status_bar_expanded"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
index ee88be7f9588..054207eb7419 100644
--- a/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
+++ b/packages/SystemUI/src/com/android/keyguard/CarrierTextController.java
@@ -173,7 +173,7 @@ public class CarrierTextController {
mSeparator = separator;
mWakefulnessLifecycle = Dependency.get(WakefulnessLifecycle.class);
mSimSlotsNumber = ((TelephonyManager) context.getSystemService(
- Context.TELEPHONY_SERVICE)).getMaxPhoneCount();
+ Context.TELEPHONY_SERVICE)).getSupportedModemCount();
mSimErrorState = new boolean[mSimSlotsNumber];
updateDisplayOpportunisticSubscriptionCarrierText(SystemProperties.getBoolean(
TelephonyProperties.DISPLAY_OPPORTUNISTIC_SUBSCRIPTION_CARRIER_TEXT_PROPERTY_NAME,
diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
index d151f7dc62be..0899d955a1ac 100644
--- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
+++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java
@@ -123,12 +123,11 @@ public class SystemUIFactory {
}
public ScrimController createScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
- ScrimView scrimForBubble,
LockscreenWallpaper lockscreenWallpaper,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
- return new ScrimController(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
+ return new ScrimController(scrimBehind, scrimInFront, scrimStateListener,
scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
}
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
index 3cc91de43438..5559d29a9050 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java
@@ -316,9 +316,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
if (mStackView == null) {
mStackView = new BubbleStackView(mContext, mBubbleData, mSurfaceSynchronizer);
ViewGroup sbv = mStatusBarWindowController.getStatusBarView();
- int bubbleScrimIndex = sbv.indexOfChild(sbv.findViewById(R.id.scrim_for_bubble));
- int stackIndex = bubbleScrimIndex + 1; // Show stack above bubble scrim.
- sbv.addView(mStackView, stackIndex,
+ // TODO(b/130237686): When you expand the shade on top of expanded bubble, there is no
+ // scrim between bubble and the shade
+ int bubblePosition = sbv.indexOfChild(sbv.findViewById(R.id.scrim_behind)) + 1;
+ sbv.addView(mStackView, bubblePosition,
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
if (mExpandListener != null) {
mStackView.setExpandListener(mExpandListener);
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
index eb826e54d340..d43e030ed9eb 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java
@@ -184,6 +184,8 @@ public class BubbleData {
Log.d(TAG, "notificationEntryUpdated: " + entry);
}
Bubble bubble = getBubbleWithKey(entry.key);
+ suppressFlyout = !entry.isVisuallyInterruptive || suppressFlyout;
+
if (bubble == null) {
// Create a new bubble
bubble = new Bubble(mContext, entry);
@@ -193,8 +195,10 @@ public class BubbleData {
} else {
// Updates an existing bubble
bubble.updateEntry(entry);
+ bubble.setSuppressFlyout(suppressFlyout);
doUpdate(bubble);
}
+
if (bubble.shouldAutoExpand()) {
setSelectedBubbleInternal(bubble);
if (!mExpanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index b68b7627fe8c..31cf853dce04 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -169,7 +169,7 @@ public class BubbleStackView extends FrameLayout {
* Callback to run after the flyout hides. Also called if a new flyout is shown before the
* previous one animates out.
*/
- private Runnable mAfterFlyoutHides;
+ private Runnable mFlyoutOnHide;
/** Layout change listener that moves the stack to the nearest valid position on rotation. */
private OnLayoutChangeListener mOrientationChangedListener;
@@ -1401,111 +1401,106 @@ public class BubbleStackView extends FrameLayout {
@VisibleForTesting
void animateInFlyoutForBubble(Bubble bubble) {
final CharSequence updateMessage = bubble.getUpdateMessage(getContext());
-
if (!bubble.showFlyoutForBubble()) {
// In case flyout was suppressed for this update, reset now.
bubble.setSuppressFlyout(false);
return;
}
-
if (updateMessage == null
|| isExpanded()
|| mIsExpansionAnimating
|| mIsGestureInProgress
- || mBubbleToExpandAfterFlyoutCollapse != null) {
+ || mBubbleToExpandAfterFlyoutCollapse != null
+ || bubble.getIconView() == null) {
// Skip the message if none exists, we're expanded or animating expansion, or we're
- // about to expand a bubble from the previous tapped flyout.
+ // about to expand a bubble from the previous tapped flyout, or if bubble view is null.
return;
}
-
- if (bubble.getIconView() != null) {
- // Temporarily suppress the dot while the flyout is visible.
- bubble.getIconView().setSuppressDot(
- true /* suppressDot */, false /* animate */);
-
- mFlyout.removeCallbacks(mAnimateInFlyout);
- mFlyoutDragDeltaX = 0f;
-
- if (mAfterFlyoutHides != null) {
- mAfterFlyoutHides.run();
+ mFlyoutDragDeltaX = 0f;
+ clearFlyoutOnHide();
+ mFlyoutOnHide = () -> {
+ resetDot(bubble);
+ if (mBubbleToExpandAfterFlyoutCollapse == null) {
+ return;
}
-
- mAfterFlyoutHides = () -> {
- final boolean suppressDot = !bubble.showBubbleDot();
- // If we're going to suppress the dot, make it visible first so it'll
- // visibly animate away.
- if (suppressDot) {
- bubble.getIconView().setSuppressDot(
- false /* suppressDot */, false /* animate */);
- }
- // Reset dot suppression. If we're not suppressing due to DND, then
- // stop suppressing it with no animation (since the flyout has
- // transformed into the dot). If we are suppressing due to DND, animate
- // it away.
- bubble.getIconView().setSuppressDot(
- suppressDot /* suppressDot */,
- suppressDot /* animate */);
-
- if (mBubbleToExpandAfterFlyoutCollapse != null) {
- mBubbleData.setSelectedBubble(mBubbleToExpandAfterFlyoutCollapse);
- mBubbleData.setExpanded(true);
- mBubbleToExpandAfterFlyoutCollapse = null;
- }
- };
-
- mFlyout.setVisibility(INVISIBLE);
-
- // Post in case layout isn't complete and getWidth returns 0.
- post(() -> {
- // An auto-expanding bubble could have been posted during the time it takes to
- // layout.
- if (isExpanded()) {
- return;
- }
-
- final Runnable afterShow = () -> {
- mAnimateInFlyout = () -> {
- mFlyout.setVisibility(VISIBLE);
- bubble.getIconView().setSuppressDot(
- true /* suppressDot */, false /* animate */);
- mFlyoutDragDeltaX =
- mStackAnimationController.isStackOnLeftSide()
- ? -mFlyout.getWidth()
- : mFlyout.getWidth();
- animateFlyoutCollapsed(false /* collapsed */, 0 /* velX */);
- mFlyout.postDelayed(mHideFlyout, FLYOUT_HIDE_AFTER);
- };
-
- mFlyout.postDelayed(mAnimateInFlyout, 200);
+ mBubbleData.setSelectedBubble(mBubbleToExpandAfterFlyoutCollapse);
+ mBubbleData.setExpanded(true);
+ mBubbleToExpandAfterFlyoutCollapse = null;
+ };
+ mFlyout.setVisibility(INVISIBLE);
+
+ // Temporarily suppress the dot while the flyout is visible.
+ bubble.getIconView().setSuppressDot(
+ true /* suppressDot */, false /* animate */);
+
+ // Start flyout expansion. Post in case layout isn't complete and getWidth returns 0.
+ post(() -> {
+ // An auto-expanding bubble could have been posted during the time it takes to
+ // layout.
+ if (isExpanded()) {
+ return;
+ }
+ final Runnable expandFlyoutAfterDelay = () -> {
+ mAnimateInFlyout = () -> {
+ mFlyout.setVisibility(VISIBLE);
+ mFlyoutDragDeltaX =
+ mStackAnimationController.isStackOnLeftSide()
+ ? -mFlyout.getWidth()
+ : mFlyout.getWidth();
+ animateFlyoutCollapsed(false /* collapsed */, 0 /* velX */);
+ mFlyout.postDelayed(mHideFlyout, FLYOUT_HIDE_AFTER);
};
-
- mFlyout.setupFlyoutStartingAsDot(
- updateMessage, mStackAnimationController.getStackPosition(), getWidth(),
- mStackAnimationController.isStackOnLeftSide(),
- bubble.getIconView().getBadgeColor(),
- afterShow,
- mAfterFlyoutHides,
- bubble.getIconView().getDotCenter());
- mFlyout.bringToFront();
- });
- }
-
+ mFlyout.postDelayed(mAnimateInFlyout, 200);
+ };
+ mFlyout.setupFlyoutStartingAsDot(
+ updateMessage, mStackAnimationController.getStackPosition(), getWidth(),
+ mStackAnimationController.isStackOnLeftSide(),
+ bubble.getIconView().getBadgeColor() /* dotColor */,
+ expandFlyoutAfterDelay /* onLayoutComplete */,
+ mFlyoutOnHide,
+ bubble.getIconView().getDotCenter());
+ mFlyout.bringToFront();
+ });
mFlyout.removeCallbacks(mHideFlyout);
mFlyout.postDelayed(mHideFlyout, FLYOUT_HIDE_AFTER);
logBubbleEvent(bubble, StatsLog.BUBBLE_UICHANGED__ACTION__FLYOUT);
}
- /** Hide the flyout immediately and cancel any pending hide runnables. */
- private void hideFlyoutImmediate() {
- if (mAfterFlyoutHides != null) {
- mAfterFlyoutHides.run();
+ private void resetDot(Bubble bubble) {
+ final boolean suppressDot = !bubble.showBubbleDot();
+ // If we're going to suppress the dot, make it visible first so it'll
+ // visibly animate away.
+
+ if (suppressDot) {
+ bubble.getIconView().setSuppressDot(
+ false /* suppressDot */, false /* animate */);
}
+ // Reset dot suppression. If we're not suppressing due to DND, then
+ // stop suppressing it with no animation (since the flyout has
+ // transformed into the dot). If we are suppressing due to DND, animate
+ // it away.
+ bubble.getIconView().setSuppressDot(
+ suppressDot /* suppressDot */,
+ suppressDot /* animate */);
+ }
+ /** Hide the flyout immediately and cancel any pending hide runnables. */
+ private void hideFlyoutImmediate() {
+ clearFlyoutOnHide();
mFlyout.removeCallbacks(mAnimateInFlyout);
mFlyout.removeCallbacks(mHideFlyout);
mFlyout.hideFlyout();
}
+ private void clearFlyoutOnHide() {
+ mFlyout.removeCallbacks(mAnimateInFlyout);
+ if (mFlyoutOnHide == null) {
+ return;
+ }
+ mFlyoutOnHide.run();
+ mFlyoutOnHide = null;
+ }
+
@Override
public void getBoundsOnScreen(Rect outRect) {
if (!mIsExpanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
index 603c4169c169..4512aa822e3b 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java
@@ -61,7 +61,7 @@ public class BubbleView extends FrameLayout {
// mBubbleIconFactory cannot be static because it depends on Context.
private BubbleIconFactory mBubbleIconFactory;
- private boolean mSuppressDot = false;
+ private boolean mSuppressDot;
private Bubble mBubble;
@@ -140,6 +140,7 @@ public class BubbleView extends FrameLayout {
public void setAppIcon(Drawable appIcon) {
mUserBadgedAppIcon = appIcon;
}
+
/**
* @return the {@link ExpandableNotificationRow} view to display notification content when the
* bubble is expanded.
@@ -154,7 +155,6 @@ public class BubbleView extends FrameLayout {
updateDotVisibility(animate, null /* after */);
}
-
/**
* Sets whether or not to hide the dot even if we'd otherwise show it. This is used while the
* flyout is visible or animating, to hide the dot until the flyout visually transforms into it.
@@ -166,7 +166,7 @@ public class BubbleView extends FrameLayout {
/** Sets the position of the 'new' dot, animating it out and back in if requested. */
void setDotPosition(boolean onLeft, boolean animate) {
- if (animate && onLeft != mBadgedImageView.getDotOnLeft() && !mSuppressDot) {
+ if (animate && onLeft != mBadgedImageView.getDotOnLeft() && shouldShowDot()) {
animateDot(false /* showDot */, () -> {
mBadgedImageView.setDotOnLeft(onLeft);
animateDot(true /* showDot */, null);
@@ -190,12 +190,12 @@ public class BubbleView extends FrameLayout {
* after animation if requested.
*/
private void updateDotVisibility(boolean animate, Runnable after) {
- boolean showDot = mBubble.showBubbleDot() && !mSuppressDot;
-
+ final boolean showDot = shouldShowDot();
if (animate) {
animateDot(showDot, after);
} else {
mBadgedImageView.setShowDot(showDot);
+ mBadgedImageView.setDotScale(showDot ? 1f : 0f);
}
}
@@ -203,27 +203,25 @@ public class BubbleView extends FrameLayout {
* Animates the badge to show or hide.
*/
private void animateDot(boolean showDot, Runnable after) {
- if (mBadgedImageView.isShowingDot() != showDot) {
- if (showDot) {
- mBadgedImageView.setShowDot(true);
- }
- mBadgedImageView.clearAnimation();
- mBadgedImageView.animate().setDuration(200)
- .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
- .setUpdateListener((valueAnimator) -> {
- float fraction = valueAnimator.getAnimatedFraction();
- fraction = showDot ? fraction : 1f - fraction;
- mBadgedImageView.setDotScale(fraction);
- }).withEndAction(() -> {
- if (!showDot) {
- mBadgedImageView.setShowDot(false);
- }
-
- if (after != null) {
- after.run();
- }
- }).start();
+ if (mBadgedImageView.isShowingDot() == showDot) {
+ return;
}
+ // Do NOT wait until after animation ends to setShowDot
+ // to avoid overriding more recent showDot states.
+ mBadgedImageView.setShowDot(showDot);
+ mBadgedImageView.clearAnimation();
+ mBadgedImageView.animate().setDuration(200)
+ .setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
+ .setUpdateListener((valueAnimator) -> {
+ float fraction = valueAnimator.getAnimatedFraction();
+ fraction = showDot ? fraction : 1f - fraction;
+ mBadgedImageView.setDotScale(fraction);
+ }).withEndAction(() -> {
+ mBadgedImageView.setDotScale(showDot ? 1f : 0f);
+ if (after != null) {
+ after.run();
+ }
+ }).start();
}
void updateViews() {
@@ -273,7 +271,11 @@ public class BubbleView extends FrameLayout {
iconPath.transform(matrix);
mBadgedImageView.drawDot(iconPath);
- animateDot(mBubble.showBubbleDot() /* showDot */, null /* after */);
+ animateDot(shouldShowDot(), null /* after */);
+ }
+
+ boolean shouldShowDot() {
+ return mBubble.showBubbleDot() && !mSuppressDot;
}
int getBadgeColor() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 6f87b2939cfb..f3ae50b4ca23 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -108,6 +108,7 @@ public class KeyguardIndicationController implements StateListener,
private ColorStateList mTransientTextColorState;
private ColorStateList mInitialTextColorState;
private boolean mVisible;
+ private boolean mHideTransientMessageOnScreenOff;
private boolean mPowerPluggedIn;
private boolean mPowerPluggedInWired;
@@ -317,15 +318,17 @@ public class KeyguardIndicationController implements StateListener,
* Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
*/
public void showTransientIndication(CharSequence transientIndication) {
- showTransientIndication(transientIndication, mInitialTextColorState);
+ showTransientIndication(transientIndication, mInitialTextColorState,
+ false /* hideOnScreenOff */);
}
/**
* Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
*/
- public void showTransientIndication(CharSequence transientIndication,
- ColorStateList textColorState) {
+ private void showTransientIndication(CharSequence transientIndication,
+ ColorStateList textColorState, boolean hideOnScreenOff) {
mTransientIndication = transientIndication;
+ mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null;
mTransientTextColorState = textColorState;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK);
@@ -344,6 +347,7 @@ public class KeyguardIndicationController implements StateListener,
public void hideTransientIndication() {
if (mTransientIndication != null) {
mTransientIndication = null;
+ mHideTransientMessageOnScreenOff = false;
mHandler.removeMessages(MSG_HIDE_TRANSIENT);
updateIndication(false);
}
@@ -566,7 +570,8 @@ public class KeyguardIndicationController implements StateListener,
String message = mContext.getString(R.string.keyguard_retry);
mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
} else if (mKeyguardUpdateMonitor.isScreenOn()) {
- showTransientIndication(mContext.getString(R.string.keyguard_unlock));
+ showTransientIndication(mContext.getString(R.string.keyguard_unlock),
+ mInitialTextColorState, true /* hideOnScreenOff */);
hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
}
}
@@ -576,7 +581,11 @@ public class KeyguardIndicationController implements StateListener,
return;
}
mDozing = dozing;
- updateIndication(false);
+ if (mHideTransientMessageOnScreenOff && mDozing) {
+ hideTransientIndication();
+ } else {
+ updateIndication(false);
+ }
updateDisclosure();
}
@@ -646,8 +655,7 @@ public class KeyguardIndicationController implements StateListener,
@Override
public void onBiometricHelp(int msgId, String helpString,
BiometricSourceType biometricSourceType) {
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- if (!updateMonitor.isUnlockingWithBiometricAllowed()) {
+ if (!mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()) {
return;
}
boolean showSwipeToUnlock =
@@ -655,8 +663,8 @@ public class KeyguardIndicationController implements StateListener,
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
mInitialTextColorState);
- } else if (updateMonitor.isScreenOn()) {
- showTransientIndication(helpString);
+ } else if (mKeyguardUpdateMonitor.isScreenOn()) {
+ showTransientIndication(helpString, mInitialTextColorState, showSwipeToUnlock);
if (!showSwipeToUnlock) {
hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
}
@@ -670,8 +678,7 @@ public class KeyguardIndicationController implements StateListener,
@Override
public void onBiometricError(int msgId, String errString,
BiometricSourceType biometricSourceType) {
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- if (shouldSuppressBiometricError(msgId, biometricSourceType, updateMonitor)) {
+ if (shouldSuppressBiometricError(msgId, biometricSourceType, mKeyguardUpdateMonitor)) {
return;
}
animatePadlockError();
@@ -681,7 +688,7 @@ public class KeyguardIndicationController implements StateListener,
showSwipeUpToUnlock();
} else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
- } else if (updateMonitor.isScreenOn()) {
+ } else if (mKeyguardUpdateMonitor.isScreenOn()) {
showTransientIndication(errString);
// We want to keep this message around in case the screen was off
hideTransientIndicationDelayed(HIDE_DELAY_MS);
@@ -721,13 +728,15 @@ public class KeyguardIndicationController implements StateListener,
@Override
public void onTrustAgentErrorMessage(CharSequence message) {
- showTransientIndication(message, Utils.getColorError(mContext));
+ showTransientIndication(message, Utils.getColorError(mContext),
+ false /* hideOnScreenOff */);
}
@Override
public void onScreenTurnedOn() {
if (mMessageToShowOnScreenOn != null) {
- showTransientIndication(mMessageToShowOnScreenOn, Utils.getColorError(mContext));
+ showTransientIndication(mMessageToShowOnScreenOn, Utils.getColorError(mContext),
+ false /* hideOnScreenOff */);
// We want to keep this message around in case the screen was off
hideTransientIndicationDelayed(HIDE_DELAY_MS);
mMessageToShowOnScreenOn = null;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
index 689d161c2ee8..239addd4ee1d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarMobileView.java
@@ -208,11 +208,9 @@ public class StatusBarMobileView extends FrameLayout implements DarkReceiver,
@Override
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
- if (!isInArea(area, this)) {
- return;
- }
+ float intensity = isInArea(area, this) ? darkIntensity : 0;
mMobileDrawable.setTintList(
- ColorStateList.valueOf(mDualToneHandler.getSingleColor(darkIntensity)));
+ ColorStateList.valueOf(mDualToneHandler.getSingleColor(intensity)));
ColorStateList color = ColorStateList.valueOf(getTint(area, this, tint));
mIn.setImageTintList(color);
mOut.setImageTintList(color);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java
index 23e2d277034d..6dbcc44e385b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarWifiView.java
@@ -236,15 +236,13 @@ public class StatusBarWifiView extends FrameLayout implements DarkReceiver,
@Override
public void onDarkChanged(Rect area, float darkIntensity, int tint) {
- if (!isInArea(area, this)) {
- return;
- }
-
- mWifiIcon.setImageTintList(ColorStateList.valueOf(getTint(area, this, tint)));
- mIn.setImageTintList(ColorStateList.valueOf(getTint(area, this, tint)));
- mOut.setImageTintList(ColorStateList.valueOf(getTint(area, this, tint)));
- mDotView.setDecorColor(tint);
- mDotView.setIconColor(tint, false);
+ int areaTint = getTint(area, this, tint);
+ ColorStateList color = ColorStateList.valueOf(areaTint);
+ mWifiIcon.setImageTintList(color);
+ mIn.setImageTintList(color);
+ mOut.setImageTintList(color);
+ mDotView.setDecorColor(areaTint);
+ mDotView.setIconColor(areaTint, false);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
index 00092929fd49..299511c8f2da 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationData.java
@@ -57,7 +57,6 @@ public class NotificationData {
private final ArrayMap<String, NotificationEntry> mEntries = new ArrayMap<>();
private final ArrayList<NotificationEntry> mSortedAndFiltered = new ArrayList<>();
- private final ArrayList<NotificationEntry> mFilteredForUser = new ArrayList<>();
private final NotificationGroupManager mGroupManager =
Dependency.get(NotificationGroupManager.class);
@@ -166,20 +165,20 @@ public class NotificationData {
}
public ArrayList<NotificationEntry> getNotificationsForCurrentUser() {
- mFilteredForUser.clear();
-
synchronized (mEntries) {
final int len = mEntries.size();
+ ArrayList<NotificationEntry> filteredForUser = new ArrayList<>(len);
+
for (int i = 0; i < len; i++) {
NotificationEntry entry = mEntries.valueAt(i);
final StatusBarNotification sbn = entry.notification;
if (!getEnvironment().isNotificationForCurrentProfiles(sbn)) {
continue;
}
- mFilteredForUser.add(entry);
+ filteredForUser.add(entry);
}
+ return filteredForUser;
}
- return mFilteredForUser;
}
public NotificationEntry get(String key) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
index 027e8e426c4b..121508b877d2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java
@@ -155,6 +155,12 @@ public final class NotificationEntry {
public boolean canBubble;
/**
+ * Whether this notification has changed in visual appearance since the previous post.
+ * New notifications are interruptive by default.
+ */
+ public boolean isVisuallyInterruptive;
+
+ /**
* Whether this notification is shown to the user as a high priority notification: visible on
* the lock screen/status bar and in the top section in the shade.
*/
@@ -196,6 +202,7 @@ public final class NotificationEntry {
suppressedVisualEffects = ranking.getSuppressedVisualEffects();
suspended = ranking.isSuspended();
canBubble = ranking.canBubble();
+ isVisuallyInterruptive = ranking.visuallyInterruptive();
}
public void setInterruption() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index 179375e31dd3..4e91e4c84e99 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -240,7 +240,7 @@ public class KeyguardClockPositionAlgorithm {
* @return Alpha from 0 to 1.
*/
private float getClockAlpha(int y) {
- float alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedPreferredClockY()));
+ float alphaKeyguard = Math.max(0, y / Math.max(1f, getClockY(1f)));
alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index ecfc45bb1182..06a2225ed0bf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -604,7 +604,7 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
*/
public void onScrimVisibilityChanged(@ScrimVisibility int scrimsVisible) {
if (mWakeAndUnlockRunning
- && scrimsVisible == ScrimController.TRANSPARENT) {
+ && scrimsVisible == ScrimController.VISIBILITY_FULLY_TRANSPARENT) {
mWakeAndUnlockRunning = false;
update();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index 2f567177f814..9019e9a3f44b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -79,24 +79,23 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
/**
* When both scrims have 0 alpha.
*/
- public static final int TRANSPARENT = 0;
+ public static final int VISIBILITY_FULLY_TRANSPARENT = 0;
/**
* When scrims aren't transparent (alpha 0) but also not opaque (alpha 1.)
*/
- public static final int SEMI_TRANSPARENT = 1;
+ public static final int VISIBILITY_SEMI_TRANSPARENT = 1;
/**
* When at least 1 scrim is fully opaque (alpha set to 1.)
*/
- public static final int OPAQUE = 2;
+ public static final int VISIBILITY_FULLY_OPAQUE = 2;
- @IntDef(prefix = {"VISIBILITY_"}, value = {
- TRANSPARENT,
- SEMI_TRANSPARENT,
- OPAQUE
+ @IntDef(prefix = { "VISIBILITY_" }, value = {
+ VISIBILITY_FULLY_TRANSPARENT,
+ VISIBILITY_SEMI_TRANSPARENT,
+ VISIBILITY_FULLY_OPAQUE
})
@Retention(RetentionPolicy.SOURCE)
- public @interface ScrimVisibility {
- }
+ public @interface ScrimVisibility {}
/**
* Default alpha value for most scrims.
@@ -124,11 +123,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private ScrimState mState = ScrimState.UNINITIALIZED;
private final Context mContext;
-
- protected final ScrimView mScrimInFront;
protected final ScrimView mScrimBehind;
- protected final ScrimView mScrimForBubble;
-
+ protected final ScrimView mScrimInFront;
private final UnlockMethodCache mUnlockMethodCache;
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
private final DozeParameters mDozeParameters;
@@ -157,15 +153,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private Runnable mOnAnimationFinished;
private boolean mDeferFinishedListener;
private final Interpolator mInterpolator = new DecelerateInterpolator();
-
- private float mInFrontAlpha = NOT_INITIALIZED;
- private float mBehindAlpha = NOT_INITIALIZED;
- private float mBubbleAlpha = NOT_INITIALIZED;
-
- private int mInFrontTint;
- private int mBehindTint;
- private int mBubbleTint;
-
+ private float mCurrentInFrontAlpha = NOT_INITIALIZED;
+ private float mCurrentBehindAlpha = NOT_INITIALIZED;
+ private int mCurrentInFrontTint;
+ private int mCurrentBehindTint;
private boolean mWallpaperVisibilityTimedOut;
private int mScrimsVisibility;
private final TriConsumer<ScrimState, Float, GradientColors> mScrimStateListener;
@@ -184,17 +175,14 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private boolean mWakeLockHeld;
private boolean mKeyguardOccluded;
- public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront, ScrimView scrimForBubble,
+ public ScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
mScrimBehind = scrimBehind;
mScrimInFront = scrimInFront;
- mScrimForBubble = scrimForBubble;
-
mScrimStateListener = scrimStateListener;
mScrimVisibleListener = scrimVisibleListener;
-
mContext = scrimBehind.getContext();
mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
@@ -225,13 +213,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
final ScrimState[] states = ScrimState.values();
for (int i = 0; i < states.length; i++) {
- states[i].init(mScrimInFront, mScrimBehind, mScrimForBubble, mDozeParameters);
+ states[i].init(mScrimInFront, mScrimBehind, mDozeParameters);
states[i].setScrimBehindAlphaKeyguard(mScrimBehindAlphaKeyguard);
}
mScrimBehind.setDefaultFocusHighlightEnabled(false);
mScrimInFront.setDefaultFocusHighlightEnabled(false);
- mScrimForBubble.setDefaultFocusHighlightEnabled(false);
updateScrims();
}
@@ -270,14 +257,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
mBlankScreen = state.getBlanksScreen();
mAnimateChange = state.getAnimateChange();
mAnimationDuration = state.getAnimationDuration();
-
- mInFrontTint = state.getFrontTint();
- mBehindTint = state.getBehindTint();
- mBubbleTint = state.getBubbleTint();
-
- mInFrontAlpha = state.getFrontAlpha();
- mBehindAlpha = state.getBehindAlpha();
- mBubbleAlpha = state.getBubbleAlpha();
+ mCurrentInFrontTint = state.getFrontTint();
+ mCurrentBehindTint = state.getBehindTint();
+ mCurrentInFrontAlpha = state.getFrontAlpha();
+ mCurrentBehindAlpha = state.getBehindAlpha();
applyExpansionToAlpha();
// Scrim might acquire focus when user is navigating with a D-pad or a keyboard.
@@ -410,20 +393,21 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
if (mExpansionFraction != fraction) {
mExpansionFraction = fraction;
- boolean relevantState = (mState == ScrimState.UNLOCKED
- || mState == ScrimState.KEYGUARD
- || mState == ScrimState.PULSING
- || mState == ScrimState.BUBBLE_EXPANDED);
- if (!(relevantState && mExpansionAffectsAlpha)) {
+ final boolean keyguardOrUnlocked = mState == ScrimState.UNLOCKED
+ || mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING;
+ if (!keyguardOrUnlocked || !mExpansionAffectsAlpha) {
return;
}
+
applyExpansionToAlpha();
+
if (mUpdatePending) {
return;
}
+
setOrAdaptCurrentAnimation(mScrimBehind);
setOrAdaptCurrentAnimation(mScrimInFront);
- setOrAdaptCurrentAnimation(mScrimForBubble);
+
dispatchScrimState(mScrimBehind.getViewAlpha());
// Reset wallpaper timeout if it's already timeout like expanding panel while PULSING
@@ -437,10 +421,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
}
private void setOrAdaptCurrentAnimation(View scrim) {
- float alpha = getCurrentScrimAlpha(scrim);
- if (isAnimating(scrim)) {
- // Adapt current animation.
+ if (!isAnimating(scrim)) {
+ updateScrimColor(scrim, getCurrentScrimAlpha(scrim), getCurrentScrimTint(scrim));
+ } else {
ValueAnimator previousAnimator = (ValueAnimator) scrim.getTag(TAG_KEY_ANIM);
+ float alpha = getCurrentScrimAlpha(scrim);
float previousEndValue = (Float) scrim.getTag(TAG_END_ALPHA);
float previousStartValue = (Float) scrim.getTag(TAG_START_ALPHA);
float relativeDiff = alpha - previousEndValue;
@@ -448,9 +433,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
scrim.setTag(TAG_START_ALPHA, newStartValue);
scrim.setTag(TAG_END_ALPHA, alpha);
previousAnimator.setCurrentPlayTime(previousAnimator.getCurrentPlayTime());
- } else {
- // Set animation.
- updateScrimColor(scrim, alpha, getCurrentScrimTint(scrim));
}
}
@@ -459,27 +441,27 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
return;
}
- if (mState == ScrimState.UNLOCKED || mState == ScrimState.BUBBLE_EXPANDED) {
+ if (mState == ScrimState.UNLOCKED) {
// Darken scrim as you pull down the shade when unlocked
float behindFraction = getInterpolatedFraction();
behindFraction = (float) Math.pow(behindFraction, 0.8f);
- mBehindAlpha = behindFraction * GRADIENT_SCRIM_ALPHA_BUSY;
- mInFrontAlpha = 0;
+ mCurrentBehindAlpha = behindFraction * GRADIENT_SCRIM_ALPHA_BUSY;
+ mCurrentInFrontAlpha = 0;
} else if (mState == ScrimState.KEYGUARD || mState == ScrimState.PULSING) {
// Either darken of make the scrim transparent when you
// pull down the shade
float interpolatedFract = getInterpolatedFraction();
float alphaBehind = mState.getBehindAlpha();
if (mDarkenWhileDragging) {
- mBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
+ mCurrentBehindAlpha = MathUtils.lerp(GRADIENT_SCRIM_ALPHA_BUSY, alphaBehind,
interpolatedFract);
- mInFrontAlpha = mState.getFrontAlpha();
+ mCurrentInFrontAlpha = mState.getFrontAlpha();
} else {
- mBehindAlpha = MathUtils.lerp(0 /* start */, alphaBehind,
+ mCurrentBehindAlpha = MathUtils.lerp(0 /* start */, alphaBehind,
interpolatedFract);
- mInFrontAlpha = mState.getFrontAlpha();
+ mCurrentInFrontAlpha = mState.getFrontAlpha();
}
- mBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
+ mCurrentBehindTint = ColorUtils.blendARGB(ScrimState.BOUNCER.getBehindTint(),
mState.getBehindTint(), interpolatedFract);
}
}
@@ -504,8 +486,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
*/
public void setAodFrontScrimAlpha(float alpha) {
if (((mState == ScrimState.AOD && mDozeParameters.getAlwaysOn())
- || mState == ScrimState.PULSING) && mInFrontAlpha != alpha) {
- mInFrontAlpha = alpha;
+ || mState == ScrimState.PULSING) && mCurrentInFrontAlpha != alpha) {
+ mCurrentInFrontAlpha = alpha;
updateScrims();
}
@@ -519,9 +501,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
*/
public void prepareForGentleWakeUp() {
if (mState == ScrimState.AOD && mDozeParameters.getAlwaysOn()) {
- mInFrontAlpha = 1f;
- mInFrontTint = Color.BLACK;
- mBehindTint = Color.BLACK;
+ mCurrentInFrontAlpha = 1f;
+ mCurrentInFrontTint = Color.BLACK;
+ mCurrentBehindTint = Color.BLACK;
mAnimateChange = false;
updateScrims();
mAnimateChange = true;
@@ -539,8 +521,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
if (mState == ScrimState.PULSING) {
float newBehindAlpha = mState.getBehindAlpha();
- if (mBehindAlpha != newBehindAlpha) {
- mBehindAlpha = newBehindAlpha;
+ if (mCurrentBehindAlpha != newBehindAlpha) {
+ mCurrentBehindAlpha = newBehindAlpha;
updateScrims();
}
}
@@ -562,11 +544,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// Only animate scrim color if the scrim view is actually visible
boolean animateScrimInFront = mScrimInFront.getViewAlpha() != 0 && !mBlankScreen;
boolean animateScrimBehind = mScrimBehind.getViewAlpha() != 0 && !mBlankScreen;
- boolean animateScrimForBubble = mScrimForBubble.getViewAlpha() != 0 && !mBlankScreen;
-
mScrimInFront.setColors(mColors, animateScrimInFront);
mScrimBehind.setColors(mColors, animateScrimBehind);
- mScrimForBubble.setColors(mColors, animateScrimForBubble);
// Calculate minimum scrim opacity for white or black text.
int textColor = mColors.supportsDarkText() ? Color.BLACK : Color.WHITE;
@@ -585,13 +564,12 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
boolean occludedKeyguard = (mState == ScrimState.PULSING || mState == ScrimState.AOD)
&& mKeyguardOccluded;
if (aodWallpaperTimeout || occludedKeyguard) {
- mBehindAlpha = 1;
+ mCurrentBehindAlpha = 1;
}
- setScrimAlpha(mScrimInFront, mInFrontAlpha);
- setScrimAlpha(mScrimBehind, mBehindAlpha);
- setScrimAlpha(mScrimForBubble, mBubbleAlpha);
- // The animation could have all already finished, let's call onFinished just in case
- onFinished();
+
+ setScrimInFrontAlpha(mCurrentInFrontAlpha);
+ setScrimBehindAlpha(mCurrentBehindAlpha);
+
dispatchScrimsVisible();
}
@@ -602,11 +580,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private void dispatchScrimsVisible() {
final int currentScrimVisibility;
if (mScrimInFront.getViewAlpha() == 1 || mScrimBehind.getViewAlpha() == 1) {
- currentScrimVisibility = OPAQUE;
+ currentScrimVisibility = VISIBILITY_FULLY_OPAQUE;
} else if (mScrimInFront.getViewAlpha() == 0 && mScrimBehind.getViewAlpha() == 0) {
- currentScrimVisibility = TRANSPARENT;
+ currentScrimVisibility = VISIBILITY_FULLY_TRANSPARENT;
} else {
- currentScrimVisibility = SEMI_TRANSPARENT;
+ currentScrimVisibility = VISIBILITY_SEMI_TRANSPARENT;
}
if (mScrimsVisibility != currentScrimVisibility) {
@@ -623,10 +601,18 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
return 0;
} else {
// woo, special effects
- return (float) (1f - 0.5f * (1f - Math.cos(3.14159f * Math.pow(1f - frac, 2f))));
+ return (float)(1f-0.5f*(1f-Math.cos(3.14159f * Math.pow(1f-frac, 2f))));
}
}
+ private void setScrimBehindAlpha(float alpha) {
+ setScrimAlpha(mScrimBehind, alpha);
+ }
+
+ private void setScrimInFrontAlpha(float alpha) {
+ setScrimAlpha(mScrimInFront, alpha);
+ }
+
private void setScrimAlpha(ScrimView scrim, float alpha) {
if (alpha == 0f) {
scrim.setClickable(false);
@@ -637,26 +623,17 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
updateScrim(scrim, alpha);
}
- private String getScrimName(ScrimView scrim) {
- if (scrim == mScrimInFront) {
- return "front_scrim";
- } else if (scrim == mScrimBehind) {
- return "back_scrim";
- } else if (scrim == mScrimForBubble) {
- return "bubble_scrim";
- }
- return "unknown_scrim";
- }
-
private void updateScrimColor(View scrim, float alpha, int tint) {
alpha = Math.max(0, Math.min(1.0f, alpha));
if (scrim instanceof ScrimView) {
ScrimView scrimView = (ScrimView) scrim;
- Trace.traceCounter(Trace.TRACE_TAG_APP, getScrimName(scrimView) + "_alpha",
+ Trace.traceCounter(Trace.TRACE_TAG_APP,
+ scrim == mScrimInFront ? "front_scrim_alpha" : "back_scrim_alpha",
(int) (alpha * 255));
- Trace.traceCounter(Trace.TRACE_TAG_APP, getScrimName(scrimView) + "_tint",
+ Trace.traceCounter(Trace.TRACE_TAG_APP,
+ scrim == mScrimInFront ? "front_scrim_tint" : "back_scrim_tint",
Color.alpha(tint));
scrimView.setTint(tint);
@@ -690,9 +667,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
@Override
public void onAnimationEnd(Animator animation) {
- scrim.setTag(TAG_KEY_ANIM, null);
onFinished(lastCallback);
+ scrim.setTag(TAG_KEY_ANIM, null);
dispatchScrimsVisible();
if (!mDeferFinishedListener && mOnAnimationFinished != null) {
@@ -713,11 +690,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private float getCurrentScrimAlpha(View scrim) {
if (scrim == mScrimInFront) {
- return mInFrontAlpha;
+ return mCurrentInFrontAlpha;
} else if (scrim == mScrimBehind) {
- return mBehindAlpha;
- } else if (scrim == mScrimForBubble) {
- return mBubbleAlpha;
+ return mCurrentBehindAlpha;
} else {
throw new IllegalArgumentException("Unknown scrim view");
}
@@ -725,11 +700,9 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
private int getCurrentScrimTint(View scrim) {
if (scrim == mScrimInFront) {
- return mInFrontTint;
+ return mCurrentInFrontTint;
} else if (scrim == mScrimBehind) {
- return mBehindTint;
- } else if (scrim == mScrimForBubble) {
- return mBubbleTint;
+ return mCurrentBehindTint;
} else {
throw new IllegalArgumentException("Unknown scrim view");
}
@@ -756,16 +729,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
}
private void onFinished(Callback callback) {
- if (isAnimating(mScrimBehind)
- || isAnimating(mScrimInFront)
- || isAnimating(mScrimForBubble)) {
- if (callback != null && callback != mCallback) {
- // Since we only notify the callback that we're finished once everything has
- // finished, we need to make sure that any changing callbacks are also invoked
- callback.onFinished();
- }
- return;
- }
if (mWakeLockHeld) {
mWakeLock.release(TAG);
mWakeLockHeld = false;
@@ -782,12 +745,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// When unlocking with fingerprint, we'll fade the scrims from black to transparent.
// At the end of the animation we need to remove the tint.
if (mState == ScrimState.UNLOCKED) {
- mInFrontTint = Color.TRANSPARENT;
- mBehindTint = Color.TRANSPARENT;
- mBubbleTint = Color.TRANSPARENT;
- updateScrimColor(mScrimInFront, mInFrontAlpha, mInFrontTint);
- updateScrimColor(mScrimBehind, mBehindAlpha, mBehindTint);
- updateScrimColor(mScrimForBubble, mBubbleAlpha, mBubbleTint);
+ mCurrentInFrontTint = Color.TRANSPARENT;
+ mCurrentBehindTint = Color.TRANSPARENT;
}
}
@@ -846,7 +805,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
} else {
// update the alpha directly
updateScrimColor(scrim, alpha, getCurrentScrimTint(scrim));
+ onFinished();
}
+ } else {
+ onFinished();
}
}
@@ -889,7 +851,6 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
/**
* Executes a callback after the frame has hit the display.
- *
* @param callback What to run.
*/
@VisibleForTesting
@@ -933,35 +894,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
pw.println(" ScrimController: ");
- pw.print(" state: ");
- pw.println(mState);
-
- pw.print(" frontScrim:");
- pw.print(" viewAlpha=");
- pw.print(mScrimInFront.getViewAlpha());
- pw.print(" alpha=");
- pw.print(mInFrontAlpha);
- pw.print(" tint=0x");
- pw.println(Integer.toHexString(mScrimInFront.getTint()));
-
- pw.print(" backScrim:");
- pw.print(" viewAlpha=");
- pw.print(mScrimBehind.getViewAlpha());
- pw.print(" alpha=");
- pw.print(mBehindAlpha);
- pw.print(" tint=0x");
- pw.println(Integer.toHexString(mScrimBehind.getTint()));
-
- pw.print(" bubbleScrim:");
- pw.print(" viewAlpha=");
- pw.print(mScrimForBubble.getViewAlpha());
- pw.print(" alpha=");
- pw.print(mBubbleAlpha);
- pw.print(" tint=0x");
- pw.println(Integer.toHexString(mScrimForBubble.getTint()));
-
- pw.print(" mTracking=");
- pw.println(mTracking);
+ pw.print(" state: "); pw.println(mState);
+ pw.print(" frontScrim:"); pw.print(" viewAlpha="); pw.print(mScrimInFront.getViewAlpha());
+ pw.print(" alpha="); pw.print(mCurrentInFrontAlpha);
+ pw.print(" tint=0x"); pw.println(Integer.toHexString(mScrimInFront.getTint()));
+
+ pw.print(" backScrim:"); pw.print(" viewAlpha="); pw.print(mScrimBehind.getViewAlpha());
+ pw.print(" alpha="); pw.print(mCurrentBehindAlpha);
+ pw.print(" tint=0x"); pw.println(Integer.toHexString(mScrimBehind.getTint()));
+
+ pw.print(" mTracking="); pw.println(mTracking);
}
public void setWallpaperSupportsAmbientMode(boolean wallpaperSupportsAmbientMode) {
@@ -1008,8 +950,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
// in this case, back-scrim needs to be re-evaluated
if (mState == ScrimState.AOD || mState == ScrimState.PULSING) {
float newBehindAlpha = mState.getBehindAlpha();
- if (mBehindAlpha != newBehindAlpha) {
- mBehindAlpha = newBehindAlpha;
+ if (mCurrentBehindAlpha != newBehindAlpha) {
+ mCurrentBehindAlpha = newBehindAlpha;
updateScrims();
}
}
@@ -1030,13 +972,10 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
public interface Callback {
default void onStart() {
}
-
default void onDisplayBlanked() {
}
-
default void onFinished() {
}
-
default void onCancelled() {
}
/** Returns whether to timeout wallpaper or not. */
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
index 7463c7c232bd..5fa861c8a2ac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
@@ -36,6 +36,7 @@ public enum ScrimState {
* On the lock screen.
*/
KEYGUARD(0) {
+
@Override
public void prepare(ScrimState previousState) {
mBlankScreen = false;
@@ -52,13 +53,10 @@ public enum ScrimState {
} else {
mAnimationDuration = ScrimController.ANIMATION_DURATION;
}
- mFrontTint = Color.BLACK;
- mBehindTint = Color.BLACK;
- mBubbleTint = Color.TRANSPARENT;
-
- mFrontAlpha = 0;
- mBehindAlpha = mScrimBehindAlphaKeyguard;
- mBubbleAlpha = 0;
+ mCurrentInFrontTint = Color.BLACK;
+ mCurrentBehindTint = Color.BLACK;
+ mCurrentBehindAlpha = mScrimBehindAlphaKeyguard;
+ mCurrentInFrontAlpha = 0;
}
},
@@ -68,9 +66,8 @@ public enum ScrimState {
BOUNCER(1) {
@Override
public void prepare(ScrimState previousState) {
- mBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
- mFrontAlpha = 0f;
- mBubbleAlpha = 0f;
+ mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
+ mCurrentInFrontAlpha = 0f;
}
},
@@ -80,9 +77,8 @@ public enum ScrimState {
BOUNCER_SCRIMMED(2) {
@Override
public void prepare(ScrimState previousState) {
- mBehindAlpha = 0;
- mBubbleAlpha = 0f;
- mFrontAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
+ mCurrentBehindAlpha = 0;
+ mCurrentInFrontAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
}
},
@@ -92,9 +88,8 @@ public enum ScrimState {
BRIGHTNESS_MIRROR(3) {
@Override
public void prepare(ScrimState previousState) {
- mBehindAlpha = 0;
- mFrontAlpha = 0;
- mBubbleAlpha = 0;
+ mCurrentBehindAlpha = 0;
+ mCurrentInFrontAlpha = 0;
}
},
@@ -106,16 +101,9 @@ public enum ScrimState {
public void prepare(ScrimState previousState) {
final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
mBlankScreen = mDisplayRequiresBlanking;
-
- mFrontTint = Color.BLACK;
- mFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
-
- mBehindTint = Color.BLACK;
- mBehindAlpha = ScrimController.TRANSPARENT;
-
- mBubbleTint = Color.TRANSPARENT;
- mBubbleAlpha = ScrimController.TRANSPARENT;
-
+ mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
+ mCurrentInFrontTint = Color.BLACK;
+ mCurrentBehindTint = Color.BLACK;
mAnimationDuration = ScrimController.ANIMATION_DURATION_LONG;
// DisplayPowerManager may blank the screen for us,
// in this case we just need to set our state.
@@ -139,10 +127,9 @@ public enum ScrimState {
PULSING(5) {
@Override
public void prepare(ScrimState previousState) {
- mFrontAlpha = mAodFrontScrimAlpha;
- mBubbleAlpha = 0f;
- mBehindTint = Color.BLACK;
- mFrontTint = Color.BLACK;
+ mCurrentInFrontAlpha = mAodFrontScrimAlpha;
+ mCurrentBehindTint = Color.BLACK;
+ mCurrentInFrontTint = Color.BLACK;
mBlankScreen = mDisplayRequiresBlanking;
mAnimationDuration = mWakeLockScreenSensorActive
? ScrimController.ANIMATION_DURATION_LONG : ScrimController.ANIMATION_DURATION;
@@ -167,33 +154,26 @@ public enum ScrimState {
UNLOCKED(6) {
@Override
public void prepare(ScrimState previousState) {
- // State that UI will sync to.
- mBehindAlpha = 0;
- mFrontAlpha = 0;
- mBubbleAlpha = 0;
-
+ mCurrentBehindAlpha = 0;
+ mCurrentInFrontAlpha = 0;
mAnimationDuration = mKeyguardFadingAway
? mKeyguardFadingAwayDuration
: StatusBar.FADE_KEYGUARD_DURATION;
mAnimateChange = !mLaunchingAffordanceWithPreview;
- mFrontTint = Color.TRANSPARENT;
- mBehindTint = Color.TRANSPARENT;
- mBubbleTint = Color.TRANSPARENT;
- mBlankScreen = false;
-
if (previousState == ScrimState.AOD) {
- // Set all scrims black, before they fade transparent.
- updateScrimColor(mScrimInFront, 1f /* alpha */, Color.BLACK /* tint */);
- updateScrimColor(mScrimBehind, 1f /* alpha */, Color.BLACK /* tint */);
- updateScrimColor(mScrimForBubble, 1f /* alpha */, Color.BLACK /* tint */);
-
+ // Fade from black to transparent when coming directly from AOD
+ updateScrimColor(mScrimInFront, 1, Color.BLACK);
+ updateScrimColor(mScrimBehind, 1, Color.BLACK);
// Scrims should still be black at the end of the transition.
- mFrontTint = Color.BLACK;
- mBehindTint = Color.BLACK;
- mBubbleTint = Color.BLACK;
+ mCurrentInFrontTint = Color.BLACK;
+ mCurrentBehindTint = Color.BLACK;
mBlankScreen = true;
+ } else {
+ mCurrentInFrontTint = Color.TRANSPARENT;
+ mCurrentBehindTint = Color.TRANSPARENT;
+ mBlankScreen = false;
}
}
},
@@ -204,36 +184,25 @@ public enum ScrimState {
BUBBLE_EXPANDED(7) {
@Override
public void prepare(ScrimState previousState) {
- mFrontTint = Color.TRANSPARENT;
- mBehindTint = Color.TRANSPARENT;
- mBubbleTint = Color.TRANSPARENT;
-
- mFrontAlpha = ScrimController.TRANSPARENT;
- mBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
- mBubbleAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
-
+ mCurrentInFrontTint = Color.TRANSPARENT;
+ mCurrentBehindTint = Color.TRANSPARENT;
mAnimationDuration = ScrimController.ANIMATION_DURATION;
+ mCurrentBehindAlpha = ScrimController.GRADIENT_SCRIM_ALPHA_BUSY;
mBlankScreen = false;
}
};
boolean mBlankScreen = false;
long mAnimationDuration = ScrimController.ANIMATION_DURATION;
- int mFrontTint = Color.TRANSPARENT;
- int mBehindTint = Color.TRANSPARENT;
- int mBubbleTint = Color.TRANSPARENT;
-
+ int mCurrentInFrontTint = Color.TRANSPARENT;
+ int mCurrentBehindTint = Color.TRANSPARENT;
boolean mAnimateChange = true;
+ float mCurrentInFrontAlpha;
+ float mCurrentBehindAlpha;
float mAodFrontScrimAlpha;
- float mFrontAlpha;
- float mBehindAlpha;
- float mBubbleAlpha;
-
float mScrimBehindAlphaKeyguard;
ScrimView mScrimInFront;
ScrimView mScrimBehind;
- ScrimView mScrimForBubble;
-
DozeParameters mDozeParameters;
boolean mDisplayRequiresBlanking;
boolean mWallpaperSupportsAmbientMode;
@@ -248,17 +217,13 @@ public enum ScrimState {
mIndex = index;
}
- public void init(ScrimView scrimInFront, ScrimView scrimBehind, ScrimView scrimForBubble,
- DozeParameters dozeParameters) {
+ public void init(ScrimView scrimInFront, ScrimView scrimBehind, DozeParameters dozeParameters) {
mScrimInFront = scrimInFront;
mScrimBehind = scrimBehind;
- mScrimForBubble = scrimForBubble;
-
mDozeParameters = dozeParameters;
mDisplayRequiresBlanking = dozeParameters.getDisplayNeedsBlanking();
}
- /** Prepare state for transition. */
public void prepare(ScrimState previousState) {
}
@@ -267,27 +232,19 @@ public enum ScrimState {
}
public float getFrontAlpha() {
- return mFrontAlpha;
+ return mCurrentInFrontAlpha;
}
public float getBehindAlpha() {
- return mBehindAlpha;
- }
-
- public float getBubbleAlpha() {
- return mBubbleAlpha;
+ return mCurrentBehindAlpha;
}
public int getFrontTint() {
- return mFrontTint;
+ return mCurrentInFrontTint;
}
public int getBehindTint() {
- return mBehindTint;
- }
-
- public int getBubbleTint() {
- return mBubbleTint;
+ return mCurrentBehindTint;
}
public long getAnimationDuration() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index fc20d83b9ddb..559df18ef478 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -229,6 +229,7 @@ import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.tuner.TunerService;
import com.android.systemui.util.InjectionInflationController;
import com.android.systemui.volume.VolumeComponent;
@@ -811,7 +812,6 @@ public class StatusBar extends SystemUI implements DemoMode,
// TODO: Deal with the ugliness that comes from having some of the statusbar broken out
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
mNotificationPanel = mStatusBarWindow.findViewById(R.id.notification_panel);
-
mStackScroller = mStatusBarWindow.findViewById(R.id.notification_stack_scroller);
mZenController.addCallback(this);
NotificationListContainer notifListContainer = (NotificationListContainer) mStackScroller;
@@ -932,10 +932,8 @@ public class StatusBar extends SystemUI implements DemoMode,
ScrimView scrimBehind = mStatusBarWindow.findViewById(R.id.scrim_behind);
ScrimView scrimInFront = mStatusBarWindow.findViewById(R.id.scrim_in_front);
- ScrimView scrimForBubble = mStatusBarWindow.findViewById(R.id.scrim_for_bubble);
-
mScrimController = SystemUIFactory.getInstance().createScrimController(
- scrimBehind, scrimInFront, scrimForBubble, mLockscreenWallpaper,
+ scrimBehind, scrimInFront, mLockscreenWallpaper,
(state, alpha, color) -> mLightBarController.setScrimState(state, alpha, color),
scrimsVisible -> {
if (mStatusBarWindowController != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index d3ae5cf35b0c..946fe0b3a2f8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -222,7 +222,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
}
final boolean scrimsOccludingWallpaper =
- state.scrimsVisibility == ScrimController.OPAQUE;
+ state.scrimsVisibility == ScrimController.VISIBILITY_FULLY_OPAQUE;
final boolean keyguardOrAod = state.keyguardShowing
|| (state.dozing && mDozeParameters.getAlwaysOn());
if (keyguardOrAod && !state.backdropShowing && !scrimsOccludingWallpaper) {
@@ -308,7 +308,7 @@ public class StatusBarWindowController implements Callback, Dumpable, Configurat
return !state.forceCollapsed && (state.isKeyguardShowingAndNotOccluded()
|| state.panelVisible || state.keyguardFadingAway || state.bouncerShowing
|| state.headsUpShowing || state.bubblesShowing
- || state.scrimsVisibility != ScrimController.TRANSPARENT);
+ || state.scrimsVisibility != ScrimController.VISIBILITY_FULLY_TRANSPARENT);
}
private void applyFitsSystemWindows(State state) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
index ed0b9d929466..919ca12648ed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java
@@ -22,6 +22,7 @@ import android.text.TextPaint;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -238,13 +239,15 @@ public class SmartReplyView extends ViewGroup {
public List<Button> inflateSmartActions(Context packageContext,
@NonNull SmartActions smartActions, SmartReplyController smartReplyController,
NotificationEntry entry, HeadsUpManager headsUpManager, boolean delayOnClickListener) {
+ Context themedPackageContext = new ContextThemeWrapper(packageContext, mContext.getTheme());
List<Button> buttons = new ArrayList<>();
int numSmartActions = smartActions.actions.size();
for (int n = 0; n < numSmartActions; n++) {
Notification.Action action = smartActions.actions.get(n);
if (action.actionIntent != null) {
buttons.add(inflateActionButton(
- this, getContext(), packageContext, n, smartActions, smartReplyController,
+ this, getContext(), themedPackageContext, n, smartActions,
+ smartReplyController,
entry, headsUpManager, delayOnClickListener));
}
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
index 7c19fa650003..92555a71ee83 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/CarrierTextControllerTest.java
@@ -129,7 +129,7 @@ public class CarrierTextControllerTest extends SysuiTestCase {
mCarrierTextCallbackInfo = new CarrierTextController.CarrierTextCallbackInfo("",
new CharSequence[]{}, false, new int[]{});
- when(mTelephonyManager.getMaxPhoneCount()).thenReturn(3);
+ when(mTelephonyManager.getSupportedModemCount()).thenReturn(3);
mCarrierTextController = new TestCarrierTextController(mContext, SEPARATOR, true, true,
mKeyguardUpdateMonitor);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
index daee55bd3d61..c85e51545bc1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java
@@ -35,8 +35,11 @@ import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
import android.content.Context;
import android.graphics.Color;
+import android.hardware.biometrics.BiometricSourceType;
+import android.hardware.face.FaceManager;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Looper;
+import android.os.UserManager;
import android.view.View;
import android.view.ViewGroup;
@@ -53,6 +56,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.ShadeController;
+import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.phone.UnlockMethodCache;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.util.wakelock.WakeLockFake;
@@ -92,6 +96,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
private StatusBarStateController mStatusBarStateController;
@Mock
private KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ @Mock
+ private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ @Mock
+ private UserManager mUserManager;
private KeyguardIndicationTextView mTextView;
private KeyguardIndicationController mController;
@@ -105,14 +113,18 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mTextView = new KeyguardIndicationTextView(mContext);
mContext.addMockSystemService(Context.DEVICE_POLICY_SERVICE, mDevicePolicyManager);
+ mContext.addMockSystemService(UserManager.class, mUserManager);
mContext.addMockSystemService(Context.TRUST_SERVICE, mock(TrustManager.class));
mContext.addMockSystemService(Context.FINGERPRINT_SERVICE, mock(FingerprintManager.class));
mDisclosureWithOrganization = mContext.getString(R.string.do_disclosure_with_name,
ORGANIZATION_NAME);
+ when(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed()).thenReturn(true);
+ when(mKeyguardUpdateMonitor.isScreenOn()).thenReturn(true);
when(mIndicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure))
.thenReturn(mDisclosure);
when(mIndicationArea.findViewById(R.id.keyguard_indication_text)).thenReturn(mTextView);
+ when(mUserManager.isUserUnlocked(anyInt())).thenReturn(true);
mWakeLock = new WakeLockFake();
}
@@ -124,6 +136,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
mController = new KeyguardIndicationController(mContext, mIndicationArea, mLockIcon,
mLockPatternUtils, mWakeLock, mShadeController, mAccessibilityController,
mUnlockMethodCache, mStatusBarStateController, mKeyguardUpdateMonitor);
+ mController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
}
@Test
@@ -245,6 +258,49 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {
}
@Test
+ public void transientIndication_visibleWhenDozing_unlessSwipeUp_fromHelp() {
+ createController();
+ String message = "A message";
+
+ mController.setVisible(true);
+ mController.getKeyguardCallback().onBiometricHelp(
+ KeyguardUpdateMonitor.BIOMETRIC_HELP_FACE_NOT_RECOGNIZED, message,
+ BiometricSourceType.FACE);
+ assertThat(mTextView.getText()).isEqualTo(message);
+ mController.setDozing(true);
+
+ assertThat(mTextView.getText()).isNotEqualTo(message);
+ }
+
+ @Test
+ public void transientIndication_visibleWhenDozing_unlessSwipeUp_fromError() {
+ createController();
+ String message = mContext.getString(R.string.keyguard_unlock);
+
+ mController.setVisible(true);
+ mController.getKeyguardCallback().onBiometricError(FaceManager.FACE_ERROR_TIMEOUT,
+ "A message", BiometricSourceType.FACE);
+
+ assertThat(mTextView.getText()).isEqualTo(message);
+ mController.setDozing(true);
+
+ assertThat(mTextView.getText()).isNotEqualTo(message);
+ }
+
+ @Test
+ public void transientIndication_swipeUpToRetry() {
+ createController();
+ String message = mContext.getString(R.string.keyguard_retry);
+ when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
+
+ mController.setVisible(true);
+ mController.getKeyguardCallback().onBiometricError(FaceManager.FACE_ERROR_TIMEOUT,
+ "A message", BiometricSourceType.FACE);
+
+ verify(mStatusBarKeyguardViewManager).showBouncerMessage(eq(message), any());
+ }
+
+ @Test
public void lockIcon_click() {
createController();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
index 2ca1b0611cd6..b07ac5ff7ea8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/NotificationEntryManagerTest.java
@@ -182,7 +182,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase {
0,
NotificationManager.IMPORTANCE_DEFAULT,
null, null,
- null, null, null, true, sentiment, false, -1, false, null, null, false);
+ null, null, null, true, sentiment, false, -1, false, null, null, false, false);
return true;
}).when(mRankingMap).getRanking(eq(key), any(NotificationListenerService.Ranking.class));
}
@@ -201,7 +201,7 @@ public class NotificationEntryManagerTest extends SysuiTestCase {
null, null,
null, null, null, true,
NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL, false, -1,
- false, smartActions, null, false);
+ false, smartActions, null, false, false);
return true;
}).when(mRankingMap).getRanking(eq(key), any(NotificationListenerService.Ranking.class));
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
index e2d8e5698daf..cf0c7185f040 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/NotificationDataTest.java
@@ -623,6 +623,7 @@ public class NotificationDataTest extends SysuiTestCase {
public static final String OVERRIDE_SMART_ACTIONS = "sa";
public static final String OVERRIDE_SMART_REPLIES = "sr";
public static final String OVERRIDE_BUBBLE = "cb";
+ public static final String OVERRIDE_VISUALLY_INTERRUPTIVE = "vi";
public Map<String, Bundle> rankingOverrides = new HashMap<>();
@@ -683,7 +684,9 @@ public class NotificationDataTest extends SysuiTestCase {
overrides.containsKey(OVERRIDE_SMART_REPLIES)
? overrides.getCharSequenceArrayList(OVERRIDE_SMART_REPLIES)
: currentReplies,
- overrides.getBoolean(OVERRIDE_BUBBLE, outRanking.canBubble()));
+ overrides.getBoolean(OVERRIDE_BUBBLE, outRanking.canBubble()),
+ overrides.getBoolean(OVERRIDE_VISUALLY_INTERRUPTIVE,
+ outRanking.visuallyInterruptive()));
}
return true;
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
index d4ad4b6d4f16..205312ca508f 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
@@ -16,9 +16,9 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.statusbar.phone.ScrimController.OPAQUE;
-import static com.android.systemui.statusbar.phone.ScrimController.SEMI_TRANSPARENT;
-import static com.android.systemui.statusbar.phone.ScrimController.TRANSPARENT;
+import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_FULLY_OPAQUE;
+import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_FULLY_TRANSPARENT;
+import static com.android.systemui.statusbar.phone.ScrimController.VISIBILITY_SEMI_TRANSPARENT;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -69,7 +69,6 @@ public class ScrimControllerTest extends SysuiTestCase {
private SynchronousScrimController mScrimController;
private ScrimView mScrimBehind;
private ScrimView mScrimInFront;
- private ScrimView mScrimForBubble;
private ScrimState mScrimState;
private float mScrimBehindAlpha;
private GradientColors mScrimInFrontColor;
@@ -85,7 +84,6 @@ public class ScrimControllerTest extends SysuiTestCase {
public void setup() {
mScrimBehind = spy(new ScrimView(getContext()));
mScrimInFront = new ScrimView(getContext());
- mScrimForBubble = new ScrimView(getContext());
mWakeLock = mock(WakeLock.class);
mAlarmManager = mock(AlarmManager.class);
mAlwaysOnEnabled = true;
@@ -94,7 +92,6 @@ public class ScrimControllerTest extends SysuiTestCase {
when(mDozeParamenters.getAlwaysOn()).thenAnswer(invocation -> mAlwaysOnEnabled);
when(mDozeParamenters.getDisplayNeedsBlanking()).thenReturn(true);
mScrimController = new SynchronousScrimController(mScrimBehind, mScrimInFront,
- mScrimForBubble,
(scrimState, scrimBehindAlpha, scrimInFrontColor) -> {
mScrimState = scrimState;
mScrimBehindAlpha = scrimBehindAlpha;
@@ -117,28 +114,21 @@ public class ScrimControllerTest extends SysuiTestCase {
public void transitionToKeyguard() {
mScrimController.transitionTo(ScrimState.KEYGUARD);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(true /* front */,
- true /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be visible without tint
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
+ assertScrimTint(mScrimBehind, true /* tinted */);
}
@Test
public void transitionToAod_withRegularWallpaper() {
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(true /* front */,
- true /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be visible with tint
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true /* tinted */);
+ assertScrimTint(mScrimInFront, true /* tinted */);
}
@Test
@@ -146,18 +136,14 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setWallpaperSupportsAmbientMode(true);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be transparent
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
// Pulsing notification should conserve AOD wallpaper.
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
}
@Test
@@ -166,14 +152,11 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setWallpaperSupportsAmbientMode(true);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(true /* front */,
- true /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be visible with tint
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true /* tinted */);
+ assertScrimTint(mScrimInFront, true /* tinted */);
}
@Test
@@ -183,14 +166,11 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.finishAnimationsImmediately();
mScrimController.setHasBackdrop(true);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(true /* front */,
- true /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be visible with tint
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true /* tinted */);
+ assertScrimTint(mScrimInFront, true /* tinted */);
}
@Test
@@ -199,32 +179,27 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.transitionTo(ScrimState.KEYGUARD);
mScrimController.setAodFrontScrimAlpha(0.5f);
mScrimController.finishAnimationsImmediately();
-
- assertScrimAlpha(TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be visible without tint
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
// ... but that it does take effect once we enter the AOD state.
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(SEMI_TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
+ // Front scrim should be semi-transparent
+ // Back scrim should be visible
+ assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
// ... and that if we set it while we're in AOD, it does take immediate effect.
mScrimController.setAodFrontScrimAlpha(1f);
- assertScrimAlpha(OPAQUE /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
// ... and make sure we recall the previous front scrim alpha even if we transition away
// for a bit.
mScrimController.transitionTo(ScrimState.UNLOCKED);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(OPAQUE /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_OPAQUE, VISIBILITY_FULLY_OPAQUE);
// ... and alpha updates should be completely ignored if always_on is off.
// Passing it forward would mess up the wake-up transition.
@@ -248,36 +223,27 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setWallpaperSupportsAmbientMode(false);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
// Front scrim should be transparent, but tinted
// Back scrim should be semi-transparent so the user can see the wallpaper
// Pulse callback should have been invoked
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(true /* front */,
- true /* behind */,
- false /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+ assertScrimTint(mScrimBehind, true /* tinted */);
// ... and when ambient goes dark, front scrim should be semi-transparent
mScrimController.setAodFrontScrimAlpha(0.5f);
mScrimController.finishAnimationsImmediately();
// Front scrim should be semi-transparent
- assertScrimAlpha(SEMI_TRANSPARENT /* front */,
- OPAQUE /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT /* front */,
+ VISIBILITY_FULLY_OPAQUE /* back */);
mScrimController.setWakeLockScreenSensorActive(true);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(SEMI_TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT /* front */,
+ VISIBILITY_SEMI_TRANSPARENT /* back */);
// Reset value since enums are static.
mScrimController.setAodFrontScrimAlpha(0f);
@@ -289,13 +255,8 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.finishAnimationsImmediately();
// Front scrim should be transparent
// Back scrim should be visible without tint
- assertScrimAlpha(TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(false /* front */,
- false /* behind */,
- false /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
+ assertScrimTint(mScrimBehind, false /* tinted */);
}
@Test
@@ -304,12 +265,8 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.finishAnimationsImmediately();
// Front scrim should be transparent
// Back scrim should be visible without tint
- assertScrimAlpha(SEMI_TRANSPARENT /* front */,
- TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
- assertScrimTint(false /* front */,
- false /* behind */,
- false /* bubble */);
+ assertScrimVisibility(VISIBILITY_SEMI_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
+ assertScrimTint(mScrimBehind, false /* tinted */);
}
@Test
@@ -317,19 +274,15 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setPanelExpansion(0f);
mScrimController.transitionTo(ScrimState.UNLOCKED);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
-
- assertScrimTint(false /* front */,
- false /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be transparent
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
+ assertScrimTint(mScrimBehind, false /* tinted */);
+ assertScrimTint(mScrimInFront, false /* tinted */);
// Back scrim should be visible after start dragging
mScrimController.setPanelExpansion(0.5f);
- assertScrimAlpha(TRANSPARENT /* front */,
- SEMI_TRANSPARENT /* back */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_SEMI_TRANSPARENT);
}
@Test
@@ -337,19 +290,12 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.transitionTo(ScrimState.BUBBLE_EXPANDED);
mScrimController.finishAnimationsImmediately();
- assertScrimTint(false /* front */,
- false /* behind */,
- false /* bubble */);
-
// Front scrim should be transparent
- Assert.assertEquals(ScrimController.TRANSPARENT,
+ Assert.assertEquals(ScrimController.VISIBILITY_FULLY_TRANSPARENT,
mScrimInFront.getViewAlpha(), 0.0f);
// Back scrim should be visible
Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
mScrimBehind.getViewAlpha(), 0.0f);
- // Bubble scrim should be visible
- Assert.assertEquals(ScrimController.GRADIENT_SCRIM_ALPHA_BUSY,
- mScrimBehind.getViewAlpha(), 0.0f);
}
@Test
@@ -418,23 +364,16 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setPanelExpansion(0f);
mScrimController.finishAnimationsImmediately();
mScrimController.transitionTo(ScrimState.UNLOCKED);
-
- // Immediately tinted black after the transition starts
- assertScrimTint(true /* front */,
- true /* behind */,
- true /* bubble */);
-
+ // Immediately tinted after the transition starts
+ assertScrimTint(mScrimInFront, true /* tinted */);
+ assertScrimTint(mScrimBehind, true /* tinted */);
mScrimController.finishAnimationsImmediately();
-
- // All scrims should be transparent at the end of fade transition.
- assertScrimAlpha(TRANSPARENT /* front */,
- TRANSPARENT /* behind */,
- TRANSPARENT /* bubble */);
-
- // Make sure at the very end of the animation, we're reset to transparent
- assertScrimTint(false /* front */,
- false /* behind */,
- false /* bubble */);
+ // Front scrim should be transparent
+ // Back scrim should be transparent
+ // Neither scrims should be tinted anymore after the animation.
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
+ assertScrimTint(mScrimInFront, false /* tinted */);
+ assertScrimTint(mScrimBehind, false /* tinted */);
}
@Test
@@ -449,11 +388,9 @@ public class ScrimControllerTest extends SysuiTestCase {
// Front scrim should be black in the middle of the transition
Assert.assertTrue("Scrim should be visible during transition. Alpha: "
+ mScrimInFront.getViewAlpha(), mScrimInFront.getViewAlpha() > 0);
- assertScrimTint(true /* front */,
- true /* behind */,
- true /* bubble */);
+ assertScrimTint(mScrimInFront, true /* tinted */);
Assert.assertSame("Scrim should be visible during transition.",
- mScrimVisibility, OPAQUE);
+ mScrimVisibility, VISIBILITY_FULLY_OPAQUE);
}
});
mScrimController.finishAnimationsImmediately();
@@ -661,15 +598,11 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setKeyguardOccluded(true);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* behind */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
mScrimController.transitionTo(ScrimState.PULSING);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* behind */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
}
@Test
@@ -677,15 +610,11 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimController.setWallpaperSupportsAmbientMode(true);
mScrimController.transitionTo(ScrimState.AOD);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- TRANSPARENT /* behind */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_TRANSPARENT);
mScrimController.setKeyguardOccluded(true);
mScrimController.finishAnimationsImmediately();
- assertScrimAlpha(TRANSPARENT /* front */,
- OPAQUE /* behind */,
- TRANSPARENT /* bubble */);
+ assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
}
@Test
@@ -724,68 +653,33 @@ public class ScrimControllerTest extends SysuiTestCase {
mScrimInFront.getDefaultFocusHighlightEnabled());
Assert.assertFalse("Scrim shouldn't have focus highlight",
mScrimBehind.getDefaultFocusHighlightEnabled());
- Assert.assertFalse("Scrim shouldn't have focus highlight",
- mScrimForBubble.getDefaultFocusHighlightEnabled());
}
- private void assertScrimTint(boolean front, boolean behind, boolean bubble) {
- Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
- + " with scrim: " + getScrimName(mScrimInFront) + " and tint: "
- + Integer.toHexString(mScrimInFront.getTint()),
- front, mScrimInFront.getTint() != Color.TRANSPARENT);
-
+ private void assertScrimTint(ScrimView scrimView, boolean tinted) {
+ final boolean viewIsTinted = scrimView.getTint() != Color.TRANSPARENT;
+ final String name = scrimView == mScrimInFront ? "front" : "back";
Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
- + " with scrim: " + getScrimName(mScrimBehind) + " and tint: "
- + Integer.toHexString(mScrimBehind.getTint()),
- behind, mScrimBehind.getTint() != Color.TRANSPARENT);
-
- Assert.assertEquals("Tint test failed at state " + mScrimController.getState()
- + " with scrim: " + getScrimName(mScrimForBubble) + " and tint: "
- + Integer.toHexString(mScrimForBubble.getTint()),
- bubble, mScrimForBubble.getTint() != Color.TRANSPARENT);
- }
-
- private String getScrimName(ScrimView scrim) {
- if (scrim == mScrimInFront) {
- return "front";
- } else if (scrim == mScrimBehind) {
- return "back";
- } else if (scrim == mScrimForBubble) {
- return "bubble";
- }
- return "unknown_scrim";
+ +" with scrim: " + name + " and tint: " + Integer.toHexString(scrimView.getTint()),
+ tinted, viewIsTinted);
}
- private void assertScrimAlpha(int front, int behind, int bubble) {
- // Check single scrim visibility.
- Assert.assertEquals("Unexpected front scrim alpha: "
- + mScrimInFront.getViewAlpha(),
- front != TRANSPARENT /* expected */,
- mScrimInFront.getViewAlpha() > TRANSPARENT /* actual */);
-
- Assert.assertEquals("Unexpected back scrim alpha: "
- + mScrimBehind.getViewAlpha(),
- behind != TRANSPARENT /* expected */,
- mScrimBehind.getViewAlpha() > TRANSPARENT /* actual */);
-
- Assert.assertEquals(
- "Unexpected bubble scrim alpha: "
- + mScrimForBubble.getViewAlpha(), /* message */
- bubble != TRANSPARENT /* expected */,
- mScrimForBubble.getViewAlpha() > TRANSPARENT /* actual */);
+ private void assertScrimVisibility(int inFront, int behind) {
+ boolean inFrontVisible = inFront != ScrimController.VISIBILITY_FULLY_TRANSPARENT;
+ boolean behindVisible = behind != ScrimController.VISIBILITY_FULLY_TRANSPARENT;
+ Assert.assertEquals("Unexpected front scrim visibility. Alpha is "
+ + mScrimInFront.getViewAlpha(), inFrontVisible, mScrimInFront.getViewAlpha() > 0);
+ Assert.assertEquals("Unexpected back scrim visibility. Alpha is "
+ + mScrimBehind.getViewAlpha(), behindVisible, mScrimBehind.getViewAlpha() > 0);
- // Check combined scrim visibility.
final int visibility;
- if (front == OPAQUE || behind == OPAQUE || bubble == OPAQUE) {
- visibility = OPAQUE;
- } else if (front > TRANSPARENT || behind > TRANSPARENT || bubble > TRANSPARENT) {
- visibility = SEMI_TRANSPARENT;
+ if (inFront == VISIBILITY_FULLY_OPAQUE || behind == VISIBILITY_FULLY_OPAQUE) {
+ visibility = VISIBILITY_FULLY_OPAQUE;
+ } else if (inFront > VISIBILITY_FULLY_TRANSPARENT || behind > VISIBILITY_FULLY_TRANSPARENT) {
+ visibility = VISIBILITY_SEMI_TRANSPARENT;
} else {
- visibility = TRANSPARENT;
+ visibility = VISIBILITY_FULLY_TRANSPARENT;
}
- Assert.assertEquals("Invalid visibility.",
- visibility /* expected */,
- mScrimVisibility);
+ Assert.assertEquals("Invalid visibility.", visibility, mScrimVisibility);
}
/**
@@ -797,12 +691,11 @@ public class ScrimControllerTest extends SysuiTestCase {
boolean mOnPreDrawCalled;
SynchronousScrimController(ScrimView scrimBehind, ScrimView scrimInFront,
- ScrimView scrimForBubble,
TriConsumer<ScrimState, Float, GradientColors> scrimStateListener,
Consumer<Integer> scrimVisibleListener, DozeParameters dozeParameters,
AlarmManager alarmManager, KeyguardMonitor keyguardMonitor) {
- super(scrimBehind, scrimInFront, scrimForBubble, scrimStateListener,
- scrimVisibleListener, dozeParameters, alarmManager, keyguardMonitor);
+ super(scrimBehind, scrimInFront, scrimStateListener, scrimVisibleListener,
+ dozeParameters, alarmManager, keyguardMonitor);
}
@Override
@@ -813,14 +706,13 @@ public class ScrimControllerTest extends SysuiTestCase {
void finishAnimationsImmediately() {
boolean[] animationFinished = {false};
- setOnAnimationFinished(() -> animationFinished[0] = true);
+ setOnAnimationFinished(()-> animationFinished[0] = true);
// Execute code that will trigger animations.
onPreDraw();
// Force finish all animations.
mLooper.processAllMessages();
endAnimation(mScrimBehind, TAG_KEY_ANIM);
endAnimation(mScrimInFront, TAG_KEY_ANIM);
- endAnimation(mScrimForBubble, TAG_KEY_ANIM);
if (!animationFinished[0]) {
throw new IllegalStateException("Animation never finished");
@@ -858,7 +750,6 @@ public class ScrimControllerTest extends SysuiTestCase {
/**
* Do not wait for a frame since we're in a test environment.
- *
* @param callback What to execute.
*/
@Override
diff --git a/packages/Tethering/Android.bp b/packages/Tethering/Android.bp
index dc88fd4014da..61bfb92363bd 100644
--- a/packages/Tethering/Android.bp
+++ b/packages/Tethering/Android.bp
@@ -21,9 +21,13 @@ java_defaults {
"src/**/*.java",
":framework-tethering-shared-srcs",
":services-tethering-shared-srcs",
+ ":servicescore-tethering-src",
],
static_libs: [
"androidx.annotation_annotation",
+ "netd_aidl_interface-java",
+ "networkstack-aidl-interfaces-java",
+ "android.hardware.tetheroffload.control-V1.0-java",
"tethering-client",
],
manifest: "AndroidManifestBase.xml",
@@ -35,11 +39,39 @@ android_library {
defaults: ["TetheringAndroidLibraryDefaults"],
}
+cc_library_shared {
+ name: "libtetheroffloadjni",
+ srcs: [
+ "jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp",
+ ],
+ shared_libs: [
+ "libnativehelper",
+ "libcutils",
+ "android.hardware.tetheroffload.config@1.0",
+ ],
+ static_libs: [
+ "liblog",
+ "libbase",
+ "libhidlbase",
+ "libutils",
+ ],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-parameter",
+ "-Wthread-safety",
+ ],
+}
+
// Common defaults for compiling the actual APK.
java_defaults {
name: "TetheringAppDefaults",
platform_apis: true,
privileged: true,
+ jni_libs: [
+ "libtetheroffloadjni",
+ ],
resource_dirs: [
"res",
],
@@ -65,8 +97,33 @@ android_app {
// This group will be removed when tethering migration is done.
filegroup {
- name: "tethering-services-srcs",
+ name: "tethering-servicescore-srcs",
srcs: [
+ "src/com/android/server/connectivity/tethering/EntitlementManager.java",
+ "src/com/android/server/connectivity/tethering/OffloadController.java",
+ "src/com/android/server/connectivity/tethering/OffloadHardwareInterface.java",
"src/com/android/server/connectivity/tethering/TetheringConfiguration.java",
+ "src/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java",
+ ],
+}
+
+// This group will be removed when tethering migration is done.
+filegroup {
+ name: "tethering-servicesnet-srcs",
+ srcs: [
+ "src/android/net/dhcp/DhcpServerCallbacks.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExt.java",
+ "src/android/net/ip/IpServer.java",
+ "src/android/net/ip/RouterAdvertisementDaemon.java",
+ "src/android/net/util/InterfaceSet.java",
+ "src/android/net/util/PrefixUtils.java",
+ ],
+}
+
+// This group would be removed when tethering migration is done.
+filegroup {
+ name: "tethering-jni-srcs",
+ srcs: [
+ "jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp",
],
}
diff --git a/packages/Tethering/AndroidManifestBase.xml b/packages/Tethering/AndroidManifestBase.xml
index b9cac1994359..dc013da33869 100644
--- a/packages/Tethering/AndroidManifestBase.xml
+++ b/packages/Tethering/AndroidManifestBase.xml
@@ -23,7 +23,6 @@
<application
android:label="Tethering"
android:defaultToDeviceProtectedStorage="true"
- android:directBootAware="true"
- android:usesCleartextTraffic="true">
+ android:directBootAware="true">
</application>
</manifest>
diff --git a/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp b/packages/Tethering/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
index 3eaf48845a2f..3eaf48845a2f 100644
--- a/services/core/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
+++ b/packages/Tethering/jni/com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp
diff --git a/services/net/java/android/net/dhcp/DhcpServerCallbacks.java b/packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
index 7c41377985d3..7c41377985d3 100644
--- a/services/net/java/android/net/dhcp/DhcpServerCallbacks.java
+++ b/packages/Tethering/src/android/net/dhcp/DhcpServerCallbacks.java
diff --git a/services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java b/packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
index 1fe2328f1cdb..1fe2328f1cdb 100644
--- a/services/net/java/android/net/dhcp/DhcpServingParamsParcelExt.java
+++ b/packages/Tethering/src/android/net/dhcp/DhcpServingParamsParcelExt.java
diff --git a/services/net/java/android/net/ip/IpServer.java b/packages/Tethering/src/android/net/ip/IpServer.java
index 3d79bba7bbe3..ff3d7bc6fd35 100644
--- a/services/net/java/android/net/ip/IpServer.java
+++ b/packages/Tethering/src/android/net/ip/IpServer.java
@@ -16,7 +16,7 @@
package android.net.ip;
-import static android.net.NetworkUtils.numericToInetAddress;
+import static android.net.InetAddresses.parseNumericAddress;
import static android.net.dhcp.IDhcpServer.STATUS_SUCCESS;
import static android.net.util.NetworkConstants.FF;
import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH;
@@ -77,6 +77,7 @@ public class IpServer extends StateMachine {
public static final int STATE_TETHERED = 2;
public static final int STATE_LOCAL_ONLY = 3;
+ /** Get string name of |state|.*/
public static String getStateString(int state) {
switch (state) {
case STATE_UNAVAILABLE: return "UNAVAILABLE";
@@ -103,15 +104,16 @@ public class IpServer extends StateMachine {
// TODO: have this configurable
private static final int DHCP_LEASE_TIME_SECS = 3600;
- private final static String TAG = "IpServer";
- private final static boolean DBG = false;
- private final static boolean VDBG = false;
- private static final Class[] messageClasses = {
+ private static final String TAG = "IpServer";
+ private static final boolean DBG = false;
+ private static final boolean VDBG = false;
+ private static final Class[] sMessageClasses = {
IpServer.class
};
private static final SparseArray<String> sMagicDecoderRing =
- MessageUtils.findMessageNames(messageClasses);
+ MessageUtils.findMessageNames(sMessageClasses);
+ /** IpServer callback. */
public static class Callback {
/**
* Notify that |who| has changed its tethering state.
@@ -131,11 +133,14 @@ public class IpServer extends StateMachine {
public void updateLinkProperties(IpServer who, LinkProperties newLp) {}
}
+ /** Capture IpServer dependencies, for injection. */
public static class Dependencies {
+ /** Create a RouterAdvertisementDaemon instance to be used by IpServer.*/
public RouterAdvertisementDaemon getRouterAdvertisementDaemon(InterfaceParams ifParams) {
return new RouterAdvertisementDaemon(ifParams);
}
+ /** Get |ifName|'s interface information.*/
public InterfaceParams getInterfaceParams(String ifName) {
return InterfaceParams.getByName(ifName);
}
@@ -244,25 +249,51 @@ public class IpServer extends StateMachine {
setInitialState(mInitialState);
}
- public String interfaceName() { return mIfaceName; }
-
- public int interfaceType() { return mInterfaceType; }
+ /** Interface name which IpServer served.*/
+ public String interfaceName() {
+ return mIfaceName;
+ }
- public int lastError() { return mLastError; }
+ /**
+ * Tethering downstream type. It would be one of ConnectivityManager#TETHERING_*.
+ */
+ public int interfaceType() {
+ return mInterfaceType;
+ }
- public int servingMode() { return mServingMode; }
+ /** Last error from this IpServer. */
+ public int lastError() {
+ return mLastError;
+ }
- public LinkProperties linkProperties() { return new LinkProperties(mLinkProperties); }
+ /** Serving mode is the current state of IpServer state machine. */
+ public int servingMode() {
+ return mServingMode;
+ }
- public void stop() { sendMessage(CMD_INTERFACE_DOWN); }
+ /** The properties of the network link which IpServer is serving. */
+ public LinkProperties linkProperties() {
+ return new LinkProperties(mLinkProperties);
+ }
- public void unwanted() { sendMessage(CMD_TETHER_UNREQUESTED); }
+ /** Stop this IpServer. After this is called this IpServer should not be used any more. */
+ public void stop() {
+ sendMessage(CMD_INTERFACE_DOWN);
+ }
/**
- * Internals.
+ * Tethering is canceled. IpServer state machine will be available and wait for
+ * next tethering request.
*/
+ public void unwanted() {
+ sendMessage(CMD_TETHER_UNREQUESTED);
+ }
+
+ /** Internals. */
- private boolean startIPv4() { return configureIPv4(true); }
+ private boolean startIPv4() {
+ return configureIPv4(true);
+ }
/**
* Convenience wrapper around INetworkStackStatusCallback to run callbacks on the IpServer
@@ -410,7 +441,7 @@ public class IpServer extends StateMachine {
prefixLen = WIFI_P2P_IFACE_PREFIX_LENGTH;
} else {
// BT configures the interface elsewhere: only start DHCP.
- final Inet4Address srvAddr = (Inet4Address) numericToInetAddress(BLUETOOTH_IFACE_ADDR);
+ final Inet4Address srvAddr = (Inet4Address) parseNumericAddress(BLUETOOTH_IFACE_ADDR);
return configureDhcp(enabled, srvAddr, BLUETOOTH_DHCP_PREFIX_LENGTH);
}
@@ -422,7 +453,7 @@ public class IpServer extends StateMachine {
return false;
}
- InetAddress addr = numericToInetAddress(ipAsString);
+ InetAddress addr = parseNumericAddress(ipAsString);
linkAddr = new LinkAddress(addr, prefixLen);
ifcg.setLinkAddress(linkAddr);
if (mInterfaceType == ConnectivityManager.TETHERING_WIFI) {
@@ -473,7 +504,7 @@ public class IpServer extends StateMachine {
private String getRandomWifiIPv4Address() {
try {
- byte[] bytes = numericToInetAddress(WIFI_HOST_IFACE_ADDR).getAddress();
+ byte[] bytes = parseNumericAddress(WIFI_HOST_IFACE_ADDR).getAddress();
bytes[3] = getRandomSanitizedByte(DOUG_ADAMS, asByte(0), asByte(1), FF);
return InetAddress.getByAddress(bytes).getHostAddress();
} catch (Exception e) {
diff --git a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
index 59aea21f46c8..414741309ef0 100644
--- a/services/net/java/android/net/ip/RouterAdvertisementDaemon.java
+++ b/packages/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java
@@ -119,6 +119,7 @@ public class RouterAdvertisementDaemon {
private volatile MulticastTransmitter mMulticastTransmitter;
private volatile UnicastResponder mUnicastResponder;
+ /** Encapsulate the RA parameters for RouterAdvertisementDaemon.*/
public static class RaParams {
// Tethered traffic will have the hop limit properly decremented.
// Consequently, set the hoplimit greater by one than the upstream
@@ -150,10 +151,12 @@ public class RouterAdvertisementDaemon {
dnses = (HashSet) other.dnses.clone();
}
- // Returns the subset of RA parameters that become deprecated when
- // moving from announcing oldRa to announcing newRa.
- //
- // Currently only tracks differences in |prefixes| and |dnses|.
+ /**
+ * Returns the subset of RA parameters that become deprecated when
+ * moving from announcing oldRa to announcing newRa.
+ *
+ * Currently only tracks differences in |prefixes| and |dnses|.
+ */
public static RaParams getDeprecatedRaParams(RaParams oldRa, RaParams newRa) {
RaParams newlyDeprecated = new RaParams();
@@ -179,7 +182,9 @@ public class RouterAdvertisementDaemon {
private final HashMap<IpPrefix, Integer> mPrefixes = new HashMap<>();
private final HashMap<Inet6Address, Integer> mDnses = new HashMap<>();
- Set<IpPrefix> getPrefixes() { return mPrefixes.keySet(); }
+ Set<IpPrefix> getPrefixes() {
+ return mPrefixes.keySet();
+ }
void putPrefixes(Set<IpPrefix> prefixes) {
for (IpPrefix ipp : prefixes) {
@@ -193,7 +198,9 @@ public class RouterAdvertisementDaemon {
}
}
- Set<Inet6Address> getDnses() { return mDnses.keySet(); }
+ Set<Inet6Address> getDnses() {
+ return mDnses.keySet();
+ }
void putDnses(Set<Inet6Address> dnses) {
for (Inet6Address dns : dnses) {
@@ -207,7 +214,9 @@ public class RouterAdvertisementDaemon {
}
}
- boolean isEmpty() { return mPrefixes.isEmpty() && mDnses.isEmpty(); }
+ boolean isEmpty() {
+ return mPrefixes.isEmpty() && mDnses.isEmpty();
+ }
private boolean decrementCounters() {
boolean removed = decrementCounter(mPrefixes);
@@ -219,7 +228,7 @@ public class RouterAdvertisementDaemon {
boolean removed = false;
for (Iterator<Map.Entry<T, Integer>> it = map.entrySet().iterator();
- it.hasNext();) {
+ it.hasNext();) {
Map.Entry<T, Integer> kv = it.next();
if (kv.getValue() == 0) {
it.remove();
@@ -240,6 +249,7 @@ public class RouterAdvertisementDaemon {
mDeprecatedInfoTracker = new DeprecatedInfoTracker();
}
+ /** Build new RA.*/
public void buildNewRa(RaParams deprecatedParams, RaParams newParams) {
synchronized (mLock) {
if (deprecatedParams != null) {
@@ -260,6 +270,7 @@ public class RouterAdvertisementDaemon {
maybeNotifyMulticastTransmitter();
}
+ /** Start router advertisement daemon. */
public boolean start() {
if (!createSocket()) {
return false;
@@ -274,6 +285,7 @@ public class RouterAdvertisementDaemon {
return true;
}
+ /** Stop router advertisement daemon. */
public void stop() {
closeSocket();
// Wake up mMulticastTransmitter thread to interrupt a potential 1 day sleep before
@@ -362,8 +374,12 @@ public class RouterAdvertisementDaemon {
}
}
- private static byte asByte(int value) { return (byte) value; }
- private static short asShort(int value) { return (short) value; }
+ private static byte asByte(int value) {
+ return (byte) value;
+ }
+ private static short asShort(int value) {
+ return (short) value;
+ }
private static void putHeader(ByteBuffer ra, boolean hasDefaultRoute, byte hopLimit) {
/**
@@ -384,14 +400,14 @@ public class RouterAdvertisementDaemon {
+-+-+-+-+-+-+-+-+-+-+-+-
*/
ra.put(ICMPV6_ND_ROUTER_ADVERT)
- .put(asByte(0))
- .putShort(asShort(0))
- .put(hopLimit)
- // RFC 4191 "high" preference, iff. advertising a default route.
- .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
- .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
- .putInt(0)
- .putInt(0);
+ .put(asByte(0))
+ .putShort(asShort(0))
+ .put(hopLimit)
+ // RFC 4191 "high" preference, iff. advertising a default route.
+ .put(hasDefaultRoute ? asByte(0x08) : asByte(0))
+ .putShort(hasDefaultRoute ? asShort(DEFAULT_LIFETIME) : asShort(0))
+ .putInt(0)
+ .putInt(0);
}
private static void putSlla(ByteBuffer ra, byte[] slla) {
@@ -408,11 +424,12 @@ public class RouterAdvertisementDaemon {
// Only IEEE 802.3 6-byte addresses are supported.
return;
}
- final byte ND_OPTION_SLLA = 1;
- final byte SLLA_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_SLLA)
- .put(SLLA_NUM_8OCTETS)
- .put(slla);
+
+ final byte nd_option_slla = 1;
+ final byte slla_num_8octets = 1;
+ ra.put(nd_option_slla)
+ .put(slla_num_8octets)
+ .put(slla);
}
private static void putExpandedFlagsOption(ByteBuffer ra) {
@@ -428,13 +445,13 @@ public class RouterAdvertisementDaemon {
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_EFO = 26;
- final byte EFO_NUM_8OCTETS = 1;
+ final byte nd_option__efo = 26;
+ final byte efo_num_8octets = 1;
- ra.put(ND_OPTION_EFO)
- .put(EFO_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(0);
+ ra.put(nd_option__efo)
+ .put(efo_num_8octets)
+ .putShort(asShort(0))
+ .putInt(0);
}
private static void putMtu(ByteBuffer ra, int mtu) {
@@ -449,12 +466,12 @@ public class RouterAdvertisementDaemon {
| MTU |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*/
- final byte ND_OPTION_MTU = 5;
- final byte MTU_NUM_8OCTETS = 1;
- ra.put(ND_OPTION_MTU)
- .put(MTU_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
+ final byte nd_option_mtu = 5;
+ final byte mtu_num_8octs = 1;
+ ra.put(nd_option_mtu)
+ .put(mtu_num_8octs)
+ .putShort(asShort(0))
+ .putInt((mtu < IPV6_MIN_MTU) ? IPV6_MIN_MTU : mtu);
}
private static void putPio(ByteBuffer ra, IpPrefix ipp,
@@ -486,22 +503,22 @@ public class RouterAdvertisementDaemon {
if (prefixLength != 64) {
return;
}
- final byte ND_OPTION_PIO = 3;
- final byte PIO_NUM_8OCTETS = 4;
+ final byte nd_option_pio = 3;
+ final byte pio_num_8octets = 4;
if (validTime < 0) validTime = 0;
if (preferredTime < 0) preferredTime = 0;
if (preferredTime > validTime) preferredTime = validTime;
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_PIO)
- .put(PIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0xc0)) /* L & A set */
- .putInt(validTime)
- .putInt(preferredTime)
- .putInt(0)
- .put(addr);
+ ra.put(nd_option_pio)
+ .put(pio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0xc0)) /* L & A set */
+ .putInt(validTime)
+ .putInt(preferredTime)
+ .putInt(0)
+ .put(addr);
}
private static void putRio(ByteBuffer ra, IpPrefix ipp) {
@@ -524,16 +541,16 @@ public class RouterAdvertisementDaemon {
if (prefixLength > 64) {
return;
}
- final byte ND_OPTION_RIO = 24;
- final byte RIO_NUM_8OCTETS = asByte(
+ final byte nd_option_rio = 24;
+ final byte rio_num_8octets = asByte(
(prefixLength == 0) ? 1 : (prefixLength <= 8) ? 2 : 3);
final byte[] addr = ipp.getAddress().getAddress();
- ra.put(ND_OPTION_RIO)
- .put(RIO_NUM_8OCTETS)
- .put(asByte(prefixLength))
- .put(asByte(0x18))
- .putInt(DEFAULT_LIFETIME);
+ ra.put(nd_option_rio)
+ .put(rio_num_8octets)
+ .put(asByte(prefixLength))
+ .put(asByte(0x18))
+ .putInt(DEFAULT_LIFETIME);
// Rely upon an IpPrefix's address being properly zeroed.
if (prefixLength > 0) {
@@ -566,12 +583,12 @@ public class RouterAdvertisementDaemon {
}
if (filteredDnses.isEmpty()) return;
- final byte ND_OPTION_RDNSS = 25;
- final byte RDNSS_NUM_8OCTETS = asByte(dnses.size() * 2 + 1);
- ra.put(ND_OPTION_RDNSS)
- .put(RDNSS_NUM_8OCTETS)
- .putShort(asShort(0))
- .putInt(lifetime);
+ final byte nd_option_rdnss = 25;
+ final byte rdnss_num_8octets = asByte(dnses.size() * 2 + 1);
+ ra.put(nd_option_rdnss)
+ .put(rdnss_num_8octets)
+ .putShort(asShort(0))
+ .putInt(lifetime);
for (Inet6Address dns : filteredDnses) {
// NOTE: If the full of list DNS servers doesn't fit in the packet,
@@ -585,7 +602,7 @@ public class RouterAdvertisementDaemon {
}
private boolean createSocket() {
- final int SEND_TIMEOUT_MS = 300;
+ final int send_timout_ms = 300;
final int oldTag = TrafficStats.getAndSetThreadStatsTag(
TrafficStatsConstants.TAG_SYSTEM_NEIGHBOR);
@@ -593,7 +610,7 @@ public class RouterAdvertisementDaemon {
mSocket = Os.socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
// Setting SNDTIMEO is purely for defensive purposes.
Os.setsockoptTimeval(
- mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(SEND_TIMEOUT_MS));
+ mSocket, SOL_SOCKET, SO_SNDTIMEO, StructTimeval.fromMillis(send_timout_ms));
Os.setsockoptIfreq(mSocket, SOL_SOCKET, SO_BINDTODEVICE, mInterface.name);
NetworkUtils.protectFromVpn(mSocket);
NetworkUtils.setupRaSocket(mSocket, mInterface.index);
@@ -611,7 +628,7 @@ public class RouterAdvertisementDaemon {
if (mSocket != null) {
try {
IoBridge.closeAndSignalBlockedThreads(mSocket);
- } catch (IOException ignored) {}
+ } catch (IOException ignored) { }
}
mSocket = null;
}
@@ -627,9 +644,9 @@ public class RouterAdvertisementDaemon {
}
final InetAddress destip = dest.getAddress();
- return (destip instanceof Inet6Address) &&
- destip.isLinkLocalAddress() &&
- (((Inet6Address) destip).getScopeId() == mInterface.index);
+ return (destip instanceof Inet6Address)
+ && destip.isLinkLocalAddress()
+ && (((Inet6Address) destip).getScopeId() == mInterface.index);
}
private void maybeSendRA(InetSocketAddress dest) {
@@ -654,11 +671,11 @@ public class RouterAdvertisementDaemon {
}
private final class UnicastResponder extends Thread {
- private final InetSocketAddress solicitor = new InetSocketAddress();
+ private final InetSocketAddress mSolicitor = new InetSocketAddress();
// The recycled buffer for receiving Router Solicitations from clients.
// If the RS is larger than IPV6_MIN_MTU the packets are truncated.
// This is fine since currently only byte 0 is examined anyway.
- private final byte mSolication[] = new byte[IPV6_MIN_MTU];
+ private final byte[] mSolicitation = new byte[IPV6_MIN_MTU];
@Override
public void run() {
@@ -666,9 +683,9 @@ public class RouterAdvertisementDaemon {
try {
// Blocking receive.
final int rval = Os.recvfrom(
- mSocket, mSolication, 0, mSolication.length, 0, solicitor);
+ mSocket, mSolicitation, 0, mSolicitation.length, 0, mSolicitor);
// Do the least possible amount of validation.
- if (rval < 1 || mSolication[0] != ICMPV6_ND_ROUTER_SOLICIT) {
+ if (rval < 1 || mSolicitation[0] != ICMPV6_ND_ROUTER_SOLICIT) {
continue;
}
} catch (ErrnoException | SocketException e) {
@@ -678,7 +695,7 @@ public class RouterAdvertisementDaemon {
continue;
}
- maybeSendRA(solicitor);
+ maybeSendRA(mSolicitor);
}
}
}
diff --git a/services/net/java/android/net/util/InterfaceSet.java b/packages/Tethering/src/android/net/util/InterfaceSet.java
index 9f26fa17ef5c..758978711bd4 100644
--- a/services/net/java/android/net/util/InterfaceSet.java
+++ b/packages/Tethering/src/android/net/util/InterfaceSet.java
@@ -47,6 +47,6 @@ public class InterfaceSet {
public boolean equals(Object obj) {
return obj != null
&& obj instanceof InterfaceSet
- && ifnames.equals(((InterfaceSet)obj).ifnames);
+ && ifnames.equals(((InterfaceSet) obj).ifnames);
}
}
diff --git a/services/net/java/android/net/util/PrefixUtils.java b/packages/Tethering/src/android/net/util/PrefixUtils.java
index f60694aaedc9..f203e9995f3d 100644
--- a/services/net/java/android/net/util/PrefixUtils.java
+++ b/packages/Tethering/src/android/net/util/PrefixUtils.java
@@ -42,16 +42,19 @@ public class PrefixUtils {
public static final IpPrefix DEFAULT_WIFI_P2P_PREFIX = pfx("192.168.49.0/24");
+ /** Get non forwardable prefixes. */
public static Set<IpPrefix> getNonForwardablePrefixes() {
final HashSet<IpPrefix> prefixes = new HashSet<>();
addNonForwardablePrefixes(prefixes);
return prefixes;
}
+ /** Add non forwardable prefixes. */
public static void addNonForwardablePrefixes(Set<IpPrefix> prefixes) {
Collections.addAll(prefixes, MIN_NON_FORWARDABLE_PREFIXES);
}
+ /** Get local prefixes from |lp|. */
public static Set<IpPrefix> localPrefixesFrom(LinkProperties lp) {
final HashSet<IpPrefix> localPrefixes = new HashSet<>();
if (lp == null) return localPrefixes;
@@ -66,10 +69,12 @@ public class PrefixUtils {
return localPrefixes;
}
+ /** Convert LinkAddress |addr| to IpPrefix. */
public static IpPrefix asIpPrefix(LinkAddress addr) {
return new IpPrefix(addr.getAddress(), addr.getPrefixLength());
}
+ /** Convert InetAddress |ip| to IpPrefix. */
public static IpPrefix ipAddressAsPrefix(InetAddress ip) {
final int bitLength = (ip instanceof Inet4Address)
? NetworkConstants.IPV4_ADDR_BITS
diff --git a/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java b/packages/Tethering/src/com/android/server/connectivity/tethering/EntitlementManager.java
index f952bcef5606..6b0f1de7ce85 100644
--- a/services/core/java/com/android/server/connectivity/tethering/EntitlementManager.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/EntitlementManager.java
@@ -87,7 +87,6 @@ public class EntitlementManager {
private static final int EVENT_MAYBE_RUN_PROVISIONING = 3;
private static final int EVENT_GET_ENTITLEMENT_VALUE = 4;
-
// The ArraySet contains enabled downstream types, ex:
// {@link ConnectivityManager.TETHERING_WIFI}
// {@link ConnectivityManager.TETHERING_USB}
@@ -112,7 +111,6 @@ public class EntitlementManager {
public EntitlementManager(Context ctx, StateMachine tetherMasterSM, SharedLog log,
int permissionChangeMessageCode, MockableSystemProperties systemProperties) {
-
mContext = ctx;
mLog = log.forSubComponent(TAG);
mCurrentTethers = new ArraySet<Integer>();
@@ -138,7 +136,7 @@ public class EntitlementManager {
/**
* Ui entitlement check fails in |downstream|.
*
- * @param downstream tethering type from ConnectivityManager.TETHERING_{@code *}.
+ * @param downstream tethering type from ConnectivityManager.TETHERING_{@code *}.
*/
void onUiEntitlementFailed(int downstream);
}
@@ -662,7 +660,6 @@ public class EntitlementManager {
private void handleGetLatestTetheringEntitlementValue(int downstream, ResultReceiver receiver,
boolean showEntitlementUi) {
-
final TetheringConfiguration config = mFetcher.fetchTetheringConfiguration();
if (!isTetherProvisioningRequired(config)) {
receiver.send(TETHER_ERROR_NO_ERROR, null);
diff --git a/services/core/java/com/android/server/connectivity/tethering/OffloadController.java b/packages/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java
index a3c299814a7a..16734d83e3aa 100644
--- a/services/core/java/com/android/server/connectivity/tethering/OffloadController.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/OffloadController.java
@@ -36,8 +36,8 @@ import android.net.netlink.NetlinkSocket;
import android.net.util.IpUtils;
import android.net.util.SharedLog;
import android.os.Handler;
-import android.os.Looper;
import android.os.INetworkManagementService;
+import android.os.Looper;
import android.os.RemoteException;
import android.os.SystemClock;
import android.provider.Settings;
@@ -60,7 +60,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
/**
* A class to encapsulate the business logic of programming the tethering
@@ -74,7 +73,7 @@ public class OffloadController {
private static final String ANYIP = "0.0.0.0";
private static final ForwardedStats EMPTY_STATS = new ForwardedStats();
- private static enum UpdateType { IF_NEEDED, FORCE };
+ private enum UpdateType { IF_NEEDED, FORCE };
private final Handler mHandler;
private final OffloadHardwareInterface mHwInterface;
@@ -128,6 +127,7 @@ public class OffloadController {
}
}
+ /** Start hardware offload. */
public boolean start() {
if (started()) return true;
@@ -235,6 +235,7 @@ public class OffloadController {
return isStarted;
}
+ /** Stop hardware offload. */
public void stop() {
// Completely stops tethering offload. After this method is called, it is no longer safe to
// call any HAL method, no callbacks from the hardware will be delivered, and any in-flight
@@ -258,7 +259,9 @@ public class OffloadController {
// getTetherStats() is the only function in OffloadController that can be called from
// a different thread. Do not attempt to update stats by querying the offload HAL
// synchronously from a different thread than our Handler thread. http://b/64771555.
- Runnable updateStats = () -> { updateStatsForCurrentUpstream(); };
+ Runnable updateStats = () -> {
+ updateStatsForCurrentUpstream();
+ };
if (Looper.myLooper() == mHandler.getLooper()) {
updateStats.run();
} else {
@@ -358,6 +361,7 @@ public class OffloadController {
}
}
+ /** Set current tethering upstream LinkProperties. */
public void setUpstreamLinkProperties(LinkProperties lp) {
if (!started() || Objects.equals(mUpstreamLinkProperties, lp)) return;
@@ -376,6 +380,7 @@ public class OffloadController {
pushUpstreamParameters(prevUpstream);
}
+ /** Set local prefixes. */
public void setLocalPrefixes(Set<IpPrefix> localPrefixes) {
mExemptPrefixes = localPrefixes;
@@ -383,6 +388,7 @@ public class OffloadController {
computeAndPushLocalPrefixes(UpdateType.IF_NEEDED);
}
+ /** Update current downstream LinkProperties. */
public void notifyDownstreamLinkProperties(LinkProperties lp) {
final String ifname = lp.getInterfaceName();
final LinkProperties oldLp = mDownstreams.put(ifname, new LinkProperties(lp));
@@ -421,6 +427,7 @@ public class OffloadController {
}
}
+ /** Remove downstream interface from offload hardware. */
public void removeDownstreamInterface(String ifname) {
final LinkProperties lp = mDownstreams.remove(ifname);
if (lp == null) return;
@@ -481,7 +488,7 @@ public class OffloadController {
iface, v4addr, v4gateway, (v6gateways.isEmpty() ? null : v6gateways));
if (!success) {
- return success;
+ return success;
}
// Update stats after we've told the hardware to change routing so we don't miss packets.
@@ -545,6 +552,7 @@ public class OffloadController {
return false;
}
+ /** Dump information. */
public void dump(IndentingPrintWriter pw) {
if (isOffloadDisabled()) {
pw.println("Offload disabled");
@@ -630,7 +638,7 @@ public class OffloadController {
if (ip instanceof Inet4Address) {
return (Inet4Address) ip;
}
- } catch (IllegalArgumentException iae) {}
+ } catch (IllegalArgumentException iae) { }
return null;
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java b/packages/Tethering/src/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
index 207f86762b95..01339a4a2c33 100644
--- a/services/core/java/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/OffloadHardwareInterface.java
@@ -23,9 +23,9 @@ import android.hardware.tetheroffload.control.V1_0.ITetheringOffloadCallback;
import android.hardware.tetheroffload.control.V1_0.NatTimeoutUpdate;
import android.hardware.tetheroffload.control.V1_0.NetworkProtocol;
import android.hardware.tetheroffload.control.V1_0.OffloadCallbackEvent;
+import android.net.util.SharedLog;
import android.os.Handler;
import android.os.RemoteException;
-import android.net.util.SharedLog;
import android.system.OsConstants;
import java.util.ArrayList;
@@ -55,18 +55,34 @@ public class OffloadHardwareInterface {
private TetheringOffloadCallback mTetheringOffloadCallback;
private ControlCallback mControlCallback;
+ /** The callback to notify status of offload management process. */
public static class ControlCallback {
+ /** Offload started. */
public void onStarted() {}
+ /**
+ * Offload stopped because an error has occurred in lower layer.
+ */
public void onStoppedError() {}
+ /**
+ * Offload stopped because the device has moved to a bearer on which hardware offload is
+ * not supported. Subsequent calls to setUpstreamParameters and add/removeDownstream will
+ * likely fail and cannot be presumed to be saved inside of the hardware management process.
+ * Upon receiving #onSupportAvailable(), the caller should reprogram the hardware to begin
+ * offload again.
+ */
public void onStoppedUnsupported() {}
+ /** Indicate that offload is able to proivde support for this time. */
public void onSupportAvailable() {}
+ /** Offload stopped because of usage limit reached. */
public void onStoppedLimitReached() {}
+ /** Indicate to update NAT timeout. */
public void onNatTimeoutUpdate(int proto,
String srcAddr, int srcPort,
String dstAddr, int dstPort) {}
}
+ /** The object which records Tx/Rx forwarded bytes. */
public static class ForwardedStats {
public long rxBytes;
public long txBytes;
@@ -76,11 +92,13 @@ public class OffloadHardwareInterface {
txBytes = 0;
}
+ /** Add Tx/Rx bytes. */
public void add(ForwardedStats other) {
rxBytes += other.rxBytes;
txBytes += other.txBytes;
}
+ /** Returns the string representation of this object. */
public String toString() {
return String.format("rx:%s tx:%s", rxBytes, txBytes);
}
@@ -91,14 +109,17 @@ public class OffloadHardwareInterface {
mLog = log.forSubComponent(TAG);
}
+ /** Get default value indicating whether offload is supported. */
public int getDefaultTetherOffloadDisabled() {
return DEFAULT_TETHER_OFFLOAD_DISABLED;
}
+ /** Configure offload management process. */
public boolean initOffloadConfig() {
return configOffload();
}
+ /** Initialize the tethering offload HAL. */
public boolean initOffloadControl(ControlCallback controlCb) {
mControlCallback = controlCb;
@@ -125,8 +146,8 @@ public class OffloadHardwareInterface {
mOffloadControl.initOffload(
mTetheringOffloadCallback,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -134,9 +155,10 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
+ /** Stop IOffloadControl. */
public void stopOffloadControl() {
if (mOffloadControl != null) {
try {
@@ -154,6 +176,7 @@ public class OffloadHardwareInterface {
mLog.log("stopOffloadControl()");
}
+ /** Get Tx/Rx usage from last query. */
public ForwardedStats getForwardedStats(String upstream) {
final String logmsg = String.format("getForwardedStats(%s)", upstream);
@@ -174,6 +197,7 @@ public class OffloadHardwareInterface {
return stats;
}
+ /** Set local prefixes to offload management process. */
public boolean setLocalPrefixes(ArrayList<String> localPrefixes) {
final String logmsg = String.format("setLocalPrefixes([%s])",
String.join(",", localPrefixes));
@@ -182,8 +206,8 @@ public class OffloadHardwareInterface {
try {
mOffloadControl.setLocalPrefixes(localPrefixes,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -191,9 +215,10 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
+ /** Set data limit value to offload management process. */
public boolean setDataLimit(String iface, long limit) {
final String logmsg = String.format("setDataLimit(%s, %d)", iface, limit);
@@ -203,8 +228,8 @@ public class OffloadHardwareInterface {
mOffloadControl.setDataLimit(
iface, limit,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -212,9 +237,10 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
+ /** Set upstream parameters to offload management process. */
public boolean setUpstreamParameters(
String iface, String v4addr, String v4gateway, ArrayList<String> v6gws) {
iface = (iface != null) ? iface : NO_INTERFACE_NAME;
@@ -230,8 +256,8 @@ public class OffloadHardwareInterface {
mOffloadControl.setUpstreamParameters(
iface, v4addr, v4gateway, v6gws,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -239,9 +265,10 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
+ /** Add downstream prefix to offload management process. */
public boolean addDownstreamPrefix(String ifname, String prefix) {
final String logmsg = String.format("addDownstreamPrefix(%s, %s)", ifname, prefix);
@@ -249,8 +276,8 @@ public class OffloadHardwareInterface {
try {
mOffloadControl.addDownstream(ifname, prefix,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -258,9 +285,10 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
+ /** Remove downstream prefix from offload management process. */
public boolean removeDownstreamPrefix(String ifname, String prefix) {
final String logmsg = String.format("removeDownstreamPrefix(%s, %s)", ifname, prefix);
@@ -268,8 +296,8 @@ public class OffloadHardwareInterface {
try {
mOffloadControl.removeDownstream(ifname, prefix,
(boolean success, String errMsg) -> {
- results.success = success;
- results.errMsg = errMsg;
+ results.mSuccess = success;
+ results.mErrMsg = errMsg;
});
} catch (RemoteException e) {
record(logmsg, e);
@@ -277,7 +305,7 @@ public class OffloadHardwareInterface {
}
record(logmsg, results);
- return results.success;
+ return results.mSuccess;
}
private void record(String msg, Throwable t) {
@@ -286,7 +314,7 @@ public class OffloadHardwareInterface {
private void record(String msg, CbResults results) {
final String logmsg = msg + YIELDS + results;
- if (!results.success) {
+ if (!results.mSuccess) {
mLog.e(logmsg);
} else {
mLog.log(logmsg);
@@ -298,7 +326,7 @@ public class OffloadHardwareInterface {
public final ControlCallback controlCb;
public final SharedLog log;
- public TetheringOffloadCallback(Handler h, ControlCallback cb, SharedLog sharedLog) {
+ TetheringOffloadCallback(Handler h, ControlCallback cb, SharedLog sharedLog) {
handler = h;
controlCb = cb;
log = sharedLog;
@@ -332,7 +360,7 @@ public class OffloadHardwareInterface {
@Override
public void updateTimeout(NatTimeoutUpdate params) {
handler.post(() -> {
- controlCb.onNatTimeoutUpdate(
+ controlCb.onNatTimeoutUpdate(
networkProtocolToOsConstant(params.proto),
params.src.addr, uint16(params.src.port),
params.dst.addr, uint16(params.dst.port));
@@ -352,15 +380,15 @@ public class OffloadHardwareInterface {
}
private static class CbResults {
- boolean success;
- String errMsg;
+ boolean mSuccess;
+ String mErrMsg;
@Override
public String toString() {
- if (success) {
+ if (mSuccess) {
return "ok";
} else {
- return "fail: " + errMsg;
+ return "fail: " + mErrMsg;
}
}
}
diff --git a/services/core/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java b/packages/Tethering/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java
index 3a9e21f943d8..9769596ab1d0 100644
--- a/services/core/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java
+++ b/packages/Tethering/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitor.java
@@ -146,6 +146,7 @@ public class UpstreamNetworkMonitor {
}
}
+ /** Listen all networks. */
public void startObserveAllNetworks() {
stop();
@@ -155,6 +156,13 @@ public class UpstreamNetworkMonitor {
cm().registerNetworkCallback(listenAllRequest, mListenAllCallback, mHandler);
}
+ /**
+ * Stop tracking candidate tethering upstreams and release mobile network request.
+ * Note: this function is used when tethering is stopped because tethering do not need to
+ * choose upstream anymore. But it would not stop default network tracking because
+ * EntitlementManager may need to know default network to decide whether to request entitlement
+ * check even tethering is not active yet.
+ */
public void stop() {
releaseMobileNetworkRequest();
@@ -165,6 +173,7 @@ public class UpstreamNetworkMonitor {
mNetworkMap.clear();
}
+ /** Setup or teardown DUN connection according to |dunRequired|. */
public void updateMobileRequiresDun(boolean dunRequired) {
final boolean valueChanged = (mDunRequired != dunRequired);
mDunRequired = dunRequired;
@@ -174,10 +183,12 @@ public class UpstreamNetworkMonitor {
}
}
+ /** Whether mobile network is requested. */
public boolean mobileNetworkRequested() {
return (mMobileNetworkCallback != null);
}
+ /** Request mobile network if mobile upstream is permitted. */
public void registerMobileNetworkRequest() {
if (!isCellularUpstreamPermitted()) {
mLog.i("registerMobileNetworkRequest() is not permitted");
@@ -209,6 +220,7 @@ public class UpstreamNetworkMonitor {
cm().requestNetwork(mobileUpstreamRequest, mMobileNetworkCallback, 0, legacyType, mHandler);
}
+ /** Release mobile network request. */
public void releaseMobileNetworkRequest() {
if (mMobileNetworkCallback == null) return;
@@ -221,6 +233,9 @@ public class UpstreamNetworkMonitor {
// becomes available and useful we (a) file a request to keep it up as
// necessary and (b) change all upstream tracking state accordingly (by
// passing LinkProperties up to Tethering).
+ /**
+ * Select the first available network from |perferredTypes|.
+ */
public NetworkState selectPreferredUpstreamType(Iterable<Integer> preferredTypes) {
final TypeStatePair typeStatePair = findFirstAvailableUpstreamByType(
mNetworkMap.values(), preferredTypes, isCellularUpstreamPermitted());
@@ -254,7 +269,11 @@ public class UpstreamNetworkMonitor {
return typeStatePair.ns;
}
- // Returns null if no current upstream available.
+ /**
+ * Get current preferred upstream network. If default network is cellular and DUN is required,
+ * preferred upstream would be DUN otherwise preferred upstream is the same as default network.
+ * Returns null if no current upstream is available.
+ */
public NetworkState getCurrentPreferredUpstream() {
final NetworkState dfltState = (mDefaultInternetNetwork != null)
? mNetworkMap.get(mDefaultInternetNetwork)
@@ -270,10 +289,12 @@ public class UpstreamNetworkMonitor {
return findFirstDunNetwork(mNetworkMap.values());
}
+ /** Tell UpstreamNetworkMonitor which network is the current upstream of tethering. */
public void setCurrentUpstream(Network upstream) {
mTetheringUpstreamNetwork = upstream;
}
+ /** Return local prefixes. */
public Set<IpPrefix> getLocalPrefixes() {
return (Set<IpPrefix>) mLocalPrefixes.clone();
}
@@ -501,8 +522,8 @@ public class UpstreamNetworkMonitor {
try {
nc = ConnectivityManager.networkCapabilitiesForType(type);
} catch (IllegalArgumentException iae) {
- Log.e(TAG, "No NetworkCapabilities mapping for legacy type: " +
- ConnectivityManager.getNetworkTypeName(type));
+ Log.e(TAG, "No NetworkCapabilities mapping for legacy type: "
+ + ConnectivityManager.getNetworkTypeName(type));
continue;
}
if (!isCellularUpstreamPermitted && isCellular(nc)) {
@@ -547,18 +568,18 @@ public class UpstreamNetworkMonitor {
}
private static boolean isCellular(NetworkCapabilities nc) {
- return (nc != null) && nc.hasTransport(TRANSPORT_CELLULAR) &&
- nc.hasCapability(NET_CAPABILITY_NOT_VPN);
+ return (nc != null) && nc.hasTransport(TRANSPORT_CELLULAR)
+ && nc.hasCapability(NET_CAPABILITY_NOT_VPN);
}
private static boolean hasCapability(NetworkState ns, int netCap) {
- return (ns != null) && (ns.networkCapabilities != null) &&
- ns.networkCapabilities.hasCapability(netCap);
+ return (ns != null) && (ns.networkCapabilities != null)
+ && ns.networkCapabilities.hasCapability(netCap);
}
private static boolean isNetworkUsableAndNotCellular(NetworkState ns) {
- return (ns != null) && (ns.networkCapabilities != null) && (ns.linkProperties != null) &&
- !isCellular(ns.networkCapabilities);
+ return (ns != null) && (ns.networkCapabilities != null) && (ns.linkProperties != null)
+ && !isCellular(ns.networkCapabilities);
}
private static NetworkState findFirstDunNetwork(Iterable<NetworkState> netStates) {
diff --git a/packages/Tethering/tests/unit/Android.bp b/packages/Tethering/tests/unit/Android.bp
index 089bbd31d9f3..363be18a73bc 100644
--- a/packages/Tethering/tests/unit/Android.bp
+++ b/packages/Tethering/tests/unit/Android.bp
@@ -17,11 +17,15 @@
android_test {
name: "TetheringTests",
certificate: "platform",
- srcs: ["src/**/*.java"],
+ srcs: [
+ ":servicescore-tethering-src",
+ "src/**/*.java",
+ ],
test_suites: ["device-tests"],
static_libs: [
"androidx.test.rules",
"frameworks-base-testutils",
+ "net-tests-utils",
"mockito-target-extended-minus-junit4",
"TetheringApiCurrentLib",
"testables",
@@ -42,6 +46,12 @@ android_test {
filegroup {
name: "tethering-tests-src",
srcs: [
+ "src/com/android/server/connectivity/tethering/EntitlementManagerTest.java",
+ "src/com/android/server/connectivity/tethering/OffloadControllerTest.java",
"src/com/android/server/connectivity/tethering/TetheringConfigurationTest.java",
+ "src/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java",
+ "src/android/net/dhcp/DhcpServingParamsParcelExtTest.java",
+ "src/android/net/ip/IpServerTest.java",
+ "src/android/net/util/InterfaceSetTest.java",
],
}
diff --git a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java b/packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
index e01ac7f08c2f..e01ac7f08c2f 100644
--- a/tests/net/java/android/net/dhcp/DhcpServingParamsParcelExtTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/dhcp/DhcpServingParamsParcelExtTest.java
diff --git a/tests/net/java/android/net/ip/IpServerTest.java b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
index b6ccebb3dcd3..4358cd6966f1 100644
--- a/tests/net/java/android/net/ip/IpServerTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/ip/IpServerTest.java
@@ -183,7 +183,7 @@ public class IpServerTest {
@Test
public void shouldDoNothingUntilRequested() throws Exception {
initStateMachine(TETHERING_BLUETOOTH);
- final int [] NOOP_COMMANDS = {
+ final int [] noOp_commands = {
IpServer.CMD_TETHER_UNREQUESTED,
IpServer.CMD_IP_FORWARDING_ENABLE_ERROR,
IpServer.CMD_IP_FORWARDING_DISABLE_ERROR,
@@ -192,7 +192,7 @@ public class IpServerTest {
IpServer.CMD_SET_DNS_FORWARDERS_ERROR,
IpServer.CMD_TETHER_CONNECTION_CHANGED
};
- for (int command : NOOP_COMMANDS) {
+ for (int command : noOp_commands) {
// None of these commands should trigger us to request action from
// the rest of the system.
dispatchCommand(command);
diff --git a/tests/net/java/android/net/util/InterfaceSetTest.java b/packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
index ea084b607868..ea084b607868 100644
--- a/tests/net/java/android/net/util/InterfaceSetTest.java
+++ b/packages/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java
diff --git a/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/EntitlementManagerTest.java
index 5217e26a40ef..5217e26a40ef 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/EntitlementManagerTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/EntitlementManagerTest.java
diff --git a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/OffloadControllerTest.java
index 9931aec01487..8574f5401496 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/OffloadControllerTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/OffloadControllerTest.java
@@ -26,10 +26,10 @@ import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED;
import static com.android.server.connectivity.tethering.OffloadHardwareInterface.ForwardedStats;
import static com.android.testutils.MiscAssertsKt.assertContainsAll;
+import static com.android.testutils.MiscAssertsKt.assertThrows;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyObject;
@@ -148,10 +148,8 @@ public class OffloadControllerTest {
public void testNoSettingsValueDefaultDisabledDoesNotStart() throws Exception {
setupFunctioningHardwareInterface();
when(mHardware.getDefaultTetherOffloadDisabled()).thenReturn(1);
- try {
- Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED);
- fail();
- } catch (SettingNotFoundException expected) {}
+ assertThrows(SettingNotFoundException.class, () ->
+ Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED));
final OffloadController offload = makeOffloadController();
offload.start();
@@ -168,10 +166,8 @@ public class OffloadControllerTest {
public void testNoSettingsValueDefaultEnabledDoesStart() throws Exception {
setupFunctioningHardwareInterface();
when(mHardware.getDefaultTetherOffloadDisabled()).thenReturn(0);
- try {
- Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED);
- fail();
- } catch (SettingNotFoundException expected) {}
+ assertThrows(SettingNotFoundException.class, () ->
+ Settings.Global.getInt(mContentResolver, TETHER_OFFLOAD_DISABLED));
final OffloadController offload = makeOffloadController();
offload.start();
diff --git a/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
index 0d276cbd1b85..c028d6d9cadc 100644
--- a/tests/net/java/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
+++ b/packages/Tethering/tests/unit/src/com/android/server/connectivity/tethering/UpstreamNetworkMonitorTest.java
@@ -87,7 +87,7 @@ public class UpstreamNetworkMonitorTest {
// Actual contents of the request don't matter for this test. The lack of
// any specific TRANSPORT_* is sufficient to identify this request.
- private static final NetworkRequest mDefaultRequest = new NetworkRequest.Builder().build();
+ private static final NetworkRequest sDefaultRequest = new NetworkRequest.Builder().build();
@Mock private Context mContext;
@Mock private EntitlementManager mEntitleMgr;
@@ -140,7 +140,7 @@ public class UpstreamNetworkMonitorTest {
@Test
public void testDefaultNetworkIsTracked() throws Exception {
assertTrue(mCM.hasNoCallbacks());
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
assertEquals(1, mCM.trackingDefault.size());
@@ -153,7 +153,7 @@ public class UpstreamNetworkMonitorTest {
public void testListensForAllNetworks() throws Exception {
assertTrue(mCM.listening.isEmpty());
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
assertFalse(mCM.listening.isEmpty());
assertTrue(mCM.isListeningForAll());
@@ -164,9 +164,9 @@ public class UpstreamNetworkMonitorTest {
@Test
public void testCallbacksRegistered() {
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
verify(mCM, times(1)).requestNetwork(
- eq(mDefaultRequest), any(NetworkCallback.class), any(Handler.class));
+ eq(sDefaultRequest), any(NetworkCallback.class), any(Handler.class));
mUNM.startObserveAllNetworks();
verify(mCM, times(1)).registerNetworkCallback(
any(NetworkRequest.class), any(NetworkCallback.class), any(Handler.class));
@@ -191,7 +191,7 @@ public class UpstreamNetworkMonitorTest {
mUNM.registerMobileNetworkRequest();
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_HIPRI);
- assertFalse(mCM.isDunRequested());
+ assertFalse(isDunRequested());
mUNM.stop();
assertFalse(mUNM.mobileNetworkRequested());
@@ -217,7 +217,7 @@ public class UpstreamNetworkMonitorTest {
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_DUN);
- assertTrue(mCM.isDunRequested());
+ assertTrue(isDunRequested());
// Try a few things that must not result in any state change.
mUNM.registerMobileNetworkRequest();
@@ -226,7 +226,7 @@ public class UpstreamNetworkMonitorTest {
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_DUN);
- assertTrue(mCM.isDunRequested());
+ assertTrue(isDunRequested());
mUNM.stop();
verify(mCM, times(2)).unregisterNetworkCallback(any(NetworkCallback.class));
@@ -250,7 +250,7 @@ public class UpstreamNetworkMonitorTest {
mUNM.registerMobileNetworkRequest();
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_DUN);
- assertTrue(mCM.isDunRequested());
+ assertTrue(isDunRequested());
mUNM.stop();
assertFalse(mUNM.mobileNetworkRequested());
@@ -266,17 +266,17 @@ public class UpstreamNetworkMonitorTest {
mUNM.registerMobileNetworkRequest();
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_HIPRI);
- assertFalse(mCM.isDunRequested());
+ assertFalse(isDunRequested());
mUNM.updateMobileRequiresDun(true);
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_DUN);
- assertTrue(mCM.isDunRequested());
+ assertTrue(isDunRequested());
// Test going from DUN to no-DUN correctly re-registers callbacks.
mUNM.updateMobileRequiresDun(false);
assertTrue(mUNM.mobileNetworkRequested());
assertUpstreamTypeRequested(TYPE_MOBILE_HIPRI);
- assertFalse(mCM.isDunRequested());
+ assertFalse(isDunRequested());
mUNM.stop();
assertFalse(mUNM.mobileNetworkRequested());
@@ -287,7 +287,7 @@ public class UpstreamNetworkMonitorTest {
final Collection<Integer> preferredTypes = new ArrayList<>();
preferredTypes.add(TYPE_WIFI);
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
// There are no networks, so there is nothing to select.
assertSatisfiesLegacyType(TYPE_NONE, mUNM.selectPreferredUpstreamType(preferredTypes));
@@ -369,7 +369,7 @@ public class UpstreamNetworkMonitorTest {
@Test
public void testGetCurrentPreferredUpstream() throws Exception {
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
mUNM.updateMobileRequiresDun(false);
@@ -418,7 +418,7 @@ public class UpstreamNetworkMonitorTest {
@Test
public void testLocalPrefixes() throws Exception {
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
// [0] Test minimum set of local prefixes.
@@ -431,13 +431,13 @@ public class UpstreamNetworkMonitorTest {
final TestNetworkAgent wifiAgent = new TestNetworkAgent(mCM, TRANSPORT_WIFI);
final LinkProperties wifiLp = wifiAgent.linkProperties;
wifiLp.setInterfaceName("wlan0");
- final String[] WIFI_ADDRS = {
+ final String[] wifi_addrs = {
"fe80::827a:bfff:fe6f:374d", "100.112.103.18",
"2001:db8:4:fd00:827a:bfff:fe6f:374d",
"2001:db8:4:fd00:6dea:325a:fdae:4ef4",
"fd6a:a640:60bf:e985::123", // ULA address for good measure.
};
- for (String addrStr : WIFI_ADDRS) {
+ for (String addrStr : wifi_addrs) {
final String cidr = addrStr.contains(":") ? "/64" : "/20";
wifiLp.addLinkAddress(new LinkAddress(addrStr + cidr));
}
@@ -458,10 +458,10 @@ public class UpstreamNetworkMonitorTest {
final TestNetworkAgent cellAgent = new TestNetworkAgent(mCM, TRANSPORT_CELLULAR);
final LinkProperties cellLp = cellAgent.linkProperties;
cellLp.setInterfaceName("rmnet_data0");
- final String[] CELL_ADDRS = {
+ final String[] cell_addrs = {
"10.102.211.48", "2001:db8:0:1:b50e:70d9:10c9:433d",
};
- for (String addrStr : CELL_ADDRS) {
+ for (String addrStr : cell_addrs) {
final String cidr = addrStr.contains(":") ? "/64" : "/27";
cellLp.addLinkAddress(new LinkAddress(addrStr + cidr));
}
@@ -481,10 +481,10 @@ public class UpstreamNetworkMonitorTest {
dunAgent.networkCapabilities.removeCapability(NET_CAPABILITY_INTERNET);
final LinkProperties dunLp = dunAgent.linkProperties;
dunLp.setInterfaceName("rmnet_data1");
- final String[] DUN_ADDRS = {
+ final String[] dun_addrs = {
"192.0.2.48", "2001:db8:1:2:b50e:70d9:10c9:433d",
};
- for (String addrStr : DUN_ADDRS) {
+ for (String addrStr : dun_addrs) {
final String cidr = addrStr.contains(":") ? "/64" : "/27";
dunLp.addLinkAddress(new LinkAddress(addrStr + cidr));
}
@@ -525,7 +525,7 @@ public class UpstreamNetworkMonitorTest {
// Mobile has higher pirority than wifi.
preferredTypes.add(TYPE_MOBILE_HIPRI);
preferredTypes.add(TYPE_WIFI);
- mUNM.startTrackDefaultNetwork(mDefaultRequest, mEntitleMgr);
+ mUNM.startTrackDefaultNetwork(sDefaultRequest, mEntitleMgr);
mUNM.startObserveAllNetworks();
// Setup wifi and make wifi as default network.
final TestNetworkAgent wifiAgent = new TestNetworkAgent(mCM, TRANSPORT_WIFI);
@@ -556,6 +556,15 @@ public class UpstreamNetworkMonitorTest {
mCM.legacyTypeMap.values().iterator().next());
}
+ private boolean isDunRequested() {
+ for (NetworkRequest req : mCM.requested.values()) {
+ if (req.networkCapabilities.hasCapability(NET_CAPABILITY_DUN)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static class TestConnectivityManager extends ConnectivityManager {
public Map<NetworkCallback, Handler> allCallbacks = new HashMap<>();
public Set<NetworkCallback> trackingDefault = new HashSet<>();
@@ -598,17 +607,10 @@ public class UpstreamNetworkMonitorTest {
return false;
}
- boolean isDunRequested() {
- for (NetworkRequest req : requested.values()) {
- if (req.networkCapabilities.hasCapability(NET_CAPABILITY_DUN)) {
- return true;
- }
- }
- return false;
+ int getNetworkId() {
+ return ++mNetworkId;
}
- int getNetworkId() { return ++mNetworkId; }
-
void makeDefaultNetwork(TestNetworkAgent agent) {
if (Objects.equals(defaultNetwork, agent)) return;
@@ -630,7 +632,7 @@ public class UpstreamNetworkMonitorTest {
public void requestNetwork(NetworkRequest req, NetworkCallback cb, Handler h) {
assertFalse(allCallbacks.containsKey(cb));
allCallbacks.put(cb, h);
- if (mDefaultRequest.equals(req)) {
+ if (sDefaultRequest.equals(req)) {
assertFalse(trackingDefault.contains(cb));
trackingDefault.add(cb);
} else {
@@ -749,9 +751,13 @@ public class UpstreamNetworkMonitorTest {
private final State mLoggingState = new LoggingState();
class LoggingState extends State {
- @Override public void enter() { messages.clear(); }
+ @Override public void enter() {
+ messages.clear();
+ }
- @Override public void exit() { messages.clear(); }
+ @Override public void exit() {
+ messages.clear();
+ }
@Override public boolean processMessage(Message msg) {
messages.add(msg);
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index 05b937a34626..d4fb9acdad5e 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -82,8 +82,6 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManagerInternal;
import android.provider.Settings;
-import android.provider.SettingsStringUtil;
-import android.provider.SettingsStringUtil.ComponentNameSet;
import android.provider.SettingsStringUtil.SettingStringHelper;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
@@ -2436,12 +2434,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
* Enables accessibility service specified by {@param componentName} for the {@param userId}.
*/
private void enableAccessibilityServiceLocked(ComponentName componentName, int userId) {
- final SettingStringHelper setting =
- new SettingStringHelper(
- mContext.getContentResolver(),
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
- userId);
- setting.write(ComponentNameSet.add(setting.read(), componentName));
+ mTempComponentNameSet.clear();
+ readComponentNamesFromSettingLocked(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ userId, mTempComponentNameSet);
+ mTempComponentNameSet.add(componentName);
+ persistComponentNamesToSettingLocked(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ mTempComponentNameSet, userId);
UserState userState = getUserStateLocked(userId);
if (userState.mEnabledServices.add(componentName)) {
@@ -2453,12 +2451,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
* Disables accessibility service specified by {@param componentName} for the {@param userId}.
*/
private void disableAccessibilityServiceLocked(ComponentName componentName, int userId) {
- final SettingsStringUtil.SettingStringHelper setting =
- new SettingStringHelper(
- mContext.getContentResolver(),
- Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
- userId);
- setting.write(ComponentNameSet.remove(setting.read(), componentName));
+ mTempComponentNameSet.clear();
+ readComponentNamesFromSettingLocked(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ userId, mTempComponentNameSet);
+ mTempComponentNameSet.remove(componentName);
+ persistComponentNamesToSettingLocked(Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES,
+ mTempComponentNameSet, userId);
UserState userState = getUserStateLocked(userId);
if (userState.mEnabledServices.remove(componentName)) {
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 58fb0bfd48e4..ed68f32036e5 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -20,7 +20,7 @@ java_library_static {
":vold_aidl",
":gsiservice_aidl",
":platform-compat-config",
- ":tethering-services-srcs",
+ ":tethering-servicescore-srcs",
"java/com/android/server/EventLogTags.logtags",
"java/com/android/server/am/EventLogTags.logtags",
"java/com/android/server/policy/EventLogTags.logtags",
@@ -49,12 +49,11 @@ java_library_static {
"android.hardware.biometrics.fingerprint-V2.1-java",
"android.hardware.oemlock-V1.0-java",
"android.hardware.tetheroffload.control-V1.0-java",
- "android.hardware.vibrator-V1.0-java",
+ "android.hardware.vibrator-V1.4-java",
"android.hardware.configstore-V1.0-java",
"android.hardware.contexthub-V1.0-java",
"android.hidl.manager-V1.2-java",
"dnsresolver_aidl_interface-V2-java",
- "netd_aidl_interface-java",
"netd_event_listener_interface-java",
],
}
@@ -82,3 +81,11 @@ prebuilt_etc {
name: "gps_debug.conf",
src: "java/com/android/server/location/gps_debug.conf",
}
+
+// TODO: this should be removed after tethering migration done.
+filegroup {
+ name: "servicescore-tethering-src",
+ srcs: [
+ "java/com/android/server/connectivity/MockableSystemProperties.java",
+ ],
+}
diff --git a/services/core/java/com/android/server/AppStateTracker.java b/services/core/java/com/android/server/AppStateTracker.java
index 3a7b5d683507..207e007cc62f 100644
--- a/services/core/java/com/android/server/AppStateTracker.java
+++ b/services/core/java/com/android/server/AppStateTracker.java
@@ -700,14 +700,16 @@ public class AppStateTracker {
Slog.d(TAG,"onAppIdleStateChanged: " + packageName + " u" + userId
+ (idle ? " idle" : " active") + " " + bucket);
}
- final boolean changed;
- if (bucket == UsageStatsManager.STANDBY_BUCKET_EXEMPTED) {
- changed = mExemptedPackages.add(userId, packageName);
- } else {
- changed = mExemptedPackages.remove(userId, packageName);
- }
- if (changed) {
- mHandler.notifyExemptChanged();
+ synchronized (mLock) {
+ final boolean changed;
+ if (bucket == UsageStatsManager.STANDBY_BUCKET_EXEMPTED) {
+ changed = mExemptedPackages.add(userId, packageName);
+ } else {
+ changed = mExemptedPackages.remove(userId, packageName);
+ }
+ if (changed) {
+ mHandler.notifyExemptChanged();
+ }
}
}
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index ce0e9e7e56cf..81eb4b355a21 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -97,6 +97,7 @@ import android.net.NetworkMonitorManager;
import android.net.NetworkPolicyManager;
import android.net.NetworkQuotaInfo;
import android.net.NetworkRequest;
+import android.net.NetworkScore;
import android.net.NetworkSpecifier;
import android.net.NetworkStack;
import android.net.NetworkStackClient;
@@ -2643,7 +2644,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
break;
}
case NetworkAgent.EVENT_NETWORK_SCORE_CHANGED: {
- updateNetworkScore(nai, msg.arg1);
+ final NetworkScore ns = (NetworkScore) msg.obj;
+ updateNetworkScore(nai, ns);
break;
}
case NetworkAgent.EVENT_SET_EXPLICITLY_SELECTED: {
@@ -5594,9 +5596,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
// TODO: Instead of passing mDefaultRequest, provide an API to determine whether a Network
// satisfies mDefaultRequest.
final NetworkCapabilities nc = new NetworkCapabilities(networkCapabilities);
+ final NetworkScore ns = new NetworkScore();
+ ns.putIntExtension(NetworkScore.LEGACY_SCORE, currentScore);
final NetworkAgentInfo nai = new NetworkAgentInfo(messenger, new AsyncChannel(),
new Network(mNetIdManager.reserveNetId()), new NetworkInfo(networkInfo), lp, nc,
- currentScore, mContext, mTrackerHandler, new NetworkMisc(networkMisc), this, mNetd,
+ ns, mContext, mTrackerHandler, new NetworkMisc(networkMisc), this, mNetd,
mDnsResolver, mNMS, factorySerialNumber);
// Make sure the network capabilities reflect what the agent info says.
nai.setNetworkCapabilities(mixInCapabilities(nai, nc));
@@ -6729,7 +6733,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
}
- private void updateNetworkScore(NetworkAgentInfo nai, int score) {
+ private void updateNetworkScore(NetworkAgentInfo nai, NetworkScore ns) {
+ int score = ns.getIntExtension(NetworkScore.LEGACY_SCORE);
if (VDBG || DDBG) log("updateNetworkScore for " + nai.name() + " to " + score);
if (score < 0) {
loge("updateNetworkScore for " + nai.name() + " got a negative score (" + score +
@@ -6738,7 +6743,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
final int oldScore = nai.getCurrentScore();
- nai.setCurrentScore(score);
+ nai.setNetworkScore(ns);
rematchAllNetworksAndRequests(nai, oldScore);
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java
index 2ab46e65e77f..4aaf0b7b9b36 100644
--- a/services/core/java/com/android/server/DeviceIdleController.java
+++ b/services/core/java/com/android/server/DeviceIdleController.java
@@ -291,6 +291,7 @@ public class DeviceIdleController extends SystemService
private boolean mLightEnabled;
private boolean mDeepEnabled;
private boolean mQuickDozeActivated;
+ private boolean mQuickDozeActivatedWhileIdling;
private boolean mForceIdle;
private boolean mNetworkConnected;
private boolean mScreenOn;
@@ -302,6 +303,10 @@ public class DeviceIdleController extends SystemService
private boolean mHasNetworkLocation;
private Location mLastGenericLocation;
private Location mLastGpsLocation;
+
+ /** Time in the elapsed realtime timebase when this listener last received a motion event. */
+ private long mLastMotionEventElapsed;
+
// Current locked state of the screen
private boolean mScreenLocked;
private int mNumBlockingConstraints = 0;
@@ -547,6 +552,9 @@ public class DeviceIdleController extends SystemService
*/
private ArrayMap<String, Integer> mRemovedFromSystemWhitelistApps = new ArrayMap<>();
+ private final ArraySet<StationaryListener> mStationaryListeners =
+ new ArraySet<>();
+
private static final int EVENT_NULL = 0;
private static final int EVENT_NORMAL = 1;
private static final int EVENT_LIGHT_IDLE = 2;
@@ -605,6 +613,21 @@ public class DeviceIdleController extends SystemService
}
};
+ private final AlarmManager.OnAlarmListener mMotionTimeoutAlarmListener = () -> {
+ synchronized (DeviceIdleController.this) {
+ if (!isStationaryLocked()) {
+ // If the device keeps registering motion, then the alarm should be
+ // rescheduled, so this shouldn't go off until the device is stationary.
+ // This case may happen in a race condition (alarm goes off right before
+ // motion is detected, but handleMotionDetectedLocked is called before
+ // we enter this block).
+ Slog.w(TAG, "motion timeout went off and device isn't stationary");
+ return;
+ }
+ }
+ postStationaryStatusUpdated();
+ };
+
private final AlarmManager.OnAlarmListener mSensingTimeoutAlarmListener
= new AlarmManager.OnAlarmListener() {
@Override
@@ -654,12 +677,70 @@ public class DeviceIdleController extends SystemService
}
};
+ /** Post stationary status only to this listener. */
+ private void postStationaryStatus(StationaryListener listener) {
+ mHandler.obtainMessage(MSG_REPORT_STATIONARY_STATUS, listener).sendToTarget();
+ }
+
+ /** Post stationary status to all registered listeners. */
+ private void postStationaryStatusUpdated() {
+ mHandler.sendEmptyMessage(MSG_REPORT_STATIONARY_STATUS);
+ }
+
+ private boolean isStationaryLocked() {
+ final long now = mInjector.getElapsedRealtime();
+ return mMotionListener.active
+ // Listening for motion for long enough and last motion was long enough ago.
+ && now - Math.max(mMotionListener.activatedTimeElapsed, mLastMotionEventElapsed)
+ >= mConstants.MOTION_INACTIVE_TIMEOUT;
+ }
+
+ @VisibleForTesting
+ void registerStationaryListener(StationaryListener listener) {
+ synchronized (this) {
+ if (!mStationaryListeners.add(listener)) {
+ // Listener already registered.
+ return;
+ }
+ postStationaryStatus(listener);
+ if (mMotionListener.active) {
+ if (!isStationaryLocked() && mStationaryListeners.size() == 1) {
+ // First listener to be registered and the device isn't stationary, so we
+ // need to register the alarm to report the device is stationary.
+ scheduleMotionTimeoutAlarmLocked();
+ }
+ } else {
+ startMonitoringMotionLocked();
+ scheduleMotionTimeoutAlarmLocked();
+ }
+ }
+ }
+
+ private void unregisterStationaryListener(StationaryListener listener) {
+ synchronized (this) {
+ if (mStationaryListeners.remove(listener) && mStationaryListeners.size() == 0
+ // Motion detection is started when transitioning from INACTIVE to IDLE_PENDING
+ // and so doesn't need to be on for ACTIVE or INACTIVE states.
+ // Motion detection isn't needed when idling due to Quick Doze.
+ && (mState == STATE_ACTIVE || mState == STATE_INACTIVE
+ || mQuickDozeActivated)) {
+ maybeStopMonitoringMotionLocked();
+ }
+ }
+ }
+
@VisibleForTesting
final class MotionListener extends TriggerEventListener
implements SensorEventListener {
boolean active = false;
+ /**
+ * Time in the elapsed realtime timebase when this listener was activated. Only valid if
+ * {@link #active} is true.
+ */
+ long activatedTimeElapsed;
+
public boolean isActive() {
return active;
}
@@ -667,7 +748,6 @@ public class DeviceIdleController extends SystemService
@Override
public void onTrigger(TriggerEvent event) {
synchronized (DeviceIdleController.this) {
- active = false;
motionLocked();
}
}
@@ -675,8 +755,6 @@ public class DeviceIdleController extends SystemService
@Override
public void onSensorChanged(SensorEvent event) {
synchronized (DeviceIdleController.this) {
- mSensorManager.unregisterListener(this, mMotionSensor);
- active = false;
motionLocked();
}
}
@@ -694,6 +772,7 @@ public class DeviceIdleController extends SystemService
}
if (success) {
active = true;
+ activatedTimeElapsed = mInjector.getElapsedRealtime();
} else {
Slog.e(TAG, "Unable to register for " + mMotionSensor);
}
@@ -1307,6 +1386,8 @@ public class DeviceIdleController extends SystemService
private static final int MSG_SEND_CONSTRAINT_MONITORING = 10;
private static final int MSG_UPDATE_PRE_IDLE_TIMEOUT_FACTOR = 11;
private static final int MSG_RESET_PRE_IDLE_TIMEOUT_FACTOR = 12;
+ @VisibleForTesting
+ static final int MSG_REPORT_STATIONARY_STATUS = 13;
final class MyHandler extends Handler {
MyHandler(Looper looper) {
@@ -1443,6 +1524,30 @@ public class DeviceIdleController extends SystemService
updatePreIdleFactor();
maybeDoImmediateMaintenance();
} break;
+ case MSG_REPORT_STATIONARY_STATUS: {
+ final StationaryListener newListener = (StationaryListener) msg.obj;
+ final StationaryListener[] listeners;
+ final boolean isStationary;
+ synchronized (DeviceIdleController.this) {
+ isStationary = isStationaryLocked();
+ if (newListener == null) {
+ // Only notify all listeners if we aren't directing to one listener.
+ listeners = mStationaryListeners.toArray(
+ new StationaryListener[mStationaryListeners.size()]);
+ } else {
+ listeners = null;
+ }
+ }
+ if (listeners != null) {
+ for (StationaryListener listener : listeners) {
+ listener.onDeviceStationaryChanged(isStationary);
+ }
+ }
+ if (newListener != null) {
+ newListener.onDeviceStationaryChanged(isStationary);
+ }
+ }
+ break;
}
}
}
@@ -1628,6 +1733,19 @@ public class DeviceIdleController extends SystemService
}
}
+ /**
+ * Listener to be notified when DeviceIdleController determines that the device has
+ * moved or is stationary.
+ */
+ public interface StationaryListener {
+ /**
+ * Called when DeviceIdleController has determined that the device is stationary or moving.
+ *
+ * @param isStationary true if the device is stationary, false otherwise
+ */
+ void onDeviceStationaryChanged(boolean isStationary);
+ }
+
public class LocalService {
public void onConstraintStateChanged(IDeviceIdleConstraint constraint, boolean active) {
synchronized (DeviceIdleController.this) {
@@ -1693,6 +1811,24 @@ public class DeviceIdleController extends SystemService
public int[] getPowerSaveTempWhitelistAppIds() {
return DeviceIdleController.this.getAppIdTempWhitelistInternal();
}
+
+ /**
+ * Registers a listener that will be notified when the system has detected that the device
+ * is
+ * stationary or in motion.
+ */
+ public void registerStationaryListener(StationaryListener listener) {
+ DeviceIdleController.this.registerStationaryListener(listener);
+ }
+
+ /**
+ * Unregisters a registered stationary listener from being notified when the system has
+ * detected
+ * that the device is stationary or in motion.
+ */
+ public void unregisterStationaryListener(StationaryListener listener) {
+ DeviceIdleController.this.unregisterStationaryListener(listener);
+ }
}
static class Injector {
@@ -1734,6 +1870,11 @@ public class DeviceIdleController extends SystemService
return mConstants;
}
+ /** Returns the current elapsed realtime in milliseconds. */
+ long getElapsedRealtime() {
+ return SystemClock.elapsedRealtime();
+ }
+
LocationManager getLocationManager() {
if (mLocationManager == null) {
mLocationManager = mContext.getSystemService(LocationManager.class);
@@ -2601,6 +2742,8 @@ public class DeviceIdleController extends SystemService
void updateQuickDozeFlagLocked(boolean enabled) {
if (DEBUG) Slog.i(TAG, "updateQuickDozeFlagLocked: enabled=" + enabled);
mQuickDozeActivated = enabled;
+ mQuickDozeActivatedWhileIdling =
+ mQuickDozeActivated && (mState == STATE_IDLE || mState == STATE_IDLE_MAINTENANCE);
if (enabled) {
// If Quick Doze is enabled, see if we should go straight into it.
becomeInactiveIfAppropriateLocked();
@@ -2767,10 +2910,11 @@ public class DeviceIdleController extends SystemService
mNextIdleDelay = 0;
mNextLightIdleDelay = 0;
mIdleStartTime = 0;
+ mQuickDozeActivatedWhileIdling = false;
cancelAlarmLocked();
cancelSensingTimeoutAlarmLocked();
cancelLocatingLocked();
- stopMonitoringMotionLocked();
+ maybeStopMonitoringMotionLocked();
mAnyMotionDetector.stop();
updateActiveConstraintsLocked();
}
@@ -3270,11 +3414,23 @@ public class DeviceIdleController extends SystemService
void motionLocked() {
if (DEBUG) Slog.d(TAG, "motionLocked()");
- // The motion sensor will have been disabled at this point
+ mLastMotionEventElapsed = mInjector.getElapsedRealtime();
handleMotionDetectedLocked(mConstants.MOTION_INACTIVE_TIMEOUT, "motion");
}
void handleMotionDetectedLocked(long timeout, String type) {
+ if (mStationaryListeners.size() > 0) {
+ postStationaryStatusUpdated();
+ scheduleMotionTimeoutAlarmLocked();
+ }
+ if (mQuickDozeActivated && !mQuickDozeActivatedWhileIdling) {
+ // Don't exit idle due to motion if quick doze is enabled.
+ // However, if the device started idling due to the normal progression (going through
+ // all the states) and then had quick doze activated, come out briefly on motion so the
+ // user can get slightly fresher content.
+ return;
+ }
+ maybeStopMonitoringMotionLocked();
// The device is not yet active, so we want to go back to the pending idle
// state to wait again for no motion. Note that we only monitor for motion
// after moving out of the inactive state, so no need to worry about that.
@@ -3326,10 +3482,15 @@ public class DeviceIdleController extends SystemService
}
}
- void stopMonitoringMotionLocked() {
- if (DEBUG) Slog.d(TAG, "stopMonitoringMotionLocked()");
- if (mMotionSensor != null && mMotionListener.active) {
+ /**
+ * Stops motion monitoring. Will not stop monitoring if there are registered stationary
+ * listeners.
+ */
+ private void maybeStopMonitoringMotionLocked() {
+ if (DEBUG) Slog.d(TAG, "maybeStopMonitoringMotionLocked()");
+ if (mMotionSensor != null && mMotionListener.active && mStationaryListeners.size() == 0) {
mMotionListener.unregisterLocked();
+ cancelMotionTimeoutAlarmLocked();
}
}
@@ -3356,6 +3517,10 @@ public class DeviceIdleController extends SystemService
}
}
+ private void cancelMotionTimeoutAlarmLocked() {
+ mAlarmManager.cancel(mMotionTimeoutAlarmListener);
+ }
+
void cancelSensingTimeoutAlarmLocked() {
if (mNextSensingTimeoutAlarmTime != 0) {
mNextSensingTimeoutAlarmTime = 0;
@@ -3402,6 +3567,14 @@ public class DeviceIdleController extends SystemService
mNextLightAlarmTime, "DeviceIdleController.light", mLightAlarmListener, mHandler);
}
+ private void scheduleMotionTimeoutAlarmLocked() {
+ if (DEBUG) Slog.d(TAG, "scheduleMotionAlarmLocked");
+ long nextMotionTimeoutAlarmTime =
+ mInjector.getElapsedRealtime() + mConstants.MOTION_INACTIVE_TIMEOUT;
+ mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, nextMotionTimeoutAlarmTime,
+ "DeviceIdleController.motion", mMotionTimeoutAlarmListener, mHandler);
+ }
+
void scheduleSensingTimeoutAlarmLocked(long delay) {
if (DEBUG) Slog.d(TAG, "scheduleSensingAlarmLocked(" + delay + ")");
mNextSensingTimeoutAlarmTime = SystemClock.elapsedRealtime() + delay;
@@ -4322,9 +4495,14 @@ public class DeviceIdleController extends SystemService
}
pw.println(" }");
}
- if (mUseMotionSensor) {
+ if (mUseMotionSensor || mStationaryListeners.size() > 0) {
pw.print(" mMotionActive="); pw.println(mMotionListener.active);
pw.print(" mNotMoving="); pw.println(mNotMoving);
+ pw.print(" mMotionListener.activatedTimeElapsed=");
+ pw.println(mMotionListener.activatedTimeElapsed);
+ pw.print(" mLastMotionEventElapsed="); pw.println(mLastMotionEventElapsed);
+ pw.print(" "); pw.print(mStationaryListeners.size());
+ pw.println(" stationary listeners registered");
}
pw.print(" mLocating="); pw.print(mLocating); pw.print(" mHasGps=");
pw.print(mHasGps); pw.print(" mHasNetwork=");
diff --git a/services/core/java/com/android/server/DynamicSystemService.java b/services/core/java/com/android/server/DynamicSystemService.java
index 18009e191482..190e6cf2d35c 100644
--- a/services/core/java/com/android/server/DynamicSystemService.java
+++ b/services/core/java/com/android/server/DynamicSystemService.java
@@ -115,7 +115,8 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements
}
@Override
- public boolean startInstallation(long systemSize, long userdataSize) throws RemoteException {
+ public boolean startInstallation(String name, long size, boolean readOnly)
+ throws RemoteException {
// priority from high to low: sysprop -> sdcard -> /data
String path = SystemProperties.get("os.aot.path");
if (path.isEmpty()) {
@@ -137,11 +138,18 @@ public class DynamicSystemService extends IDynamicSystemService.Stub implements
}
Slog.i(TAG, "startInstallation -> " + path);
}
+ IGsiService service = getGsiService();
GsiInstallParams installParams = new GsiInstallParams();
installParams.installDir = path;
- installParams.gsiSize = systemSize;
- installParams.userdataSize = userdataSize;
- return getGsiService().beginGsiInstall(installParams) == 0;
+ installParams.name = name;
+ installParams.size = size;
+ installParams.wipe = readOnly;
+ installParams.readOnly = readOnly;
+ if (service.beginGsiInstall(installParams) != 0) {
+ Slog.i(TAG, "Failed to install " + name);
+ return false;
+ }
+ return true;
}
@Override
diff --git a/services/core/java/com/android/server/MasterClearReceiver.java b/services/core/java/com/android/server/MasterClearReceiver.java
index 06c46b908b7a..6a9246dacc51 100644
--- a/services/core/java/com/android/server/MasterClearReceiver.java
+++ b/services/core/java/com/android/server/MasterClearReceiver.java
@@ -82,7 +82,7 @@ public class MasterClearReceiver extends BroadcastReceiver {
}
};
- if (mWipeExternalStorage || mWipeEsims) {
+ if (mWipeExternalStorage) {
// thr will be started at the end of this task.
new WipeDataTask(context, thr).execute();
} else {
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index 0269579e3e07..447ed59a775e 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -33,6 +33,9 @@ import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.telephony.Annotation.DataFailureCause;
+import android.telephony.Annotation.RadioPowerState;
+import android.telephony.Annotation.SrvccState;
import android.telephony.CallAttributes;
import android.telephony.CallQuality;
import android.telephony.CellInfo;
@@ -245,7 +248,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private int mActiveDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
- @TelephonyManager.RadioPowerState
+ @RadioPowerState
private int mRadioPowerState = TelephonyManager.RADIO_POWER_UNAVAILABLE;
private final LocalLog mLocalLog = new LocalLog(100);
@@ -382,7 +385,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
mContext = context;
mBatteryStats = BatteryStatsService.getService();
- int numPhones = TelephonyManager.getDefault().getMaxPhoneCount();
+ int numPhones = TelephonyManager.getDefault().getSupportedModemCount();
if (DBG) log("TelephonyRegistry: ctor numPhones=" + numPhones);
mNumPhones = numPhones;
mCallState = new int[numPhones];
@@ -961,13 +964,13 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
}
- public void notifyCallState(int state, String phoneNumber) {
+ public void notifyCallStateForAllSubs(int state, String phoneNumber) {
if (!checkNotifyPermission("notifyCallState()")) {
return;
}
if (VDBG) {
- log("notifyCallState: state=" + state + " phoneNumber=" + phoneNumber);
+ log("notifyCallStateForAllSubs: state=" + state + " phoneNumber=" + phoneNumber);
}
synchronized (mRecords) {
@@ -994,13 +997,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
SubscriptionManager.INVALID_SUBSCRIPTION_ID);
}
- public void notifyCallStateForPhoneId(int phoneId, int subId, int state,
- String incomingNumber) {
+ public void notifyCallState(int phoneId, int subId, int state, String incomingNumber) {
if (!checkNotifyPermission("notifyCallState()")) {
return;
}
if (VDBG) {
- log("notifyCallStateForPhoneId: subId=" + subId
+ log("notifyCallState: subId=" + subId
+ " state=" + state + " incomingNumber=" + incomingNumber);
}
synchronized (mRecords) {
@@ -1094,10 +1096,10 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
synchronized (mRecords) {
if (validatePhoneId(phoneId)) {
switch (activationType) {
- case PhoneConstants.SIM_ACTIVATION_TYPE_VOICE:
+ case TelephonyManager.SIM_ACTIVATION_TYPE_VOICE:
mVoiceActivationState[phoneId] = activationState;
break;
- case PhoneConstants.SIM_ACTIVATION_TYPE_DATA:
+ case TelephonyManager.SIM_ACTIVATION_TYPE_DATA:
mDataActivationState[phoneId] = activationState;
break;
default:
@@ -1110,7 +1112,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
+ " state=" + activationState);
}
try {
- if ((activationType == PhoneConstants.SIM_ACTIVATION_TYPE_VOICE) &&
+ if ((activationType == TelephonyManager.SIM_ACTIVATION_TYPE_VOICE) &&
r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_VOICE_ACTIVATION_STATE) &&
idMatch(r.subId, subId, phoneId)) {
@@ -1121,7 +1123,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
r.callback.onVoiceActivationStateChanged(activationState);
}
- if ((activationType == PhoneConstants.SIM_ACTIVATION_TYPE_DATA) &&
+ if ((activationType == TelephonyManager.SIM_ACTIVATION_TYPE_DATA) &&
r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DATA_ACTIVATION_STATE) &&
idMatch(r.subId, subId, phoneId)) {
@@ -1241,7 +1243,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
public void notifyCellInfoForSubscriber(int subId, List<CellInfo> cellInfo) {
- if (!checkNotifyPermission("notifyCellInfo()")) {
+ if (!checkNotifyPermission("notifyCellInfoForSubscriber()")) {
return;
}
if (VDBG) {
@@ -1258,7 +1260,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
checkFineLocationAccess(r, Build.VERSION_CODES.Q)) {
try {
if (DBG_LOC) {
- log("notifyCellInfo: mCellInfo=" + cellInfo + " r=" + r);
+ log("notifyCellInfoForSubscriber: mCellInfo=" + cellInfo
+ + " r=" + r);
}
r.callback.onCellInfoChanged(cellInfo);
} catch (RemoteException ex) {
@@ -1718,7 +1721,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
public void notifyPreciseDataConnectionFailed(int phoneId, int subId, String apnType,
- String apn, @DataFailCause.FailCause int failCause) {
+ String apn, @DataFailureCause int failCause) {
if (!checkNotifyPermission("notifyPreciseDataConnectionFailed()")) {
return;
}
@@ -1748,7 +1751,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
@Override
- public void notifySrvccStateChanged(int subId, @TelephonyManager.SrvccState int state) {
+ public void notifySrvccStateChanged(int subId, @SrvccState int state) {
if (!checkNotifyPermission("notifySrvccStateChanged()")) {
return;
}
@@ -1855,8 +1858,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
}
}
- public void notifyRadioPowerStateChanged(int phoneId, int subId,
- @TelephonyManager.RadioPowerState int state) {
+ public void notifyRadioPowerStateChanged(int phoneId, int subId, @RadioPowerState int state) {
if (!checkNotifyPermission("notifyRadioPowerStateChanged()")) {
return;
}
@@ -2227,7 +2229,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
private void broadcastPreciseDataConnectionStateChanged(int state, int networkType,
String apnType, String apn, LinkProperties linkProperties,
- @DataFailCause.FailCause int failCause) {
+ @DataFailureCause int failCause) {
Intent intent = new Intent(TelephonyManager.ACTION_PRECISE_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(PhoneConstants.STATE_KEY, state);
intent.putExtra(PhoneConstants.DATA_NETWORK_TYPE_KEY, networkType);
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 9936d73fb800..d622fb433ed8 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -29,6 +29,7 @@ import android.content.res.Resources;
import android.database.ContentObserver;
import android.hardware.input.InputManager;
import android.hardware.vibrator.V1_0.EffectStrength;
+import android.hardware.vibrator.V1_4.Capabilities;
import android.icu.text.DateFormat;
import android.media.AudioAttributes;
import android.media.AudioManager;
@@ -108,6 +109,9 @@ public class VibratorService extends IVibratorService.Stub
// If a vibration is playing for longer than 5s, it's probably not haptic feedback.
private static final long MAX_HAPTIC_FEEDBACK_DURATION = 5000;
+ // If HAL supports callbacks set the timeout to ASYNC_TIMEOUT_MULTIPLIER * duration.
+ private static final long ASYNC_TIMEOUT_MULTIPLIER = 2;
+
// A mapping from the intensity adjustment to the scaling to apply, where the intensity
// adjustment is defined as the delta between the default intensity level and the user selected
@@ -123,6 +127,7 @@ public class VibratorService extends IVibratorService.Stub
private final boolean mAllowPriorityVibrationsInLowPowerMode;
private final boolean mSupportsAmplitudeControl;
private final boolean mSupportsExternalControl;
+ private final long mCapabilities;
private final int mDefaultVibrationAmplitude;
private final SparseArray<VibrationEffect> mFallbackEffects;
private final SparseArray<Integer> mProcStatesCache = new SparseArray();
@@ -163,9 +168,10 @@ public class VibratorService extends IVibratorService.Stub
static native void vibratorOff();
static native boolean vibratorSupportsAmplitudeControl();
static native void vibratorSetAmplitude(int amplitude);
- static native long vibratorPerformEffect(long effect, long strength);
+ static native long vibratorPerformEffect(long effect, long strength, Vibration vibration);
static native boolean vibratorSupportsExternalControl();
static native void vibratorSetExternalControl(boolean enabled);
+ static native long vibratorGetCapabilities();
private final IUidObserver mUidObserver = new IUidObserver.Stub() {
@Override public void onUidStateChanged(int uid, int procState, long procStateSeq) {
@@ -226,6 +232,14 @@ public class VibratorService extends IVibratorService.Stub
}
}
+ private void onComplete() {
+ synchronized (mLock) {
+ if (this == mCurrentVibration) {
+ doCancelVibrateLocked();
+ }
+ }
+ }
+
public boolean hasTimeoutLongerThan(long millis) {
final long duration = effect.getDuration();
return duration >= 0 && duration > millis;
@@ -347,6 +361,7 @@ public class VibratorService extends IVibratorService.Stub
mSupportsAmplitudeControl = vibratorSupportsAmplitudeControl();
mSupportsExternalControl = vibratorSupportsExternalControl();
+ mCapabilities = vibratorGetCapabilities();
mContext = context;
PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
@@ -1135,10 +1150,14 @@ public class VibratorService extends IVibratorService.Stub
}
// Input devices don't support prebaked effect, so skip trying it with them.
if (!usingInputDeviceVibrators) {
- long timeout = vibratorPerformEffect(prebaked.getId(),
- prebaked.getEffectStrength());
+ long duration = vibratorPerformEffect(prebaked.getId(),
+ prebaked.getEffectStrength(), vib);
+ long timeout = duration;
+ if ((mCapabilities & Capabilities.PERFORM_COMPLETION_CALLBACK) != 0) {
+ timeout *= ASYNC_TIMEOUT_MULTIPLIER;
+ }
if (timeout > 0) {
- noteVibratorOnLocked(vib.uid, timeout);
+ noteVibratorOnLocked(vib.uid, duration);
return timeout;
}
}
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java
index 19ad32e202fe..83ad4e7e7100 100644
--- a/services/core/java/com/android/server/Watchdog.java
+++ b/services/core/java/com/android/server/Watchdog.java
@@ -103,6 +103,8 @@ public class Watchdog extends Thread {
public static final List<String> HAL_INTERFACES_OF_INTEREST = Arrays.asList(
"android.hardware.audio@2.0::IDevicesFactory",
"android.hardware.audio@4.0::IDevicesFactory",
+ "android.hardware.audio@5.0::IDevicesFactory",
+ "android.hardware.audio@6.0::IDevicesFactory",
"android.hardware.biometrics.face@1.0::IBiometricsFace",
"android.hardware.bluetooth@1.0::IBluetoothHci",
"android.hardware.camera.provider@2.4::ICameraProvider",
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 7bc2e6d647be..6cbbcddc2b3f 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -192,34 +192,38 @@ public final class ActiveServices {
@Override
public void stopForegroundServicesForUidPackage(final int uid, final String packageName) {
synchronized (mAm) {
- final ServiceMap smap = getServiceMapLocked(UserHandle.getUserId(uid));
- final int N = smap.mServicesByInstanceName.size();
- final ArrayList<ServiceRecord> toStop = new ArrayList<>(N);
- for (int i = 0; i < N; i++) {
- final ServiceRecord r = smap.mServicesByInstanceName.valueAt(i);
- if (uid == r.serviceInfo.applicationInfo.uid
- || packageName.equals(r.serviceInfo.packageName)) {
- if (r.isForeground) {
- toStop.add(r);
- }
- }
- }
+ stopAllForegroundServicesLocked(uid, packageName);
+ }
+ }
+ }
- // Now stop them all
- final int numToStop = toStop.size();
- if (numToStop > 0 && DEBUG_FOREGROUND_SERVICE) {
- Slog.i(TAG, "Package " + packageName + "/" + uid
- + " entering FAS with foreground services");
- }
- for (int i = 0; i < numToStop; i++) {
- final ServiceRecord r = toStop.get(i);
- if (DEBUG_FOREGROUND_SERVICE) {
- Slog.i(TAG, " Stopping fg for service " + r);
- }
- setServiceForegroundInnerLocked(r, 0, null, 0, 0);
+ void stopAllForegroundServicesLocked(final int uid, final String packageName) {
+ final ServiceMap smap = getServiceMapLocked(UserHandle.getUserId(uid));
+ final int N = smap.mServicesByInstanceName.size();
+ final ArrayList<ServiceRecord> toStop = new ArrayList<>(N);
+ for (int i = 0; i < N; i++) {
+ final ServiceRecord r = smap.mServicesByInstanceName.valueAt(i);
+ if (uid == r.serviceInfo.applicationInfo.uid
+ || packageName.equals(r.serviceInfo.packageName)) {
+ if (r.isForeground) {
+ toStop.add(r);
}
}
}
+
+ // Now stop them all
+ final int numToStop = toStop.size();
+ if (numToStop > 0 && DEBUG_FOREGROUND_SERVICE) {
+ Slog.i(TAG, "Package " + packageName + "/" + uid
+ + " in FAS with foreground services");
+ }
+ for (int i = 0; i < numToStop; i++) {
+ final ServiceRecord r = toStop.get(i);
+ if (DEBUG_FOREGROUND_SERVICE) {
+ Slog.i(TAG, " Stopping fg for service " + r);
+ }
+ setServiceForegroundInnerLocked(r, 0, null, 0, 0);
+ }
}
/**
@@ -1010,12 +1014,23 @@ public final class ActiveServices {
}
}
if (!aa.mAppOnTop) {
- if (active == null) {
- active = new ArrayList<>();
+ // Transitioning a fg-service host app out of top: if it's bg restricted,
+ // it loses the fg service state now.
+ if (!appRestrictedAnyInBackground(aa.mUid, aa.mPackageName)) {
+ if (active == null) {
+ active = new ArrayList<>();
+ }
+ if (DEBUG_FOREGROUND_SERVICE) Slog.d(TAG, "Adding active: pkg="
+ + aa.mPackageName + ", uid=" + aa.mUid);
+ active.add(aa);
+ } else {
+ if (DEBUG_FOREGROUND_SERVICE) {
+ Slog.d(TAG, "bg-restricted app "
+ + aa.mPackageName + "/" + aa.mUid
+ + " exiting top; demoting fg services ");
+ }
+ stopAllForegroundServicesLocked(aa.mUid, aa.mPackageName);
}
- if (DEBUG_FOREGROUND_SERVICE) Slog.d(TAG, "Adding active: pkg="
- + aa.mPackageName + ", uid=" + aa.mUid);
- active.add(aa);
}
}
smap.removeMessages(ServiceMap.MSG_UPDATE_FOREGROUND_APPS);
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 28c506a8c990..227d0787a879 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -7789,10 +7789,18 @@ public class ActivityManagerService extends IActivityManager.Stub
false /* mountExtStorageFull */, abiOverride);
}
- // TODO: Move to ProcessList?
@GuardedBy("this")
final ProcessRecord addAppLocked(ApplicationInfo info, String customProcess, boolean isolated,
boolean disableHiddenApiChecks, boolean mountExtStorageFull, String abiOverride) {
+ return addAppLocked(info, customProcess, isolated, disableHiddenApiChecks,
+ false /* disableTestApiChecks */, mountExtStorageFull, abiOverride);
+ }
+
+ // TODO: Move to ProcessList?
+ @GuardedBy("this")
+ final ProcessRecord addAppLocked(ApplicationInfo info, String customProcess, boolean isolated,
+ boolean disableHiddenApiChecks, boolean disableTestApiChecks,
+ boolean mountExtStorageFull, String abiOverride) {
ProcessRecord app;
if (!isolated) {
app = getProcessRecordLocked(customProcess != null ? customProcess : info.processName,
@@ -7827,7 +7835,7 @@ public class ActivityManagerService extends IActivityManager.Stub
mPersistentStartingProcesses.add(app);
mProcessList.startProcessLocked(app, new HostingRecord("added application",
customProcess != null ? customProcess : app.processName),
- disableHiddenApiChecks, mountExtStorageFull, abiOverride);
+ disableHiddenApiChecks, disableTestApiChecks, mountExtStorageFull, abiOverride);
}
return app;
@@ -15792,6 +15800,10 @@ public class ActivityManagerService extends IActivityManager.Stub
enforceCallingPermission(android.Manifest.permission.DISABLE_HIDDEN_API_CHECKS,
"disable hidden API checks");
}
+ // Allow instrumented processes access to test APIs.
+ // TODO(satayev): make this configurable via testing framework.
+ boolean disableTestApiChecks = true;
+
final boolean mountExtStorageFull = isCallerShell()
&& (flags & INSTR_FLAG_MOUNT_EXTERNAL_STORAGE_FULL) != 0;
@@ -15806,7 +15818,7 @@ public class ActivityManagerService extends IActivityManager.Stub
}
ProcessRecord app = addAppLocked(ai, defProcess, false, disableHiddenApiChecks,
- mountExtStorageFull, abiOverride);
+ disableTestApiChecks, mountExtStorageFull, abiOverride);
app.setActiveInstrumentation(activeInstr);
activeInstr.mFinished = false;
activeInstr.mRunningProcesses.add(app);
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 3c098d1a6653..1d099c81a1e7 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -1329,7 +1329,7 @@ public final class ProcessList {
final int procCount = procs.size();
for (int i = 0; i < procCount; i++) {
final int procUid = procs.keyAt(i);
- if (UserHandle.isApp(procUid) || !UserHandle.isSameUser(procUid, uid)) {
+ if (!UserHandle.isCore(procUid) || !UserHandle.isSameUser(procUid, uid)) {
// Don't use an app process or different user process for system component.
continue;
}
@@ -1419,15 +1419,11 @@ public final class ProcessList {
/**
* @return {@code true} if process start is successful, false otherwise.
- * @param app
- * @param hostingRecord
- * @param disableHiddenApiChecks
- * @param abiOverride
*/
@GuardedBy("mService")
boolean startProcessLocked(ProcessRecord app, HostingRecord hostingRecord,
- boolean disableHiddenApiChecks, boolean mountExtStorageFull,
- String abiOverride) {
+ boolean disableHiddenApiChecks, boolean disableTestApiChecks,
+ boolean mountExtStorageFull, String abiOverride) {
if (app.pendingStart) {
return true;
}
@@ -1572,6 +1568,10 @@ public final class ProcessList {
throw new IllegalStateException("Invalid API policy: " + policy);
}
runtimeFlags |= policyBits;
+
+ if (disableTestApiChecks) {
+ runtimeFlags |= Zygote.DISABLE_TEST_API_ENFORCEMENT_POLICY;
+ }
}
String useAppImageCache = SystemProperties.get(
@@ -1845,7 +1845,8 @@ public final class ProcessList {
final boolean startProcessLocked(ProcessRecord app, HostingRecord hostingRecord,
String abiOverride) {
return startProcessLocked(app, hostingRecord,
- false /* disableHiddenApiChecks */, false /* mountExtStorageFull */, abiOverride);
+ false /* disableHiddenApiChecks */, false /* disableTestApiChecks */,
+ false /* mountExtStorageFull */, abiOverride);
}
@GuardedBy("mService")
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index 055a4bde8a78..24569a624a51 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -1582,12 +1582,13 @@ public class AudioService extends IAudioService.Stub
setMicrophoneMuteNoCallerCheck(currentUser);
}
- private int rescaleIndex(int index, int srcStream, int dstStream) {
- int srcRange =
- mStreamStates[srcStream].getMaxIndex() - mStreamStates[srcStream].getMinIndex();
- int dstRange =
- mStreamStates[dstStream].getMaxIndex() - mStreamStates[dstStream].getMinIndex();
+ private int getIndexRange(int streamType) {
+ return (mStreamStates[streamType].getMaxIndex() - mStreamStates[streamType].getMinIndex());
+ }
+ private int rescaleIndex(int index, int srcStream, int dstStream) {
+ int srcRange = getIndexRange(srcStream);
+ int dstRange = getIndexRange(dstStream);
if (srcRange == 0) {
Log.e(TAG, "rescaleIndex : index range should not be zero");
return mStreamStates[dstStream].getMinIndex();
@@ -1598,6 +1599,17 @@ public class AudioService extends IAudioService.Stub
/ srcRange;
}
+ private int rescaleStep(int step, int srcStream, int dstStream) {
+ int srcRange = getIndexRange(srcStream);
+ int dstRange = getIndexRange(dstStream);
+ if (srcRange == 0) {
+ Log.e(TAG, "rescaleStep : index range should not be zero");
+ return 0;
+ }
+
+ return ((step * dstRange + srcRange / 2) / srcRange);
+ }
+
///////////////////////////////////////////////////////////////////////////
// IPC methods
///////////////////////////////////////////////////////////////////////////
@@ -1774,7 +1786,7 @@ public class AudioService extends IAudioService.Stub
}
} else {
// convert one UI step (+/-1) into a number of internal units on the stream alias
- step = rescaleIndex(10, streamType, streamTypeAlias);
+ step = rescaleStep(10, streamType, streamTypeAlias);
}
// If either the client forces allowing ringer modes for this adjustment,
diff --git a/services/core/java/com/android/server/compat/CompatChange.java b/services/core/java/com/android/server/compat/CompatChange.java
index bc5973d1b270..87624359ef85 100644
--- a/services/core/java/com/android/server/compat/CompatChange.java
+++ b/services/core/java/com/android/server/compat/CompatChange.java
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.compat.annotation.EnabledAfter;
import android.content.pm.ApplicationInfo;
+import com.android.internal.compat.CompatibilityChangeInfo;
import com.android.server.compat.config.Change;
import java.util.HashMap;
@@ -35,12 +36,8 @@ import java.util.Map;
*
* <p>Note, this class is not thread safe so callers must ensure thread safety.
*/
-public final class CompatChange {
+public final class CompatChange extends CompatibilityChangeInfo {
- private final long mChangeId;
- @Nullable private final String mName;
- private final int mEnableAfterTargetSdk;
- private final boolean mDisabled;
private Map<String, Boolean> mPackageOverrides;
public CompatChange(long changeId) {
@@ -56,29 +53,15 @@ public final class CompatChange {
*/
public CompatChange(long changeId, @Nullable String name, int enableAfterTargetSdk,
boolean disabled) {
- mChangeId = changeId;
- mName = name;
- mEnableAfterTargetSdk = enableAfterTargetSdk;
- mDisabled = disabled;
+ super(changeId, name, enableAfterTargetSdk, disabled);
}
/**
* @param change an object generated by services/core/xsd/platform-compat-config.xsd
*/
public CompatChange(Change change) {
- mChangeId = change.getId();
- mName = change.getName();
- mEnableAfterTargetSdk = change.getEnableAfterTargetSdk();
- mDisabled = change.getDisabled();
- }
-
- long getId() {
- return mChangeId;
- }
-
- @Nullable
- String getName() {
- return mName;
+ super(change.getId(), change.getName(), change.getEnableAfterTargetSdk(),
+ change.getDisabled());
}
/**
@@ -121,11 +104,11 @@ public final class CompatChange {
if (mPackageOverrides != null && mPackageOverrides.containsKey(app.packageName)) {
return mPackageOverrides.get(app.packageName);
}
- if (mDisabled) {
+ if (getDisabled()) {
return false;
}
- if (mEnableAfterTargetSdk != -1) {
- return app.targetSdkVersion > mEnableAfterTargetSdk;
+ if (getEnableAfterTargetSdk() != -1) {
+ return app.targetSdkVersion > getEnableAfterTargetSdk();
}
return true;
}
@@ -133,14 +116,14 @@ public final class CompatChange {
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ChangeId(")
- .append(mChangeId);
- if (mName != null) {
- sb.append("; name=").append(mName);
+ .append(getId());
+ if (getName() != null) {
+ sb.append("; name=").append(getName());
}
- if (mEnableAfterTargetSdk != -1) {
- sb.append("; enableAfterTargetSdk=").append(mEnableAfterTargetSdk);
+ if (getEnableAfterTargetSdk() != -1) {
+ sb.append("; enableAfterTargetSdk=").append(getEnableAfterTargetSdk());
}
- if (mDisabled) {
+ if (getDisabled()) {
sb.append("; disabled");
}
if (mPackageOverrides != null && mPackageOverrides.size() > 0) {
diff --git a/services/core/java/com/android/server/compat/CompatConfig.java b/services/core/java/com/android/server/compat/CompatConfig.java
index 0fabd9aef373..d6ec22b078ea 100644
--- a/services/core/java/com/android/server/compat/CompatConfig.java
+++ b/services/core/java/com/android/server/compat/CompatConfig.java
@@ -16,6 +16,7 @@
package com.android.server.compat;
+import android.compat.Compatibility.ChangeConfig;
import android.content.pm.ApplicationInfo;
import android.os.Environment;
import android.text.TextUtils;
@@ -26,6 +27,7 @@ import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.compat.CompatibilityChangeConfig;
+import com.android.internal.compat.CompatibilityChangeInfo;
import com.android.server.compat.config.Change;
import com.android.server.compat.config.XmlParser;
@@ -37,6 +39,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
+import java.util.HashSet;
+import java.util.Set;
import javax.xml.datatype.DatatypeConfigurationException;
/**
@@ -243,6 +247,49 @@ public final class CompatConfig {
}
}
+ /**
+ * Get the config for a given app.
+ *
+ * @param applicationInfo the {@link ApplicationInfo} for which the info should be dumped.
+ * @return A {@link CompatibilityChangeConfig} which contains the compat config info for the
+ * given app.
+ */
+
+ public CompatibilityChangeConfig getAppConfig(ApplicationInfo applicationInfo) {
+ Set<Long> enabled = new HashSet<>();
+ Set<Long> disabled = new HashSet<>();
+ synchronized (mChanges) {
+ for (int i = 0; i < mChanges.size(); ++i) {
+ CompatChange c = mChanges.valueAt(i);
+ if (c.isEnabled(applicationInfo)) {
+ enabled.add(c.getId());
+ } else {
+ disabled.add(c.getId());
+ }
+ }
+ }
+ return new CompatibilityChangeConfig(new ChangeConfig(enabled, disabled));
+ }
+
+ /**
+ * Dumps all the compatibility change information.
+ *
+ * @return An array of {@link CompatibilityChangeInfo} with the current changes.
+ */
+ public CompatibilityChangeInfo[] dumpChanges() {
+ synchronized (mChanges) {
+ CompatibilityChangeInfo[] changeInfos = new CompatibilityChangeInfo[mChanges.size()];
+ for (int i = 0; i < mChanges.size(); ++i) {
+ CompatChange change = mChanges.valueAt(i);
+ changeInfos[i] = new CompatibilityChangeInfo(change.getId(),
+ change.getName(),
+ change.getEnableAfterTargetSdk(),
+ change.getDisabled());
+ }
+ return changeInfos;
+ }
+ }
+
CompatConfig initConfigFromLib(File libraryDir) {
if (!libraryDir.exists() || !libraryDir.isDirectory()) {
Slog.e(TAG, "No directory " + libraryDir + ", skipping");
diff --git a/services/core/java/com/android/server/compat/PlatformCompat.java b/services/core/java/com/android/server/compat/PlatformCompat.java
index 9ac9955493cc..75e2d220898d 100644
--- a/services/core/java/com/android/server/compat/PlatformCompat.java
+++ b/services/core/java/com/android/server/compat/PlatformCompat.java
@@ -25,6 +25,7 @@ import android.util.StatsLog;
import com.android.internal.compat.ChangeReporter;
import com.android.internal.compat.CompatibilityChangeConfig;
+import com.android.internal.compat.CompatibilityChangeInfo;
import com.android.internal.compat.IPlatformCompat;
import com.android.internal.util.DumpUtils;
@@ -114,6 +115,16 @@ public class PlatformCompat extends IPlatformCompat.Stub {
}
@Override
+ public CompatibilityChangeConfig getAppConfig(ApplicationInfo appInfo) {
+ return CompatConfig.get().getAppConfig(appInfo);
+ }
+
+ @Override
+ public CompatibilityChangeInfo[] listAllChanges() {
+ return CompatConfig.get().dumpChanges();
+ }
+
+ @Override
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, "platform_compat", pw)) return;
CompatConfig.get().dumpConfig(pw);
diff --git a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
index 96b7cb315f58..24a5b7fa1489 100644
--- a/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
+++ b/services/core/java/com/android/server/connectivity/NetworkAgentInfo.java
@@ -28,6 +28,7 @@ import android.net.NetworkInfo;
import android.net.NetworkMisc;
import android.net.NetworkMonitorManager;
import android.net.NetworkRequest;
+import android.net.NetworkScore;
import android.net.NetworkState;
import android.os.Handler;
import android.os.INetworkManagementService;
@@ -227,8 +228,10 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
// validated).
private boolean mLingering;
- // This represents the last score received from the NetworkAgent.
- private int currentScore;
+ // This represents the characteristics of a network that affects how good the network is
+ // considered for a particular use.
+ @NonNull
+ private NetworkScore mNetworkScore;
// The list of NetworkRequests being satisfied by this Network.
private final SparseArray<NetworkRequest> mNetworkRequests = new SparseArray<>();
@@ -257,8 +260,8 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
private final Handler mHandler;
public NetworkAgentInfo(Messenger messenger, AsyncChannel ac, Network net, NetworkInfo info,
- LinkProperties lp, NetworkCapabilities nc, int score, Context context, Handler handler,
- NetworkMisc misc, ConnectivityService connService, INetd netd,
+ LinkProperties lp, NetworkCapabilities nc, @NonNull NetworkScore ns, Context context,
+ Handler handler, NetworkMisc misc, ConnectivityService connService, INetd netd,
IDnsResolver dnsResolver, INetworkManagementService nms, int factorySerialNumber) {
this.messenger = messenger;
asyncChannel = ac;
@@ -266,7 +269,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
networkInfo = info;
linkProperties = lp;
networkCapabilities = nc;
- currentScore = score;
+ mNetworkScore = ns;
clatd = new Nat464Xlat(this, netd, dnsResolver, nms);
mConnService = connService;
mContext = context;
@@ -483,7 +486,7 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
return ConnectivityConstants.EXPLICITLY_SELECTED_NETWORK_SCORE;
}
- int score = currentScore;
+ int score = mNetworkScore.getIntExtension(NetworkScore.LEGACY_SCORE);
if (!lastValidated && !pretendValidated && !ignoreWifiUnvalidationPenalty() && !isVPN()) {
score -= ConnectivityConstants.UNVALIDATED_SCORE_PENALTY;
}
@@ -512,8 +515,13 @@ public class NetworkAgentInfo implements Comparable<NetworkAgentInfo> {
return getCurrentScore(true);
}
- public void setCurrentScore(int newScore) {
- currentScore = newScore;
+ public void setNetworkScore(@NonNull NetworkScore ns) {
+ mNetworkScore = ns;
+ }
+
+ @NonNull
+ public NetworkScore getNetworkScore() {
+ return mNetworkScore;
}
public NetworkState getNetworkState() {
diff --git a/services/core/java/com/android/server/display/color/ColorDisplayService.java b/services/core/java/com/android/server/display/color/ColorDisplayService.java
index 0bf43b6d1b9c..2dc2cf0d8e90 100644
--- a/services/core/java/com/android/server/display/color/ColorDisplayService.java
+++ b/services/core/java/com/android/server/display/color/ColorDisplayService.java
@@ -589,16 +589,18 @@ public final class ColorDisplayService extends SystemService {
if (immediate) {
dtm.setColorMatrix(tintController.getLevel(), to);
} else {
- tintController.setAnimator(ValueAnimator.ofObject(COLOR_MATRIX_EVALUATOR,
- from == null ? MATRIX_IDENTITY : from, to));
- tintController.getAnimator().setDuration(TRANSITION_DURATION);
- tintController.getAnimator().setInterpolator(AnimationUtils.loadInterpolator(
+ TintValueAnimator valueAnimator = TintValueAnimator.ofMatrix(COLOR_MATRIX_EVALUATOR,
+ from == null ? MATRIX_IDENTITY : from, to);
+ tintController.setAnimator(valueAnimator);
+ valueAnimator.setDuration(TRANSITION_DURATION);
+ valueAnimator.setInterpolator(AnimationUtils.loadInterpolator(
getContext(), android.R.interpolator.fast_out_slow_in));
- tintController.getAnimator().addUpdateListener((ValueAnimator animator) -> {
+ valueAnimator.addUpdateListener((ValueAnimator animator) -> {
final float[] value = (float[]) animator.getAnimatedValue();
dtm.setColorMatrix(tintController.getLevel(), value);
+ ((TintValueAnimator) animator).updateMinMaxComponents();
});
- tintController.getAnimator().addListener(new AnimatorListenerAdapter() {
+ valueAnimator.addListener(new AnimatorListenerAdapter() {
private boolean mIsCancelled;
@@ -609,9 +611,14 @@ public final class ColorDisplayService extends SystemService {
@Override
public void onAnimationEnd(Animator animator) {
+ TintValueAnimator t = (TintValueAnimator) animator;
Slog.d(TAG, tintController.getClass().getSimpleName()
+ " Animation cancelled: " + mIsCancelled
- + " to matrix: " + TintController.matrixToString(to, 16));
+ + " to matrix: " + TintController.matrixToString(to, 16)
+ + " min matrix coefficients: "
+ + TintController.matrixToString(t.getMin(), 16)
+ + " max matrix coefficients: "
+ + TintController.matrixToString(t.getMax(), 16));
if (!mIsCancelled) {
// Ensure final color matrix is set at the end of the animation. If the
// animation is cancelled then don't set the final color matrix so the new
@@ -621,7 +628,7 @@ public final class ColorDisplayService extends SystemService {
tintController.setAnimator(null);
}
});
- tintController.getAnimator().start();
+ valueAnimator.start();
}
}
@@ -1109,6 +1116,51 @@ public final class ColorDisplayService extends SystemService {
}
/**
+ * Only animates matrices and saves min and max coefficients for logging.
+ */
+ static class TintValueAnimator extends ValueAnimator {
+ private float[] min;
+ private float[] max;
+
+ public static TintValueAnimator ofMatrix(ColorMatrixEvaluator evaluator,
+ Object... values) {
+ TintValueAnimator anim = new TintValueAnimator();
+ anim.setObjectValues(values);
+ anim.setEvaluator(evaluator);
+ if (values == null || values.length == 0) {
+ return null;
+ }
+ float[] m = (float[]) values[0];
+ anim.min = new float[m.length];
+ anim.max = new float[m.length];
+ for (int i = 0; i < m.length; ++i) {
+ anim.min[i] = Float.MAX_VALUE;
+ anim.max[i] = Float.MIN_VALUE;
+ }
+ return anim;
+ }
+
+ public void updateMinMaxComponents() {
+ float[] value = (float[]) getAnimatedValue();
+ if (value == null) {
+ return;
+ }
+ for (int i = 0; i < value.length; ++i) {
+ min[i] = Math.min(min[i], value[i]);
+ max[i] = Math.max(max[i], value[i]);
+ }
+ }
+
+ public float[] getMin() {
+ return min;
+ }
+
+ public float[] getMax() {
+ return max;
+ }
+ }
+
+ /**
* Interpolates between two 4x4 color transform matrices (in column-major order).
*/
private static class ColorMatrixEvaluator implements TypeEvaluator<float[]> {
diff --git a/services/core/java/com/android/server/display/color/TintController.java b/services/core/java/com/android/server/display/color/TintController.java
index 8d8b9b2af04e..422dd328d2b6 100644
--- a/services/core/java/com/android/server/display/color/TintController.java
+++ b/services/core/java/com/android/server/display/color/TintController.java
@@ -24,14 +24,14 @@ import java.io.PrintWriter;
abstract class TintController {
- private ValueAnimator mAnimator;
+ private ColorDisplayService.TintValueAnimator mAnimator;
private Boolean mIsActivated;
- public ValueAnimator getAnimator() {
+ public ColorDisplayService.TintValueAnimator getAnimator() {
return mAnimator;
}
- public void setAnimator(ValueAnimator animator) {
+ public void setAnimator(ColorDisplayService.TintValueAnimator animator) {
mAnimator = animator;
}
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index 181a43549313..4b79677b475b 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -75,6 +75,8 @@ import com.android.internal.location.ProviderProperties;
import com.android.internal.location.ProviderRequest;
import com.android.internal.location.gnssmetrics.GnssMetrics;
import com.android.internal.telephony.TelephonyIntents;
+import com.android.server.DeviceIdleController;
+import com.android.server.LocalServices;
import com.android.server.location.GnssSatelliteBlacklistHelper.GnssSatelliteBlacklistCallback;
import com.android.server.location.NtpTimeHelper.InjectNtpTimeCallback;
@@ -178,6 +180,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
private static final int AGPS_SUPL_MODE_MSA = 0x02;
private static final int AGPS_SUPL_MODE_MSB = 0x01;
+ private static final int UPDATE_LOW_POWER_MODE = 1;
private static final int SET_REQUEST = 3;
private static final int INJECT_NTP_TIME = 5;
// PSDS stands for Predicted Satellite Data Service
@@ -371,6 +374,12 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
private boolean mDisableGpsForPowerManager = false;
/**
+ * True if the device idle controller has determined that the device is stationary. This is only
+ * updated when the device enters idle mode.
+ */
+ private volatile boolean mIsDeviceStationary = false;
+
+ /**
* Properties loaded from PROPERTIES_FILE.
* It must be accessed only inside {@link #mHandler}.
*/
@@ -462,6 +471,15 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
public GnssNavigationMessageProvider getGnssNavigationMessageProvider() {
return mGnssNavigationMessageProvider;
}
+
+ private final DeviceIdleController.StationaryListener mDeviceIdleStationaryListener =
+ isStationary -> {
+ mIsDeviceStationary = isStationary;
+ // Call updateLowPowerMode on handler thread so it's always called from the same
+ // thread.
+ mHandler.sendEmptyMessage(UPDATE_LOW_POWER_MODE);
+ };
+
private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -478,11 +496,22 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
case ALARM_TIMEOUT:
hibernate();
break;
- case PowerManager.ACTION_POWER_SAVE_MODE_CHANGED:
case PowerManager.ACTION_DEVICE_IDLE_MODE_CHANGED:
+ DeviceIdleController.LocalService deviceIdleService = LocalServices.getService(
+ DeviceIdleController.LocalService.class);
+ if (mPowerManager.isDeviceIdleMode()) {
+ deviceIdleService.registerStationaryListener(mDeviceIdleStationaryListener);
+ } else {
+ deviceIdleService.unregisterStationaryListener(
+ mDeviceIdleStationaryListener);
+ }
+ // Intentional fall-through.
+ case PowerManager.ACTION_POWER_SAVE_MODE_CHANGED:
case Intent.ACTION_SCREEN_OFF:
case Intent.ACTION_SCREEN_ON:
- updateLowPowerMode();
+ // Call updateLowPowerMode on handler thread so it's always called from the
+ // same thread.
+ mHandler.sendEmptyMessage(UPDATE_LOW_POWER_MODE);
break;
case CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED:
case TelephonyIntents.ACTION_DEFAULT_DATA_SUBSCRIPTION_CHANGED:
@@ -540,10 +569,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
}
private void updateLowPowerMode() {
- // Disable GPS if we are in device idle mode.
- boolean disableGpsForPowerManager = mPowerManager.isDeviceIdleMode();
- final PowerSaveState result =
- mPowerManager.getPowerSaveState(ServiceType.LOCATION);
+ // Disable GPS if we are in device idle mode and the device is stationary.
+ boolean disableGpsForPowerManager = mPowerManager.isDeviceIdleMode() && mIsDeviceStationary;
+ final PowerSaveState result = mPowerManager.getPowerSaveState(ServiceType.LOCATION);
switch (result.locationMode) {
case PowerManager.LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF:
case PowerManager.LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF:
@@ -2048,6 +2076,9 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
case REPORT_SV_STATUS:
handleReportSvStatus((SvStatusInfo) msg.obj);
break;
+ case UPDATE_LOW_POWER_MODE:
+ updateLowPowerMode();
+ break;
}
if (msg.arg2 == 1) {
// wakelock was taken for this message, release it
diff --git a/services/core/java/com/android/server/notification/NotificationComparator.java b/services/core/java/com/android/server/notification/NotificationComparator.java
index 9b9f4de7a18f..bc051547a53f 100644
--- a/services/core/java/com/android/server/notification/NotificationComparator.java
+++ b/services/core/java/com/android/server/notification/NotificationComparator.java
@@ -129,6 +129,12 @@ public class NotificationComparator
return -1 * Integer.compare(leftPriority, rightPriority);
}
+ final boolean leftInterruptive = left.isInterruptive();
+ final boolean rightInterruptive = right.isInterruptive();
+ if (leftInterruptive != rightInterruptive) {
+ return -1 * Boolean.compare(leftInterruptive, rightInterruptive);
+ }
+
// then break ties by time, most recent first
return -1 * Long.compare(left.getRankingTimeMs(), right.getRankingTimeMs());
}
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index a213d482aacd..edccf058caad 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -5542,7 +5542,9 @@ public class NotificationManagerService extends SystemService {
notification.flags |=
old.getNotification().flags & FLAG_FOREGROUND_SERVICE;
r.isUpdate = true;
- r.setTextChanged(isVisuallyInterruptive(old, r));
+ final boolean isInterruptive = isVisuallyInterruptive(old, r);
+ r.setTextChanged(isInterruptive);
+ r.setInterruptive(isInterruptive);
}
mNotificationsByKey.put(n.getKey(), r);
@@ -5641,7 +5643,6 @@ public class NotificationManagerService extends SystemService {
Notification oldN = old.sbn.getNotification();
Notification newN = r.sbn.getNotification();
-
if (oldN.extras == null || newN.extras == null) {
if (DEBUG_INTERRUPTIVENESS) {
Slog.v(TAG, "INTERRUPTIVENESS: "
@@ -5673,6 +5674,7 @@ public class NotificationManagerService extends SystemService {
}
return true;
}
+
// Do not compare Spannables (will always return false); compare unstyled Strings
final String oldText = String.valueOf(oldN.extras.get(Notification.EXTRA_TEXT));
final String newText = String.valueOf(newN.extras.get(Notification.EXTRA_TEXT));
@@ -5687,6 +5689,7 @@ public class NotificationManagerService extends SystemService {
}
return true;
}
+
if (oldN.hasCompletedProgress() != newN.hasCompletedProgress()) {
if (DEBUG_INTERRUPTIVENESS) {
Slog.v(TAG, "INTERRUPTIVENESS: "
@@ -5694,6 +5697,16 @@ public class NotificationManagerService extends SystemService {
}
return true;
}
+
+ // Fields below are invisible to bubbles.
+ if (r.canBubble()) {
+ if (DEBUG_INTERRUPTIVENESS) {
+ Slog.v(TAG, "INTERRUPTIVENESS: "
+ + r.getKey() + " is not interruptive: bubble");
+ }
+ return false;
+ }
+
// Actions
if (Notification.areActionsVisiblyDifferent(oldN, newN)) {
if (DEBUG_INTERRUPTIVENESS) {
@@ -5727,7 +5740,6 @@ public class NotificationManagerService extends SystemService {
} catch (Exception e) {
Slog.w(TAG, "error recovering builder", e);
}
-
return false;
}
@@ -5922,12 +5934,17 @@ public class NotificationManagerService extends SystemService {
Slog.v(TAG, "INTERRUPTIVENESS: "
+ record.getKey() + " is not interruptive: summary");
}
+ } else if (record.canBubble()) {
+ if (DEBUG_INTERRUPTIVENESS) {
+ Slog.v(TAG, "INTERRUPTIVENESS: "
+ + record.getKey() + " is not interruptive: bubble");
+ }
} else {
+ record.setInterruptive(true);
if (DEBUG_INTERRUPTIVENESS) {
Slog.v(TAG, "INTERRUPTIVENESS: "
+ record.getKey() + " is interruptive: alerted");
}
- record.setInterruptive(true);
}
MetricsLogger.action(record.getLogMaker()
.setCategory(MetricsEvent.NOTIFICATION_ALERT)
@@ -6286,15 +6303,21 @@ public class NotificationManagerService extends SystemService {
int indexBefore = findNotificationRecordIndexLocked(record);
boolean interceptBefore = record.isIntercepted();
int visibilityBefore = record.getPackageVisibilityOverride();
+ boolean interruptiveBefore = record.isInterruptive();
+
recon.applyChangesLocked(record);
applyZenModeLocked(record);
mRankingHelper.sort(mNotificationList);
- int indexAfter = findNotificationRecordIndexLocked(record);
- boolean interceptAfter = record.isIntercepted();
- int visibilityAfter = record.getPackageVisibilityOverride();
- changed = indexBefore != indexAfter || interceptBefore != interceptAfter
- || visibilityBefore != visibilityAfter;
- if (interceptBefore && !interceptAfter
+ boolean indexChanged = indexBefore != findNotificationRecordIndexLocked(record);
+ boolean interceptChanged = interceptBefore != record.isIntercepted();
+ boolean visibilityChanged = visibilityBefore != record.getPackageVisibilityOverride();
+
+ // Broadcast isInterruptive changes for bubbles.
+ boolean interruptiveChanged =
+ record.canBubble() && (interruptiveBefore != record.isInterruptive());
+
+ changed = indexChanged || interceptChanged || visibilityChanged || interruptiveChanged;
+ if (interceptBefore && !record.isIntercepted()
&& record.isNewEnoughForAlerting(System.currentTimeMillis())) {
buzzBeepBlinkLocked(record);
}
@@ -7425,7 +7448,8 @@ public class NotificationManagerService extends SystemService {
record.getSound() != null || record.getVibration() != null,
record.getSystemGeneratedSmartActions(),
record.getSmartReplies(),
- record.canBubble()
+ record.canBubble(),
+ record.isInterruptive()
);
rankings.add(ranking);
}
@@ -8613,6 +8637,7 @@ public class NotificationManagerService extends SystemService {
@VisibleForTesting
void resetAssistantUserSet(int userId) {
+ checkCallerIsSystemOrShell();
mAssistants.setUserSet(userId, false);
handleSavePolicyFile();
}
@@ -8620,12 +8645,14 @@ public class NotificationManagerService extends SystemService {
@VisibleForTesting
@Nullable
ComponentName getApprovedAssistant(int userId) {
+ checkCallerIsSystemOrShell();
List<ComponentName> allowedComponents = mAssistants.getAllowedComponents(userId);
return CollectionUtils.firstOrNull(allowedComponents);
}
@VisibleForTesting
protected void simulatePackageSuspendBroadcast(boolean suspend, String pkg) {
+ checkCallerIsSystemOrShell();
// only use for testing: mimic receive broadcast that package is (un)suspended
// but does not actually (un)suspend the package
final Bundle extras = new Bundle();
@@ -8642,6 +8669,7 @@ public class NotificationManagerService extends SystemService {
@VisibleForTesting
protected void simulatePackageDistractionBroadcast(int flag, String[] pkgs) {
+ checkCallerIsSystemOrShell();
// only use for testing: mimic receive broadcast that package is (un)distracting
// but does not actually register that info with packagemanager
final Bundle extras = new Bundle();
diff --git a/services/core/java/com/android/server/notification/NotificationShellCmd.java b/services/core/java/com/android/server/notification/NotificationShellCmd.java
index dd0f420b6df5..c6c98965d668 100644
--- a/services/core/java/com/android/server/notification/NotificationShellCmd.java
+++ b/services/core/java/com/android/server/notification/NotificationShellCmd.java
@@ -16,6 +16,12 @@
package com.android.server.notification;
+import static android.app.NotificationManager.INTERRUPTION_FILTER_ALARMS;
+import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL;
+import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE;
+import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY;
+import static android.app.NotificationManager.INTERRUPTION_FILTER_UNKNOWN;
+
import android.app.ActivityManager;
import android.app.INotificationManager;
import android.app.Notification;
@@ -26,6 +32,7 @@ import android.app.Person;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.content.res.Resources;
import android.graphics.drawable.BitmapDrawable;
@@ -47,8 +54,8 @@ import java.util.Collections;
* Implementation of `cmd notification` in NotificationManagerService.
*/
public class NotificationShellCmd extends ShellCommand {
- private static final String USAGE =
- "usage: cmd notification SUBCMD [args]\n\n"
+ private static final String TAG = "NotifShellCmd";
+ private static final String USAGE = "usage: cmd notification SUBCMD [args]\n\n"
+ "SUBCMDs:\n"
+ " allow_listener COMPONENT [user_id (current user if not specified)]\n"
+ " disallow_listener COMPONENT [user_id (current user if not specified)]\n"
@@ -89,18 +96,19 @@ public class NotificationShellCmd extends ShellCommand {
+ "an <intentspec> is (broadcast|service|activity) <args>\n"
+ " <args> are as described in `am start`";
- public static final int NOTIFICATION_ID = 1138;
- public static final String NOTIFICATION_PACKAGE = "com.android.shell";
- public static final String CHANNEL_ID = "shellcmd";
+ public static final int NOTIFICATION_ID = 2020;
+ public static final String CHANNEL_ID = "shell_cmd";
public static final String CHANNEL_NAME = "Shell command";
public static final int CHANNEL_IMP = NotificationManager.IMPORTANCE_DEFAULT;
private final NotificationManagerService mDirectService;
private final INotificationManager mBinderService;
+ private final PackageManager mPm;
public NotificationShellCmd(NotificationManagerService service) {
mDirectService = service;
mBinderService = service.getBinderService();
+ mPm = mDirectService.getContext().getPackageManager();
}
@Override
@@ -108,9 +116,44 @@ public class NotificationShellCmd extends ShellCommand {
if (cmd == null) {
return handleDefaultCommands(cmd);
}
+ String callingPackage = null;
+ final int callingUid = Binder.getCallingUid();
+ long identity = Binder.clearCallingIdentity();
+ try {
+ String[] packages = mPm.getPackagesForUid(callingUid);
+ if (packages != null && packages.length > 0) {
+ callingPackage = packages[0];
+ }
+ } catch (Exception e) {
+ Slog.e(TAG, "failed to get caller pkg", e);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
final PrintWriter pw = getOutPrintWriter();
try {
switch (cmd.replace('-', '_')) {
+ case "set_dnd": {
+ String mode = getNextArgRequired();
+ int interruptionFilter = INTERRUPTION_FILTER_UNKNOWN;
+ switch(mode) {
+ case "none":
+ case "on":
+ interruptionFilter = INTERRUPTION_FILTER_NONE;
+ break;
+ case "priority":
+ interruptionFilter = INTERRUPTION_FILTER_PRIORITY;
+ break;
+ case "alarms":
+ interruptionFilter = INTERRUPTION_FILTER_ALARMS;
+ break;
+ case "all":
+ case "off":
+ interruptionFilter = INTERRUPTION_FILTER_ALL;
+ }
+ final int filter = interruptionFilter;
+ mBinderService.setInterruptionFilter(callingPackage, filter);
+ }
+ break;
case "allow_dnd": {
String packageName = getNextArgRequired();
int userId = ActivityManager.getCurrentUser();
@@ -226,7 +269,7 @@ public class NotificationShellCmd extends ShellCommand {
}
case "post":
case "notify":
- doNotify(pw);
+ doNotify(pw, callingPackage, callingUid);
break;
default:
return handleDefaultCommands(cmd);
@@ -238,27 +281,14 @@ public class NotificationShellCmd extends ShellCommand {
return 0;
}
- void ensureChannel() throws RemoteException {
- final int uid = Binder.getCallingUid();
- final int userid = UserHandle.getCallingUserId();
- final long token = Binder.clearCallingIdentity();
- try {
- if (mBinderService.getNotificationChannelForPackage(NOTIFICATION_PACKAGE,
- uid, CHANNEL_ID, false) == null) {
- final NotificationChannel chan = new NotificationChannel(CHANNEL_ID, CHANNEL_NAME,
- CHANNEL_IMP);
- Slog.v(NotificationManagerService.TAG,
- "creating shell channel for user " + userid + " uid " + uid + ": " + chan);
- mBinderService.createNotificationChannelsForPackage(NOTIFICATION_PACKAGE, uid,
- new ParceledListSlice<NotificationChannel>(
- Collections.singletonList(chan)));
- Slog.v(NotificationManagerService.TAG, "created channel: "
- + mBinderService.getNotificationChannelForPackage(NOTIFICATION_PACKAGE,
- uid, CHANNEL_ID, false));
- }
- } finally {
- Binder.restoreCallingIdentity(token);
- }
+ void ensureChannel(String callingPackage, int callingUid) throws RemoteException {
+ final NotificationChannel channel =
+ new NotificationChannel(CHANNEL_ID, CHANNEL_NAME, CHANNEL_IMP);
+ mBinderService.createNotificationChannels(callingPackage,
+ new ParceledListSlice<>(Collections.singletonList(channel)));
+ Slog.v(NotificationManagerService.TAG, "created channel: "
+ + mBinderService.getNotificationChannel(callingPackage,
+ UserHandle.getUserId(callingUid), callingPackage, CHANNEL_ID));
}
Icon parseIcon(Resources res, String encoded) throws IllegalArgumentException {
@@ -287,7 +317,8 @@ public class NotificationShellCmd extends ShellCommand {
return null;
}
- private int doNotify(PrintWriter pw) throws RemoteException, URISyntaxException {
+ private int doNotify(PrintWriter pw, String callingPackage, int callingUid)
+ throws RemoteException, URISyntaxException {
final Context context = mDirectService.getContext();
final Resources res = context.getResources();
final Notification.Builder builder = new Notification.Builder(context, CHANNEL_ID);
@@ -481,26 +512,18 @@ public class NotificationShellCmd extends ShellCommand {
builder.setSmallIcon(smallIcon);
}
- ensureChannel();
+ ensureChannel(callingPackage, callingUid);
final Notification n = builder.build();
pw.println("posting:\n " + n);
Slog.v("NotificationManager", "posting: " + n);
- final int userId = UserHandle.getCallingUserId();
- final long token = Binder.clearCallingIdentity();
- try {
- mBinderService.enqueueNotificationWithTag(
- NOTIFICATION_PACKAGE, "android",
- tag, NOTIFICATION_ID,
- n, userId);
- } finally {
- Binder.restoreCallingIdentity(token);
- }
+ mBinderService.enqueueNotificationWithTag(callingPackage, callingPackage, tag,
+ NOTIFICATION_ID, n, UserHandle.getUserId(callingUid));
if (verbose) {
NotificationRecord nr = mDirectService.findNotificationLocked(
- NOTIFICATION_PACKAGE, tag, NOTIFICATION_ID, userId);
+ callingPackage, tag, NOTIFICATION_ID, UserHandle.getUserId(callingUid));
for (int tries = 3; tries-- > 0; ) {
if (nr != null) break;
try {
@@ -509,7 +532,7 @@ public class NotificationShellCmd extends ShellCommand {
} catch (InterruptedException e) {
}
nr = mDirectService.findNotificationLocked(
- NOTIFICATION_PACKAGE, tag, NOTIFICATION_ID, userId);
+ callingPackage, tag, NOTIFICATION_ID, UserHandle.getUserId(callingUid));
}
if (nr == null) {
pw.println("warning: couldn't find notification after enqueueing");
diff --git a/services/core/java/com/android/server/pm/ApexManager.java b/services/core/java/com/android/server/pm/ApexManager.java
index a0c00f8c9b69..fd44cbb46065 100644
--- a/services/core/java/com/android/server/pm/ApexManager.java
+++ b/services/core/java/com/android/server/pm/ApexManager.java
@@ -11,7 +11,7 @@
* 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.s
+ * limitations under the License.
*/
package com.android.server.pm;
@@ -29,17 +29,17 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
+import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
import android.content.pm.PackageParser;
-import android.content.pm.PackageParser.PackageParserException;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.ServiceManager.ServiceNotFoundException;
import android.sysprop.ApexProperties;
-import android.util.ArrayMap;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
+import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.os.BackgroundThread;
import com.android.internal.util.IndentingPrintWriter;
import java.io.File;
@@ -56,117 +56,33 @@ import java.util.stream.Collectors;
* ApexManager class handles communications with the apex service to perform operation and queries,
* as well as providing caching to avoid unnecessary calls to the service.
*/
-class ApexManager {
- static final String TAG = "ApexManager";
- private final IApexService mApexService;
- private final Context mContext;
- private final Object mLock = new Object();
- /**
- * A map from {@code APEX packageName} to the {@Link PackageInfo} generated from the {@code
- * AndroidManifest.xml}
- *
- * <p>Note that key of this map is {@code packageName} field of the corresponding {@code
- * AndroidManifest.xml}.
- */
- @GuardedBy("mLock")
- private List<PackageInfo> mAllPackagesCache;
- /**
- * A map from {@code apexName} to the {@Link PackageInfo} generated from the {@code
- * AndroidManifest.xml}.
- *
- * <p>Note that key of this map is {@code apexName} field which corresponds to the {@code name}
- * field of {@code apex_manifest.json}.
- */
- // TODO(b/132324953): remove.
- @GuardedBy("mLock")
- private ArrayMap<String, PackageInfo> mApexNameToPackageInfoCache;
+abstract class ApexManager {
-
- ApexManager(Context context) {
- mContext = context;
- if (!isApexSupported()) {
- mApexService = null;
- return;
- }
- try {
- mApexService = IApexService.Stub.asInterface(
- ServiceManager.getServiceOrThrow("apexservice"));
- } catch (ServiceNotFoundException e) {
- throw new IllegalStateException("Required service apexservice not available");
- }
- }
+ private static final String TAG = "ApexManager";
static final int MATCH_ACTIVE_PACKAGE = 1 << 0;
static final int MATCH_FACTORY_PACKAGE = 1 << 1;
- @IntDef(
- flag = true,
- prefix = { "MATCH_"},
- value = {MATCH_ACTIVE_PACKAGE, MATCH_FACTORY_PACKAGE})
- @Retention(RetentionPolicy.SOURCE)
- @interface PackageInfoFlags{}
- void systemReady() {
- if (!isApexSupported()) return;
- mContext.registerReceiver(new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- onBootCompleted();
- mContext.unregisterReceiver(this);
- }
- }, new IntentFilter(Intent.ACTION_BOOT_COMPLETED));
- }
-
- private void populateAllPackagesCacheIfNeeded() {
- synchronized (mLock) {
- if (mAllPackagesCache != null) {
- return;
- }
- mApexNameToPackageInfoCache = new ArrayMap<>();
+ /**
+ * Returns an instance of either {@link ApexManagerImpl} or {@link ApexManagerNoOp} depending
+ * on whenever this device supports APEX, i.e. {@link ApexProperties#updatable()} evaluates to
+ * {@code true}.
+ */
+ static ApexManager create(Context systemContext) {
+ if (ApexProperties.updatable().orElse(false)) {
try {
- mAllPackagesCache = new ArrayList<>();
- HashSet<String> activePackagesSet = new HashSet<>();
- HashSet<String> factoryPackagesSet = new HashSet<>();
- final ApexInfo[] allPkgs = mApexService.getAllPackages();
- for (ApexInfo ai : allPkgs) {
- // If the device is using flattened APEX, don't report any APEX
- // packages since they won't be managed or updated by PackageManager.
- if ((new File(ai.modulePath)).isDirectory()) {
- break;
- }
- try {
- final PackageInfo pkg = PackageParser.generatePackageInfoFromApex(
- ai, PackageManager.GET_META_DATA
- | PackageManager.GET_SIGNING_CERTIFICATES);
- mAllPackagesCache.add(pkg);
- if (ai.isActive) {
- if (activePackagesSet.contains(pkg.packageName)) {
- throw new IllegalStateException(
- "Two active packages have the same name: "
- + pkg.packageName);
- }
- activePackagesSet.add(pkg.packageName);
- // TODO(b/132324953): remove.
- mApexNameToPackageInfoCache.put(ai.moduleName, pkg);
- }
- if (ai.isFactory) {
- if (factoryPackagesSet.contains(pkg.packageName)) {
- throw new IllegalStateException(
- "Two factory packages have the same name: "
- + pkg.packageName);
- }
- factoryPackagesSet.add(pkg.packageName);
- }
- } catch (PackageParserException pe) {
- throw new IllegalStateException("Unable to parse: " + ai, pe);
- }
- }
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to retrieve packages from apexservice: " + re.toString());
- throw new RuntimeException(re);
+ return new ApexManagerImpl(systemContext, IApexService.Stub.asInterface(
+ ServiceManager.getServiceOrThrow("apexservice")));
+ } catch (ServiceManager.ServiceNotFoundException e) {
+ throw new IllegalStateException("Required service apexservice not available");
}
+ } else {
+ return new ApexManagerNoOp();
}
}
+ abstract void systemReady();
+
/**
* Retrieves information about an APEX package.
*
@@ -179,35 +95,8 @@ class ApexManager {
* @return a PackageInfo object with the information about the package, or null if the package
* is not found.
*/
- @Nullable PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) {
- if (!isApexSupported()) return null;
- populateAllPackagesCacheIfNeeded();
- boolean matchActive = (flags & MATCH_ACTIVE_PACKAGE) != 0;
- boolean matchFactory = (flags & MATCH_FACTORY_PACKAGE) != 0;
- for (PackageInfo packageInfo: mAllPackagesCache) {
- if (!packageInfo.packageName.equals(packageName)) {
- continue;
- }
- if ((!matchActive || isActive(packageInfo))
- && (!matchFactory || isFactory(packageInfo))) {
- return packageInfo;
- }
- }
- return null;
- }
-
- /**
- * Returns a {@link PackageInfo} for an active APEX package keyed by it's {@code apexName}.
- *
- * @deprecated this API will soon be deleted, please don't depend on it.
- */
- // TODO(b/132324953): delete.
- @Deprecated
- @Nullable PackageInfo getPackageInfoForApexName(String apexName) {
- if (!isApexSupported()) return null;
- populateAllPackagesCacheIfNeeded();
- return mApexNameToPackageInfoCache.get(apexName);
- }
+ @Nullable
+ abstract PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags);
/**
* Retrieves information about all active APEX packages.
@@ -215,14 +104,7 @@ class ApexManager {
* @return a List of PackageInfo object, each one containing information about a different
* active package.
*/
- List<PackageInfo> getActivePackages() {
- if (!isApexSupported()) return Collections.emptyList();
- populateAllPackagesCacheIfNeeded();
- return mAllPackagesCache
- .stream()
- .filter(item -> isActive(item))
- .collect(Collectors.toList());
- }
+ abstract List<PackageInfo> getActivePackages();
/**
* Retrieves information about all active pre-installed APEX packages.
@@ -230,14 +112,7 @@ class ApexManager {
* @return a List of PackageInfo object, each one containing information about a different
* active pre-installed package.
*/
- List<PackageInfo> getFactoryPackages() {
- if (!isApexSupported()) return Collections.emptyList();
- populateAllPackagesCacheIfNeeded();
- return mAllPackagesCache
- .stream()
- .filter(item -> isFactory(item))
- .collect(Collectors.toList());
- }
+ abstract List<PackageInfo> getFactoryPackages();
/**
* Retrieves information about all inactive APEX packages.
@@ -245,14 +120,7 @@ class ApexManager {
* @return a List of PackageInfo object, each one containing information about a different
* inactive package.
*/
- List<PackageInfo> getInactivePackages() {
- if (!isApexSupported()) return Collections.emptyList();
- populateAllPackagesCacheIfNeeded();
- return mAllPackagesCache
- .stream()
- .filter(item -> !isActive(item))
- .collect(Collectors.toList());
- }
+ abstract List<PackageInfo> getInactivePackages();
/**
* Checks if {@code packageName} is an apex package.
@@ -260,16 +128,7 @@ class ApexManager {
* @param packageName package to check.
* @return {@code true} if {@code packageName} is an apex package.
*/
- boolean isApexPackage(String packageName) {
- if (!isApexSupported()) return false;
- populateAllPackagesCacheIfNeeded();
- for (PackageInfo packageInfo : mAllPackagesCache) {
- if (packageInfo.packageName.equals(packageName)) {
- return true;
- }
- }
- return false;
- }
+ abstract boolean isApexPackage(String packageName);
/**
* Retrieves information about an apexd staged session i.e. the internal state used by apexd to
@@ -278,19 +137,8 @@ class ApexManager {
* @param sessionId the identifier of the session.
* @return an ApexSessionInfo object, or null if the session is not known.
*/
- @Nullable ApexSessionInfo getStagedSessionInfo(int sessionId) {
- if (!isApexSupported()) return null;
- try {
- ApexSessionInfo apexSessionInfo = mApexService.getStagedSessionInfo(sessionId);
- if (apexSessionInfo.isUnknown) {
- return null;
- }
- return apexSessionInfo;
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
- }
- }
+ @Nullable
+ abstract ApexSessionInfo getStagedSessionInfo(int sessionId);
/**
* Submit a staged session to apex service. This causes the apex service to perform some initial
@@ -302,47 +150,19 @@ class ApexManager {
* @param childSessionIds if {@code sessionId} is a multi-package session, this should contain
* an array of identifiers of all the child sessions. Otherwise it should
* be an empty array.
- * @param apexInfoList this is an output parameter, which needs to be initialized by tha caller
- * and will be filled with a list of {@link ApexInfo} objects, each of which
- * contains metadata about one of the packages being submitted as part of
- * the session.
- * @return whether the submission of the session was successful.
+ * @throws PackageManagerException if call to apexd fails
*/
- boolean submitStagedSession(
- int sessionId, @NonNull int[] childSessionIds, @NonNull ApexInfoList apexInfoList) {
- if (!isApexSupported()) return false;
- try {
- mApexService.submitStagedSession(sessionId, childSessionIds, apexInfoList);
- return true;
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
- } catch (Exception e) {
- Slog.e(TAG, "apexd verification failed", e);
- return false;
- }
- }
+ abstract ApexInfoList submitStagedSession(int sessionId, @NonNull int[] childSessionIds)
+ throws PackageManagerException;
/**
* Mark a staged session previously submitted using {@code submitStagedSession} as ready to be
* applied at next reboot.
*
* @param sessionId the identifier of the {@link PackageInstallerSession} being marked as ready.
- * @return true upon success, false if the session is unknown.
+ * @throws PackageManagerException if call to apexd fails
*/
- boolean markStagedSessionReady(int sessionId) {
- if (!isApexSupported()) return false;
- try {
- mApexService.markStagedSessionReady(sessionId);
- return true;
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
- } catch (Exception e) {
- Slog.e(TAG, "Failed to mark session " + sessionId + " ready", e);
- return false;
- }
- }
+ abstract void markStagedSessionReady(int sessionId) throws PackageManagerException;
/**
* Marks a staged session as successful.
@@ -352,44 +172,21 @@ class ApexManager {
* @param sessionId the identifier of the {@link PackageInstallerSession} being marked as
* successful.
*/
- void markStagedSessionSuccessful(int sessionId) {
- if (!isApexSupported()) return;
- try {
- mApexService.markStagedSessionSuccessful(sessionId);
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to contact apexservice", re);
- throw new RuntimeException(re);
- } catch (Exception e) {
- // It is fine to just log an exception in this case. APEXd will be able to recover in
- // case markStagedSessionSuccessful fails.
- Slog.e(TAG, "Failed to mark session " + sessionId + " as successful", e);
- }
- }
+ abstract void markStagedSessionSuccessful(int sessionId);
/**
* Whether the current device supports the management of APEX packages.
*
* @return true if APEX packages can be managed on this device, false otherwise.
*/
- boolean isApexSupported() {
- return ApexProperties.updatable().orElse(false);
- }
+ abstract boolean isApexSupported();
/**
* Abandons the (only) active session previously submitted.
*
* @return {@code true} upon success, {@code false} if any remote exception occurs
*/
- boolean abortActiveSession() {
- if (!isApexSupported()) return false;
- try {
- mApexService.abortActiveSession();
- return true;
- } catch (RemoteException re) {
- Slog.e(TAG, "Unable to contact apexservice", re);
- return false;
- }
- }
+ abstract boolean abortActiveSession();
/**
* Uninstalls given {@code apexPackage}.
@@ -399,120 +196,431 @@ class ApexManager {
* @param apexPackagePath package to uninstall.
* @return {@code true} upon successful uninstall, {@code false} otherwise.
*/
- boolean uninstallApex(String apexPackagePath) {
- if (!isApexSupported()) return false;
- try {
- mApexService.unstagePackages(Collections.singletonList(apexPackagePath));
- return true;
- } catch (Exception e) {
- return false;
- }
- }
+ abstract boolean uninstallApex(String apexPackagePath);
/**
- * Whether an APEX package is active or not.
+ * Dumps various state information to the provided {@link PrintWriter} object.
*
- * @param packageInfo the package to check
- * @return {@code true} if this package is active, {@code false} otherwise.
+ * @param pw the {@link PrintWriter} object to send information to.
+ * @param packageName a {@link String} containing a package name, or {@code null}. If set, only
+ * information about that specific package will be dumped.
*/
- private static boolean isActive(PackageInfo packageInfo) {
- return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) != 0;
- }
+ abstract void dump(PrintWriter pw, @Nullable String packageName);
- /**
- * Whether the APEX package is pre-installed or not.
- *
- * @param packageInfo the package to check
- * @return {@code true} if this package is pre-installed, {@code false} otherwise.
- */
- private static boolean isFactory(PackageInfo packageInfo) {
- return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
- }
+ @IntDef(
+ flag = true,
+ prefix = { "MATCH_"},
+ value = {MATCH_ACTIVE_PACKAGE, MATCH_FACTORY_PACKAGE})
+ @Retention(RetentionPolicy.SOURCE)
+ @interface PackageInfoFlags{}
/**
- * Dump information about the packages contained in a particular cache
- * @param packagesCache the cache to print information about.
- * @param packageName a {@link String} containing a package name, or {@code null}. If set, only
- * information about that specific package will be dumped.
- * @param ipw the {@link IndentingPrintWriter} object to send information to.
+ * An implementation of {@link ApexManager} that should be used in case device supports updating
+ * APEX packages.
*/
- void dumpFromPackagesCache(
- List<PackageInfo> packagesCache,
- @Nullable String packageName,
- IndentingPrintWriter ipw) {
- ipw.println();
- ipw.increaseIndent();
- for (PackageInfo pi : packagesCache) {
- if (packageName != null && !packageName.equals(pi.packageName)) {
- continue;
+ @VisibleForTesting
+ static class ApexManagerImpl extends ApexManager {
+ private final IApexService mApexService;
+ private final Context mContext;
+ private final Object mLock = new Object();
+ /**
+ * A map from {@code APEX packageName} to the {@Link PackageInfo} generated from the {@code
+ * AndroidManifest.xml}
+ *
+ * <p>Note that key of this map is {@code packageName} field of the corresponding {@code
+ * AndroidManifest.xml}.
+ */
+ @GuardedBy("mLock")
+ private List<PackageInfo> mAllPackagesCache;
+
+ ApexManagerImpl(Context context, IApexService apexService) {
+ mContext = context;
+ mApexService = apexService;
+ }
+
+ /**
+ * Whether an APEX package is active or not.
+ *
+ * @param packageInfo the package to check
+ * @return {@code true} if this package is active, {@code false} otherwise.
+ */
+ private static boolean isActive(PackageInfo packageInfo) {
+ return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_INSTALLED) != 0;
+ }
+
+ /**
+ * Whether the APEX package is pre-installed or not.
+ *
+ * @param packageInfo the package to check
+ * @return {@code true} if this package is pre-installed, {@code false} otherwise.
+ */
+ private static boolean isFactory(PackageInfo packageInfo) {
+ return (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
+ @Override
+ void systemReady() {
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ // Post populateAllPackagesCacheIfNeeded to a background thread, since it's
+ // expensive to run it in broadcast handler thread.
+ BackgroundThread.getHandler().post(() -> populateAllPackagesCacheIfNeeded());
+ mContext.unregisterReceiver(this);
+ }
+ }, new IntentFilter(Intent.ACTION_BOOT_COMPLETED));
+ }
+
+ private void populateAllPackagesCacheIfNeeded() {
+ synchronized (mLock) {
+ if (mAllPackagesCache != null) {
+ return;
+ }
+ try {
+ mAllPackagesCache = new ArrayList<>();
+ HashSet<String> activePackagesSet = new HashSet<>();
+ HashSet<String> factoryPackagesSet = new HashSet<>();
+ final ApexInfo[] allPkgs = mApexService.getAllPackages();
+ for (ApexInfo ai : allPkgs) {
+ // If the device is using flattened APEX, don't report any APEX
+ // packages since they won't be managed or updated by PackageManager.
+ if ((new File(ai.modulePath)).isDirectory()) {
+ break;
+ }
+ int flags = PackageManager.GET_META_DATA
+ | PackageManager.GET_SIGNING_CERTIFICATES
+ | PackageManager.GET_SIGNATURES;
+ PackageParser.Package pkg;
+ try {
+ File apexFile = new File(ai.modulePath);
+ PackageParser pp = new PackageParser();
+ pkg = pp.parsePackage(apexFile, flags, false);
+ PackageParser.collectCertificates(pkg, false);
+ } catch (PackageParser.PackageParserException pe) {
+ throw new IllegalStateException("Unable to parse: " + ai, pe);
+ }
+
+ final PackageInfo packageInfo =
+ PackageParser.generatePackageInfo(pkg, ai, flags);
+ mAllPackagesCache.add(packageInfo);
+ if (ai.isActive) {
+ if (activePackagesSet.contains(packageInfo.packageName)) {
+ throw new IllegalStateException(
+ "Two active packages have the same name: "
+ + packageInfo.packageName);
+ }
+ activePackagesSet.add(packageInfo.packageName);
+ }
+ if (ai.isFactory) {
+ if (factoryPackagesSet.contains(packageInfo.packageName)) {
+ throw new IllegalStateException(
+ "Two factory packages have the same name: "
+ + packageInfo.packageName);
+ }
+ factoryPackagesSet.add(packageInfo.packageName);
+ }
+
+ }
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to retrieve packages from apexservice: " + re.toString());
+ throw new RuntimeException(re);
+ }
}
- ipw.println(pi.packageName);
- ipw.increaseIndent();
- ipw.println("Version: " + pi.versionCode);
- ipw.println("Path: " + pi.applicationInfo.sourceDir);
- ipw.println("IsActive: " + isActive(pi));
- ipw.println("IsFactory: " + isFactory(pi));
- ipw.decreaseIndent();
}
- ipw.decreaseIndent();
- ipw.println();
- }
- /**
- * Dumps various state information to the provided {@link PrintWriter} object.
- *
- * @param pw the {@link PrintWriter} object to send information to.
- * @param packageName a {@link String} containing a package name, or {@code null}. If set, only
- * information about that specific package will be dumped.
- */
- void dump(PrintWriter pw, @Nullable String packageName) {
- if (!isApexSupported()) return;
- final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ", 120);
- try {
+ @Override
+ @Nullable PackageInfo getPackageInfo(String packageName, @PackageInfoFlags int flags) {
populateAllPackagesCacheIfNeeded();
+ boolean matchActive = (flags & MATCH_ACTIVE_PACKAGE) != 0;
+ boolean matchFactory = (flags & MATCH_FACTORY_PACKAGE) != 0;
+ for (PackageInfo packageInfo: mAllPackagesCache) {
+ if (!packageInfo.packageName.equals(packageName)) {
+ continue;
+ }
+ if ((matchActive && isActive(packageInfo))
+ || (matchFactory && isFactory(packageInfo))) {
+ return packageInfo;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ List<PackageInfo> getActivePackages() {
+ populateAllPackagesCacheIfNeeded();
+ return mAllPackagesCache
+ .stream()
+ .filter(item -> isActive(item))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ List<PackageInfo> getFactoryPackages() {
+ populateAllPackagesCacheIfNeeded();
+ return mAllPackagesCache
+ .stream()
+ .filter(item -> isFactory(item))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ List<PackageInfo> getInactivePackages() {
+ populateAllPackagesCacheIfNeeded();
+ return mAllPackagesCache
+ .stream()
+ .filter(item -> !isActive(item))
+ .collect(Collectors.toList());
+ }
+
+ @Override
+ boolean isApexPackage(String packageName) {
+ if (!isApexSupported()) return false;
+ populateAllPackagesCacheIfNeeded();
+ for (PackageInfo packageInfo : mAllPackagesCache) {
+ if (packageInfo.packageName.equals(packageName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ @Nullable ApexSessionInfo getStagedSessionInfo(int sessionId) {
+ try {
+ ApexSessionInfo apexSessionInfo = mApexService.getStagedSessionInfo(sessionId);
+ if (apexSessionInfo.isUnknown) {
+ return null;
+ }
+ return apexSessionInfo;
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to contact apexservice", re);
+ throw new RuntimeException(re);
+ }
+ }
+
+ @Override
+ ApexInfoList submitStagedSession(int sessionId, @NonNull int[] childSessionIds)
+ throws PackageManagerException {
+ try {
+ final ApexInfoList apexInfoList = new ApexInfoList();
+ mApexService.submitStagedSession(sessionId, childSessionIds, apexInfoList);
+ return apexInfoList;
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to contact apexservice", re);
+ throw new RuntimeException(re);
+ } catch (Exception e) {
+ throw new PackageManagerException(
+ PackageInstaller.SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "apexd verification failed : " + e.getMessage());
+ }
+ }
+
+ @Override
+ void markStagedSessionReady(int sessionId) throws PackageManagerException {
+ try {
+ mApexService.markStagedSessionReady(sessionId);
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to contact apexservice", re);
+ throw new RuntimeException(re);
+ } catch (Exception e) {
+ throw new PackageManagerException(
+ PackageInstaller.SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Failed to mark apexd session as ready : " + e.getMessage());
+ }
+ }
+
+ @Override
+ void markStagedSessionSuccessful(int sessionId) {
+ try {
+ mApexService.markStagedSessionSuccessful(sessionId);
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to contact apexservice", re);
+ throw new RuntimeException(re);
+ } catch (Exception e) {
+ // It is fine to just log an exception in this case. APEXd will be able to recover
+ // in case markStagedSessionSuccessful fails.
+ Slog.e(TAG, "Failed to mark session " + sessionId + " as successful", e);
+ }
+ }
+
+ @Override
+ boolean isApexSupported() {
+ return true;
+ }
+
+ @Override
+ boolean abortActiveSession() {
+ try {
+ mApexService.abortActiveSession();
+ return true;
+ } catch (RemoteException re) {
+ Slog.e(TAG, "Unable to contact apexservice", re);
+ return false;
+ }
+ }
+
+ @Override
+ boolean uninstallApex(String apexPackagePath) {
+ try {
+ mApexService.unstagePackages(Collections.singletonList(apexPackagePath));
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Dump information about the packages contained in a particular cache
+ * @param packagesCache the cache to print information about.
+ * @param packageName a {@link String} containing a package name, or {@code null}. If set,
+ * only information about that specific package will be dumped.
+ * @param ipw the {@link IndentingPrintWriter} object to send information to.
+ */
+ void dumpFromPackagesCache(
+ List<PackageInfo> packagesCache,
+ @Nullable String packageName,
+ IndentingPrintWriter ipw) {
ipw.println();
- ipw.println("Active APEX packages:");
- dumpFromPackagesCache(getActivePackages(), packageName, ipw);
- ipw.println("Inactive APEX packages:");
- dumpFromPackagesCache(getInactivePackages(), packageName, ipw);
- ipw.println("Factory APEX packages:");
- dumpFromPackagesCache(getFactoryPackages(), packageName, ipw);
- ipw.increaseIndent();
- ipw.println("APEX session state:");
ipw.increaseIndent();
- final ApexSessionInfo[] sessions = mApexService.getSessions();
- for (ApexSessionInfo si : sessions) {
- ipw.println("Session ID: " + si.sessionId);
- ipw.increaseIndent();
- if (si.isUnknown) {
- ipw.println("State: UNKNOWN");
- } else if (si.isVerified) {
- ipw.println("State: VERIFIED");
- } else if (si.isStaged) {
- ipw.println("State: STAGED");
- } else if (si.isActivated) {
- ipw.println("State: ACTIVATED");
- } else if (si.isActivationFailed) {
- ipw.println("State: ACTIVATION FAILED");
- } else if (si.isSuccess) {
- ipw.println("State: SUCCESS");
- } else if (si.isRollbackInProgress) {
- ipw.println("State: ROLLBACK IN PROGRESS");
- } else if (si.isRolledBack) {
- ipw.println("State: ROLLED BACK");
- } else if (si.isRollbackFailed) {
- ipw.println("State: ROLLBACK FAILED");
+ for (PackageInfo pi : packagesCache) {
+ if (packageName != null && !packageName.equals(pi.packageName)) {
+ continue;
}
+ ipw.println(pi.packageName);
+ ipw.increaseIndent();
+ ipw.println("Version: " + pi.versionCode);
+ ipw.println("Path: " + pi.applicationInfo.sourceDir);
+ ipw.println("IsActive: " + isActive(pi));
+ ipw.println("IsFactory: " + isFactory(pi));
ipw.decreaseIndent();
}
ipw.decreaseIndent();
- } catch (RemoteException e) {
- ipw.println("Couldn't communicate with apexd.");
+ ipw.println();
+ }
+
+ @Override
+ void dump(PrintWriter pw, @Nullable String packageName) {
+ final IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " ", 120);
+ try {
+ populateAllPackagesCacheIfNeeded();
+ ipw.println();
+ ipw.println("Active APEX packages:");
+ dumpFromPackagesCache(getActivePackages(), packageName, ipw);
+ ipw.println("Inactive APEX packages:");
+ dumpFromPackagesCache(getInactivePackages(), packageName, ipw);
+ ipw.println("Factory APEX packages:");
+ dumpFromPackagesCache(getFactoryPackages(), packageName, ipw);
+ ipw.increaseIndent();
+ ipw.println("APEX session state:");
+ ipw.increaseIndent();
+ final ApexSessionInfo[] sessions = mApexService.getSessions();
+ for (ApexSessionInfo si : sessions) {
+ ipw.println("Session ID: " + si.sessionId);
+ ipw.increaseIndent();
+ if (si.isUnknown) {
+ ipw.println("State: UNKNOWN");
+ } else if (si.isVerified) {
+ ipw.println("State: VERIFIED");
+ } else if (si.isStaged) {
+ ipw.println("State: STAGED");
+ } else if (si.isActivated) {
+ ipw.println("State: ACTIVATED");
+ } else if (si.isActivationFailed) {
+ ipw.println("State: ACTIVATION FAILED");
+ } else if (si.isSuccess) {
+ ipw.println("State: SUCCESS");
+ } else if (si.isRollbackInProgress) {
+ ipw.println("State: ROLLBACK IN PROGRESS");
+ } else if (si.isRolledBack) {
+ ipw.println("State: ROLLED BACK");
+ } else if (si.isRollbackFailed) {
+ ipw.println("State: ROLLBACK FAILED");
+ }
+ ipw.decreaseIndent();
+ }
+ ipw.decreaseIndent();
+ } catch (RemoteException e) {
+ ipw.println("Couldn't communicate with apexd.");
+ }
}
}
- public void onBootCompleted() {
- if (!isApexSupported()) return;
- populateAllPackagesCacheIfNeeded();
+ /**
+ * An implementation of {@link ApexManager} that should be used in case device does not support
+ * updating APEX packages.
+ */
+ private static final class ApexManagerNoOp extends ApexManager {
+
+ @Override
+ void systemReady() {
+ // No-op
+ }
+
+ @Override
+ PackageInfo getPackageInfo(String packageName, int flags) {
+ return null;
+ }
+
+ @Override
+ List<PackageInfo> getActivePackages() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ List<PackageInfo> getFactoryPackages() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ List<PackageInfo> getInactivePackages() {
+ return Collections.emptyList();
+ }
+
+ @Override
+ boolean isApexPackage(String packageName) {
+ return false;
+ }
+
+ @Override
+ ApexSessionInfo getStagedSessionInfo(int sessionId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ ApexInfoList submitStagedSession(int sessionId, int[] childSessionIds)
+ throws PackageManagerException {
+ throw new PackageManagerException(PackageManager.INSTALL_FAILED_INTERNAL_ERROR,
+ "Device doesn't support updating APEX");
+ }
+
+ @Override
+ void markStagedSessionReady(int sessionId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ void markStagedSessionSuccessful(int sessionId) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ boolean isApexSupported() {
+ return false;
+ }
+
+ @Override
+ boolean abortActiveSession() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ boolean uninstallApex(String apexPackagePath) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ void dump(PrintWriter pw, String packageName) {
+ // No-op
+ }
}
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index f54799b382c6..310798650f95 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2490,7 +2490,8 @@ public class PackageManagerService extends IPackageManager.Stub
mProtectedPackages = new ProtectedPackages(mContext);
- mApexManager = new ApexManager(context);
+ mApexManager = ApexManager.create(context);
+ // CHECKSTYLE:OFF IndentationCheck
synchronized (mInstallLock) {
// writer
synchronized (mPackages) {
@@ -4278,7 +4279,7 @@ public class PackageManagerService extends IPackageManager.Stub
}
return generatePackageInfo(ps, flags, userId);
}
- if (!matchFactoryOnly && (flags & MATCH_APEX) != 0) {
+ if ((flags & MATCH_APEX) != 0) {
return mApexManager.getPackageInfo(packageName, ApexManager.MATCH_ACTIVE_PACKAGE);
}
}
@@ -9350,6 +9351,16 @@ public class PackageManagerService extends IPackageManager.Stub
pkgSetting = originalPkgSetting == null ? installedPkgSetting : originalPkgSetting;
pkgAlreadyExists = pkgSetting != null;
final String disabledPkgName = pkgAlreadyExists ? pkgSetting.name : pkg.packageName;
+ if (scanSystemPartition && !pkgAlreadyExists
+ && mSettings.getDisabledSystemPkgLPr(disabledPkgName) != null) {
+ // The updated-package data for /system apk remains inconsistently
+ // after the package data for /data apk is lost accidentally.
+ // To recover it, enable /system apk and install it as non-updated system app.
+ Slog.w(TAG, "Inconsistent package setting of updated system app for "
+ + disabledPkgName + ". To recover it, enable the system app"
+ + "and install it as non-updated system app.");
+ mSettings.removeDisabledSystemPackageLPw(disabledPkgName);
+ }
disabledPkgSetting = mSettings.getDisabledSystemPkgLPr(disabledPkgName);
isSystemPkgUpdated = disabledPkgSetting != null;
@@ -18627,7 +18638,7 @@ public class PackageManagerService extends IPackageManager.Stub
continue;
}
List<VersionedPackage> libClientPackages = getPackagesUsingSharedLibraryLPr(
- libraryInfo, 0, currUserId);
+ libraryInfo, MATCH_KNOWN_PACKAGES, currUserId);
if (!ArrayUtils.isEmpty(libClientPackages)) {
Slog.w(TAG, "Not removing package " + pkg.manifestPackageName
+ " hosting lib " + libraryInfo.getName() + " version "
@@ -19047,10 +19058,11 @@ public class PackageManagerService extends IPackageManager.Stub
* Tries to delete system package.
*/
private void deleteSystemPackageLIF(DeletePackageAction action, PackageSetting deletedPs,
- int[] allUserHandles, int flags, PackageRemovedInfo outInfo, boolean writeSettings)
+ int[] allUserHandles, int flags, @Nullable PackageRemovedInfo outInfo,
+ boolean writeSettings)
throws SystemDeleteException {
- final boolean applyUserRestrictions
- = (allUserHandles != null) && (outInfo.origUsers != null);
+ final boolean applyUserRestrictions =
+ (allUserHandles != null) && outInfo != null && (outInfo.origUsers != null);
final PackageParser.Package deletedPkg = deletedPs.pkg;
// Confirm if the system package has been updated
// An updated system app can be deleted. This will also have to restore
@@ -19071,19 +19083,21 @@ public class PackageManagerService extends IPackageManager.Stub
}
}
- // Delete the updated package
- outInfo.isRemovedPackageSystemUpdate = true;
- if (outInfo.removedChildPackages != null) {
- final int childCount = (deletedPs.childPackageNames != null)
- ? deletedPs.childPackageNames.size() : 0;
- for (int i = 0; i < childCount; i++) {
- String childPackageName = deletedPs.childPackageNames.get(i);
- if (disabledPs.childPackageNames != null && disabledPs.childPackageNames
- .contains(childPackageName)) {
- PackageRemovedInfo childInfo = outInfo.removedChildPackages.get(
- childPackageName);
- if (childInfo != null) {
- childInfo.isRemovedPackageSystemUpdate = true;
+ if (outInfo != null) {
+ // Delete the updated package
+ outInfo.isRemovedPackageSystemUpdate = true;
+ if (outInfo.removedChildPackages != null) {
+ final int childCount = (deletedPs.childPackageNames != null)
+ ? deletedPs.childPackageNames.size() : 0;
+ for (int i = 0; i < childCount; i++) {
+ String childPackageName = deletedPs.childPackageNames.get(i);
+ if (disabledPs.childPackageNames != null && disabledPs.childPackageNames
+ .contains(childPackageName)) {
+ PackageRemovedInfo childInfo = outInfo.removedChildPackages.get(
+ childPackageName);
+ if (childInfo != null) {
+ childInfo.isRemovedPackageSystemUpdate = true;
+ }
}
}
}
@@ -19116,7 +19130,8 @@ public class PackageManagerService extends IPackageManager.Stub
if (DEBUG_REMOVE) Slog.d(TAG, "Re-installing system package: " + disabledPs);
try {
installPackageFromSystemLIF(disabledPs.codePathString, allUserHandles,
- outInfo.origUsers, deletedPs.getPermissionsState(), writeSettings);
+ outInfo == null ? null : outInfo.origUsers, deletedPs.getPermissionsState(),
+ writeSettings);
} catch (PackageManagerException e) {
Slog.w(TAG, "Failed to restore system package:" + deletedPkg.packageName + ": "
+ e.getMessage());
@@ -22968,9 +22983,9 @@ public class PackageManagerService extends IPackageManager.Stub
mSettings.writeKernelMappingLPr(ps);
}
- final UserManager um = mContext.getSystemService(UserManager.class);
+ final UserManagerService um = sUserManager;
UserManagerInternal umInternal = getUserManagerInternal();
- for (UserInfo user : um.getUsers()) {
+ for (UserInfo user : um.getUsers(false /* excludeDying */)) {
final int flags;
if (umInternal.isUserUnlockingOrUnlocked(user.id)) {
flags = StorageManager.FLAG_STORAGE_DE | StorageManager.FLAG_STORAGE_CE;
@@ -23653,8 +23668,9 @@ public class PackageManagerService extends IPackageManager.Stub
continue;
}
final String packageName = ps.pkg.packageName;
- // Skip over if system app
- if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+ // Skip over if system app or static shared library
+ if ((ps.pkgFlags & ApplicationInfo.FLAG_SYSTEM) != 0
+ || !TextUtils.isEmpty(ps.pkg.staticSharedLibName)) {
continue;
}
if (DEBUG_CLEAN_APKS) {
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 3b51095ddcd2..a9a6bd2cd031 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -2398,10 +2398,14 @@ class PackageManagerShellCommand extends ShellCommand {
}
}
String arg = getNextArg();
- if (arg == null) {
+ if (arg == null && !preCreateOnly) {
getErrPrintWriter().println("Error: no user name specified.");
return 1;
}
+ if (arg != null && preCreateOnly) {
+ getErrPrintWriter().println("Warning: name is ignored for pre-created users");
+ }
+
name = arg;
UserInfo info;
IUserManager um = IUserManager.Stub.asInterface(
diff --git a/services/core/java/com/android/server/pm/StagingManager.java b/services/core/java/com/android/server/pm/StagingManager.java
index 88d681f973c4..2705455078ff 100644
--- a/services/core/java/com/android/server/pm/StagingManager.java
+++ b/services/core/java/com/android/server/pm/StagingManager.java
@@ -30,6 +30,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.PackageManager;
+import android.content.pm.PackageParser;
import android.content.pm.PackageParser.PackageParserException;
import android.content.pm.PackageParser.SigningDetails;
import android.content.pm.PackageParser.SigningDetails.SignatureSchemeVersion;
@@ -43,6 +44,7 @@ import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.util.IntArray;
import android.util.Slog;
import android.util.SparseArray;
import android.util.apk.ApkSignatureVerifier;
@@ -104,21 +106,22 @@ public class StagingManager {
return new ParceledListSlice<>(result);
}
- private boolean validateApexSignature(String apexPath, String apexModuleName) {
+ private void validateApexSignature(String apexPath, String packageName)
+ throws PackageManagerException {
final SigningDetails signingDetails;
try {
signingDetails = ApkSignatureVerifier.verify(apexPath, SignatureSchemeVersion.JAR);
} catch (PackageParserException e) {
- Slog.e(TAG, "Unable to parse APEX package: " + apexPath, e);
- return false;
+ throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Failed to parse APEX package " + apexPath, e);
}
- final PackageInfo packageInfo = mApexManager.getPackageInfoForApexName(apexModuleName);
-
+ final PackageInfo packageInfo = mApexManager.getPackageInfo(packageName,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
if (packageInfo == null) {
- // Don't allow installation of new APEX.
- Slog.e(TAG, "Attempted to install a new apex " + apexModuleName + ". Rejecting");
- return false;
+ // This should never happen, because submitSessionToApexService ensures that no new
+ // apexes were installed.
+ throw new IllegalStateException("Unknown apex package " + packageName);
}
final SigningDetails existingSigningDetails;
@@ -126,73 +129,99 @@ public class StagingManager {
existingSigningDetails = ApkSignatureVerifier.verify(
packageInfo.applicationInfo.sourceDir, SignatureSchemeVersion.JAR);
} catch (PackageParserException e) {
- Slog.e(TAG, "Unable to parse APEX package: "
- + packageInfo.applicationInfo.sourceDir, e);
- return false;
+ throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Failed to parse APEX package " + packageInfo.applicationInfo.sourceDir, e);
}
// Now that we have both sets of signatures, demand that they're an exact match.
if (Signature.areExactMatch(existingSigningDetails.signatures, signingDetails.signatures)) {
- return true;
+ return;
}
- return false;
+ throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "APK-container signature verification failed for package "
+ + packageName + ". Signature of file "
+ + apexPath + " does not match the signature of "
+ + " the package already installed.");
}
- private boolean submitSessionToApexService(@NonNull PackageInstallerSession session,
- List<PackageInstallerSession> childSessions,
- ApexInfoList apexInfoList) {
- boolean submittedToApexd = mApexManager.submitStagedSession(
- session.sessionId,
- childSessions != null
- ? childSessions.stream().mapToInt(s -> s.sessionId).toArray() :
- new int[]{},
- apexInfoList);
- if (!submittedToApexd) {
- session.setStagedSessionFailed(
- SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "APEX staging failed, check logcat messages from apexd for more details.");
- return false;
+ private List<PackageInfo> submitSessionToApexService(
+ @NonNull PackageInstallerSession session) throws PackageManagerException {
+ final IntArray childSessionsIds = new IntArray();
+ if (session.isMultiPackage()) {
+ for (int id : session.getChildSessionIds()) {
+ if (isApexSession(mStagedSessions.get(id))) {
+ childSessionsIds.add(id);
+ }
+ }
}
- for (ApexInfo newModule : apexInfoList.apexInfos) {
- PackageInfo activePackage = mApexManager.getPackageInfoForApexName(
- newModule.moduleName);
+ // submitStagedSession will throw a PackageManagerException if apexd verification fails,
+ // which will be propagated to populate stagedSessionErrorMessage of this session.
+ final ApexInfoList apexInfoList = mApexManager.submitStagedSession(session.sessionId,
+ childSessionsIds.toArray());
+ final List<PackageInfo> result = new ArrayList<>();
+ for (ApexInfo apexInfo : apexInfoList.apexInfos) {
+ final PackageInfo packageInfo;
+ int flags = PackageManager.GET_META_DATA;
+ PackageParser.Package pkg;
+ try {
+ File apexFile = new File(apexInfo.modulePath);
+ PackageParser pp = new PackageParser();
+ pkg = pp.parsePackage(apexFile, flags, false);
+ } catch (PackageParserException e) {
+ throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Failed to parse APEX package " + apexInfo.modulePath, e);
+ }
+ packageInfo = PackageParser.generatePackageInfo(pkg, apexInfo, flags);
+ final PackageInfo activePackage = mApexManager.getPackageInfo(packageInfo.packageName,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
if (activePackage == null) {
- continue;
- }
- long activeVersion = activePackage.applicationInfo.longVersionCode;
- if (session.params.requiredInstalledVersionCode
- != PackageManager.VERSION_CODE_HIGHEST) {
- if (activeVersion != session.params.requiredInstalledVersionCode) {
- session.setStagedSessionFailed(
- SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "Installed version of APEX package " + activePackage.packageName
- + " does not match required. Active version: " + activeVersion
- + " required: " + session.params.requiredInstalledVersionCode);
-
- if (!mApexManager.abortActiveSession()) {
- Slog.e(TAG, "Failed to abort apex session " + session.sessionId);
- }
- return false;
- }
+ Slog.w(TAG, "Attempting to install new APEX package " + packageInfo.packageName);
+ throw new PackageManagerException(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "It is forbidden to install new APEX packages.");
}
+ checkRequiredVersionCode(session, activePackage);
+ checkDowngrade(session, activePackage, packageInfo);
+ result.add(packageInfo);
+ }
+ return result;
+ }
- boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted(
- session.params.installFlags, activePackage.applicationInfo.flags);
- if (activeVersion > newModule.versionCode && !allowsDowngrade) {
- session.setStagedSessionFailed(
- SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "Downgrade of APEX package " + activePackage.packageName
- + " is not allowed. Active version: " + activeVersion
- + " attempted: " + newModule.versionCode);
+ private void checkRequiredVersionCode(final PackageInstallerSession session,
+ final PackageInfo activePackage) throws PackageManagerException {
+ if (session.params.requiredInstalledVersionCode == PackageManager.VERSION_CODE_HIGHEST) {
+ return;
+ }
+ final long activeVersion = activePackage.applicationInfo.longVersionCode;
+ if (activeVersion != session.params.requiredInstalledVersionCode) {
+ if (!mApexManager.abortActiveSession()) {
+ Slog.e(TAG, "Failed to abort apex session " + session.sessionId);
+ }
+ throw new PackageManagerException(
+ SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Installed version of APEX package " + activePackage.packageName
+ + " does not match required. Active version: " + activeVersion
+ + " required: " + session.params.requiredInstalledVersionCode);
+ }
+ }
- if (!mApexManager.abortActiveSession()) {
- Slog.e(TAG, "Failed to abort apex session " + session.sessionId);
- }
- return false;
+ private void checkDowngrade(final PackageInstallerSession session,
+ final PackageInfo activePackage, final PackageInfo newPackage)
+ throws PackageManagerException {
+ final long activeVersion = activePackage.applicationInfo.longVersionCode;
+ final long newVersionCode = newPackage.applicationInfo.longVersionCode;
+ boolean allowsDowngrade = PackageManagerServiceUtils.isDowngradePermitted(
+ session.params.installFlags, activePackage.applicationInfo.flags);
+ if (activeVersion > newVersionCode && !allowsDowngrade) {
+ if (!mApexManager.abortActiveSession()) {
+ Slog.e(TAG, "Failed to abort apex session " + session.sessionId);
}
+ throw new PackageManagerException(
+ SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
+ "Downgrade of APEX package " + newPackage.packageName
+ + " is not allowed. Active version: " + activeVersion
+ + " attempted: " + newVersionCode);
}
- return true;
}
private static boolean isApexSession(@NonNull PackageInstallerSession session) {
@@ -200,31 +229,20 @@ public class StagingManager {
}
private void preRebootVerification(@NonNull PackageInstallerSession session) {
- boolean success = true;
-
- final ApexInfoList apexInfoList = new ApexInfoList();
+ final boolean hasApex = sessionContainsApex(session);
// APEX checks. For single-package sessions, check if they contain an APEX. For
// multi-package sessions, find all the child sessions that contain an APEX.
- if (!session.isMultiPackage()
- && isApexSession(session)) {
- success = submitSessionToApexService(session, null, apexInfoList);
-
- } else if (session.isMultiPackage()) {
- List<PackageInstallerSession> childSessions =
- Arrays.stream(session.getChildSessionIds())
- // Retrieve cached sessions matching ids.
- .mapToObj(i -> mStagedSessions.get(i))
- // Filter only the ones containing APEX.
- .filter(childSession -> isApexSession(childSession))
- .collect(Collectors.toList());
- if (!childSessions.isEmpty()) {
- success = submitSessionToApexService(session, childSessions, apexInfoList);
- } // else this is a staged multi-package session with no APEX files.
- }
-
- if (!success) {
- // submitSessionToApexService will populate error.
- return;
+ if (hasApex) {
+ try {
+ final List<PackageInfo> apexPackages = submitSessionToApexService(session);
+ for (PackageInfo apexPackage : apexPackages) {
+ validateApexSignature(apexPackage.applicationInfo.sourceDir,
+ apexPackage.packageName);
+ }
+ } catch (PackageManagerException e) {
+ session.setStagedSessionFailed(e.error, e.getMessage());
+ return;
+ }
}
if (sessionContainsApk(session)) {
@@ -237,25 +255,6 @@ public class StagingManager {
}
}
- if (apexInfoList.apexInfos != null && apexInfoList.apexInfos.length > 0) {
- // For APEXes, we validate the signature here before we mark the session as ready,
- // so we fail the session early if there is a signature mismatch. For APKs, the
- // signature verification will be done by the package manager at the point at which
- // it applies the staged install.
- for (ApexInfo apexModule : apexInfoList.apexInfos) {
- if (!validateApexSignature(apexModule.modulePath,
- apexModule.moduleName)) {
- session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "APK-container signature verification failed for package "
- + apexModule.moduleName + ". Signature of file "
- + apexModule.modulePath + " does not match the signature of "
- + " the package already installed.");
- // TODO(b/118865310): abort the session on apexd.
- return;
- }
- }
- }
-
if ((session.params.installFlags & PackageManager.INSTALL_ENABLE_ROLLBACK) != 0) {
// If rollback is enabled for this session, we call through to the RollbackManager
// with the list of sessions it must enable rollback for. Note that notifyStagedSession
@@ -273,12 +272,24 @@ public class StagingManager {
}
}
+ // Proactively mark session as ready before calling apexd. Although this call order looks
+ // counter-intuitive, this is the easiest way to ensure that session won't end up in the
+ // inconsistent state:
+ // - If device gets rebooted right before call to apexd, then apexd will never activate
+ // apex files of this staged session. This will result in StagingManager failing the
+ // session.
+ // On the other hand, if the order of the calls was inverted (first call apexd, then mark
+ // session as ready), then if a device gets rebooted right after the call to apexd, only
+ // apex part of the train will be applied, leaving device in an inconsistent state.
session.setStagedSessionReady();
- if (sessionContainsApex(session)
- && !mApexManager.markStagedSessionReady(session.sessionId)) {
- session.setStagedSessionFailed(SessionInfo.STAGED_SESSION_VERIFICATION_FAILED,
- "APEX staging failed, check logcat messages from apexd for more "
- + "details.");
+ if (!hasApex) {
+ // Session doesn't contain apex, nothing to do.
+ return;
+ }
+ try {
+ mApexManager.markStagedSessionReady(session.sessionId);
+ } catch (PackageManagerException e) {
+ session.setStagedSessionFailed(e.error, e.getMessage());
}
}
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index 338811efd4ea..e23ce9e0d1cb 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -2805,7 +2805,7 @@ public class UserManagerService extends IUserManager.Stub {
return null;
}
// If we're adding a guest and there already exists one, bail.
- if (isGuest && findCurrentGuestUser() != null) {
+ if (isGuest && !preCreate && findCurrentGuestUser() != null) {
Log.e(LOG_TAG, "Cannot add guest user. Guest user already exists.");
return null;
}
@@ -3044,7 +3044,8 @@ public class UserManagerService extends IUserManager.Stub {
final int size = mUsers.size();
for (int i = 0; i < size; i++) {
final UserInfo user = mUsers.valueAt(i).info;
- if (user.isGuest() && !user.guestToRemove && !mRemovingUserIds.get(user.id)) {
+ if (user.isGuest() && !user.guestToRemove && !user.preCreated
+ && !mRemovingUserIds.get(user.id)) {
return user;
}
}
@@ -3897,9 +3898,14 @@ public class UserManagerService extends IUserManager.Stub {
long now = System.currentTimeMillis();
final long nowRealtime = SystemClock.elapsedRealtime();
- final int currentUser = LocalServices.getService(ActivityManagerInternal.class)
- .getCurrentUserId();
- pw.print("Current user: "); pw.println(currentUser);
+ final ActivityManagerInternal amInternal = LocalServices
+ .getService(ActivityManagerInternal.class);
+ pw.print("Current user: ");
+ if (amInternal != null) {
+ pw.println(amInternal.getCurrentUserId());
+ } else {
+ pw.println("N/A");
+ }
StringBuilder sb = new StringBuilder();
synchronized (mPackagesLock) {
diff --git a/services/core/java/com/android/server/timezone/RulesManagerService.java b/services/core/java/com/android/server/timezone/RulesManagerService.java
index 28c171bdeb98..9347d2194b68 100644
--- a/services/core/java/com/android/server/timezone/RulesManagerService.java
+++ b/services/core/java/com/android/server/timezone/RulesManagerService.java
@@ -32,6 +32,7 @@ import android.app.timezone.IRulesManager;
import android.app.timezone.RulesManager;
import android.app.timezone.RulesState;
import android.content.Context;
+import android.icu.util.TimeZone;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Slog;
@@ -45,7 +46,6 @@ import com.android.timezone.distro.StagedDistroOperation;
import com.android.timezone.distro.TimeZoneDistro;
import com.android.timezone.distro.installer.TimeZoneDistroInstaller;
-import libcore.icu.ICU;
import libcore.timezone.TimeZoneDataFiles;
import libcore.timezone.TimeZoneFinder;
import libcore.timezone.TzDataSetVersion;
@@ -519,7 +519,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
// Report the active rules version (i.e. the rules in use by the current
// process).
pw.println("Active rules version (ICU, ZoneInfoDB, TimeZoneFinder): "
- + ICU.getTZDataVersion() + ","
+ + TimeZone.getTZDataVersion() + ","
+ ZoneInfoDB.getInstance().getVersion() + ","
+ TimeZoneFinder.getInstance().getIanaVersion());
break;
@@ -535,7 +535,7 @@ public final class RulesManagerService extends IRulesManager.Stub {
pw.println("RulesManagerService state: " + toString());
pw.println("Active rules version (ICU, ZoneInfoDB, TimeZoneFinder): "
- + ICU.getTZDataVersion() + ","
+ + TimeZone.getTZDataVersion() + ","
+ ZoneInfoDB.getInstance().getVersion() + ","
+ TimeZoneFinder.getInstance().getIanaVersion());
pw.println("Distro state: " + rulesState.toString());
diff --git a/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java b/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java
index 852f70779f77..cb0b45ceaf05 100644
--- a/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java
+++ b/services/core/java/com/android/server/updates/EmergencyNumberDbInstallReceiver.java
@@ -18,6 +18,7 @@ package com.android.server.updates;
import android.content.Context;
import android.content.Intent;
+import android.telephony.TelephonyManager;
import android.util.Slog;
/**
@@ -34,6 +35,11 @@ public class EmergencyNumberDbInstallReceiver extends ConfigUpdateInstallReceive
@Override
protected void postInstall(Context context, Intent intent) {
Slog.i(TAG, "Emergency number database is updated in file partition");
- // TODO Send a notification to EmergencyNumberTracker for updating of emergency number db.
+
+ // Notify EmergencyNumberTracker for emergency number installation complete.
+ Intent notifyInstallComplete = new Intent(
+ TelephonyManager.ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED);
+ context.sendBroadcast(
+ notifyInstallComplete, android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
}
}
diff --git a/services/core/java/com/android/server/wallpaper/GLHelper.java b/services/core/java/com/android/server/wallpaper/GLHelper.java
new file mode 100644
index 000000000000..1d733f53f055
--- /dev/null
+++ b/services/core/java/com/android/server/wallpaper/GLHelper.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.wallpaper;
+
+import static android.opengl.EGL14.EGL_ALPHA_SIZE;
+import static android.opengl.EGL14.EGL_BLUE_SIZE;
+import static android.opengl.EGL14.EGL_CONFIG_CAVEAT;
+import static android.opengl.EGL14.EGL_CONTEXT_CLIENT_VERSION;
+import static android.opengl.EGL14.EGL_DEFAULT_DISPLAY;
+import static android.opengl.EGL14.EGL_DEPTH_SIZE;
+import static android.opengl.EGL14.EGL_GREEN_SIZE;
+import static android.opengl.EGL14.EGL_HEIGHT;
+import static android.opengl.EGL14.EGL_NONE;
+import static android.opengl.EGL14.EGL_NO_CONTEXT;
+import static android.opengl.EGL14.EGL_NO_DISPLAY;
+import static android.opengl.EGL14.EGL_NO_SURFACE;
+import static android.opengl.EGL14.EGL_OPENGL_ES2_BIT;
+import static android.opengl.EGL14.EGL_RED_SIZE;
+import static android.opengl.EGL14.EGL_RENDERABLE_TYPE;
+import static android.opengl.EGL14.EGL_STENCIL_SIZE;
+import static android.opengl.EGL14.EGL_WIDTH;
+import static android.opengl.EGL14.eglChooseConfig;
+import static android.opengl.EGL14.eglCreateContext;
+import static android.opengl.EGL14.eglCreatePbufferSurface;
+import static android.opengl.EGL14.eglDestroyContext;
+import static android.opengl.EGL14.eglDestroySurface;
+import static android.opengl.EGL14.eglGetDisplay;
+import static android.opengl.EGL14.eglGetError;
+import static android.opengl.EGL14.eglInitialize;
+import static android.opengl.EGL14.eglMakeCurrent;
+import static android.opengl.EGL14.eglTerminate;
+import static android.opengl.GLES20.GL_MAX_TEXTURE_SIZE;
+import static android.opengl.GLES20.glGetIntegerv;
+
+import android.opengl.EGLConfig;
+import android.opengl.EGLContext;
+import android.opengl.EGLDisplay;
+import android.opengl.EGLSurface;
+import android.opengl.GLUtils;
+import android.os.SystemProperties;
+import android.util.Log;
+
+class GLHelper {
+ private static final String TAG = GLHelper.class.getSimpleName();
+ private static final int sMaxTextureSize;
+
+ static {
+ int maxTextureSize = SystemProperties.getInt("sys.max_texture_size", 0);
+ sMaxTextureSize = maxTextureSize > 0 ? maxTextureSize : retrieveTextureSizeFromGL();
+ }
+
+ private static int retrieveTextureSizeFromGL() {
+ try {
+ String err;
+
+ // Before we can retrieve info from GL,
+ // we have to create EGLContext, EGLConfig and EGLDisplay first.
+ // We will fail at querying info from GL once one of above failed.
+ // When this happens, we will use defValue instead.
+ EGLDisplay eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (eglDisplay == null || eglDisplay == EGL_NO_DISPLAY) {
+ err = "eglGetDisplay failed: " + GLUtils.getEGLErrorString(eglGetError());
+ throw new RuntimeException(err);
+ }
+
+ if (!eglInitialize(eglDisplay, null, 0 /* majorOffset */, null, 1 /* minorOffset */)) {
+ err = "eglInitialize failed: " + GLUtils.getEGLErrorString(eglGetError());
+ throw new RuntimeException(err);
+ }
+
+ EGLConfig eglConfig = null;
+ int[] configsCount = new int[1];
+ EGLConfig[] configs = new EGLConfig[1];
+ int[] configSpec = new int[] {
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 0,
+ EGL_DEPTH_SIZE, 0,
+ EGL_STENCIL_SIZE, 0,
+ EGL_CONFIG_CAVEAT, EGL_NONE,
+ EGL_NONE
+ };
+
+ if (!eglChooseConfig(eglDisplay, configSpec, 0 /* attrib_listOffset */,
+ configs, 0 /* configOffset */, 1 /* config_size */,
+ configsCount, 0 /* num_configOffset */)) {
+ err = "eglChooseConfig failed: " + GLUtils.getEGLErrorString(eglGetError());
+ throw new RuntimeException(err);
+ } else if (configsCount[0] > 0) {
+ eglConfig = configs[0];
+ }
+
+ if (eglConfig == null) {
+ throw new RuntimeException("eglConfig not initialized!");
+ }
+
+ int[] attr_list = new int[] {EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE};
+ EGLContext eglContext = eglCreateContext(
+ eglDisplay, eglConfig, EGL_NO_CONTEXT, attr_list, 0 /* offset */);
+
+ if (eglContext == null || eglContext == EGL_NO_CONTEXT) {
+ err = "eglCreateContext failed: " + GLUtils.getEGLErrorString(eglGetError());
+ throw new RuntimeException(err);
+ }
+
+ // We create a push buffer temporarily for querying info from GL.
+ int[] attrs = {EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE};
+ EGLSurface eglSurface =
+ eglCreatePbufferSurface(eglDisplay, eglConfig, attrs, 0 /* offset */);
+ eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
+
+ // Now, we are ready to query the info from GL.
+ int[] maxSize = new int[1];
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, maxSize, 0 /* offset */);
+
+ // We have got the info we want, release all egl resources.
+ eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglDestroySurface(eglDisplay, eglSurface);
+ eglDestroyContext(eglDisplay, eglContext);
+ eglTerminate(eglDisplay);
+ return maxSize[0];
+ } catch (RuntimeException e) {
+ Log.w(TAG, "Retrieve from GL failed", e);
+ return Integer.MAX_VALUE;
+ }
+ }
+
+ static int getMaxTextureSize() {
+ return sMaxTextureSize;
+ }
+}
+
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index b0f1e5d69be4..4e136af0fdc3 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -134,6 +134,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
private static final boolean DEBUG = false;
private static final boolean DEBUG_LIVE = true;
+ // This 100MB limitation is defined in RecordingCanvas.
+ private static final int MAX_BITMAP_SIZE = 100 * 1024 * 1024;
+
public static class Lifecycle extends SystemService {
private IWallpaperManagerService mService;
@@ -572,7 +575,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
// Only generate crop for default display.
final DisplayData wpData = getDisplayDataOrCreate(DEFAULT_DISPLAY);
- Rect cropHint = new Rect(wallpaper.cropHint);
+ final Rect cropHint = new Rect(wallpaper.cropHint);
+ final DisplayInfo displayInfo = new DisplayInfo();
+ mDisplayManager.getDisplay(DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
if (DEBUG) {
Slog.v(TAG, "Generating crop for new wallpaper(s): 0x"
@@ -618,12 +623,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
}
// scale if the crop height winds up not matching the recommended metrics
- needScale = (wpData.mHeight != cropHint.height());
+ needScale = wpData.mHeight != cropHint.height()
+ || cropHint.height() > GLHelper.getMaxTextureSize()
+ || cropHint.width() > GLHelper.getMaxTextureSize();
//make sure screen aspect ratio is preserved if width is scaled under screen size
if (needScale) {
- final DisplayInfo displayInfo = new DisplayInfo();
- mDisplayManager.getDisplay(DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
final float scaleByHeight = (float) wpData.mHeight / (float) cropHint.height();
final int newWidth = (int) (cropHint.width() * scaleByHeight);
if (newWidth < displayInfo.logicalWidth) {
@@ -644,14 +649,29 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
if (!needCrop && !needScale) {
// Simple case: the nominal crop fits what we want, so we take
// the whole thing and just copy the image file directly.
- if (DEBUG) {
- Slog.v(TAG, "Null crop of new wallpaper; copying");
+
+ // TODO: It is not accurate to estimate bitmap size without decoding it,
+ // may be we can try to remove this optimized way in the future,
+ // that means, we will always go into the 'else' block.
+
+ // This is just a quick estimation, may be smaller than it is.
+ long estimateSize = options.outWidth * options.outHeight * 4;
+
+ // A bitmap over than MAX_BITMAP_SIZE will make drawBitmap() fail.
+ // Please see: RecordingCanvas#throwIfCannotDraw.
+ if (estimateSize < MAX_BITMAP_SIZE) {
+ success = FileUtils.copyFile(wallpaper.wallpaperFile, wallpaper.cropFile);
}
- success = FileUtils.copyFile(wallpaper.wallpaperFile, wallpaper.cropFile);
+
if (!success) {
wallpaper.cropFile.delete();
// TODO: fall back to default wallpaper in this case
}
+
+ if (DEBUG) {
+ Slog.v(TAG, "Null crop of new wallpaper, estimate size="
+ + estimateSize + ", success=" + success);
+ }
} else {
// Fancy case: crop and scale. First, we decode and scale down if appropriate.
FileOutputStream f = null;
@@ -665,49 +685,78 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
// We calculate the largest power-of-two under the actual ratio rather than
// just let the decode take care of it because we also want to remap where the
// cropHint rectangle lies in the decoded [super]rect.
- final BitmapFactory.Options scaler;
final int actualScale = cropHint.height() / wpData.mHeight;
int scale = 1;
- while (2*scale < actualScale) {
+ while (2 * scale <= actualScale) {
scale *= 2;
}
- if (scale > 1) {
- scaler = new BitmapFactory.Options();
- scaler.inSampleSize = scale;
+ options.inSampleSize = scale;
+ options.inJustDecodeBounds = false;
+
+ final Rect estimateCrop = new Rect(cropHint);
+ estimateCrop.scale(1f / options.inSampleSize);
+ final float hRatio = (float) wpData.mHeight / estimateCrop.height();
+ final int destHeight = (int) (estimateCrop.height() * hRatio);
+ final int destWidth = (int) (estimateCrop.width() * hRatio);
+
+ // We estimated an invalid crop, try to adjust the cropHint to get a valid one.
+ if (destWidth > GLHelper.getMaxTextureSize()) {
+ int newHeight = (int) (wpData.mHeight / hRatio);
+ int newWidth = (int) (wpData.mWidth / hRatio);
+
if (DEBUG) {
- Slog.v(TAG, "Downsampling cropped rect with scale " + scale);
+ Slog.v(TAG, "Invalid crop dimensions, trying to adjust.");
}
- } else {
- scaler = null;
+
+ estimateCrop.set(cropHint);
+ estimateCrop.left += (cropHint.width() - newWidth) / 2;
+ estimateCrop.top += (cropHint.height() - newHeight) / 2;
+ estimateCrop.right = estimateCrop.left + newWidth;
+ estimateCrop.bottom = estimateCrop.top + newHeight;
+ cropHint.set(estimateCrop);
+ estimateCrop.scale(1f / options.inSampleSize);
+ }
+
+ // We've got the safe cropHint; now we want to scale it properly to
+ // the desired rectangle.
+ // That's a height-biased operation: make it fit the hinted height.
+ final int safeHeight = (int) (estimateCrop.height() * hRatio);
+ final int safeWidth = (int) (estimateCrop.width() * hRatio);
+
+ if (DEBUG) {
+ Slog.v(TAG, "Decode parameters:");
+ Slog.v(TAG, " cropHint=" + cropHint + ", estimateCrop=" + estimateCrop);
+ Slog.v(TAG, " down sampling=" + options.inSampleSize
+ + ", hRatio=" + hRatio);
+ Slog.v(TAG, " dest=" + destWidth + "x" + destHeight);
+ Slog.v(TAG, " safe=" + safeWidth + "x" + safeHeight);
+ Slog.v(TAG, " maxTextureSize=" + GLHelper.getMaxTextureSize());
}
- Bitmap cropped = decoder.decodeRegion(cropHint, scaler);
+
+ Bitmap cropped = decoder.decodeRegion(cropHint, options);
decoder.recycle();
if (cropped == null) {
Slog.e(TAG, "Could not decode new wallpaper");
} else {
- // We've got the extracted crop; now we want to scale it properly to
- // the desired rectangle. That's a height-biased operation: make it
- // fit the hinted height, and accept whatever width we end up with.
- cropHint.offsetTo(0, 0);
- cropHint.right /= scale; // adjust by downsampling factor
- cropHint.bottom /= scale;
- final float heightR =
- ((float) wpData.mHeight) / ((float) cropHint.height());
- if (DEBUG) {
- Slog.v(TAG, "scale " + heightR + ", extracting " + cropHint);
- }
- final int destWidth = (int)(cropHint.width() * heightR);
+ // We are safe to create final crop with safe dimensions now.
final Bitmap finalCrop = Bitmap.createScaledBitmap(cropped,
- destWidth, wpData.mHeight, true);
+ safeWidth, safeHeight, true);
if (DEBUG) {
Slog.v(TAG, "Final extract:");
Slog.v(TAG, " dims: w=" + wpData.mWidth
+ " h=" + wpData.mHeight);
- Slog.v(TAG, " out: w=" + finalCrop.getWidth()
+ Slog.v(TAG, " out: w=" + finalCrop.getWidth()
+ " h=" + finalCrop.getHeight());
}
+ // A bitmap over than MAX_BITMAP_SIZE will make drawBitmap() fail.
+ // Please see: RecordingCanvas#throwIfCannotDraw.
+ if (finalCrop.getByteCount() > MAX_BITMAP_SIZE) {
+ throw new RuntimeException(
+ "Too large bitmap, limit=" + MAX_BITMAP_SIZE);
+ }
+
f = new FileOutputStream(wallpaper.cropFile);
bos = new BufferedOutputStream(f, 32*1024);
finalCrop.compress(Bitmap.CompressFormat.JPEG, 100, bos);
@@ -1237,6 +1286,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
saveSettingsLocked(mWallpaper.userId);
}
FgThread.getHandler().removeCallbacks(mResetRunnable);
+ mContext.getMainThreadHandler().removeCallbacks(this::tryToRebind);
}
}
}
@@ -1279,6 +1329,34 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
}
}
+ private void tryToRebind() {
+ synchronized (mLock) {
+ if (mWallpaper.wallpaperUpdating) {
+ return;
+ }
+ final ComponentName wpService = mWallpaper.wallpaperComponent;
+ // The broadcast of package update could be delayed after service disconnected. Try
+ // to re-bind the service for 10 seconds.
+ if (bindWallpaperComponentLocked(
+ wpService, true, false, mWallpaper, null)) {
+ mWallpaper.connection.scheduleTimeoutLocked();
+ } else if (SystemClock.uptimeMillis() - mWallpaper.lastDiedTime
+ < WALLPAPER_RECONNECT_TIMEOUT_MS) {
+ // Bind fail without timeout, schedule rebind
+ Slog.w(TAG, "Rebind fail! Try again later");
+ mContext.getMainThreadHandler().postDelayed(this::tryToRebind, 1000);
+ } else {
+ // Timeout
+ Slog.w(TAG, "Reverting to built-in wallpaper!");
+ clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
+ final String flattened = wpService.flattenToString();
+ EventLog.writeEvent(EventLogTags.WP_WALLPAPER_CRASHED,
+ flattened.substring(0, Math.min(flattened.length(),
+ MAX_WALLPAPER_COMPONENT_LOG_LENGTH)));
+ }
+ }
+ }
+
private void processDisconnect(final ServiceConnection connection) {
synchronized (mLock) {
// The wallpaper disappeared. If this isn't a system-default one, track
@@ -1302,20 +1380,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
} else {
mWallpaper.lastDiedTime = SystemClock.uptimeMillis();
-
- clearWallpaperComponentLocked(mWallpaper);
- if (bindWallpaperComponentLocked(
- wpService, false, false, mWallpaper, null)) {
- mWallpaper.connection.scheduleTimeoutLocked();
- } else {
- Slog.w(TAG, "Reverting to built-in wallpaper!");
- clearWallpaperLocked(true, FLAG_SYSTEM, mWallpaper.userId, null);
- }
+ tryToRebind();
}
- final String flattened = wpService.flattenToString();
- EventLog.writeEvent(EventLogTags.WP_WALLPAPER_CRASHED,
- flattened.substring(0, Math.min(flattened.length(),
- MAX_WALLPAPER_COMPONENT_LOG_LENGTH)));
}
} else {
if (DEBUG_LIVE) {
@@ -1981,6 +2047,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
if (!isWallpaperSupported(callingPackage)) {
return;
}
+
+ // Make sure both width and height are not larger than max texture size.
+ width = Math.min(width, GLHelper.getMaxTextureSize());
+ height = Math.min(height, GLHelper.getMaxTextureSize());
+
synchronized (mLock) {
int userId = UserHandle.getCallingUserId();
WallpaperData wallpaper = getWallpaperSafeLocked(userId, FLAG_SYSTEM);
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 56be335c2624..242139cd2da7 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -4112,9 +4112,13 @@ class ActivityStack extends ConfigurationContainer {
final ActivityDisplay display = getDisplay();
final ActivityRecord next = display.topRunningActivity(true /* considerKeyguardState */);
final boolean isFloating = r.getConfiguration().windowConfiguration.tasksAreFloating();
-
- if (mode == FINISH_AFTER_VISIBLE && (r.visible || r.nowVisible)
- && next != null && !next.nowVisible && !isFloating) {
+ // isNextNotYetVisible is to check if the next activity is invisible, or it has been
+ // requested to be invisible but its windows haven't reported as invisible. If so, it
+ // implied that the current finishing activity should be added into stopping list rather
+ // than destroying it immediately.
+ final boolean isNextNotYetVisible = next != null && (!next.nowVisible || !next.visible);
+ if (mode == FINISH_AFTER_VISIBLE && (r.visible || r.nowVisible) && isNextNotYetVisible
+ && !isFloating) {
if (!mStackSupervisor.mStoppingActivities.contains(r)) {
addToStopping(r, false /* scheduleIdle */, false /* idleDelayed */,
"finishCurrentActivityLocked");
diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp
index 3bc239b53529..6175d4183020 100644
--- a/services/core/jni/Android.bp
+++ b/services/core/jni/Android.bp
@@ -23,7 +23,6 @@ cc_library_static {
"com_android_server_AlarmManagerService.cpp",
"com_android_server_am_BatteryStatsService.cpp",
"com_android_server_connectivity_Vpn.cpp",
- "com_android_server_connectivity_tethering_OffloadHardwareInterface.cpp",
"com_android_server_ConsumerIrService.cpp",
"com_android_server_devicepolicy_CryptoTestHelper.cpp",
"com_android_server_HardwarePropertiesManagerService.cpp",
@@ -54,6 +53,7 @@ cc_library_static {
"com_android_server_am_LowMemDetector.cpp",
"onload.cpp",
":lib_networkStatsFactory_native",
+ ":tethering-jni-srcs",
],
include_dirs: [
@@ -130,11 +130,13 @@ cc_defaults {
"android.hardware.vibrator@1.1",
"android.hardware.vibrator@1.2",
"android.hardware.vibrator@1.3",
+ "android.hardware.vibrator@1.4",
"android.hardware.vr@1.0",
"android.frameworks.schedulerservice@1.0",
"android.frameworks.sensorservice@1.0",
"android.system.suspend@1.0",
"suspend_control_aidl_interface-cpp",
+ "vintf-vibrator-cpp",
],
static_libs: [
diff --git a/services/core/jni/com_android_server_VibratorService.cpp b/services/core/jni/com_android_server_VibratorService.cpp
index d5fbd2b316e7..372622801aa0 100644
--- a/services/core/jni/com_android_server_VibratorService.cpp
+++ b/services/core/jni/com_android_server_VibratorService.cpp
@@ -16,17 +16,15 @@
#define LOG_TAG "VibratorService"
-#include <android/hardware/vibrator/1.0/IVibrator.h>
-#include <android/hardware/vibrator/1.0/types.h>
-#include <android/hardware/vibrator/1.0/IVibrator.h>
-#include <android/hardware/vibrator/1.1/types.h>
-#include <android/hardware/vibrator/1.2/IVibrator.h>
-#include <android/hardware/vibrator/1.2/types.h>
-#include <android/hardware/vibrator/1.3/IVibrator.h>
+#include <android/hardware/vibrator/1.4/IVibrator.h>
+#include <android/hardware/vibrator/BnVibratorCallback.h>
+#include <android/hardware/vibrator/IVibrator.h>
+#include <binder/IServiceManager.h>
#include "jni.h"
#include <nativehelper/JNIHelp.h>
#include "android_runtime/AndroidRuntime.h"
+#include "core_jni_helpers.h"
#include <utils/misc.h>
#include <utils/Log.h>
@@ -36,6 +34,7 @@
#include <stdio.h>
using android::hardware::Return;
+using android::hardware::Void;
using android::hardware::vibrator::V1_0::EffectStrength;
using android::hardware::vibrator::V1_0::Status;
using android::hardware::vibrator::V1_1::Effect_1_1;
@@ -44,9 +43,185 @@ namespace V1_0 = android::hardware::vibrator::V1_0;
namespace V1_1 = android::hardware::vibrator::V1_1;
namespace V1_2 = android::hardware::vibrator::V1_2;
namespace V1_3 = android::hardware::vibrator::V1_3;
+namespace V1_4 = android::hardware::vibrator::V1_4;
+namespace aidl = android::hardware::vibrator;
namespace android {
+static jmethodID sMethodIdOnComplete;
+
+// TODO(b/141828236): remove HIDL 1.4 and re-write all of this code to remove
+// shim
+class VibratorShim : public V1_4::IVibrator {
+ public:
+ VibratorShim(const sp<aidl::IVibrator>& vib) : mVib(vib) {}
+
+ Return<V1_0::Status> on(uint32_t timeoutMs) override {
+ return on_1_4(timeoutMs, nullptr);
+ }
+
+ Return<V1_0::Status> off() override {
+ return toHidlStatus(mVib->off());
+ }
+
+ Return<bool> supportsAmplitudeControl() override {
+ int32_t cap = 0;
+ if (!mVib->getCapabilities(&cap).isOk()) return false;
+ if (mUnderExternalControl) {
+ return (cap & aidl::IVibrator::CAP_EXTERNAL_AMPLITUDE_CONTROL) > 0;
+ } else {
+ return (cap & aidl::IVibrator::CAP_AMPLITUDE_CONTROL) > 0;
+ }
+ }
+
+ Return<V1_0::Status> setAmplitude(uint8_t amplitude) override {
+ return toHidlStatus(mVib->setAmplitude(amplitude));
+ }
+
+ Return<void> perform(V1_0::Effect effect, V1_0::EffectStrength strength,
+ perform_cb _hidl_cb) override {
+ return perform_1_4(static_cast<V1_3::Effect>(effect), strength, nullptr, _hidl_cb);
+ }
+
+ Return<void> perform_1_1(V1_1::Effect_1_1 effect, V1_0::EffectStrength strength,
+ perform_1_1_cb _hidl_cb) override {
+ return perform_1_4(static_cast<V1_3::Effect>(effect), strength, nullptr, _hidl_cb);
+ }
+
+ Return<void> perform_1_2(V1_2::Effect effect, V1_0::EffectStrength strength,
+ perform_1_2_cb _hidl_cb) override {
+ return perform_1_4(static_cast<V1_3::Effect>(effect), strength, nullptr, _hidl_cb);
+ }
+
+ Return<bool> supportsExternalControl() override {
+ int32_t cap = 0;
+ if (!mVib->getCapabilities(&cap).isOk()) return false;
+ return (cap & aidl::IVibrator::CAP_EXTERNAL_CONTROL) > 0;
+ }
+
+ Return<V1_0::Status> setExternalControl(bool enabled) override {
+ Return<V1_0::Status> status = toHidlStatus(mVib->setExternalControl(enabled));
+ if (status.isOk() && status == V1_0::Status::OK) {
+ mUnderExternalControl = enabled;
+ }
+ return status;
+ }
+
+ Return<void> perform_1_3(V1_3::Effect effect, V1_0::EffectStrength strength,
+ perform_1_3_cb _hidl_cb) override {
+ return perform_1_4(static_cast<V1_3::Effect>(effect), strength, nullptr, _hidl_cb);
+ }
+
+ Return<uint32_t> getCapabilities() override {
+ static_assert(static_cast<int32_t>(V1_4::Capabilities::ON_COMPLETION_CALLBACK) ==
+ static_cast<int32_t>(aidl::IVibrator::CAP_ON_CALLBACK));
+ static_assert(static_cast<int32_t>(V1_4::Capabilities::PERFORM_COMPLETION_CALLBACK) ==
+ static_cast<int32_t>(aidl::IVibrator::CAP_PERFORM_CALLBACK));
+
+ int32_t cap;
+ if (!mVib->getCapabilities(&cap).isOk()) return 0;
+ return (cap & (aidl::IVibrator::CAP_ON_CALLBACK |
+ aidl::IVibrator::CAP_PERFORM_CALLBACK)) > 0;
+ }
+
+ Return<V1_0::Status> on_1_4(uint32_t timeoutMs,
+ const sp<V1_4::IVibratorCallback>& callback) override {
+ sp<aidl::IVibratorCallback> cb = callback ? new CallbackShim(callback) : nullptr;
+ return toHidlStatus(mVib->on(timeoutMs, cb));
+ }
+
+ Return<void> perform_1_4(V1_3::Effect effect, V1_0::EffectStrength strength,
+ const sp<V1_4::IVibratorCallback>& callback,
+ perform_1_4_cb _hidl_cb) override {
+ static_assert(static_cast<uint8_t>(V1_0::EffectStrength::LIGHT) ==
+ static_cast<uint8_t>(aidl::EffectStrength::LIGHT));
+ static_assert(static_cast<uint8_t>(V1_0::EffectStrength::MEDIUM) ==
+ static_cast<uint8_t>(aidl::EffectStrength::MEDIUM));
+ static_assert(static_cast<uint8_t>(V1_0::EffectStrength::STRONG) ==
+ static_cast<uint8_t>(aidl::EffectStrength::STRONG));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::CLICK) ==
+ static_cast<uint8_t>(aidl::Effect::CLICK));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::DOUBLE_CLICK) ==
+ static_cast<uint8_t>(aidl::Effect::DOUBLE_CLICK));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::TICK) ==
+ static_cast<uint8_t>(aidl::Effect::TICK));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::THUD) ==
+ static_cast<uint8_t>(aidl::Effect::THUD));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::POP) ==
+ static_cast<uint8_t>(aidl::Effect::POP));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::HEAVY_CLICK) ==
+ static_cast<uint8_t>(aidl::Effect::HEAVY_CLICK));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::RINGTONE_1) ==
+ static_cast<uint8_t>(aidl::Effect::RINGTONE_1));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::RINGTONE_2) ==
+ static_cast<uint8_t>(aidl::Effect::RINGTONE_2));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::RINGTONE_15) ==
+ static_cast<uint8_t>(aidl::Effect::RINGTONE_15));
+ static_assert(static_cast<uint8_t>(V1_3::Effect::TEXTURE_TICK) ==
+ static_cast<uint8_t>(aidl::Effect::TEXTURE_TICK));
+
+ sp<aidl::IVibratorCallback> cb = callback ? new CallbackShim(callback) : nullptr;
+ int timeoutMs = 0;
+ Return<V1_0::Status> status = toHidlStatus(
+ mVib->perform(static_cast<aidl::Effect>(effect),
+ static_cast<aidl::EffectStrength>(strength), cb, &timeoutMs));
+
+ if (status.isOk()) {
+ _hidl_cb(status, timeoutMs);
+ return android::hardware::Status::ok();
+ } else {
+ return android::hardware::details::StatusOf<V1_0::Status, void>(status);
+ }
+ }
+ private:
+ sp<aidl::IVibrator> mVib;
+ bool mUnderExternalControl = false;
+
+ Return<V1_0::Status> toHidlStatus(const android::binder::Status& status) {
+ switch(status.exceptionCode()) {
+ using android::hardware::Status;
+ case Status::EX_NONE: return V1_0::Status::OK;
+ case Status::EX_ILLEGAL_ARGUMENT: return V1_0::Status::BAD_VALUE;
+ case Status::EX_UNSUPPORTED_OPERATION: return V1_0::Status::UNSUPPORTED_OPERATION;
+ case Status::EX_TRANSACTION_FAILED: {
+ return Status::fromStatusT(status.transactionError());
+ }
+ }
+ return V1_0::Status::UNKNOWN_ERROR;
+ }
+
+ class CallbackShim : public aidl::BnVibratorCallback {
+ public:
+ CallbackShim(const sp<V1_4::IVibratorCallback>& cb) : mCb(cb) {}
+ binder::Status onComplete() {
+ mCb->onComplete();
+ return binder::Status::ok(); // oneway, local call
+ }
+ private:
+ sp<V1_4::IVibratorCallback> mCb;
+ };
+};
+
+class VibratorCallback : public V1_4::IVibratorCallback {
+ public:
+ VibratorCallback(JNIEnv *env, jobject vibration) :
+ mVibration(MakeGlobalRefOrDie(env, vibration)) {}
+
+ ~VibratorCallback() {
+ JNIEnv *env = AndroidRuntime::getJNIEnv();
+ env->DeleteGlobalRef(mVibration);
+ }
+
+ Return<void> onComplete() override {
+ auto env = AndroidRuntime::getJNIEnv();
+ env->CallVoidMethod(mVibration, sMethodIdOnComplete);
+ return Void();
+ }
+
+ private:
+ jobject mVibration;
+};
+
static constexpr int NUM_TRIES = 2;
// Creates a Return<R> with STATUS::EX_NULL_POINTER.
@@ -56,37 +231,68 @@ inline Return<R> NullptrStatus() {
return Return<R>{Status::fromExceptionCode(Status::EX_NULL_POINTER)};
}
-// Helper used to transparently deal with the vibrator HAL becoming unavailable.
-template<class R, class I, class... Args0, class... Args1>
-Return<R> halCall(Return<R> (I::* fn)(Args0...), Args1&&... args1) {
- // Assume that if getService returns a nullptr, HAL is not available on the
- // device.
- static sp<I> sHal = I::getService();
- static bool sAvailable = sHal != nullptr;
+template <typename I>
+class HalWrapper {
+ public:
+ static std::unique_ptr<HalWrapper> Create() {
+ sp<aidl::IVibrator> aidlVib = waitForVintfService<aidl::IVibrator>();
+ if (aidlVib) {
+ return std::unique_ptr<HalWrapper>(new HalWrapper(new VibratorShim(aidlVib)));
+ }
- if (!sAvailable) {
- return NullptrStatus<R>();
+ // Assume that if getService returns a nullptr, HAL is not available on the
+ // device.
+ auto hal = I::getService();
+ return hal ? std::unique_ptr<HalWrapper>(new HalWrapper(std::move(hal))) : nullptr;
}
- // Return<R> doesn't have a default constructor, so make a Return<R> with
- // STATUS::EX_NONE.
- using ::android::hardware::Status;
- Return<R> ret{Status::fromExceptionCode(Status::EX_NONE)};
+ // Helper used to transparently deal with the vibrator HAL becoming unavailable.
+ template<class R, class... Args0, class... Args1>
+ Return<R> call(Return<R> (I::* fn)(Args0...), Args1&&... args1) {
+ // Return<R> doesn't have a default constructor, so make a Return<R> with
+ // STATUS::EX_NONE.
+ using ::android::hardware::Status;
+ Return<R> ret{Status::fromExceptionCode(Status::EX_NONE)};
+
+ // Note that ret is guaranteed to be changed after this loop.
+ for (int i = 0; i < NUM_TRIES; ++i) {
+ ret = (mHal == nullptr) ? NullptrStatus<R>()
+ : (*mHal.*fn)(std::forward<Args1>(args1)...);
+
+ if (ret.isOk()) {
+ break;
+ }
+
+ ALOGE("Failed to issue command to vibrator HAL. Retrying.");
+
+ // Restoring connection to the HAL.
+ sp<aidl::IVibrator> aidlVib = checkVintfService<aidl::IVibrator>();
+ if (aidlVib) {
+ mHal = new VibratorShim(aidlVib);
+ } else {
+ mHal = I::tryGetService();
+ }
+ }
+ return ret;
+ }
- // Note that ret is guaranteed to be changed after this loop.
- for (int i = 0; i < NUM_TRIES; ++i) {
- ret = (sHal == nullptr) ? NullptrStatus<R>()
- : (*sHal.*fn)(std::forward<Args1>(args1)...);
+ private:
+ HalWrapper(sp<I> &&hal) : mHal(std::move(hal)) {}
- if (ret.isOk()) {
- break;
- }
+ private:
+ sp<I> mHal;
+};
- ALOGE("Failed to issue command to vibrator HAL. Retrying.");
- // Restoring connection to the HAL.
- sHal = I::tryGetService();
- }
- return ret;
+template <typename I>
+static auto getHal() {
+ static auto sHalWrapper = HalWrapper<I>::Create();
+ return sHalWrapper.get();
+}
+
+template<class R, class I, class... Args0, class... Args1>
+Return<R> halCall(Return<R> (I::* fn)(Args0...), Args1&&... args1) {
+ auto hal = getHal<I>();
+ return hal ? hal->call(fn, std::forward<Args1>(args1)...) : NullptrStatus<R>();
}
template<class R>
@@ -99,17 +305,17 @@ bool isValidEffect(jlong effect) {
return val >= *iter.begin() && val <= *std::prev(iter.end());
}
-static void vibratorInit(JNIEnv /* env */, jobject /* clazz */)
+static void vibratorInit(JNIEnv *env, jclass clazz)
{
halCall(&V1_0::IVibrator::ping).isOk();
}
-static jboolean vibratorExists(JNIEnv* /* env */, jobject /* clazz */)
+static jboolean vibratorExists(JNIEnv* /* env */, jclass /* clazz */)
{
return halCall(&V1_0::IVibrator::ping).isOk() ? JNI_TRUE : JNI_FALSE;
}
-static void vibratorOn(JNIEnv* /* env */, jobject /* clazz */, jlong timeout_ms)
+static void vibratorOn(JNIEnv* /* env */, jclass /* clazz */, jlong timeout_ms)
{
Status retStatus = halCall(&V1_0::IVibrator::on, timeout_ms).withDefault(Status::UNKNOWN_ERROR);
if (retStatus != Status::OK) {
@@ -117,7 +323,7 @@ static void vibratorOn(JNIEnv* /* env */, jobject /* clazz */, jlong timeout_ms)
}
}
-static void vibratorOff(JNIEnv* /* env */, jobject /* clazz */)
+static void vibratorOff(JNIEnv* /* env */, jclass /* clazz */)
{
Status retStatus = halCall(&V1_0::IVibrator::off).withDefault(Status::UNKNOWN_ERROR);
if (retStatus != Status::OK) {
@@ -125,11 +331,11 @@ static void vibratorOff(JNIEnv* /* env */, jobject /* clazz */)
}
}
-static jlong vibratorSupportsAmplitudeControl(JNIEnv*, jobject) {
+static jlong vibratorSupportsAmplitudeControl(JNIEnv*, jclass) {
return halCall(&V1_0::IVibrator::supportsAmplitudeControl).withDefault(false);
}
-static void vibratorSetAmplitude(JNIEnv*, jobject, jint amplitude) {
+static void vibratorSetAmplitude(JNIEnv*, jclass, jint amplitude) {
Status status = halCall(&V1_0::IVibrator::setAmplitude, static_cast<uint32_t>(amplitude))
.withDefault(Status::UNKNOWN_ERROR);
if (status != Status::OK) {
@@ -138,11 +344,11 @@ static void vibratorSetAmplitude(JNIEnv*, jobject, jint amplitude) {
}
}
-static jboolean vibratorSupportsExternalControl(JNIEnv*, jobject) {
+static jboolean vibratorSupportsExternalControl(JNIEnv*, jclass) {
return halCall(&V1_3::IVibrator::supportsExternalControl).withDefault(false);
}
-static void vibratorSetExternalControl(JNIEnv*, jobject, jboolean enabled) {
+static void vibratorSetExternalControl(JNIEnv*, jclass, jboolean enabled) {
Status status = halCall(&V1_3::IVibrator::setExternalControl, static_cast<uint32_t>(enabled))
.withDefault(Status::UNKNOWN_ERROR);
if (status != Status::OK) {
@@ -151,7 +357,8 @@ static void vibratorSetExternalControl(JNIEnv*, jobject, jboolean enabled) {
}
}
-static jlong vibratorPerformEffect(JNIEnv*, jobject, jlong effect, jint strength) {
+static jlong vibratorPerformEffect(JNIEnv* env, jclass, jlong effect, jlong strength,
+ jobject vibration) {
Status status;
uint32_t lengthMs;
auto callback = [&status, &lengthMs](Status retStatus, uint32_t retLengthMs) {
@@ -161,7 +368,11 @@ static jlong vibratorPerformEffect(JNIEnv*, jobject, jlong effect, jint strength
EffectStrength effectStrength(static_cast<EffectStrength>(strength));
Return<void> ret;
- if (isValidEffect<V1_0::Effect>(effect)) {
+ if (auto hal = getHal<V1_4::IVibrator>(); hal && isValidEffect<V1_3::Effect>(effect)) {
+ sp<VibratorCallback> effectCallback = new VibratorCallback(env, vibration);
+ ret = hal->call(&V1_4::IVibrator::perform_1_4, static_cast<V1_3::Effect>(effect),
+ effectStrength, effectCallback, callback);
+ } else if (isValidEffect<V1_0::Effect>(effect)) {
ret = halCall(&V1_0::IVibrator::perform, static_cast<V1_0::Effect>(effect),
effectStrength, callback);
} else if (isValidEffect<Effect_1_1>(effect)) {
@@ -198,6 +409,10 @@ static jlong vibratorPerformEffect(JNIEnv*, jobject, jlong effect, jint strength
return -1;
}
+static jlong vibratorGetCapabilities(JNIEnv*, jclass) {
+ return halCall(&V1_4::IVibrator::getCapabilities).withDefault(0);
+}
+
static const JNINativeMethod method_table[] = {
{ "vibratorExists", "()Z", (void*)vibratorExists },
{ "vibratorInit", "()V", (void*)vibratorInit },
@@ -205,13 +420,18 @@ static const JNINativeMethod method_table[] = {
{ "vibratorOff", "()V", (void*)vibratorOff },
{ "vibratorSupportsAmplitudeControl", "()Z", (void*)vibratorSupportsAmplitudeControl},
{ "vibratorSetAmplitude", "(I)V", (void*)vibratorSetAmplitude},
- { "vibratorPerformEffect", "(JJ)J", (void*)vibratorPerformEffect},
+ { "vibratorPerformEffect", "(JJLcom/android/server/VibratorService$Vibration;)J",
+ (void*)vibratorPerformEffect},
{ "vibratorSupportsExternalControl", "()Z", (void*)vibratorSupportsExternalControl},
{ "vibratorSetExternalControl", "(Z)V", (void*)vibratorSetExternalControl},
+ { "vibratorGetCapabilities", "()J", (void*)vibratorGetCapabilities},
};
int register_android_server_VibratorService(JNIEnv *env)
{
+ sMethodIdOnComplete = GetMethodIDOrDie(env,
+ FindClassOrDie(env, "com/android/server/VibratorService$Vibration"),
+ "onComplete", "()V");
return jniRegisterNativeMethods(env, "com/android/server/VibratorService",
method_table, NELEM(method_table));
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b2c9e593c0dc..80535e496fbc 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -25,6 +25,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import android.annotation.NonNull;
import android.annotation.StringRes;
import android.app.ActivityThread;
+import android.app.AppCompatCallbacks;
import android.app.INotificationManager;
import android.app.usage.UsageStatsManagerInternal;
import android.content.ComponentName;
@@ -646,6 +647,7 @@ public final class SystemServer {
ServiceManager.addService(Context.PLATFORM_COMPAT_SERVICE, platformCompat);
ServiceManager.addService(Context.PLATFORM_COMPAT_NATIVE_SERVICE,
new PlatformCompatNative(platformCompat));
+ AppCompatCallbacks.install(new long[0]);
traceEnd();
// Wait for installd to finish starting up so that it has a chance to
diff --git a/services/net/Android.bp b/services/net/Android.bp
index 6a871aa81543..c56ecd6e19e7 100644
--- a/services/net/Android.bp
+++ b/services/net/Android.bp
@@ -1,9 +1,12 @@
java_library_static {
name: "services.net",
- srcs: ["java/**/*.java"],
+ srcs: [
+ ":tethering-servicesnet-srcs",
+ "java/**/*.java",
+ ],
static_libs: [
"dnsresolver_aidl_interface-V2-java",
- "netd_aidl_interface-java",
+ "netd_aidl_interface-unstable-java",
"networkstack-client",
"tethering-client",
],
@@ -23,6 +26,13 @@ filegroup {
name: "services-tethering-shared-srcs",
srcs: [
":framework-annotations",
+ "java/android/net/ConnectivityModuleConnector.java",
+ "java/android/net/NetworkStackClient.java",
+ "java/android/net/ip/InterfaceController.java",
+ "java/android/net/netlink/*.java",
+ "java/android/net/util/InterfaceParams.java",
+ "java/android/net/util/NetdService.java",
+ "java/android/net/util/NetworkConstants.java",
"java/android/net/util/SharedLog.java"
],
}
diff --git a/services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java b/services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java
index e51ee947cba1..88273b7bc2cf 100644
--- a/services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java
+++ b/services/tests/mockingservicestests/src/com/android/server/DeviceIdleControllerTest.java
@@ -17,6 +17,7 @@ package com.android.server;
import static androidx.test.InstrumentationRegistry.getContext;
+import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.inOrder;
@@ -31,6 +32,7 @@ import static com.android.server.DeviceIdleController.LIGHT_STATE_INACTIVE;
import static com.android.server.DeviceIdleController.LIGHT_STATE_OVERRIDE;
import static com.android.server.DeviceIdleController.LIGHT_STATE_PRE_IDLE;
import static com.android.server.DeviceIdleController.LIGHT_STATE_WAITING_FOR_NETWORK;
+import static com.android.server.DeviceIdleController.MSG_REPORT_STATIONARY_STATUS;
import static com.android.server.DeviceIdleController.STATE_ACTIVE;
import static com.android.server.DeviceIdleController.STATE_IDLE;
import static com.android.server.DeviceIdleController.STATE_IDLE_MAINTENANCE;
@@ -51,6 +53,7 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
@@ -70,6 +73,7 @@ import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Handler;
import android.os.Looper;
+import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManagerInternal;
import android.os.PowerSaveState;
@@ -85,11 +89,13 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Answers;
+import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
import org.mockito.Mock;
import org.mockito.MockitoSession;
+import org.mockito.invocation.InvocationOnMock;
import org.mockito.quality.Strictness;
+import org.mockito.stubbing.Answer;
/**
* Tests for {@link com.android.server.DeviceIdleController}.
@@ -97,6 +103,7 @@ import org.mockito.quality.Strictness;
@RunWith(AndroidJUnit4.class)
public class DeviceIdleControllerTest {
private DeviceIdleController mDeviceIdleController;
+ private DeviceIdleController.MyHandler mHandler;
private AnyMotionDetectorForTest mAnyMotionDetector;
private AppStateTrackerForTest mAppStateTracker;
private DeviceIdleController.Constants mConstants;
@@ -110,8 +117,6 @@ public class DeviceIdleControllerTest {
@Mock
private ContentResolver mContentResolver;
@Mock
- private DeviceIdleController.MyHandler mHandler;
- @Mock
private IActivityManager mIActivityManager;
@Mock
private LocationManager mLocationManager;
@@ -128,6 +133,8 @@ public class DeviceIdleControllerTest {
ConnectivityService connectivityService;
LocationManager locationManager;
ConstraintController constraintController;
+ // Freeze time for testing.
+ long nowElapsed;
InjectorForTest(Context ctx) {
super(ctx);
@@ -155,12 +162,34 @@ public class DeviceIdleControllerTest {
}
@Override
+ long getElapsedRealtime() {
+ return nowElapsed;
+ }
+
+ @Override
LocationManager getLocationManager() {
return locationManager;
}
@Override
DeviceIdleController.MyHandler getHandler(DeviceIdleController controller) {
+ if (mHandler == null) {
+ mHandler = controller.new MyHandler(getContext().getMainLooper());
+ spyOn(mHandler);
+ doNothing().when(mHandler).handleMessage(argThat((message) ->
+ message.what != MSG_REPORT_STATIONARY_STATUS));
+ doAnswer(new Answer<Boolean>() {
+ @Override
+ public Boolean answer(InvocationOnMock invocation) throws Throwable {
+ Message msg = invocation.getArgument(0);
+ mHandler.handleMessage(msg);
+ return true;
+ }
+ }).when(mHandler).sendMessageDelayed(
+ argThat((message) -> message.what == MSG_REPORT_STATIONARY_STATUS),
+ anyLong());
+ }
+
return mHandler;
}
@@ -226,6 +255,19 @@ public class DeviceIdleControllerTest {
}
}
+ private class StationaryListenerForTest implements DeviceIdleController.StationaryListener {
+ boolean motionExpected = false;
+ boolean isStationary = false;
+
+ @Override
+ public void onDeviceStationaryChanged(boolean isStationary) {
+ if (isStationary == motionExpected) {
+ fail("Unexpected device stationary status: " + isStationary);
+ }
+ this.isStationary = isStationary;
+ }
+ }
+
@Before
public void setUp() {
mMockingSession = mockitoSession()
@@ -255,8 +297,6 @@ public class DeviceIdleControllerTest {
doReturn(true).when(mSensorManager).registerListener(any(), any(), anyInt());
mAppStateTracker = new AppStateTrackerForTest(getContext(), Looper.getMainLooper());
mAnyMotionDetector = new AnyMotionDetectorForTest();
- mHandler = mock(DeviceIdleController.MyHandler.class, Answers.RETURNS_DEEP_STUBS);
- doNothing().when(mHandler).handleMessage(any());
mInjector = new InjectorForTest(getContext());
doNothing().when(mContentResolver).registerContentObserver(any(), anyBoolean(), any());
@@ -1607,6 +1647,86 @@ public class DeviceIdleControllerTest {
1.0f, curfactor, delta);
}
+ @Test
+ public void testStationaryDetection_QuickDozeOff() {
+ setQuickDozeEnabled(false);
+ enterDeepState(STATE_IDLE);
+ // Regular progression through states, so time should have increased appropriately.
+ mInjector.nowElapsed += mConstants.IDLE_AFTER_INACTIVE_TIMEOUT + mConstants.SENSING_TIMEOUT
+ + mConstants.LOCATING_TIMEOUT;
+
+ StationaryListenerForTest stationaryListener = new StationaryListenerForTest();
+
+ mDeviceIdleController.registerStationaryListener(stationaryListener);
+
+ // Go to IDLE_MAINTENANCE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+
+ // Back to IDLE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+ assertTrue(stationaryListener.isStationary);
+
+ // Test motion
+ stationaryListener.motionExpected = true;
+ mDeviceIdleController.mMotionListener.onTrigger(null);
+ assertFalse(stationaryListener.isStationary);
+ }
+
+ @Test
+ public void testStationaryDetection_QuickDozeOn() {
+ setAlarmSoon(false);
+ enterDeepState(STATE_QUICK_DOZE_DELAY);
+ mDeviceIdleController.stepIdleStateLocked("testing");
+ verifyStateConditions(STATE_IDLE);
+ // Quick doze progression through states, so time should have increased appropriately.
+ mInjector.nowElapsed += mConstants.QUICK_DOZE_DELAY_TIMEOUT;
+ final ArgumentCaptor<AlarmManager.OnAlarmListener> alarmListener = ArgumentCaptor
+ .forClass(AlarmManager.OnAlarmListener.class);
+ doNothing().when(mAlarmManager).set(anyInt(), anyLong(), eq("DeviceIdleController.motion"),
+ alarmListener.capture(), any());
+
+ StationaryListenerForTest stationaryListener = new StationaryListenerForTest();
+
+ stationaryListener.motionExpected = true;
+ mDeviceIdleController.registerStationaryListener(stationaryListener);
+ assertFalse(stationaryListener.isStationary);
+
+ // Go to IDLE_MAINTENANCE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+
+ mInjector.nowElapsed += mConstants.MOTION_INACTIVE_TIMEOUT / 2;
+
+ // Back to IDLE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+
+ // Now enough time has passed.
+ mInjector.nowElapsed += mConstants.MOTION_INACTIVE_TIMEOUT / 2;
+ stationaryListener.motionExpected = false;
+ alarmListener.getValue().onAlarm();
+ assertTrue(stationaryListener.isStationary);
+
+ stationaryListener.motionExpected = true;
+ mDeviceIdleController.mMotionListener.onSensorChanged(null);
+ assertFalse(stationaryListener.isStationary);
+
+ // Since we're in quick doze, the device shouldn't stop idling.
+ verifyStateConditions(STATE_IDLE);
+
+ // Go to IDLE_MAINTENANCE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+
+ mInjector.nowElapsed += mConstants.MOTION_INACTIVE_TIMEOUT / 2;
+
+ // Back to IDLE
+ mDeviceIdleController.stepIdleStateLocked("testing");
+
+ // Now enough time has passed.
+ mInjector.nowElapsed += mConstants.MOTION_INACTIVE_TIMEOUT / 2;
+ stationaryListener.motionExpected = false;
+ alarmListener.getValue().onAlarm();
+ assertTrue(stationaryListener.isStationary);
+ }
+
private void enterDeepState(int state) {
switch (state) {
case STATE_ACTIVE:
diff --git a/services/tests/servicestests/Android.bp b/services/tests/servicestests/Android.bp
index ecddeb3dda61..eecdeed2cd25 100644
--- a/services/tests/servicestests/Android.bp
+++ b/services/tests/servicestests/Android.bp
@@ -74,7 +74,7 @@ android_test {
"libui",
"libunwindstack",
"libutils",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
dxflags: ["--multi-dex"],
diff --git a/services/tests/servicestests/res/raw/apex_test.apex b/services/tests/servicestests/res/raw/apex_test.apex
new file mode 100644
index 000000000000..19b1c5e2e1c6
--- /dev/null
+++ b/services/tests/servicestests/res/raw/apex_test.apex
Binary files differ
diff --git a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
index 4a9dd9776a1b..0605d9e18069 100644
--- a/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/DynamicSystemServiceTest.java
@@ -36,7 +36,7 @@ public class DynamicSystemServiceTest extends AndroidTestCase {
public void test1() {
assertTrue("dynamic_system service available", mService != null);
try {
- mService.startInstallation(1 << 20, 8 << 30);
+ mService.startInstallation("userdata", 8L << 30, false);
fail("DynamicSystemService did not throw SecurityException as expected");
} catch (SecurityException e) {
// expected
diff --git a/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
new file mode 100644
index 000000000000..6bb4202fa759
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/pm/ApexManagerTest.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.pm;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertThrows;
+
+import android.apex.ApexInfo;
+import android.apex.ApexSessionInfo;
+import android.apex.IApexService;
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.os.FileUtils;
+import android.os.RemoteException;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.frameworks.servicestests.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+@SmallTest
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class ApexManagerTest {
+ private static final String TEST_APEX_PKG = "com.android.apex.test";
+ private static final int TEST_SESSION_ID = 99999999;
+ private static final int[] TEST_CHILD_SESSION_ID = {8888, 7777};
+ private ApexManager mApexManager;
+ private Context mContext;
+
+ private IApexService mApexService = mock(IApexService.class);
+
+ @Before
+ public void setUp() throws RemoteException {
+ mContext = InstrumentationRegistry.getInstrumentation().getContext();
+ mApexManager = new ApexManager.ApexManagerImpl(mContext, mApexService);
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsMatchActivePackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+ final PackageInfo activePkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
+
+ assertThat(activePkgPi).isNotNull();
+ assertThat(activePkgPi.packageName).contains(TEST_APEX_PKG);
+
+ final PackageInfo factoryPkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_FACTORY_PACKAGE);
+
+ assertThat(factoryPkgPi).isNull();
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsMatchFactoryPackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+ PackageInfo factoryPkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_FACTORY_PACKAGE);
+
+ assertThat(factoryPkgPi).isNotNull();
+ assertThat(factoryPkgPi.packageName).contains(TEST_APEX_PKG);
+
+ final PackageInfo activePkgPi = mApexManager.getPackageInfo(TEST_APEX_PKG,
+ ApexManager.MATCH_ACTIVE_PACKAGE);
+
+ assertThat(activePkgPi).isNull();
+ }
+
+ @Test
+ public void testGetPackageInfo_setFlagsNone() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getPackageInfo(TEST_APEX_PKG, 0)).isNull();
+ }
+
+ @Test
+ public void testGetActivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, true));
+
+ assertThat(mApexManager.getActivePackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetActivePackages_noneActivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getActivePackages()).isEmpty();
+ }
+
+ @Test
+ public void testGetFactoryPackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getFactoryPackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetFactoryPackages_noneFactoryPackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+
+ assertThat(mApexManager.getFactoryPackages()).isEmpty();
+ }
+
+ @Test
+ public void testGetInactivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.getInactivePackages()).isNotEmpty();
+ }
+
+ @Test
+ public void testGetInactivePackages_noneInactivePackages() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(true, false));
+
+ assertThat(mApexManager.getInactivePackages()).isEmpty();
+ }
+
+ @Test
+ public void testIsApexPackage() throws RemoteException {
+ when(mApexService.getAllPackages()).thenReturn(createApexInfo(false, true));
+
+ assertThat(mApexManager.isApexPackage(TEST_APEX_PKG)).isTrue();
+ }
+
+ @Test
+ public void testIsApexSupported() {
+ assertThat(mApexManager.isApexSupported()).isTrue();
+ }
+
+ @Test
+ public void testGetStagedSessionInfo() throws RemoteException {
+ when(mApexService.getStagedSessionInfo(anyInt())).thenReturn(
+ getFakeStagedSessionInfo());
+
+ mApexManager.getStagedSessionInfo(TEST_SESSION_ID);
+ verify(mApexService, times(1)).getStagedSessionInfo(TEST_SESSION_ID);
+ }
+
+ @Test
+ public void testGetStagedSessionInfo_unKnownStagedSessionId() throws RemoteException {
+ when(mApexService.getStagedSessionInfo(anyInt())).thenReturn(
+ getFakeUnknownSessionInfo());
+
+ assertThat(mApexManager.getStagedSessionInfo(TEST_SESSION_ID)).isNull();
+ }
+
+ @Test
+ public void testSubmitStagedSession_throwPackageManagerException() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).submitStagedSession(anyInt(), any(), any());
+
+ assertThrows(PackageManagerException.class,
+ () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));
+ }
+
+ @Test
+ public void testSubmitStagedSession_throwRunTimeException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).submitStagedSession(anyInt(), any(),
+ any());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.submitStagedSession(TEST_SESSION_ID, TEST_CHILD_SESSION_ID));
+ }
+
+ @Test
+ public void testMarkStagedSessionReady_throwPackageManagerException() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).markStagedSessionReady(anyInt());
+
+ assertThrows(PackageManagerException.class,
+ () -> mApexManager.markStagedSessionReady(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testMarkStagedSessionReady_throwRunTimeException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).markStagedSessionReady(anyInt());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.markStagedSessionReady(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testAbortActiveSession_remoteException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).abortActiveSession();
+
+ try {
+ assertThat(mApexManager.abortActiveSession()).isFalse();
+ } catch (Exception e) {
+ throw new AssertionError("ApexManager should not raise Exception");
+ }
+ }
+
+ @Test
+ public void testMarkStagedSessionSuccessful_throwRemoteException() throws RemoteException {
+ doThrow(RemoteException.class).when(mApexService).markStagedSessionSuccessful(anyInt());
+
+ assertThrows(RuntimeException.class,
+ () -> mApexManager.markStagedSessionSuccessful(TEST_SESSION_ID));
+ }
+
+ @Test
+ public void testUninstallApex_throwException_returnFalse() throws RemoteException {
+ doAnswer(invocation -> {
+ throw new Exception();
+ }).when(mApexService).unstagePackages(any());
+
+ assertThat(mApexManager.uninstallApex(TEST_APEX_PKG)).isFalse();
+ }
+
+ private ApexInfo[] createApexInfo(boolean isActive, boolean isFactory) {
+ File apexFile = copyRawResourceToFile(TEST_APEX_PKG, R.raw.apex_test);
+ ApexInfo apexInfo = new ApexInfo();
+ apexInfo.isActive = isActive;
+ apexInfo.isFactory = isFactory;
+ apexInfo.moduleName = TEST_APEX_PKG;
+ apexInfo.modulePath = apexFile.getPath();
+ apexInfo.versionCode = 191000070;
+
+ return new ApexInfo[]{apexInfo};
+ }
+
+ private ApexSessionInfo getFakeStagedSessionInfo() {
+ ApexSessionInfo stagedSessionInfo = new ApexSessionInfo();
+ stagedSessionInfo.sessionId = TEST_SESSION_ID;
+ stagedSessionInfo.isStaged = true;
+
+ return stagedSessionInfo;
+ }
+
+ private ApexSessionInfo getFakeUnknownSessionInfo() {
+ ApexSessionInfo stagedSessionInfo = new ApexSessionInfo();
+ stagedSessionInfo.sessionId = TEST_SESSION_ID;
+ stagedSessionInfo.isUnknown = true;
+
+ return stagedSessionInfo;
+ }
+
+ /**
+ * Copies a specified {@code resourceId} to a temp file. Returns a non-null file if the copy
+ * succeeded
+ */
+ File copyRawResourceToFile(String baseName, int resourceId) {
+ File outFile;
+ try {
+ outFile = File.createTempFile(baseName, ".apex");
+ } catch (IOException e) {
+ throw new AssertionError("CreateTempFile IOException" + e);
+ }
+
+ try (InputStream is = mContext.getResources().openRawResource(resourceId);
+ FileOutputStream os = new FileOutputStream(outFile)) {
+ assertThat(FileUtils.copy(is, os)).isGreaterThan(0L);
+ } catch (FileNotFoundException e) {
+ throw new AssertionError("File not found exception " + e);
+ } catch (IOException e) {
+ throw new AssertionError("IOException" + e);
+ }
+
+ return outFile;
+ }
+}
diff --git a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java
index 806c71a7a9b8..6d5b994a63bb 100644
--- a/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java
+++ b/services/tests/servicestests/src/com/android/server/pm/UserManagerServiceUserInfoTest.java
@@ -132,6 +132,7 @@ public class UserManagerServiceUserInfoTest {
user.profileBadge = 2;
user.partial = true;
user.guestToRemove = true;
+ user.preCreated = true;
return user;
}
@@ -147,5 +148,6 @@ public class UserManagerServiceUserInfoTest {
assertEquals("profile badge not preseved", one.profileBadge, two.profileBadge);
assertEquals("partial not preseved", one.partial, two.partial);
assertEquals("guestToRemove not preseved", one.guestToRemove, two.guestToRemove);
+ assertEquals("preCreated not preseved", one.preCreated, two.preCreated);
}
}
diff --git a/services/tests/uiservicestests/Android.bp b/services/tests/uiservicestests/Android.bp
index 4a9cef1f1cbd..92198fa8cb0c 100644
--- a/services/tests/uiservicestests/Android.bp
+++ b/services/tests/uiservicestests/Android.bp
@@ -55,6 +55,6 @@ android_test {
"libui",
"libunwindstack",
"libutils",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
}
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
index e15af3dbecc4..0b4760d89686 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationComparatorTest.java
@@ -68,6 +68,7 @@ public class NotificationComparatorTest extends UiServiceTestCase {
private final int uid2 = 1111111;
private static final String TEST_CHANNEL_ID = "test_channel_id";
+ private NotificationRecord mRecordMinCallNonInterruptive;
private NotificationRecord mRecordMinCall;
private NotificationRecord mRecordHighCall;
private NotificationRecord mRecordDefaultMedia;
@@ -105,6 +106,18 @@ public class NotificationComparatorTest extends UiServiceTestCase {
smsPkg = Settings.Secure.getString(mContext.getContentResolver(),
Settings.Secure.SMS_DEFAULT_APPLICATION);
+ Notification nonInterruptiveNotif = new Notification.Builder(mContext, TEST_CHANNEL_ID)
+ .setCategory(Notification.CATEGORY_CALL)
+ .setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
+ .build();
+ mRecordMinCallNonInterruptive = new NotificationRecord(mContext,
+ new StatusBarNotification(callPkg,
+ callPkg, 1, "mRecordMinCallNonInterruptive", callUid, callUid,
+ nonInterruptiveNotif,
+ new UserHandle(userId), "", 2000), getDefaultChannel());
+ mRecordMinCallNonInterruptive.setSystemImportance(NotificationManager.IMPORTANCE_MIN);
+ mRecordMinCallNonInterruptive.setInterruptive(false);
+
Notification n1 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
.setCategory(Notification.CATEGORY_CALL)
.setFlag(Notification.FLAG_FOREGROUND_SERVICE, true)
@@ -113,6 +126,7 @@ public class NotificationComparatorTest extends UiServiceTestCase {
callPkg, 1, "minCall", callUid, callUid, n1,
new UserHandle(userId), "", 2000), getDefaultChannel());
mRecordMinCall.setSystemImportance(NotificationManager.IMPORTANCE_MIN);
+ mRecordMinCall.setInterruptive(true);
Notification n2 = new Notification.Builder(mContext, TEST_CHANNEL_ID)
.setCategory(Notification.CATEGORY_CALL)
@@ -245,6 +259,7 @@ public class NotificationComparatorTest extends UiServiceTestCase {
expected.add(mRecordCheater);
expected.add(mRecordCheaterColorized);
expected.add(mRecordMinCall);
+ expected.add(mRecordMinCallNonInterruptive);
List<NotificationRecord> actual = new ArrayList<>();
actual.addAll(expected);
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
index 397d2155beeb..a9fe1a62b558 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationListenerServiceTest.java
@@ -51,6 +51,8 @@ import android.service.notification.NotificationRankingUpdate;
import android.service.notification.SnoozeCriterion;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.server.UiServiceTestCase;
import org.junit.After;
@@ -61,8 +63,6 @@ import org.junit.runner.RunWith;
import java.util.ArrayList;
import java.util.List;
-import androidx.test.runner.AndroidJUnit4;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class NotificationListenerServiceTest extends UiServiceTestCase {
@@ -116,6 +116,7 @@ public class NotificationListenerServiceTest extends UiServiceTestCase {
assertActionsEqual(getSmartActions(key, i), ranking.getSmartActions());
assertEquals(getSmartReplies(key, i), ranking.getSmartReplies());
assertEquals(canBubble(i), ranking.canBubble());
+ assertEquals(visuallyInterruptive(i), ranking.visuallyInterruptive());
}
}
@@ -182,7 +183,8 @@ public class NotificationListenerServiceTest extends UiServiceTestCase {
tweak.isNoisy(),
(ArrayList) tweak.getSmartActions(),
(ArrayList) tweak.getSmartReplies(),
- tweak.canBubble()
+ tweak.canBubble(),
+ tweak.visuallyInterruptive()
);
assertNotEquals(nru, nru2);
}
@@ -258,7 +260,8 @@ public class NotificationListenerServiceTest extends UiServiceTestCase {
getNoisy(i),
getSmartActions(key, i),
getSmartReplies(key, i),
- canBubble(i)
+ canBubble(i),
+ visuallyInterruptive(i)
);
rankings[i] = ranking;
}
@@ -363,6 +366,10 @@ public class NotificationListenerServiceTest extends UiServiceTestCase {
return index % 4 == 0;
}
+ private boolean visuallyInterruptive(int index) {
+ return index % 4 == 0;
+ }
+
private void assertActionsEqual(
List<Notification.Action> expecteds, List<Notification.Action> actuals) {
assertEquals(expecteds.size(), actuals.size());
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationShellCmdTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationShellCmdTest.java
index fa90b291eeee..0d44318e4aaa 100644
--- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationShellCmdTest.java
+++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationShellCmdTest.java
@@ -116,8 +116,8 @@ public class NotificationShellCmdTest extends UiServiceTestCase {
ArgumentCaptor<Notification> notificationCaptor =
ArgumentCaptor.forClass(Notification.class);
verify(mMockBinderService).enqueueNotificationWithTag(
- eq(NotificationShellCmd.NOTIFICATION_PACKAGE),
- eq("android"),
+ eq(getContext().getPackageName()),
+ eq(getContext().getPackageName()),
eq(aTag),
eq(NotificationShellCmd.NOTIFICATION_ID),
notificationCaptor.capture(),
diff --git a/startop/view_compiler/Android.bp b/startop/view_compiler/Android.bp
index c380d291d573..7cc233b2439e 100644
--- a/startop/view_compiler/Android.bp
+++ b/startop/view_compiler/Android.bp
@@ -16,7 +16,6 @@
cc_defaults {
name: "viewcompiler_defaults",
- defaults: ["libdexfile_static_defaults"],
header_libs: [
"libbase_headers",
],
@@ -30,6 +29,7 @@ cc_defaults {
"liblog",
"libutils",
"libziparchive",
+ "libz",
],
cppflags: ["-std=c++17"],
target: {
diff --git a/startop/view_compiler/dex_builder.cc b/startop/view_compiler/dex_builder.cc
index 48b44d0fc99b..50cf5a50d7a8 100644
--- a/startop/view_compiler/dex_builder.cc
+++ b/startop/view_compiler/dex_builder.cc
@@ -16,8 +16,6 @@
#include "dex_builder.h"
-#include "dex/descriptors_names.h"
-
#include <fstream>
#include <memory>
@@ -30,8 +28,6 @@ using std::string;
using ::dex::kAccPublic;
using Op = Instruction::Op;
-using Opcode = ::art::Instruction::Code;
-
const TypeDescriptor TypeDescriptor::Int() { return TypeDescriptor{"I"}; };
const TypeDescriptor TypeDescriptor::Void() { return TypeDescriptor{"V"}; };
@@ -43,20 +39,29 @@ constexpr uint8_t kDexFileMagic[]{0x64, 0x65, 0x78, 0x0a, 0x30, 0x33, 0x38, 0x00
constexpr size_t kMaxEncodedStringLength{5};
// Converts invoke-* to invoke-*/range
-constexpr Opcode InvokeToInvokeRange(Opcode opcode) {
+constexpr ::dex::Opcode InvokeToInvokeRange(::dex::Opcode opcode) {
switch (opcode) {
- case ::art::Instruction::INVOKE_VIRTUAL:
- return ::art::Instruction::INVOKE_VIRTUAL_RANGE;
- case ::art::Instruction::INVOKE_DIRECT:
- return ::art::Instruction::INVOKE_DIRECT_RANGE;
- case ::art::Instruction::INVOKE_STATIC:
- return ::art::Instruction::INVOKE_STATIC_RANGE;
- case ::art::Instruction::INVOKE_INTERFACE:
- return ::art::Instruction::INVOKE_INTERFACE_RANGE;
+ case ::dex::Opcode::OP_INVOKE_VIRTUAL:
+ return ::dex::Opcode::OP_INVOKE_VIRTUAL_RANGE;
+ case ::dex::Opcode::OP_INVOKE_DIRECT:
+ return ::dex::Opcode::OP_INVOKE_DIRECT_RANGE;
+ case ::dex::Opcode::OP_INVOKE_STATIC:
+ return ::dex::Opcode::OP_INVOKE_STATIC_RANGE;
+ case ::dex::Opcode::OP_INVOKE_INTERFACE:
+ return ::dex::Opcode::OP_INVOKE_INTERFACE_RANGE;
default:
LOG(FATAL) << opcode << " is not a recognized invoke opcode.";
- UNREACHABLE();
+ __builtin_unreachable();
+ }
+}
+
+std::string DotToDescriptor(const char* class_name) {
+ std::string descriptor(class_name);
+ std::replace(descriptor.begin(), descriptor.end(), '.', '/');
+ if (descriptor.length() > 0 && descriptor[0] != '[') {
+ descriptor = "L" + descriptor + ";";
}
+ return descriptor;
}
} // namespace
@@ -178,7 +183,7 @@ void WriteTestDexFile(const string& filename) {
}
TypeDescriptor TypeDescriptor::FromClassname(const std::string& name) {
- return TypeDescriptor{art::DotToDescriptor(name.c_str())};
+ return TypeDescriptor{DotToDescriptor(name.c_str())};
}
DexBuilder::DexBuilder() : dex_file_{std::make_shared<ir::DexFile>()} {
@@ -219,11 +224,11 @@ ir::String* DexBuilder::GetOrAddString(const std::string& string) {
ClassBuilder DexBuilder::MakeClass(const std::string& name) {
auto* class_def = Alloc<ir::Class>();
- ir::Type* type_def = GetOrAddType(art::DotToDescriptor(name.c_str()));
+ ir::Type* type_def = GetOrAddType(DotToDescriptor(name.c_str()));
type_def->class_def = class_def;
class_def->type = type_def;
- class_def->super_class = GetOrAddType(art::DotToDescriptor("java.lang.Object"));
+ class_def->super_class = GetOrAddType(DotToDescriptor("java.lang.Object"));
class_def->access_flags = kAccPublic;
return ClassBuilder{this, name, class_def};
}
@@ -378,26 +383,26 @@ void MethodBuilder::EncodeInstructions() {
void MethodBuilder::EncodeInstruction(const Instruction& instruction) {
switch (instruction.opcode()) {
case Instruction::Op::kReturn:
- return EncodeReturn(instruction, ::art::Instruction::RETURN);
+ return EncodeReturn(instruction, ::dex::Opcode::OP_RETURN);
case Instruction::Op::kReturnObject:
- return EncodeReturn(instruction, ::art::Instruction::RETURN_OBJECT);
+ return EncodeReturn(instruction, ::dex::Opcode::OP_RETURN_OBJECT);
case Instruction::Op::kMove:
case Instruction::Op::kMoveObject:
return EncodeMove(instruction);
case Instruction::Op::kInvokeVirtual:
- return EncodeInvoke(instruction, art::Instruction::INVOKE_VIRTUAL);
+ return EncodeInvoke(instruction, ::dex::Opcode::OP_INVOKE_VIRTUAL);
case Instruction::Op::kInvokeDirect:
- return EncodeInvoke(instruction, art::Instruction::INVOKE_DIRECT);
+ return EncodeInvoke(instruction, ::dex::Opcode::OP_INVOKE_DIRECT);
case Instruction::Op::kInvokeStatic:
- return EncodeInvoke(instruction, art::Instruction::INVOKE_STATIC);
+ return EncodeInvoke(instruction, ::dex::Opcode::OP_INVOKE_STATIC);
case Instruction::Op::kInvokeInterface:
- return EncodeInvoke(instruction, art::Instruction::INVOKE_INTERFACE);
+ return EncodeInvoke(instruction, ::dex::Opcode::OP_INVOKE_INTERFACE);
case Instruction::Op::kBindLabel:
return BindLabel(instruction.args()[0]);
case Instruction::Op::kBranchEqz:
- return EncodeBranch(art::Instruction::IF_EQZ, instruction);
+ return EncodeBranch(::dex::Opcode::OP_IF_EQZ, instruction);
case Instruction::Op::kBranchNEqz:
- return EncodeBranch(art::Instruction::IF_NEZ, instruction);
+ return EncodeBranch(::dex::Opcode::OP_IF_NEZ, instruction);
case Instruction::Op::kNew:
return EncodeNew(instruction);
case Instruction::Op::kCheckCast:
@@ -410,10 +415,10 @@ void MethodBuilder::EncodeInstruction(const Instruction& instruction) {
}
}
-void MethodBuilder::EncodeReturn(const Instruction& instruction, ::art::Instruction::Code opcode) {
+void MethodBuilder::EncodeReturn(const Instruction& instruction, ::dex::Opcode opcode) {
CHECK(!instruction.dest().has_value());
if (instruction.args().size() == 0) {
- Encode10x(art::Instruction::RETURN_VOID);
+ Encode10x(::dex::Opcode::OP_RETURN_VOID);
} else {
CHECK_EQ(1, instruction.args().size());
size_t source = RegisterValue(instruction.args()[0]);
@@ -433,27 +438,27 @@ void MethodBuilder::EncodeMove(const Instruction& instruction) {
if (source.is_immediate()) {
// TODO: support more registers
CHECK_LT(RegisterValue(*instruction.dest()), 16);
- Encode11n(art::Instruction::CONST_4, RegisterValue(*instruction.dest()), source.value());
+ Encode11n(::dex::Opcode::OP_CONST_4, RegisterValue(*instruction.dest()), source.value());
} else if (source.is_string()) {
constexpr size_t kMaxRegisters = 256;
CHECK_LT(RegisterValue(*instruction.dest()), kMaxRegisters);
CHECK_LT(source.value(), 65536); // make sure we don't need a jumbo string
- Encode21c(::art::Instruction::CONST_STRING, RegisterValue(*instruction.dest()), source.value());
+ Encode21c(::dex::Opcode::OP_CONST_STRING, RegisterValue(*instruction.dest()), source.value());
} else if (source.is_variable()) {
// For the moment, we only use this when we need to reshuffle registers for
// an invoke instruction, meaning we are too big for the 4-bit version.
// We'll err on the side of caution and always generate the 16-bit form of
// the instruction.
- Opcode opcode = instruction.opcode() == Instruction::Op::kMove
- ? ::art::Instruction::MOVE_16
- : ::art::Instruction::MOVE_OBJECT_16;
+ auto opcode = instruction.opcode() == Instruction::Op::kMove
+ ? ::dex::Opcode::OP_MOVE_16
+ : ::dex::Opcode::OP_MOVE_OBJECT_16;
Encode32x(opcode, RegisterValue(*instruction.dest()), RegisterValue(source));
} else {
UNIMPLEMENTED(FATAL);
}
}
-void MethodBuilder::EncodeInvoke(const Instruction& instruction, ::art::Instruction::Code opcode) {
+void MethodBuilder::EncodeInvoke(const Instruction& instruction, ::dex::Opcode opcode) {
constexpr size_t kMaxArgs = 5;
// Currently, we only support up to 5 arguments.
@@ -480,8 +485,8 @@ void MethodBuilder::EncodeInvoke(const Instruction& instruction, ::art::Instruct
for (size_t i = 0; i < instruction.args().size(); ++i) {
Instruction::Op move_op;
- if (opcode == ::art::Instruction::INVOKE_VIRTUAL ||
- opcode == ::art::Instruction::INVOKE_DIRECT) {
+ if (opcode == ::dex::Opcode::OP_INVOKE_VIRTUAL ||
+ opcode == ::dex::Opcode::OP_INVOKE_DIRECT) {
// In this case, there is an implicit `this` argument, which is always an object.
if (i == 0) {
move_op = Instruction::Op::kMoveObject;
@@ -514,8 +519,8 @@ void MethodBuilder::EncodeInvoke(const Instruction& instruction, ::art::Instruct
// If there is a return value, add a move-result instruction
if (instruction.dest().has_value()) {
- Encode11x(instruction.result_is_object() ? art::Instruction::MOVE_RESULT_OBJECT
- : art::Instruction::MOVE_RESULT,
+ Encode11x(instruction.result_is_object() ? ::dex::Opcode::OP_MOVE_RESULT_OBJECT
+ : ::dex::Opcode::OP_MOVE_RESULT,
RegisterValue(*instruction.dest()));
}
@@ -523,7 +528,7 @@ void MethodBuilder::EncodeInvoke(const Instruction& instruction, ::art::Instruct
}
// Encodes a conditional branch that tests a single argument.
-void MethodBuilder::EncodeBranch(art::Instruction::Code op, const Instruction& instruction) {
+void MethodBuilder::EncodeBranch(::dex::Opcode op, const Instruction& instruction) {
const auto& args = instruction.args();
const auto& test_value = args[0];
const auto& branch_target = args[1];
@@ -546,7 +551,7 @@ void MethodBuilder::EncodeNew(const Instruction& instruction) {
const Value& type = instruction.args()[0];
CHECK_LT(RegisterValue(*instruction.dest()), 256);
CHECK(type.is_type());
- Encode21c(::art::Instruction::NEW_INSTANCE, RegisterValue(*instruction.dest()), type.value());
+ Encode21c(::dex::Opcode::OP_NEW_INSTANCE, RegisterValue(*instruction.dest()), type.value());
}
void MethodBuilder::EncodeCast(const Instruction& instruction) {
@@ -558,7 +563,7 @@ void MethodBuilder::EncodeCast(const Instruction& instruction) {
const Value& type = instruction.args()[0];
CHECK_LT(RegisterValue(*instruction.dest()), 256);
CHECK(type.is_type());
- Encode21c(::art::Instruction::CHECK_CAST, RegisterValue(*instruction.dest()), type.value());
+ Encode21c(::dex::Opcode::OP_CHECK_CAST, RegisterValue(*instruction.dest()), type.value());
}
void MethodBuilder::EncodeFieldOp(const Instruction& instruction) {
@@ -569,7 +574,7 @@ void MethodBuilder::EncodeFieldOp(const Instruction& instruction) {
CHECK(instruction.dest()->is_variable());
CHECK_EQ(0, instruction.args().size());
- Encode21c(::art::Instruction::SGET,
+ Encode21c(::dex::Opcode::OP_SGET,
RegisterValue(*instruction.dest()),
instruction.index_argument());
break;
@@ -579,7 +584,7 @@ void MethodBuilder::EncodeFieldOp(const Instruction& instruction) {
CHECK_EQ(1, args.size());
CHECK(args[0].is_variable());
- Encode21c(::art::Instruction::SPUT, RegisterValue(args[0]), instruction.index_argument());
+ Encode21c(::dex::Opcode::OP_SPUT, RegisterValue(args[0]), instruction.index_argument());
break;
}
case Instruction::Op::kGetInstanceField: {
@@ -587,7 +592,7 @@ void MethodBuilder::EncodeFieldOp(const Instruction& instruction) {
CHECK(instruction.dest()->is_variable());
CHECK_EQ(1, instruction.args().size());
- Encode22c(::art::Instruction::IGET,
+ Encode22c(::dex::Opcode::OP_IGET,
RegisterValue(*instruction.dest()),
RegisterValue(args[0]),
instruction.index_argument());
@@ -599,7 +604,7 @@ void MethodBuilder::EncodeFieldOp(const Instruction& instruction) {
CHECK(args[0].is_variable());
CHECK(args[1].is_variable());
- Encode22c(::art::Instruction::IPUT,
+ Encode22c(::dex::Opcode::OP_IPUT,
RegisterValue(args[1]),
RegisterValue(args[0]),
instruction.index_argument());
diff --git a/startop/view_compiler/dex_builder.h b/startop/view_compiler/dex_builder.h
index 3924e77fab59..eb2dc88835d4 100644
--- a/startop/view_compiler/dex_builder.h
+++ b/startop/view_compiler/dex_builder.h
@@ -24,7 +24,9 @@
#include <unordered_map>
#include <vector>
-#include "dex/dex_instruction.h"
+#include "android-base/logging.h"
+
+#include "slicer/dex_bytecode.h"
#include "slicer/dex_ir.h"
#include "slicer/writer.h"
@@ -364,11 +366,11 @@ class MethodBuilder {
// Encodes a return instruction. For instructions with no return value, the opcode field is
// ignored. Otherwise, this specifies which return instruction will be used (return,
// return-object, etc.)
- void EncodeReturn(const Instruction& instruction, ::art::Instruction::Code opcode);
+ void EncodeReturn(const Instruction& instruction, ::dex::Opcode opcode);
void EncodeMove(const Instruction& instruction);
- void EncodeInvoke(const Instruction& instruction, ::art::Instruction::Code opcode);
- void EncodeBranch(art::Instruction::Code op, const Instruction& instruction);
+ void EncodeInvoke(const Instruction& instruction, ::dex::Opcode opcode);
+ void EncodeBranch(::dex::Opcode op, const Instruction& instruction);
void EncodeNew(const Instruction& instruction);
void EncodeCast(const Instruction& instruction);
void EncodeFieldOp(const Instruction& instruction);
@@ -377,17 +379,23 @@ class MethodBuilder {
// https://source.android.com/devices/tech/dalvik/instruction-formats for documentation of
// formats.
- inline void Encode10x(art::Instruction::Code opcode) {
+ inline uint8_t ToBits(::dex::Opcode opcode) {
+ static_assert(sizeof(uint8_t) == sizeof(::dex::Opcode));
+ return static_cast<uint8_t>(opcode);
+ }
+
+ inline void Encode10x(::dex::Opcode opcode) {
// 00|op
- buffer_.push_back(opcode);
+ static_assert(sizeof(uint8_t) == sizeof(::dex::Opcode));
+ buffer_.push_back(ToBits(opcode));
}
- inline void Encode11x(art::Instruction::Code opcode, uint8_t a) {
+ inline void Encode11x(::dex::Opcode opcode, uint8_t a) {
// aa|op
- buffer_.push_back((a << 8) | opcode);
+ buffer_.push_back((a << 8) | ToBits(opcode));
}
- inline void Encode11n(art::Instruction::Code opcode, uint8_t a, int8_t b) {
+ inline void Encode11n(::dex::Opcode opcode, uint8_t a, int8_t b) {
// b|a|op
// Make sure the fields are in bounds (4 bits for a, 4 bits for b).
@@ -395,30 +403,30 @@ class MethodBuilder {
CHECK_LE(-8, b);
CHECK_LT(b, 8);
- buffer_.push_back(((b & 0xf) << 12) | (a << 8) | opcode);
+ buffer_.push_back(((b & 0xf) << 12) | (a << 8) | ToBits(opcode));
}
- inline void Encode21c(art::Instruction::Code opcode, uint8_t a, uint16_t b) {
+ inline void Encode21c(::dex::Opcode opcode, uint8_t a, uint16_t b) {
// aa|op|bbbb
- buffer_.push_back((a << 8) | opcode);
+ buffer_.push_back((a << 8) | ToBits(opcode));
buffer_.push_back(b);
}
- inline void Encode22c(art::Instruction::Code opcode, uint8_t a, uint8_t b, uint16_t c) {
+ inline void Encode22c(::dex::Opcode opcode, uint8_t a, uint8_t b, uint16_t c) {
// b|a|op|bbbb
CHECK(IsShortRegister(a));
CHECK(IsShortRegister(b));
- buffer_.push_back((b << 12) | (a << 8) | opcode);
+ buffer_.push_back((b << 12) | (a << 8) | ToBits(opcode));
buffer_.push_back(c);
}
- inline void Encode32x(art::Instruction::Code opcode, uint16_t a, uint16_t b) {
- buffer_.push_back(opcode);
+ inline void Encode32x(::dex::Opcode opcode, uint16_t a, uint16_t b) {
+ buffer_.push_back(ToBits(opcode));
buffer_.push_back(a);
buffer_.push_back(b);
}
- inline void Encode35c(art::Instruction::Code opcode, size_t a, uint16_t b, uint8_t c, uint8_t d,
+ inline void Encode35c(::dex::Opcode opcode, size_t a, uint16_t b, uint8_t c, uint8_t d,
uint8_t e, uint8_t f, uint8_t g) {
// a|g|op|bbbb|f|e|d|c
@@ -428,14 +436,14 @@ class MethodBuilder {
CHECK(IsShortRegister(e));
CHECK(IsShortRegister(f));
CHECK(IsShortRegister(g));
- buffer_.push_back((a << 12) | (g << 8) | opcode);
+ buffer_.push_back((a << 12) | (g << 8) | ToBits(opcode));
buffer_.push_back(b);
buffer_.push_back((f << 12) | (e << 8) | (d << 4) | c);
}
- inline void Encode3rc(art::Instruction::Code opcode, size_t a, uint16_t b, uint16_t c) {
+ inline void Encode3rc(::dex::Opcode opcode, size_t a, uint16_t b, uint16_t c) {
CHECK_LE(a, 255);
- buffer_.push_back((a << 8) | opcode);
+ buffer_.push_back((a << 8) | ToBits(opcode));
buffer_.push_back(b);
buffer_.push_back(c);
}
diff --git a/telephony/java/com/android/internal/telephony/CallerInfo.java b/telecomm/java/android/telecom/CallerInfo.java
index 13539b855de2..a5d25e2ce4bb 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfo.java
+++ b/telecomm/java/android/telecom/CallerInfo.java
@@ -14,8 +14,9 @@
* limitations under the License.
*/
-package com.android.internal.telephony;
+package android.telecom;
+import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -32,17 +33,16 @@ import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.RawContacts;
import android.telephony.PhoneNumberUtils;
-import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import android.util.Log;
import com.android.i18n.phonenumbers.NumberParseException;
import com.android.i18n.phonenumbers.PhoneNumberUtil;
import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
import com.android.i18n.phonenumbers.geocoding.PhoneNumberOfflineGeocoder;
+import com.android.internal.annotations.VisibleForTesting;
import java.util.Locale;
@@ -53,9 +53,11 @@ import java.util.Locale;
*/
public class CallerInfo {
private static final String TAG = "CallerInfo";
- private static final boolean VDBG = Rlog.isLoggable(TAG, Log.VERBOSE);
+ private static final boolean VDBG = Log.VERBOSE;
+ /** @hide */
public static final long USER_TYPE_CURRENT = 0;
+ /** @hide */
public static final long USER_TYPE_WORK = 1;
/**
@@ -85,49 +87,61 @@ public class CallerInfo {
* field here, NOT name. We're NOT always guaranteed to have a name
* for a connection, but the number should be displayable.
*/
- @UnsupportedAppUsage
- public String name;
- @UnsupportedAppUsage
- public String phoneNumber;
+ private String name;
+ private String phoneNumber;
+ /** @hide */
public String normalizedNumber;
+ /** @hide */
public String geoDescription;
-
+ /** @hide */
public String cnapName;
+ /** @hide */
public int numberPresentation;
+ /** @hide */
public int namePresentation;
+ /** @hide */
public boolean contactExists;
-
+ /** @hide */
public String phoneLabel;
- /* Split up the phoneLabel into number type and label name */
+ /**
+ * Split up the phoneLabel into number type and label name.
+ * @hide
+ */
@UnsupportedAppUsage
public int numberType;
+ /** @hide */
@UnsupportedAppUsage
public String numberLabel;
-
+ /** @hide */
public int photoResource;
// Contact ID, which will be 0 if a contact comes from the corp CP2.
- @UnsupportedAppUsage
- public long contactIdOrZero;
+ private long contactIdOrZero;
+ /** @hide */
public boolean needUpdate;
+ /** @hide */
public Uri contactRefUri;
+ /** @hide */
public String lookupKey;
-
+ /** @hide */
public ComponentName preferredPhoneAccountComponent;
+ /** @hide */
public String preferredPhoneAccountId;
-
+ /** @hide */
public long userType;
/**
* Contact display photo URI. If a contact has no display photo but a thumbnail, it'll be
* the thumbnail URI instead.
*/
- public Uri contactDisplayPhotoUri;
+ private Uri contactDisplayPhotoUri;
// fields to hold individual contact preference data,
// including the send to voicemail flag and the ringtone
// uri reference.
+ /** @hide */
public Uri contactRingtoneUri;
+ /** @hide */
public boolean shouldSendToVoicemail;
/**
@@ -141,6 +155,8 @@ public class CallerInfo {
*
* The {@link #isCachedPhotoCurrent} flag indicates if the image
* data needs to be reloaded.
+ *
+ * @hide
*/
public Drawable cachedPhoto;
/**
@@ -153,18 +169,23 @@ public class CallerInfo {
*
* The {@link #isCachedPhotoCurrent} flag indicates if the image
* data needs to be reloaded.
+ *
+ * @hide
*/
public Bitmap cachedPhotoIcon;
/**
* Boolean which indicates if {@link #cachedPhoto} and
* {@link #cachedPhotoIcon} is fresh enough. If it is false,
* those images aren't pointing to valid objects.
+ *
+ * @hide
*/
public boolean isCachedPhotoCurrent;
private boolean mIsEmergency;
private boolean mIsVoiceMail;
+ /** @hide */
@UnsupportedAppUsage
public CallerInfo() {
// TODO: Move all the basic initialization here?
@@ -180,6 +201,8 @@ public class CallerInfo {
* @param cursor the first object in the cursor is used to build the CallerInfo object.
* @return the CallerInfo which contains the caller id for the given
* number. The returned CallerInfo is null if no number is supplied.
+ *
+ * @hide
*/
public static CallerInfo getCallerInfo(Context context, Uri contactRef, Cursor cursor) {
CallerInfo info = new CallerInfo();
@@ -192,7 +215,7 @@ public class CallerInfo {
info.contactExists = false;
info.userType = USER_TYPE_CURRENT;
- if (VDBG) Rlog.v(TAG, "getCallerInfo() based on cursor...");
+ if (VDBG) Log.v(TAG, "getCallerInfo() based on cursor...");
if (cursor != null) {
if (cursor.moveToFirst()) {
@@ -240,7 +263,7 @@ public class CallerInfo {
if (contactId != 0 && !Contacts.isEnterpriseContactId(contactId)) {
info.contactIdOrZero = contactId;
if (VDBG) {
- Rlog.v(TAG, "==> got info.contactIdOrZero: " + info.contactIdOrZero);
+ Log.v(TAG, "==> got info.contactIdOrZero: " + info.contactIdOrZero);
}
}
if (Contacts.isEnterpriseContactId(contactId)) {
@@ -248,7 +271,7 @@ public class CallerInfo {
}
} else {
// No valid columnIndex, so we can't look up person_id.
- Rlog.w(TAG, "Couldn't find contact_id column for " + contactRef);
+ Log.w(TAG, "Couldn't find contact_id column for " + contactRef);
// Watch out: this means that anything that depends on
// person_id will be broken (like contact photo lookups in
// the in-call UI, for example.)
@@ -321,6 +344,8 @@ public class CallerInfo {
* @param contactRef the URI used to lookup caller id
* @return the CallerInfo which contains the caller id for the given
* number. The returned CallerInfo is null if no number is supplied.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, Uri contactRef) {
@@ -331,7 +356,7 @@ public class CallerInfo {
info = getCallerInfo(context, contactRef,
cr.query(contactRef, null, null, null, null));
} catch (RuntimeException re) {
- Rlog.e(TAG, "Error getting caller info.", re);
+ Log.e(TAG, re, "Error getting caller info.");
}
}
return info;
@@ -346,10 +371,12 @@ public class CallerInfo {
* number. The returned CallerInfo is null if no number is supplied. If
* a matching number is not found, then a generic caller info is returned,
* with all relevant fields empty or null.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, String number) {
- if (VDBG) Rlog.v(TAG, "getCallerInfo() based on number...");
+ if (VDBG) Log.v(TAG, "getCallerInfo() based on number...");
int subId = SubscriptionManager.getDefaultSubscriptionId();
return getCallerInfo(context, number, subId);
@@ -365,6 +392,8 @@ public class CallerInfo {
* number. The returned CallerInfo is null if no number is supplied. If
* a matching number is not found, then a generic caller info is returned,
* with all relevant fields empty or null.
+ *
+ * @hide
*/
@UnsupportedAppUsage
public static CallerInfo getCallerInfo(Context context, String number, int subId) {
@@ -378,8 +407,8 @@ public class CallerInfo {
// shortcut and skip the query.
if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
return new CallerInfo().markAsEmergency(context);
- } else if (PhoneNumberUtils.isVoiceMailNumber(subId, number)) {
- return new CallerInfo().markAsVoiceMail();
+ } else if (PhoneNumberUtils.isVoiceMailNumber(null, subId, number)) {
+ return new CallerInfo().markAsVoiceMail(context, subId);
}
Uri contactUri = Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI,
@@ -398,6 +427,59 @@ public class CallerInfo {
}
/**
+ * @return Name assocaited with this caller.
+ */
+ @Nullable
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set caller Info Name.
+ * @param name caller Info Name
+ *
+ * @hide
+ */
+ public void setName(@Nullable String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Phone number assocaited with this caller.
+ */
+ @Nullable
+ public String getPhoneNumber() {
+ return phoneNumber;
+ }
+
+ /** @hide */
+ public void setPhoneNumber(String number) {
+ phoneNumber = number;
+ }
+
+ /**
+ * @return Contact ID, which will be 0 if a contact comes from the corp Contacts Provider.
+ */
+ public long getContactId() {
+ return contactIdOrZero;
+ }
+
+ /**
+ * @return Contact display photo URI. If a contact has no display photo but a thumbnail,
+ * it'll the thumbnail URI instead.
+ */
+ @Nullable
+ public Uri getContactDisplayPhotoUri() {
+ return contactDisplayPhotoUri;
+ }
+
+ /** @hide */
+ @VisibleForTesting
+ public void SetContactDisplayPhotoUri(Uri photoUri) {
+ contactDisplayPhotoUri = photoUri;
+ }
+
+ /**
* Performs another lookup if previous lookup fails and it's a SIP call
* and the peer's username is all numeric. Look up the username as it
* could be a PSTN number in the contact database.
@@ -425,6 +507,7 @@ public class CallerInfo {
/**
* @return true if the caller info is an emergency number.
+ * @hide
*/
public boolean isEmergencyNumber() {
return mIsEmergency;
@@ -432,6 +515,7 @@ public class CallerInfo {
/**
* @return true if the caller info is a voicemail number.
+ * @hide
*/
public boolean isVoiceMailNumber() {
return mIsVoiceMail;
@@ -458,36 +542,20 @@ public class CallerInfo {
}
- /**
- * Mark this CallerInfo as a voicemail call. The voicemail label
- * is obtained from the telephony manager. Caller must hold the
- * READ_PHONE_STATE permission otherwise the phoneNumber will be
- * set to null.
- * @return this instance.
- */
- // TODO: As in the emergency number handling, we end up writing a
- // string in the phone number field.
- /* package */ CallerInfo markAsVoiceMail() {
-
- int subId = SubscriptionManager.getDefaultSubscriptionId();
- return markAsVoiceMail(subId);
-
- }
-
- /* package */ CallerInfo markAsVoiceMail(int subId) {
+ /* package */ CallerInfo markAsVoiceMail(Context context, int subId) {
mIsVoiceMail = true;
try {
- String voiceMailLabel = TelephonyManager.getDefault().getVoiceMailAlphaTag(subId);
-
- phoneNumber = voiceMailLabel;
+ phoneNumber = context.getSystemService(TelephonyManager.class)
+ .createForSubscriptionId(subId)
+ .getVoiceMailAlphaTag();
} catch (SecurityException se) {
// Should never happen: if this process does not have
// permission to retrieve VM tag, it should not have
// permission to retrieve VM number and would not call
// this method.
// Leave phoneNumber untouched.
- Rlog.e(TAG, "Cannot access VoiceMail.", se);
+ Log.e(TAG, se, "Cannot access VoiceMail.");
}
// TODO: There is no voicemail picture?
// FIXME: FIND ANOTHER ICON
@@ -546,10 +614,10 @@ public class CallerInfo {
// So instead, figure out the column to use for person_id by just
// looking at the URI itself.
- if (VDBG) Rlog.v(TAG, "- getColumnIndexForPersonId: contactRef URI = '"
+ if (VDBG) Log.v(TAG, "- getColumnIndexForPersonId: contactRef URI = '"
+ contactRef + "'...");
// Warning: Do not enable the following logging (due to ANR risk.)
- // if (VDBG) Rlog.v(TAG, "- MIME type: "
+ // if (VDBG) Log.v(TAG, "- MIME type: "
// + context.getContentResolver().getType(contactRef));
String url = contactRef.toString();
@@ -557,25 +625,25 @@ public class CallerInfo {
if (url.startsWith("content://com.android.contacts/data/phones")) {
// Direct lookup in the Phone table.
// MIME type: Phone.CONTENT_ITEM_TYPE (= "vnd.android.cursor.item/phone_v2")
- if (VDBG) Rlog.v(TAG, "'data/phones' URI; using RawContacts.CONTACT_ID");
+ if (VDBG) Log.v(TAG, "'data/phones' URI; using RawContacts.CONTACT_ID");
columnName = RawContacts.CONTACT_ID;
} else if (url.startsWith("content://com.android.contacts/data")) {
// Direct lookup in the Data table.
// MIME type: Data.CONTENT_TYPE (= "vnd.android.cursor.dir/data")
- if (VDBG) Rlog.v(TAG, "'data' URI; using Data.CONTACT_ID");
+ if (VDBG) Log.v(TAG, "'data' URI; using Data.CONTACT_ID");
// (Note Data.CONTACT_ID and RawContacts.CONTACT_ID are equivalent.)
columnName = Data.CONTACT_ID;
} else if (url.startsWith("content://com.android.contacts/phone_lookup")) {
// Lookup in the PhoneLookup table, which provides "fuzzy matching"
// for phone numbers.
// MIME type: PhoneLookup.CONTENT_TYPE (= "vnd.android.cursor.dir/phone_lookup")
- if (VDBG) Rlog.v(TAG, "'phone_lookup' URI; using PhoneLookup._ID");
+ if (VDBG) Log.v(TAG, "'phone_lookup' URI; using PhoneLookup._ID");
columnName = PhoneLookup._ID;
} else {
- Rlog.w(TAG, "Unexpected prefix for contactRef '" + url + "'");
+ Log.w(TAG, "Unexpected prefix for contactRef '" + url + "'");
}
int columnIndex = (columnName != null) ? cursor.getColumnIndex(columnName) : -1;
- if (VDBG) Rlog.v(TAG, "==> Using column '" + columnName
+ if (VDBG) Log.v(TAG, "==> Using column '" + columnName
+ "' (columnIndex = " + columnIndex + ") for person_id lookup...");
return columnIndex;
}
@@ -591,6 +659,7 @@ public class CallerInfo {
* @param context the context used to look up the current locale / country
* @param fallbackNumber if this CallerInfo's phoneNumber field is empty,
* this specifies a fallback number to use instead.
+ * @hide
*/
public void updateGeoDescription(Context context, String fallbackNumber) {
String number = TextUtils.isEmpty(phoneNumber) ? fallbackNumber : phoneNumber;
@@ -600,9 +669,11 @@ public class CallerInfo {
/**
* @return a geographical description string for the specified number.
* @see com.android.i18n.phonenumbers.PhoneNumberOfflineGeocoder
+ *
+ * @hide
*/
public static String getGeoDescription(Context context, String number) {
- if (VDBG) Rlog.v(TAG, "getGeoDescription('" + number + "')...");
+ if (VDBG) Log.v(TAG, "getGeoDescription('" + number + "')...");
if (TextUtils.isEmpty(number)) {
return null;
@@ -615,18 +686,18 @@ public class CallerInfo {
String countryIso = getCurrentCountryIso(context, locale);
PhoneNumber pn = null;
try {
- if (VDBG) Rlog.v(TAG, "parsing '" + number
+ if (VDBG) Log.v(TAG, "parsing '" + number
+ "' for countryIso '" + countryIso + "'...");
pn = util.parse(number, countryIso);
- if (VDBG) Rlog.v(TAG, "- parsed number: " + pn);
+ if (VDBG) Log.v(TAG, "- parsed number: " + pn);
} catch (NumberParseException e) {
- Rlog.w(TAG, "getGeoDescription: NumberParseException for incoming number '"
- + Rlog.pii(TAG, number) + "'");
+ Log.w(TAG, "getGeoDescription: NumberParseException for incoming number '"
+ + Log.pii(number) + "'");
}
if (pn != null) {
String description = geocoder.getDescriptionForNumber(pn, locale);
- if (VDBG) Rlog.v(TAG, "- got description: '" + description + "'");
+ if (VDBG) Log.v(TAG, "- got description: '" + description + "'");
return description;
} else {
return null;
@@ -646,17 +717,18 @@ public class CallerInfo {
if (country != null) {
countryIso = country.getCountryIso();
} else {
- Rlog.e(TAG, "CountryDetector.detectCountry() returned null.");
+ Log.e(TAG, new Exception(), "CountryDetector.detectCountry() returned null.");
}
}
if (countryIso == null) {
countryIso = locale.getCountry();
- Rlog.w(TAG, "No CountryDetector; falling back to countryIso based on locale: "
+ Log.w(TAG, "No CountryDetector; falling back to countryIso based on locale: "
+ countryIso);
}
return countryIso;
}
+ /** @hide */
protected static String getCurrentCountryIso(Context context) {
return getCurrentCountryIso(context, Locale.getDefault());
}
diff --git a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
index e9a177defd26..f38b34e85d89 100644
--- a/telephony/java/com/android/internal/telephony/CallerInfoAsyncQuery.java
+++ b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.internal.telephony;
+package android.telecom;
import android.app.ActivityManager;
import android.content.AsyncQueryHandler;
@@ -32,10 +32,8 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
-import android.text.TextUtils;
-import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
-
+import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
@@ -104,12 +102,12 @@ public class CallerInfoAsyncQuery {
*/
static ContentResolver getCurrentProfileContentResolver(Context context) {
- if (DBG) Rlog.d(LOG_TAG, "Trying to get current content resolver...");
+ if (DBG) Log.d(LOG_TAG, "Trying to get current content resolver...");
final int currentUser = ActivityManager.getCurrentUser();
final int myUser = UserManager.get(context).getUserHandle();
- if (DBG) Rlog.d(LOG_TAG, "myUser=" + myUser + "currentUser=" + currentUser);
+ if (DBG) Log.d(LOG_TAG, "myUser=" + myUser + "currentUser=" + currentUser);
if (myUser != currentUser) {
final Context otherContext;
@@ -118,7 +116,7 @@ public class CallerInfoAsyncQuery {
/* flags =*/ 0, UserHandle.of(currentUser));
return otherContext.getContentResolver();
} catch (NameNotFoundException e) {
- Rlog.e(LOG_TAG, "Can't find self package", e);
+ Log.e(LOG_TAG, e, "Can't find self package");
// Fall back to the primary user.
}
}
@@ -183,13 +181,13 @@ public class CallerInfoAsyncQuery {
// However, if there is any code that this Handler calls (such as in
// super.handleMessage) that DOES place unexpected messages on the
// queue, then we need pass these messages on.
- Rlog.i(LOG_TAG, "Unexpected command (CookieWrapper is null): " + msg.what +
+ Log.i(LOG_TAG, "Unexpected command (CookieWrapper is null): " + msg.what +
" ignored by CallerInfoWorkerHandler, passing onto parent.");
super.handleMessage(msg);
} else {
- Rlog.d(LOG_TAG, "Processing event: " + cw.event + " token (arg1): " + msg.arg1 +
+ Log.d(LOG_TAG, "Processing event: " + cw.event + " token (arg1): " + msg.arg1 +
" command: " + msg.what + " query URI: " + sanitizeUriToString(args.uri));
switch (cw.event) {
@@ -230,7 +228,7 @@ public class CallerInfoAsyncQuery {
cw.geoDescription = CallerInfo.getGeoDescription(mContext, cw.number);
final long duration = SystemClock.elapsedRealtime() - startTimeMillis;
if (duration > 500) {
- if (DBG) Rlog.d(LOG_TAG, "[handleGeoDescription]" +
+ if (DBG) Log.d(LOG_TAG, "[handleGeoDescription]" +
"Spends long time to retrieve Geo description: " + duration);
}
}
@@ -267,7 +265,7 @@ public class CallerInfoAsyncQuery {
*/
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
- Rlog.d(LOG_TAG, "##### onQueryComplete() ##### query complete for token: " + token);
+ Log.d(LOG_TAG, "##### onQueryComplete() ##### query complete for token: " + token);
//get the cookie and notify the listener.
CookieWrapper cw = (CookieWrapper) cookie;
@@ -276,7 +274,7 @@ public class CallerInfoAsyncQuery {
// from within this code.
// However, if there is any code that calls this method, we should
// check the parameters to make sure they're viable.
- Rlog.i(LOG_TAG, "Cookie is null, ignoring onQueryComplete() request.");
+ Log.i(LOG_TAG, "Cookie is null, ignoring onQueryComplete() request.");
if (cursor != null) {
cursor.close();
}
@@ -325,32 +323,32 @@ public class CallerInfoAsyncQuery {
// comments at the top of CallerInfo class).
mCallerInfo = new CallerInfo().markAsEmergency(mContext);
} else if (cw.event == EVENT_VOICEMAIL_NUMBER) {
- mCallerInfo = new CallerInfo().markAsVoiceMail(cw.subId);
+ mCallerInfo = new CallerInfo().markAsVoiceMail(mContext, cw.subId);
} else {
mCallerInfo = CallerInfo.getCallerInfo(mContext, mQueryUri, cursor);
- if (DBG) Rlog.d(LOG_TAG, "==> Got mCallerInfo: " + mCallerInfo);
+ if (DBG) Log.d(LOG_TAG, "==> Got mCallerInfo: " + mCallerInfo);
CallerInfo newCallerInfo = CallerInfo.doSecondaryLookupIfNecessary(
mContext, cw.number, mCallerInfo);
if (newCallerInfo != mCallerInfo) {
mCallerInfo = newCallerInfo;
- if (DBG) Rlog.d(LOG_TAG, "#####async contact look up with numeric username"
+ if (DBG) Log.d(LOG_TAG, "#####async contact look up with numeric username"
+ mCallerInfo);
}
// Use the number entered by the user for display.
if (!TextUtils.isEmpty(cw.number)) {
- mCallerInfo.phoneNumber = PhoneNumberUtils.formatNumber(cw.number,
+ mCallerInfo.setPhoneNumber(PhoneNumberUtils.formatNumber(cw.number,
mCallerInfo.normalizedNumber,
- CallerInfo.getCurrentCountryIso(mContext));
+ CallerInfo.getCurrentCountryIso(mContext)));
}
// This condition refer to the google default code for geo.
// If the number exists in Contacts, the CallCard would never show
// the geo description, so it would be unnecessary to query it.
if (ENABLE_UNKNOWN_NUMBER_GEO_DESCRIPTION) {
- if (TextUtils.isEmpty(mCallerInfo.name)) {
- if (DBG) Rlog.d(LOG_TAG, "start querying geo description");
+ if (TextUtils.isEmpty(mCallerInfo.getName())) {
+ if (DBG) Log.d(LOG_TAG, "start querying geo description");
cw.event = EVENT_GET_GEO_DESCRIPTION;
startQuery(token, cw, null, null, null, null, null);
return;
@@ -358,7 +356,7 @@ public class CallerInfoAsyncQuery {
}
}
- if (DBG) Rlog.d(LOG_TAG, "constructing CallerInfo object for token: " + token);
+ if (DBG) Log.d(LOG_TAG, "constructing CallerInfo object for token: " + token);
//notify that we can clean up the queue after this.
CookieWrapper endMarker = new CookieWrapper();
@@ -371,14 +369,14 @@ public class CallerInfoAsyncQuery {
mPendingListenerCallbacks.add(new Runnable() {
@Override
public void run() {
- if (DBG) Rlog.d(LOG_TAG, "notifying listener: "
+ if (DBG) Log.d(LOG_TAG, "notifying listener: "
+ cw.listener.getClass().toString() + " for token: " + token
+ mCallerInfo);
cw.listener.onQueryComplete(token, cw.cookie, mCallerInfo);
}
});
} else {
- Rlog.w(LOG_TAG, "There is no listener to notify for this query.");
+ Log.w(LOG_TAG, "There is no listener to notify for this query.");
}
if (cursor != null) {
@@ -403,7 +401,7 @@ public class CallerInfoAsyncQuery {
CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
c.allocate(context, contactRef);
- if (DBG) Rlog.d(LOG_TAG, "starting query for URI: " + contactRef + " handler: " + c.toString());
+ if (DBG) Log.d(LOG_TAG, "starting query for URI: " + contactRef + " handler: " + c.toString());
//create cookieWrapper, start query
CookieWrapper cw = new CookieWrapper();
@@ -449,9 +447,9 @@ public class CallerInfoAsyncQuery {
OnQueryCompleteListener listener, Object cookie, int subId) {
if (DBG) {
- Rlog.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####");
- Rlog.d(LOG_TAG, "- number: " + /*number*/ "xxxxxxx");
- Rlog.d(LOG_TAG, "- cookie: " + cookie);
+ Log.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####");
+ Log.d(LOG_TAG, "- number: " + /*number*/ "xxxxxxx");
+ Log.d(LOG_TAG, "- cookie: " + cookie);
}
// Construct the URI object and query params, and start the query.
@@ -463,7 +461,7 @@ public class CallerInfoAsyncQuery {
.build();
if (DBG) {
- Rlog.d(LOG_TAG, "==> contactRef: " + sanitizeUriToString(contactRef));
+ Log.d(LOG_TAG, "==> contactRef: " + sanitizeUriToString(contactRef));
}
CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
@@ -500,8 +498,8 @@ public class CallerInfoAsyncQuery {
*/
public void addQueryListener(int token, OnQueryCompleteListener listener, Object cookie) {
- if (DBG) Rlog.d(LOG_TAG, "adding listener to query: " + sanitizeUriToString(mHandler.mQueryUri) +
- " handler: " + mHandler.toString());
+ if (DBG) Log.d(LOG_TAG, "adding listener to query: "
+ + sanitizeUriToString(mHandler.mQueryUri) + " handler: " + mHandler.toString());
//create cookieWrapper, add query request to end of queue.
CookieWrapper cw = new CookieWrapper();
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 2ce84fbc0dc7..4f373af984fa 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -857,7 +857,7 @@ public abstract class Connection extends Conferenceable {
}
/** @hide */
- public abstract static class Listener {
+ abstract static class Listener {
public void onStateChanged(Connection c, int state) {}
public void onAddressChanged(Connection c, Uri newAddress, int presentation) {}
public void onCallerDisplayNameChanged(
@@ -2005,7 +2005,7 @@ public abstract class Connection extends Conferenceable {
*
* @hide
*/
- public final Connection addConnectionListener(Listener l) {
+ final Connection addConnectionListener(Listener l) {
mListeners.add(l);
return this;
}
@@ -2018,7 +2018,7 @@ public abstract class Connection extends Conferenceable {
*
* @hide
*/
- public final Connection removeConnectionListener(Listener l) {
+ final Connection removeConnectionListener(Listener l) {
if (l != null) {
mListeners.remove(l);
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 12066c4caeb6..2bc20d51113a 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -33,6 +33,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.telephony.Annotation.CallState;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -1412,7 +1413,7 @@ public class TelecomManager {
* @hide
*/
@SystemApi
- public @TelephonyManager.CallState int getCallState() {
+ public @CallState int getCallState() {
try {
if (isServiceConnected()) {
return getTelecomService().getCallState();
diff --git a/telephony/common/com/android/internal/telephony/HbpcdLookup.java b/telephony/common/com/android/internal/telephony/HbpcdLookup.java
new file mode 100644
index 000000000000..d9a3e725b6fb
--- /dev/null
+++ b/telephony/common/com/android/internal/telephony/HbpcdLookup.java
@@ -0,0 +1,124 @@
+/*
+**
+** Copyright 2014, 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 com.android.internal.telephony;
+
+import android.net.Uri;
+import android.provider.BaseColumns;
+
+/**
+ * @hide
+ */
+public class HbpcdLookup {
+ public static final String AUTHORITY = "hbpcd_lookup";
+
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY);
+
+ public static final String PATH_MCC_IDD = "idd";
+ public static final String PATH_MCC_LOOKUP_TABLE = "lookup";
+ public static final String PATH_MCC_SID_CONFLICT = "conflict";
+ public static final String PATH_MCC_SID_RANGE = "range";
+ public static final String PATH_NANP_AREA_CODE = "nanp";
+ public static final String PATH_ARBITRARY_MCC_SID_MATCH = "arbitrary";
+ public static final String PATH_USERADD_COUNTRY = "useradd";
+
+ public static final String ID = "_id";
+ public static final int IDINDEX = 0;
+
+ /**
+ * @hide
+ */
+ public static class MccIdd implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_MCC_IDD);
+ public static final String DEFAULT_SORT_ORDER = "MCC ASC";
+
+ public static final String MCC = "MCC";
+ public static final String IDD = "IDD";
+
+ }
+
+ /**
+ * @hide
+ */
+ public static class MccLookup implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_MCC_LOOKUP_TABLE);
+ public static final String DEFAULT_SORT_ORDER = "MCC ASC";
+
+ public static final String MCC = "MCC";
+ public static final String COUNTRY_CODE = "Country_Code";
+ public static final String COUNTRY_NAME = "Country_Name";
+ public static final String NDD = "NDD";
+ public static final String NANPS = "NANPS";
+ public static final String GMT_OFFSET_LOW = "GMT_Offset_Low";
+ public static final String GMT_OFFSET_HIGH = "GMT_Offset_High";
+ public static final String GMT_DST_LOW = "GMT_DST_Low";
+ public static final String GMT_DST_HIGH = "GMT_DST_High";
+
+ }
+
+ /**
+ * @hide
+ */
+ public static class MccSidConflicts implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_MCC_SID_CONFLICT);
+ public static final String DEFAULT_SORT_ORDER = "MCC ASC";
+
+ public static final String MCC = "MCC";
+ public static final String SID_CONFLICT = "SID_Conflict";
+
+ }
+
+ /**
+ * @hide
+ */
+ public static class MccSidRange implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_MCC_SID_RANGE);
+ public static final String DEFAULT_SORT_ORDER = "MCC ASC";
+
+ public static final String MCC = "MCC";
+ public static final String RANGE_LOW = "SID_Range_Low";
+ public static final String RANGE_HIGH = "SID_Range_High";
+ }
+
+ /**
+ * @hide
+ */
+ public static class ArbitraryMccSidMatch implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_ARBITRARY_MCC_SID_MATCH);
+ public static final String DEFAULT_SORT_ORDER = "MCC ASC";
+
+ public static final String MCC = "MCC";
+ public static final String SID = "SID";
+
+ }
+
+ /**
+ * @hide
+ */
+ public static class NanpAreaCode implements BaseColumns {
+ public static final Uri CONTENT_URI =
+ Uri.parse("content://" + AUTHORITY + "/" + PATH_NANP_AREA_CODE);
+ public static final String DEFAULT_SORT_ORDER = "Area_Code ASC";
+
+ public static final String AREA_CODE = "Area_Code";
+ }
+}
diff --git a/telephony/common/com/android/internal/telephony/HbpcdUtils.java b/telephony/common/com/android/internal/telephony/HbpcdUtils.java
new file mode 100644
index 000000000000..2f3194214be6
--- /dev/null
+++ b/telephony/common/com/android/internal/telephony/HbpcdUtils.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2014 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 com.android.internal.telephony;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.database.Cursor;
+import android.telephony.Rlog;
+
+import com.android.internal.telephony.HbpcdLookup.ArbitraryMccSidMatch;
+import com.android.internal.telephony.HbpcdLookup.MccIdd;
+import com.android.internal.telephony.HbpcdLookup.MccLookup;
+import com.android.internal.telephony.HbpcdLookup.MccSidConflicts;
+import com.android.internal.telephony.HbpcdLookup.MccSidRange;
+
+public final class HbpcdUtils {
+ private static final String LOG_TAG = "HbpcdUtils";
+ private static final boolean DBG = false;
+ private ContentResolver resolver = null;
+
+ public HbpcdUtils(Context context) {
+ resolver = context.getContentResolver();
+ }
+
+ /**
+ * Resolves the unknown MCC with SID and Timezone information.
+ */
+ public int getMcc(int sid, int tz, int DSTflag, boolean isNitzTimeZone) {
+ int tmpMcc = 0;
+
+ // check if SID exists in arbitrary_mcc_sid_match table.
+ // these SIDs are assigned to more than 1 operators, but they are known to
+ // be used by a specific operator, other operators having the same SID are
+ // not using it currently, if that SID is in this table, we don't need to
+ // check other tables.
+ String projection2[] = {ArbitraryMccSidMatch.MCC};
+ Cursor c2 = resolver.query(ArbitraryMccSidMatch.CONTENT_URI, projection2,
+ ArbitraryMccSidMatch.SID + "=" + sid, null, null);
+
+ if (c2 != null) {
+ int c2Counter = c2.getCount();
+ if (DBG) {
+ Rlog.d(LOG_TAG, "Query unresolved arbitrary table, entries are " + c2Counter);
+ }
+ if (c2Counter == 1) {
+ if (DBG) {
+ Rlog.d(LOG_TAG, "Query Unresolved arbitrary returned the cursor " + c2);
+ }
+ c2.moveToFirst();
+ tmpMcc = c2.getInt(0);
+ if (DBG) {
+ Rlog.d(LOG_TAG, "MCC found in arbitrary_mcc_sid_match: " + tmpMcc);
+ }
+ c2.close();
+ return tmpMcc;
+ }
+ c2.close();
+ }
+
+ // Then check if SID exists in mcc_sid_conflict table.
+ // and use the timezone in mcc_lookup table to check which MCC matches.
+ String projection3[] = {MccSidConflicts.MCC};
+ Cursor c3 = resolver.query(MccSidConflicts.CONTENT_URI, projection3,
+ MccSidConflicts.SID_CONFLICT + "=" + sid + " and (((" +
+ MccLookup.GMT_OFFSET_LOW + "<=" + tz + ") and (" + tz + "<=" +
+ MccLookup.GMT_OFFSET_HIGH + ") and (" + "0=" + DSTflag + ")) or ((" +
+ MccLookup.GMT_DST_LOW + "<=" + tz + ") and (" + tz + "<=" +
+ MccLookup.GMT_DST_HIGH + ") and (" + "1=" + DSTflag + ")))",
+ null, null);
+ if (c3 != null) {
+ int c3Counter = c3.getCount();
+ if (c3Counter > 0) {
+ if (c3Counter > 1) {
+ Rlog.w(LOG_TAG, "something wrong, get more results for 1 conflict SID: " + c3);
+ }
+ if (DBG) Rlog.d(LOG_TAG, "Query conflict sid returned the cursor " + c3);
+ c3.moveToFirst();
+ tmpMcc = c3.getInt(0);
+ if (DBG) {
+ Rlog.d(LOG_TAG, "MCC found in mcc_lookup_table. Return tmpMcc = " + tmpMcc);
+ }
+ if (!isNitzTimeZone) {
+ // time zone is not accurate, it may get wrong mcc, ignore it.
+ if (DBG) {
+ Rlog.d(LOG_TAG, "time zone is not accurate, mcc may be " + tmpMcc);
+ }
+ tmpMcc = 0;
+ }
+ c3.close();
+ return tmpMcc;
+ } else {
+ c3.close();
+ }
+ }
+
+ // if there is no conflict, then check if SID is in mcc_sid_range.
+ String projection5[] = {MccSidRange.MCC};
+ Cursor c5 = resolver.query(MccSidRange.CONTENT_URI, projection5,
+ MccSidRange.RANGE_LOW + "<=" + sid + " and " +
+ MccSidRange.RANGE_HIGH + ">=" + sid,
+ null, null);
+ if (c5 != null) {
+ if (c5.getCount() > 0) {
+ if (DBG) Rlog.d(LOG_TAG, "Query Range returned the cursor " + c5);
+ c5.moveToFirst();
+ tmpMcc = c5.getInt(0);
+ if (DBG) Rlog.d(LOG_TAG, "SID found in mcc_sid_range. Return tmpMcc = " + tmpMcc);
+ c5.close();
+ return tmpMcc;
+ }
+ c5.close();
+ }
+ if (DBG) Rlog.d(LOG_TAG, "SID NOT found in mcc_sid_range.");
+
+ if (DBG) Rlog.d(LOG_TAG, "Exit getMccByOtherFactors. Return tmpMcc = " + tmpMcc);
+ // If unknown MCC still could not be resolved,
+ return tmpMcc;
+ }
+
+ /**
+ * Gets country information with given MCC.
+ */
+ public String getIddByMcc(int mcc) {
+ if (DBG) Rlog.d(LOG_TAG, "Enter getHbpcdInfoByMCC.");
+ String idd = "";
+
+ Cursor c = null;
+
+ String projection[] = {MccIdd.IDD};
+ Cursor cur = resolver.query(MccIdd.CONTENT_URI, projection,
+ MccIdd.MCC + "=" + mcc, null, null);
+ if (cur != null) {
+ if (cur.getCount() > 0) {
+ if (DBG) Rlog.d(LOG_TAG, "Query Idd returned the cursor " + cur);
+ // TODO: for those country having more than 1 IDDs, need more information
+ // to decide which IDD would be used. currently just use the first 1.
+ cur.moveToFirst();
+ idd = cur.getString(0);
+ if (DBG) Rlog.d(LOG_TAG, "IDD = " + idd);
+
+ }
+ cur.close();
+ }
+ if (c != null) c.close();
+
+ if (DBG) Rlog.d(LOG_TAG, "Exit getHbpcdInfoByMCC.");
+ return idd;
+ }
+}
diff --git a/telephony/java/com/android/internal/telephony/SmsApplication.java b/telephony/common/com/android/internal/telephony/SmsApplication.java
index f17a1a5c694c..f79aef3ae5c9 100644
--- a/telephony/java/com/android/internal/telephony/SmsApplication.java
+++ b/telephony/common/com/android/internal/telephony/SmsApplication.java
@@ -40,7 +40,6 @@ import android.os.UserHandle;
import android.provider.Telephony;
import android.provider.Telephony.Sms.Intents;
import android.telephony.Rlog;
-import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.util.Log;
@@ -48,6 +47,8 @@ import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -57,6 +58,8 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
+
+
/**
* Class for managing the primary application that we will deliver SMS/MMS messages to
*
@@ -91,6 +94,7 @@ public final class SmsApplication {
/**
* Name of this SMS app for display.
*/
+ @UnsupportedAppUsage
private String mApplicationName;
/**
@@ -224,6 +228,7 @@ public final class SmsApplication {
* Implement ACTION_SENDTO intent.
* Support smsto Uri scheme.
*/
+ @UnsupportedAppUsage
public static Collection<SmsApplicationData> getApplicationCollection(Context context) {
return getApplicationCollectionAsUser(context, getIncomingUserId(context));
}
@@ -579,6 +584,7 @@ public final class SmsApplication {
* Sets the specified package as the default SMS/MMS application. The caller of this method
* needs to have permission to set AppOps and write to secure settings.
*/
+ @UnsupportedAppUsage
public static void setDefaultApplication(String packageName, Context context) {
setDefaultApplicationAsUser(packageName, context, getIncomingUserId(context));
}
@@ -826,6 +832,7 @@ public final class SmsApplication {
sSmsPackageMonitor.register(context, context.getMainLooper(), UserHandle.ALL, false);
}
+ @UnsupportedAppUsage
private static void configurePreferredActivity(PackageManager packageManager,
ComponentName componentName, int userId) {
// Add the four activity preferences we want to direct to this app.
@@ -868,6 +875,7 @@ public final class SmsApplication {
* Returns SmsApplicationData for this package if this package is capable of being set as the
* default SMS application.
*/
+ @UnsupportedAppUsage
public static SmsApplicationData getSmsApplicationData(String packageName, Context context) {
Collection<SmsApplicationData> applications = getApplicationCollection(context);
return getApplicationForPackage(applications, packageName);
@@ -879,6 +887,7 @@ public final class SmsApplication {
* @param updateIfNeeded update the default app if there is no valid default app configured.
* @return component name of the app and class to deliver SMS messages to
*/
+ @UnsupportedAppUsage
public static ComponentName getDefaultSmsApplication(Context context, boolean updateIfNeeded) {
return getDefaultSmsApplicationAsUser(context, updateIfNeeded, getIncomingUserId(context));
}
@@ -913,6 +922,7 @@ public final class SmsApplication {
* @param updateIfNeeded update the default app if there is no valid default app configured.
* @return component name of the app and class to deliver MMS messages to
*/
+ @UnsupportedAppUsage
public static ComponentName getDefaultMmsApplication(Context context, boolean updateIfNeeded) {
int userId = getIncomingUserId(context);
final long token = Binder.clearCallingIdentity();
@@ -936,6 +946,7 @@ public final class SmsApplication {
* @param updateIfNeeded update the default app if there is no valid default app configured.
* @return component name of the app and class to direct Respond Via Message intent to
*/
+ @UnsupportedAppUsage
public static ComponentName getDefaultRespondViaMessageApplication(Context context,
boolean updateIfNeeded) {
int userId = getIncomingUserId(context);
@@ -1036,10 +1047,8 @@ public final class SmsApplication {
* <p>
* Caller must pass in the correct user context if calling from a singleton service.
*/
+ @UnsupportedAppUsage
public static boolean shouldWriteMessageForPackage(String packageName, Context context) {
- if (SmsManager.getDefault().getAutoPersisting()) {
- return true;
- }
return !isDefaultSmsApplication(context, packageName);
}
@@ -1050,6 +1059,7 @@ public final class SmsApplication {
* @param packageName the name of the package to be checked
* @return true if the package is default sms app or bluetooth
*/
+ @UnsupportedAppUsage
public static boolean isDefaultSmsApplication(Context context, String packageName) {
if (packageName == null) {
return false;
diff --git a/telephony/common/com/android/internal/telephony/SmsNumberUtils.java b/telephony/common/com/android/internal/telephony/SmsNumberUtils.java
new file mode 100644
index 000000000000..0d33af639113
--- /dev/null
+++ b/telephony/common/com/android/internal/telephony/SmsNumberUtils.java
@@ -0,0 +1,627 @@
+/*
+ * Copyright (C) 2014 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 com.android.internal.telephony;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.os.Binder;
+import android.os.Build;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
+import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+
+import com.android.internal.telephony.HbpcdLookup.MccIdd;
+import com.android.internal.telephony.HbpcdLookup.MccLookup;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+
+/**
+ * This class implements handle the MO SMS target address before sending.
+ * This is special for VZW requirement. Follow the specifications of assisted dialing
+ * of MO SMS while traveling on VZW CDMA, international CDMA or GSM markets.
+ * {@hide}
+ */
+public class SmsNumberUtils {
+ private static final String TAG = "SmsNumberUtils";
+ private static final boolean DBG = Build.IS_DEBUGGABLE;
+
+ private static final String PLUS_SIGN = "+";
+
+ private static final int NANP_SHORT_LENGTH = 7;
+ private static final int NANP_MEDIUM_LENGTH = 10;
+ private static final int NANP_LONG_LENGTH = 11;
+
+ private static final int NANP_CC = 1;
+ private static final String NANP_NDD = "1";
+ private static final String NANP_IDD = "011";
+
+ private static final int MIN_COUNTRY_AREA_LOCAL_LENGTH = 10;
+
+ private static final int GSM_UMTS_NETWORK = 0;
+ private static final int CDMA_HOME_NETWORK = 1;
+ private static final int CDMA_ROAMING_NETWORK = 2;
+
+ private static final int NP_NONE = 0;
+ private static final int NP_NANP_BEGIN = 1;
+
+ /* <Phone Number>, <NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_LOCAL = NP_NANP_BEGIN;
+
+ /* <Area_code>-<Phone Number>, <NXX>-<NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_AREA_LOCAL = NP_NANP_BEGIN + 1;
+
+ /* <1>-<Area_code>-<Phone Number>, 1-<NXX>-<NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_NDD_AREA_LOCAL = NP_NANP_BEGIN + 2;
+
+ /* <+><U.S.Country_code><Area_code><Phone Number>, +1-<NXX>-<NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_NBPCD_CC_AREA_LOCAL = NP_NANP_BEGIN + 3;
+
+ /* <Local_IDD><Country_code><Area_code><Phone Number>, 001-1-<NXX>-<NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_LOCALIDD_CC_AREA_LOCAL = NP_NANP_BEGIN + 4;
+
+ /* <+><Home_IDD><Country_code><Area_code><Phone Number>, +011-1-<NXX>-<NXX>-<XXXX> N[2-9] */
+ private static final int NP_NANP_NBPCD_HOMEIDD_CC_AREA_LOCAL = NP_NANP_BEGIN + 5;
+
+ private static final int NP_INTERNATIONAL_BEGIN = 100;
+ /* <+>-<Home_IDD>-<Country_code>-<Area_code>-<Phone Number>, +011-86-25-86281234 */
+ private static final int NP_NBPCD_HOMEIDD_CC_AREA_LOCAL = NP_INTERNATIONAL_BEGIN;
+
+ /* <Home_IDD>-<Country_code>-<Area_code>-<Phone Number>, 011-86-25-86281234 */
+ private static final int NP_HOMEIDD_CC_AREA_LOCAL = NP_INTERNATIONAL_BEGIN + 1;
+
+ /* <NBPCD>-<Country_code>-<Area_code>-<Phone Number>, +1-86-25-86281234 */
+ private static final int NP_NBPCD_CC_AREA_LOCAL = NP_INTERNATIONAL_BEGIN + 2;
+
+ /* <Local_IDD>-<Country_code>-<Area_code>-<Phone Number>, 00-86-25-86281234 */
+ private static final int NP_LOCALIDD_CC_AREA_LOCAL = NP_INTERNATIONAL_BEGIN + 3;
+
+ /* <Country_code>-<Area_code>-<Phone Number>, 86-25-86281234*/
+ private static final int NP_CC_AREA_LOCAL = NP_INTERNATIONAL_BEGIN + 4;
+
+ private static int[] ALL_COUNTRY_CODES = null;
+ private static int MAX_COUNTRY_CODES_LENGTH;
+ private static HashMap<String, ArrayList<String>> IDDS_MAPS =
+ new HashMap<String, ArrayList<String>>();
+
+ private static class NumberEntry {
+ public String number;
+ public String IDD;
+ public int countryCode;
+ public NumberEntry(String number) {
+ this.number = number;
+ }
+ }
+
+ /**
+ * Breaks the given number down and formats it according to the rules
+ * for different number plans and different network.
+ *
+ * @param number destination number which need to be format
+ * @param activeMcc current network's mcc
+ * @param networkType current network type
+ *
+ * @return the number after formatting.
+ */
+ private static String formatNumber(Context context, String number,
+ String activeMcc,
+ int networkType) {
+ if (number == null ) {
+ throw new IllegalArgumentException("number is null");
+ }
+
+ if (activeMcc == null || activeMcc.trim().length() == 0) {
+ throw new IllegalArgumentException("activeMcc is null or empty!");
+ }
+
+ String networkPortionNumber = PhoneNumberUtils.extractNetworkPortion(number);
+ if (networkPortionNumber == null || networkPortionNumber.length() == 0) {
+ throw new IllegalArgumentException("Number is invalid!");
+ }
+
+ NumberEntry numberEntry = new NumberEntry(networkPortionNumber);
+ ArrayList<String> allIDDs = getAllIDDs(context, activeMcc);
+
+ // First check whether the number is a NANP number.
+ int nanpState = checkNANP(numberEntry, allIDDs);
+ if (DBG) Rlog.d(TAG, "NANP type: " + getNumberPlanType(nanpState));
+
+ if ((nanpState == NP_NANP_LOCAL)
+ || (nanpState == NP_NANP_AREA_LOCAL)
+ || (nanpState == NP_NANP_NDD_AREA_LOCAL)) {
+ return networkPortionNumber;
+ } else if (nanpState == NP_NANP_NBPCD_CC_AREA_LOCAL) {
+ if (networkType == CDMA_HOME_NETWORK
+ || networkType == CDMA_ROAMING_NETWORK) {
+ // Remove "+"
+ return networkPortionNumber.substring(1);
+ } else {
+ return networkPortionNumber;
+ }
+ } else if (nanpState == NP_NANP_LOCALIDD_CC_AREA_LOCAL) {
+ if (networkType == CDMA_HOME_NETWORK) {
+ return networkPortionNumber;
+ } else if (networkType == GSM_UMTS_NETWORK) {
+ // Remove the local IDD and replace with "+"
+ int iddLength = numberEntry.IDD != null ? numberEntry.IDD.length() : 0;
+ return PLUS_SIGN + networkPortionNumber.substring(iddLength);
+ } else if (networkType == CDMA_ROAMING_NETWORK) {
+ // Remove the local IDD
+ int iddLength = numberEntry.IDD != null ? numberEntry.IDD.length() : 0;
+ return networkPortionNumber.substring(iddLength);
+ }
+ }
+
+ int internationalState = checkInternationalNumberPlan(context, numberEntry, allIDDs,
+ NANP_IDD);
+ if (DBG) Rlog.d(TAG, "International type: " + getNumberPlanType(internationalState));
+ String returnNumber = null;
+
+ switch (internationalState) {
+ case NP_NBPCD_HOMEIDD_CC_AREA_LOCAL:
+ if (networkType == GSM_UMTS_NETWORK) {
+ // Remove "+"
+ returnNumber = networkPortionNumber.substring(1);
+ }
+ break;
+
+ case NP_NBPCD_CC_AREA_LOCAL:
+ // Replace "+" with "011"
+ returnNumber = NANP_IDD + networkPortionNumber.substring(1);
+ break;
+
+ case NP_LOCALIDD_CC_AREA_LOCAL:
+ if (networkType == GSM_UMTS_NETWORK || networkType == CDMA_ROAMING_NETWORK) {
+ int iddLength = numberEntry.IDD != null ? numberEntry.IDD.length() : 0;
+ // Replace <Local IDD> to <Home IDD>("011")
+ returnNumber = NANP_IDD + networkPortionNumber.substring(iddLength);
+ }
+ break;
+
+ case NP_CC_AREA_LOCAL:
+ int countryCode = numberEntry.countryCode;
+
+ if (!inExceptionListForNpCcAreaLocal(numberEntry)
+ && networkPortionNumber.length() >= 11 && countryCode != NANP_CC) {
+ // Add "011"
+ returnNumber = NANP_IDD + networkPortionNumber;
+ }
+ break;
+
+ case NP_HOMEIDD_CC_AREA_LOCAL:
+ returnNumber = networkPortionNumber;
+ break;
+
+ default:
+ // Replace "+" with 011 in CDMA network if the number's country
+ // code is not in the HbpcdLookup database.
+ if (networkPortionNumber.startsWith(PLUS_SIGN)
+ && (networkType == CDMA_HOME_NETWORK || networkType == CDMA_ROAMING_NETWORK)) {
+ if (networkPortionNumber.startsWith(PLUS_SIGN + NANP_IDD)) {
+ // Only remove "+"
+ returnNumber = networkPortionNumber.substring(1);
+ } else {
+ // Replace "+" with "011"
+ returnNumber = NANP_IDD + networkPortionNumber.substring(1);
+ }
+ }
+ }
+
+ if (returnNumber == null) {
+ returnNumber = networkPortionNumber;
+ }
+ return returnNumber;
+ }
+
+ /**
+ * Query International direct dialing from HbpcdLookup.db
+ * for specified country code
+ *
+ * @param mcc current network's country code
+ *
+ * @return the IDD array list.
+ */
+ private static ArrayList<String> getAllIDDs(Context context, String mcc) {
+ ArrayList<String> allIDDs = IDDS_MAPS.get(mcc);
+ if (allIDDs != null) {
+ return allIDDs;
+ } else {
+ allIDDs = new ArrayList<String>();
+ }
+
+ String projection[] = {MccIdd.IDD, MccIdd.MCC};
+ String where = null;
+
+ // if mcc is null : return all rows
+ // if mcc is empty-string : return those rows whose mcc is emptry-string
+ String[] selectionArgs = null;
+ if (mcc != null) {
+ where = MccIdd.MCC + "=?";
+ selectionArgs = new String[] {mcc};
+ }
+
+ Cursor cursor = null;
+ try {
+ cursor = context.getContentResolver().query(MccIdd.CONTENT_URI, projection,
+ where, selectionArgs, null);
+ if (cursor.getCount() > 0) {
+ while (cursor.moveToNext()) {
+ String idd = cursor.getString(0);
+ if (!allIDDs.contains(idd)) {
+ allIDDs.add(idd);
+ }
+ }
+ }
+ } catch (SQLException e) {
+ Rlog.e(TAG, "Can't access HbpcdLookup database", e);
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+
+ IDDS_MAPS.put(mcc, allIDDs);
+
+ if (DBG) Rlog.d(TAG, "MCC = " + mcc + ", all IDDs = " + allIDDs);
+ return allIDDs;
+ }
+
+
+ /**
+ * Verify if the the destination number is a NANP number
+ *
+ * @param numberEntry including number and IDD array
+ * @param allIDDs the IDD array list of the current network's country code
+ *
+ * @return the number plan type related NANP
+ */
+ private static int checkNANP(NumberEntry numberEntry, ArrayList<String> allIDDs) {
+ boolean isNANP = false;
+ String number = numberEntry.number;
+
+ if (number.length() == NANP_SHORT_LENGTH) {
+ // 7 digits - Seven digit phone numbers
+ char firstChar = number.charAt(0);
+ if (firstChar >= '2' && firstChar <= '9') {
+ isNANP = true;
+ for (int i=1; i< NANP_SHORT_LENGTH; i++ ) {
+ char c= number.charAt(i);
+ if (!PhoneNumberUtils.isISODigit(c)) {
+ isNANP = false;
+ break;
+ }
+ }
+ }
+ if (isNANP) {
+ return NP_NANP_LOCAL;
+ }
+ } else if (number.length() == NANP_MEDIUM_LENGTH) {
+ // 10 digits - Three digit area code followed by seven digit phone numbers/
+ if (isNANP(number)) {
+ return NP_NANP_AREA_LOCAL;
+ }
+ } else if (number.length() == NANP_LONG_LENGTH) {
+ // 11 digits - One digit U.S. NDD(National Direct Dial) prefix '1',
+ // followed by three digit area code and seven digit phone numbers
+ if (isNANP(number)) {
+ return NP_NANP_NDD_AREA_LOCAL;
+ }
+ } else if (number.startsWith(PLUS_SIGN)) {
+ number = number.substring(1);
+ if (number.length() == NANP_LONG_LENGTH) {
+ // '+' and 11 digits -'+', followed by NANP CC prefix '1' followed by
+ // three digit area code and seven digit phone numbers
+ if (isNANP(number)) {
+ return NP_NANP_NBPCD_CC_AREA_LOCAL;
+ }
+ } else if (number.startsWith(NANP_IDD) && number.length() == NANP_LONG_LENGTH + 3) {
+ // '+' and 14 digits -'+', followed by NANP IDD "011" followed by NANP CC
+ // prefix '1' followed by three digit area code and seven digit phone numbers
+ number = number.substring(3);
+ if (isNANP(number)) {
+ return NP_NANP_NBPCD_HOMEIDD_CC_AREA_LOCAL;
+ }
+ }
+ } else {
+ // Check whether it's NP_NANP_LOCALIDD_CC_AREA_LOCAL
+ for (String idd : allIDDs) {
+ if (number.startsWith(idd)) {
+ String number2 = number.substring(idd.length());
+ if(number2 !=null && number2.startsWith(String.valueOf(NANP_CC))){
+ if (isNANP(number2)) {
+ numberEntry.IDD = idd;
+ return NP_NANP_LOCALIDD_CC_AREA_LOCAL;
+ }
+ }
+ }
+ }
+ }
+
+ return NP_NONE;
+ }
+
+ private static boolean isNANP(String number) {
+ if (number.length() == NANP_MEDIUM_LENGTH
+ || (number.length() == NANP_LONG_LENGTH && number.startsWith(NANP_NDD))) {
+ if (number.length() == NANP_LONG_LENGTH) {
+ number = number.substring(1);
+ }
+ return (PhoneNumberUtils.isNanp(number));
+ }
+ return false;
+ }
+
+ /**
+ * Verify if the the destination number is an internal number
+ *
+ * @param numberEntry including number and IDD array
+ * @param allIDDs the IDD array list of the current network's country code
+ *
+ * @return the number plan type related international number
+ */
+ private static int checkInternationalNumberPlan(Context context, NumberEntry numberEntry,
+ ArrayList<String> allIDDs,String homeIDD) {
+ String number = numberEntry.number;
+ int countryCode = -1;
+
+ if (number.startsWith(PLUS_SIGN)) {
+ // +xxxxxxxxxx
+ String numberNoNBPCD = number.substring(1);
+ if (numberNoNBPCD.startsWith(homeIDD)) {
+ // +011xxxxxxxx
+ String numberCountryAreaLocal = numberNoNBPCD.substring(homeIDD.length());
+ if ((countryCode = getCountryCode(context, numberCountryAreaLocal)) > 0) {
+ numberEntry.countryCode = countryCode;
+ return NP_NBPCD_HOMEIDD_CC_AREA_LOCAL;
+ }
+ } else if ((countryCode = getCountryCode(context, numberNoNBPCD)) > 0) {
+ numberEntry.countryCode = countryCode;
+ return NP_NBPCD_CC_AREA_LOCAL;
+ }
+
+ } else if (number.startsWith(homeIDD)) {
+ // 011xxxxxxxxx
+ String numberCountryAreaLocal = number.substring(homeIDD.length());
+ if ((countryCode = getCountryCode(context, numberCountryAreaLocal)) > 0) {
+ numberEntry.countryCode = countryCode;
+ return NP_HOMEIDD_CC_AREA_LOCAL;
+ }
+ } else {
+ for (String exitCode : allIDDs) {
+ if (number.startsWith(exitCode)) {
+ String numberNoIDD = number.substring(exitCode.length());
+ if ((countryCode = getCountryCode(context, numberNoIDD)) > 0) {
+ numberEntry.countryCode = countryCode;
+ numberEntry.IDD = exitCode;
+ return NP_LOCALIDD_CC_AREA_LOCAL;
+ }
+ }
+ }
+
+ if (!number.startsWith("0") && (countryCode = getCountryCode(context, number)) > 0) {
+ numberEntry.countryCode = countryCode;
+ return NP_CC_AREA_LOCAL;
+ }
+ }
+ return NP_NONE;
+ }
+
+ /**
+ * Returns the country code from the given number.
+ */
+ private static int getCountryCode(Context context, String number) {
+ int countryCode = -1;
+ if (number.length() >= MIN_COUNTRY_AREA_LOCAL_LENGTH) {
+ // Check Country code
+ int[] allCCs = getAllCountryCodes(context);
+ if (allCCs == null) {
+ return countryCode;
+ }
+
+ int[] ccArray = new int[MAX_COUNTRY_CODES_LENGTH];
+ for (int i = 0; i < MAX_COUNTRY_CODES_LENGTH; i ++) {
+ ccArray[i] = Integer.parseInt(number.substring(0, i+1));
+ }
+
+ for (int i = 0; i < allCCs.length; i ++) {
+ int tempCC = allCCs[i];
+ for (int j = 0; j < MAX_COUNTRY_CODES_LENGTH; j ++) {
+ if (tempCC == ccArray[j]) {
+ if (DBG) Rlog.d(TAG, "Country code = " + tempCC);
+ return tempCC;
+ }
+ }
+ }
+ }
+
+ return countryCode;
+ }
+
+ /**
+ * Gets all country Codes information with given MCC.
+ */
+ private static int[] getAllCountryCodes(Context context) {
+ if (ALL_COUNTRY_CODES != null) {
+ return ALL_COUNTRY_CODES;
+ }
+
+ Cursor cursor = null;
+ try {
+ String projection[] = {MccLookup.COUNTRY_CODE};
+ cursor = context.getContentResolver().query(MccLookup.CONTENT_URI,
+ projection, null, null, null);
+
+ if (cursor.getCount() > 0) {
+ ALL_COUNTRY_CODES = new int[cursor.getCount()];
+ int i = 0;
+ while (cursor.moveToNext()) {
+ int countryCode = cursor.getInt(0);
+ ALL_COUNTRY_CODES[i++] = countryCode;
+ int length = String.valueOf(countryCode).trim().length();
+ if (length > MAX_COUNTRY_CODES_LENGTH) {
+ MAX_COUNTRY_CODES_LENGTH = length;
+ }
+ }
+ }
+ } catch (SQLException e) {
+ Rlog.e(TAG, "Can't access HbpcdLookup database", e);
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ return ALL_COUNTRY_CODES;
+ }
+
+ private static boolean inExceptionListForNpCcAreaLocal(NumberEntry numberEntry) {
+ int countryCode = numberEntry.countryCode;
+ boolean result = (numberEntry.number.length() == 12
+ && (countryCode == 7 || countryCode == 20
+ || countryCode == 65 || countryCode == 90));
+ return result;
+ }
+
+ private static String getNumberPlanType(int state) {
+ String numberPlanType = "Number Plan type (" + state + "): ";
+
+ if (state == NP_NANP_LOCAL) {
+ numberPlanType = "NP_NANP_LOCAL";
+ } else if (state == NP_NANP_AREA_LOCAL) {
+ numberPlanType = "NP_NANP_AREA_LOCAL";
+ } else if (state == NP_NANP_NDD_AREA_LOCAL) {
+ numberPlanType = "NP_NANP_NDD_AREA_LOCAL";
+ } else if (state == NP_NANP_NBPCD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_NANP_NBPCD_CC_AREA_LOCAL";
+ } else if (state == NP_NANP_LOCALIDD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_NANP_LOCALIDD_CC_AREA_LOCAL";
+ } else if (state == NP_NANP_NBPCD_HOMEIDD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_NANP_NBPCD_HOMEIDD_CC_AREA_LOCAL";
+ } else if (state == NP_NBPCD_HOMEIDD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_NBPCD_HOMEIDD_CC_AREA_LOCAL";
+ } else if (state == NP_HOMEIDD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_HOMEIDD_CC_AREA_LOCAL";
+ } else if (state == NP_NBPCD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_NBPCD_CC_AREA_LOCAL";
+ } else if (state == NP_LOCALIDD_CC_AREA_LOCAL) {
+ numberPlanType = "NP_LOCALIDD_CC_AREA_LOCAL";
+ } else if (state == NP_CC_AREA_LOCAL) {
+ numberPlanType = "NP_CC_AREA_LOCAL";
+ } else {
+ numberPlanType = "Unknown type";
+ }
+ return numberPlanType;
+ }
+
+ /**
+ * Filter the destination number if using VZW sim card.
+ */
+ public static String filterDestAddr(Context context, int subId, String destAddr) {
+ if (DBG) Rlog.d(TAG, "enter filterDestAddr. destAddr=\"" + Rlog.pii(TAG, destAddr) + "\"" );
+
+ if (destAddr == null || !PhoneNumberUtils.isGlobalPhoneNumber(destAddr)) {
+ Rlog.w(TAG, "destAddr" + Rlog.pii(TAG, destAddr) +
+ " is not a global phone number! Nothing changed.");
+ return destAddr;
+ }
+
+ final TelephonyManager telephonyManager = ((TelephonyManager) context
+ .getSystemService(Context.TELEPHONY_SERVICE)).createForSubscriptionId(subId);
+ final String networkOperator = telephonyManager.getNetworkOperator();
+ String result = null;
+
+ if (needToConvert(context, subId)) {
+ final int networkType = getNetworkType(telephonyManager);
+ if (networkType != -1 && !TextUtils.isEmpty(networkOperator)) {
+ String networkMcc = networkOperator.substring(0, 3);
+ if (networkMcc != null && networkMcc.trim().length() > 0) {
+ result = formatNumber(context, destAddr, networkMcc, networkType);
+ }
+ }
+ }
+
+ if (DBG) {
+ Rlog.d(TAG, "destAddr is " + ((result != null)?"formatted.":"not formatted."));
+ Rlog.d(TAG, "leave filterDestAddr, new destAddr=\"" + (result != null ? Rlog.pii(TAG,
+ result) : Rlog.pii(TAG, destAddr)) + "\"");
+ }
+ return result != null ? result : destAddr;
+ }
+
+ /**
+ * Returns the current network type
+ */
+ private static int getNetworkType(TelephonyManager telephonyManager) {
+ int networkType = -1;
+ int phoneType = telephonyManager.getPhoneType();
+
+ if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+ networkType = GSM_UMTS_NETWORK;
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+ if (isInternationalRoaming(telephonyManager)) {
+ networkType = CDMA_ROAMING_NETWORK;
+ } else {
+ networkType = CDMA_HOME_NETWORK;
+ }
+ } else {
+ if (DBG) Rlog.w(TAG, "warning! unknown mPhoneType value=" + phoneType);
+ }
+
+ return networkType;
+ }
+
+ private static boolean isInternationalRoaming(TelephonyManager telephonyManager) {
+ String operatorIsoCountry = telephonyManager.getNetworkCountryIso();
+ String simIsoCountry = telephonyManager.getSimCountryIso();
+ boolean internationalRoaming = !TextUtils.isEmpty(operatorIsoCountry)
+ && !TextUtils.isEmpty(simIsoCountry)
+ && !simIsoCountry.equals(operatorIsoCountry);
+ if (internationalRoaming) {
+ if ("us".equals(simIsoCountry)) {
+ internationalRoaming = !"vi".equals(operatorIsoCountry);
+ } else if ("vi".equals(simIsoCountry)) {
+ internationalRoaming = !"us".equals(operatorIsoCountry);
+ }
+ }
+ return internationalRoaming;
+ }
+
+ private static boolean needToConvert(Context context, int subId) {
+ // Calling package may not have READ_PHONE_STATE which is required for getConfig().
+ // Clear the calling identity so that it is called as self.
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ CarrierConfigManager configManager = (CarrierConfigManager)
+ context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ if (configManager != null) {
+ PersistableBundle bundle = configManager.getConfigForSubId(subId);
+ if (bundle != null) {
+ return bundle.getBoolean(CarrierConfigManager
+ .KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL);
+ }
+ }
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ // by default this value is false
+ return false;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/ContentType.java b/telephony/common/com/google/android/mms/ContentType.java
new file mode 100644
index 000000000000..12e4b7e26e1e
--- /dev/null
+++ b/telephony/common/com/google/android/mms/ContentType.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.util.ArrayList;
+
+public class ContentType {
+ public static final String MMS_MESSAGE = "application/vnd.wap.mms-message";
+ // The phony content type for generic PDUs (e.g. ReadOrig.ind,
+ // Notification.ind, Delivery.ind).
+ public static final String MMS_GENERIC = "application/vnd.wap.mms-generic";
+ public static final String MULTIPART_MIXED = "application/vnd.wap.multipart.mixed";
+ public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related";
+ public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative";
+
+ public static final String TEXT_PLAIN = "text/plain";
+ public static final String TEXT_HTML = "text/html";
+ public static final String TEXT_VCALENDAR = "text/x-vCalendar";
+ public static final String TEXT_VCARD = "text/x-vCard";
+
+ public static final String IMAGE_UNSPECIFIED = "image/*";
+ public static final String IMAGE_JPEG = "image/jpeg";
+ public static final String IMAGE_JPG = "image/jpg";
+ public static final String IMAGE_GIF = "image/gif";
+ public static final String IMAGE_WBMP = "image/vnd.wap.wbmp";
+ public static final String IMAGE_PNG = "image/png";
+ public static final String IMAGE_X_MS_BMP = "image/x-ms-bmp";
+
+ public static final String AUDIO_UNSPECIFIED = "audio/*";
+ public static final String AUDIO_AAC = "audio/aac";
+ public static final String AUDIO_AMR = "audio/amr";
+ public static final String AUDIO_IMELODY = "audio/imelody";
+ public static final String AUDIO_MID = "audio/mid";
+ public static final String AUDIO_MIDI = "audio/midi";
+ public static final String AUDIO_MP3 = "audio/mp3";
+ public static final String AUDIO_MPEG3 = "audio/mpeg3";
+ public static final String AUDIO_MPEG = "audio/mpeg";
+ public static final String AUDIO_MPG = "audio/mpg";
+ public static final String AUDIO_MP4 = "audio/mp4";
+ public static final String AUDIO_X_MID = "audio/x-mid";
+ public static final String AUDIO_X_MIDI = "audio/x-midi";
+ public static final String AUDIO_X_MP3 = "audio/x-mp3";
+ public static final String AUDIO_X_MPEG3 = "audio/x-mpeg3";
+ public static final String AUDIO_X_MPEG = "audio/x-mpeg";
+ public static final String AUDIO_X_MPG = "audio/x-mpg";
+ public static final String AUDIO_3GPP = "audio/3gpp";
+ public static final String AUDIO_X_WAV = "audio/x-wav";
+ public static final String AUDIO_OGG = "application/ogg";
+ public static final String AUDIO_OGG2 = "audio/ogg";
+
+ public static final String VIDEO_UNSPECIFIED = "video/*";
+ public static final String VIDEO_3GPP = "video/3gpp";
+ public static final String VIDEO_3G2 = "video/3gpp2";
+ public static final String VIDEO_H263 = "video/h263";
+ public static final String VIDEO_MP4 = "video/mp4";
+
+ public static final String APP_SMIL = "application/smil";
+ public static final String APP_WAP_XHTML = "application/vnd.wap.xhtml+xml";
+ public static final String APP_XHTML = "application/xhtml+xml";
+
+ public static final String APP_DRM_CONTENT = "application/vnd.oma.drm.content";
+ public static final String APP_DRM_MESSAGE = "application/vnd.oma.drm.message";
+
+ private static final ArrayList<String> sSupportedContentTypes = new ArrayList<String>();
+ private static final ArrayList<String> sSupportedImageTypes = new ArrayList<String>();
+ private static final ArrayList<String> sSupportedAudioTypes = new ArrayList<String>();
+ private static final ArrayList<String> sSupportedVideoTypes = new ArrayList<String>();
+
+ static {
+ sSupportedContentTypes.add(TEXT_PLAIN);
+ sSupportedContentTypes.add(TEXT_HTML);
+ sSupportedContentTypes.add(TEXT_VCALENDAR);
+ sSupportedContentTypes.add(TEXT_VCARD);
+
+ sSupportedContentTypes.add(IMAGE_JPEG);
+ sSupportedContentTypes.add(IMAGE_GIF);
+ sSupportedContentTypes.add(IMAGE_WBMP);
+ sSupportedContentTypes.add(IMAGE_PNG);
+ sSupportedContentTypes.add(IMAGE_JPG);
+ sSupportedContentTypes.add(IMAGE_X_MS_BMP);
+ //supportedContentTypes.add(IMAGE_SVG); not yet supported.
+
+ sSupportedContentTypes.add(AUDIO_AAC);
+ sSupportedContentTypes.add(AUDIO_AMR);
+ sSupportedContentTypes.add(AUDIO_IMELODY);
+ sSupportedContentTypes.add(AUDIO_MID);
+ sSupportedContentTypes.add(AUDIO_MIDI);
+ sSupportedContentTypes.add(AUDIO_MP3);
+ sSupportedContentTypes.add(AUDIO_MP4);
+ sSupportedContentTypes.add(AUDIO_MPEG3);
+ sSupportedContentTypes.add(AUDIO_MPEG);
+ sSupportedContentTypes.add(AUDIO_MPG);
+ sSupportedContentTypes.add(AUDIO_X_MID);
+ sSupportedContentTypes.add(AUDIO_X_MIDI);
+ sSupportedContentTypes.add(AUDIO_X_MP3);
+ sSupportedContentTypes.add(AUDIO_X_MPEG3);
+ sSupportedContentTypes.add(AUDIO_X_MPEG);
+ sSupportedContentTypes.add(AUDIO_X_MPG);
+ sSupportedContentTypes.add(AUDIO_X_WAV);
+ sSupportedContentTypes.add(AUDIO_3GPP);
+ sSupportedContentTypes.add(AUDIO_OGG);
+ sSupportedContentTypes.add(AUDIO_OGG2);
+
+ sSupportedContentTypes.add(VIDEO_3GPP);
+ sSupportedContentTypes.add(VIDEO_3G2);
+ sSupportedContentTypes.add(VIDEO_H263);
+ sSupportedContentTypes.add(VIDEO_MP4);
+
+ sSupportedContentTypes.add(APP_SMIL);
+ sSupportedContentTypes.add(APP_WAP_XHTML);
+ sSupportedContentTypes.add(APP_XHTML);
+
+ sSupportedContentTypes.add(APP_DRM_CONTENT);
+ sSupportedContentTypes.add(APP_DRM_MESSAGE);
+
+ // add supported image types
+ sSupportedImageTypes.add(IMAGE_JPEG);
+ sSupportedImageTypes.add(IMAGE_GIF);
+ sSupportedImageTypes.add(IMAGE_WBMP);
+ sSupportedImageTypes.add(IMAGE_PNG);
+ sSupportedImageTypes.add(IMAGE_JPG);
+ sSupportedImageTypes.add(IMAGE_X_MS_BMP);
+
+ // add supported audio types
+ sSupportedAudioTypes.add(AUDIO_AAC);
+ sSupportedAudioTypes.add(AUDIO_AMR);
+ sSupportedAudioTypes.add(AUDIO_IMELODY);
+ sSupportedAudioTypes.add(AUDIO_MID);
+ sSupportedAudioTypes.add(AUDIO_MIDI);
+ sSupportedAudioTypes.add(AUDIO_MP3);
+ sSupportedAudioTypes.add(AUDIO_MPEG3);
+ sSupportedAudioTypes.add(AUDIO_MPEG);
+ sSupportedAudioTypes.add(AUDIO_MPG);
+ sSupportedAudioTypes.add(AUDIO_MP4);
+ sSupportedAudioTypes.add(AUDIO_X_MID);
+ sSupportedAudioTypes.add(AUDIO_X_MIDI);
+ sSupportedAudioTypes.add(AUDIO_X_MP3);
+ sSupportedAudioTypes.add(AUDIO_X_MPEG3);
+ sSupportedAudioTypes.add(AUDIO_X_MPEG);
+ sSupportedAudioTypes.add(AUDIO_X_MPG);
+ sSupportedAudioTypes.add(AUDIO_X_WAV);
+ sSupportedAudioTypes.add(AUDIO_3GPP);
+ sSupportedAudioTypes.add(AUDIO_OGG);
+ sSupportedAudioTypes.add(AUDIO_OGG2);
+
+ // add supported video types
+ sSupportedVideoTypes.add(VIDEO_3GPP);
+ sSupportedVideoTypes.add(VIDEO_3G2);
+ sSupportedVideoTypes.add(VIDEO_H263);
+ sSupportedVideoTypes.add(VIDEO_MP4);
+ }
+
+ // This class should never be instantiated.
+ private ContentType() {
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isSupportedType(String contentType) {
+ return (null != contentType) && sSupportedContentTypes.contains(contentType);
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isSupportedImageType(String contentType) {
+ return isImageType(contentType) && isSupportedType(contentType);
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isSupportedAudioType(String contentType) {
+ return isAudioType(contentType) && isSupportedType(contentType);
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isSupportedVideoType(String contentType) {
+ return isVideoType(contentType) && isSupportedType(contentType);
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isTextType(String contentType) {
+ return (null != contentType) && contentType.startsWith("text/");
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isImageType(String contentType) {
+ return (null != contentType) && contentType.startsWith("image/");
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isAudioType(String contentType) {
+ return (null != contentType) && contentType.startsWith("audio/");
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isVideoType(String contentType) {
+ return (null != contentType) && contentType.startsWith("video/");
+ }
+
+ @UnsupportedAppUsage
+ public static boolean isDrmType(String contentType) {
+ return (null != contentType)
+ && (contentType.equals(APP_DRM_CONTENT)
+ || contentType.equals(APP_DRM_MESSAGE));
+ }
+
+ public static boolean isUnspecified(String contentType) {
+ return (null != contentType) && contentType.endsWith("*");
+ }
+
+ @UnsupportedAppUsage
+ @SuppressWarnings("unchecked")
+ public static ArrayList<String> getImageTypes() {
+ return (ArrayList<String>) sSupportedImageTypes.clone();
+ }
+
+ @UnsupportedAppUsage
+ @SuppressWarnings("unchecked")
+ public static ArrayList<String> getAudioTypes() {
+ return (ArrayList<String>) sSupportedAudioTypes.clone();
+ }
+
+ @UnsupportedAppUsage
+ @SuppressWarnings("unchecked")
+ public static ArrayList<String> getVideoTypes() {
+ return (ArrayList<String>) sSupportedVideoTypes.clone();
+ }
+
+ @SuppressWarnings("unchecked")
+ public static ArrayList<String> getSupportedTypes() {
+ return (ArrayList<String>) sSupportedContentTypes.clone();
+ }
+}
diff --git a/telephony/common/com/google/android/mms/InvalidHeaderValueException.java b/telephony/common/com/google/android/mms/InvalidHeaderValueException.java
new file mode 100644
index 000000000000..2836c3075b3b
--- /dev/null
+++ b/telephony/common/com/google/android/mms/InvalidHeaderValueException.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+/**
+ * Thrown when an invalid header value was set.
+ */
+public class InvalidHeaderValueException extends MmsException {
+ private static final long serialVersionUID = -2053384496042052262L;
+
+ /**
+ * Constructs an InvalidHeaderValueException with no detailed message.
+ */
+ public InvalidHeaderValueException() {
+ super();
+ }
+
+ /**
+ * Constructs an InvalidHeaderValueException with the specified detailed message.
+ *
+ * @param message the detailed message.
+ */
+ @UnsupportedAppUsage
+ public InvalidHeaderValueException(String message) {
+ super(message);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/MmsException.java b/telephony/common/com/google/android/mms/MmsException.java
new file mode 100644
index 000000000000..5be33ed1fac9
--- /dev/null
+++ b/telephony/common/com/google/android/mms/MmsException.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+/**
+ * A generic exception that is thrown by the Mms client.
+ */
+public class MmsException extends Exception {
+ private static final long serialVersionUID = -7323249827281485390L;
+
+ /**
+ * Creates a new MmsException.
+ */
+ @UnsupportedAppUsage
+ public MmsException() {
+ super();
+ }
+
+ /**
+ * Creates a new MmsException with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ @UnsupportedAppUsage
+ public MmsException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new MmsException with the specified cause.
+ *
+ * @param cause the cause.
+ */
+ @UnsupportedAppUsage
+ public MmsException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new MmsException with the specified detail message and cause.
+ *
+ * @param message the detail message.
+ * @param cause the cause.
+ */
+ @UnsupportedAppUsage
+ public MmsException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/package.html b/telephony/common/com/google/android/mms/package.html
new file mode 100755
index 000000000000..c9f96a66ab3b
--- /dev/null
+++ b/telephony/common/com/google/android/mms/package.html
@@ -0,0 +1,5 @@
+<body>
+
+{@hide}
+
+</body>
diff --git a/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java b/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java
new file mode 100644
index 000000000000..ae447d7a7417
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/AcknowledgeInd.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * M-Acknowledge.ind PDU.
+ */
+public class AcknowledgeInd extends GenericPdu {
+ /**
+ * Constructor, used when composing a M-Acknowledge.ind pdu.
+ *
+ * @param mmsVersion current viersion of mms
+ * @param transactionId the transaction-id value
+ * @throws InvalidHeaderValueException if parameters are invalid.
+ * NullPointerException if transactionId is null.
+ */
+ @UnsupportedAppUsage
+ public AcknowledgeInd(int mmsVersion, byte[] transactionId)
+ throws InvalidHeaderValueException {
+ super();
+
+ setMessageType(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND);
+ setMmsVersion(mmsVersion);
+ setTransactionId(transactionId);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ AcknowledgeInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get X-Mms-Report-Allowed field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ public int getReportAllowed() {
+ return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
+ }
+
+ /**
+ * Set X-Mms-Report-Allowed field value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setReportAllowed(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id field value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/Base64.java b/telephony/common/com/google/android/mms/pdu/Base64.java
new file mode 100644
index 000000000000..483fa7f9842e
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/Base64.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+public class Base64 {
+ /**
+ * Used to get the number of Quadruples.
+ */
+ static final int FOURBYTE = 4;
+
+ /**
+ * Byte used to pad output.
+ */
+ static final byte PAD = (byte) '=';
+
+ /**
+ * The base length.
+ */
+ static final int BASELENGTH = 255;
+
+ // Create arrays to hold the base64 characters
+ private static byte[] base64Alphabet = new byte[BASELENGTH];
+
+ // Populating the character arrays
+ static {
+ for (int i = 0; i < BASELENGTH; i++) {
+ base64Alphabet[i] = (byte) -1;
+ }
+ for (int i = 'Z'; i >= 'A'; i--) {
+ base64Alphabet[i] = (byte) (i - 'A');
+ }
+ for (int i = 'z'; i >= 'a'; i--) {
+ base64Alphabet[i] = (byte) (i - 'a' + 26);
+ }
+ for (int i = '9'; i >= '0'; i--) {
+ base64Alphabet[i] = (byte) (i - '0' + 52);
+ }
+
+ base64Alphabet['+'] = 62;
+ base64Alphabet['/'] = 63;
+ }
+
+ /**
+ * Decodes Base64 data into octects
+ *
+ * @param base64Data Byte array containing Base64 data
+ * @return Array containing decoded data.
+ */
+ @UnsupportedAppUsage
+ public static byte[] decodeBase64(byte[] base64Data) {
+ // RFC 2045 requires that we discard ALL non-Base64 characters
+ base64Data = discardNonBase64(base64Data);
+
+ // handle the edge case, so we don't have to worry about it later
+ if (base64Data.length == 0) {
+ return new byte[0];
+ }
+
+ int numberQuadruple = base64Data.length / FOURBYTE;
+ byte decodedData[] = null;
+ byte b1 = 0, b2 = 0, b3 = 0, b4 = 0, marker0 = 0, marker1 = 0;
+
+ // Throw away anything not in base64Data
+
+ int encodedIndex = 0;
+ int dataIndex = 0;
+ {
+ // this sizes the output array properly - rlw
+ int lastData = base64Data.length;
+ // ignore the '=' padding
+ while (base64Data[lastData - 1] == PAD) {
+ if (--lastData == 0) {
+ return new byte[0];
+ }
+ }
+ decodedData = new byte[lastData - numberQuadruple];
+ }
+
+ for (int i = 0; i < numberQuadruple; i++) {
+ dataIndex = i * 4;
+ marker0 = base64Data[dataIndex + 2];
+ marker1 = base64Data[dataIndex + 3];
+
+ b1 = base64Alphabet[base64Data[dataIndex]];
+ b2 = base64Alphabet[base64Data[dataIndex + 1]];
+
+ if (marker0 != PAD && marker1 != PAD) {
+ //No PAD e.g 3cQl
+ b3 = base64Alphabet[marker0];
+ b4 = base64Alphabet[marker1];
+
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ decodedData[encodedIndex + 1] =
+ (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+ decodedData[encodedIndex + 2] = (byte) (b3 << 6 | b4);
+ } else if (marker0 == PAD) {
+ //Two PAD e.g. 3c[Pad][Pad]
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ } else if (marker1 == PAD) {
+ //One PAD e.g. 3cQ[Pad]
+ b3 = base64Alphabet[marker0];
+
+ decodedData[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+ decodedData[encodedIndex + 1] =
+ (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+ }
+ encodedIndex += 3;
+ }
+ return decodedData;
+ }
+
+ /**
+ * Check octect whether it is a base64 encoding.
+ *
+ * @param octect to be checked byte
+ * @return ture if it is base64 encoding, false otherwise.
+ */
+ private static boolean isBase64(byte octect) {
+ if (octect == PAD) {
+ return true;
+ } else if (base64Alphabet[octect] == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Discards any characters outside of the base64 alphabet, per
+ * the requirements on page 25 of RFC 2045 - "Any characters
+ * outside of the base64 alphabet are to be ignored in base64
+ * encoded data."
+ *
+ * @param data The base-64 encoded data to groom
+ * @return The data, less non-base64 characters (see RFC 2045).
+ */
+ static byte[] discardNonBase64(byte[] data) {
+ byte groomedData[] = new byte[data.length];
+ int bytesCopied = 0;
+
+ for (int i = 0; i < data.length; i++) {
+ if (isBase64(data[i])) {
+ groomedData[bytesCopied++] = data[i];
+ }
+ }
+
+ byte packedData[] = new byte[bytesCopied];
+
+ System.arraycopy(groomedData, 0, packedData, 0, bytesCopied);
+
+ return packedData;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/CharacterSets.java b/telephony/common/com/google/android/mms/pdu/CharacterSets.java
new file mode 100644
index 000000000000..27da35e2d928
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/CharacterSets.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+
+public class CharacterSets {
+ /**
+ * IANA assigned MIB enum numbers.
+ *
+ * From wap-230-wsp-20010705-a.pdf
+ * Any-charset = <Octet 128>
+ * Equivalent to the special RFC2616 charset value "*"
+ */
+ public static final int ANY_CHARSET = 0x00;
+ public static final int US_ASCII = 0x03;
+ public static final int ISO_8859_1 = 0x04;
+ public static final int ISO_8859_2 = 0x05;
+ public static final int ISO_8859_3 = 0x06;
+ public static final int ISO_8859_4 = 0x07;
+ public static final int ISO_8859_5 = 0x08;
+ public static final int ISO_8859_6 = 0x09;
+ public static final int ISO_8859_7 = 0x0A;
+ public static final int ISO_8859_8 = 0x0B;
+ public static final int ISO_8859_9 = 0x0C;
+ public static final int SHIFT_JIS = 0x11;
+ public static final int UTF_8 = 0x6A;
+ public static final int BIG5 = 0x07EA;
+ public static final int UCS2 = 0x03E8;
+ public static final int UTF_16 = 0x03F7;
+
+ /**
+ * If the encoding of given data is unsupported, use UTF_8 to decode it.
+ */
+ public static final int DEFAULT_CHARSET = UTF_8;
+
+ /**
+ * Array of MIB enum numbers.
+ */
+ private static final int[] MIBENUM_NUMBERS = {
+ ANY_CHARSET,
+ US_ASCII,
+ ISO_8859_1,
+ ISO_8859_2,
+ ISO_8859_3,
+ ISO_8859_4,
+ ISO_8859_5,
+ ISO_8859_6,
+ ISO_8859_7,
+ ISO_8859_8,
+ ISO_8859_9,
+ SHIFT_JIS,
+ UTF_8,
+ BIG5,
+ UCS2,
+ UTF_16,
+ };
+
+ /**
+ * The Well-known-charset Mime name.
+ */
+ public static final String MIMENAME_ANY_CHARSET = "*";
+ public static final String MIMENAME_US_ASCII = "us-ascii";
+ public static final String MIMENAME_ISO_8859_1 = "iso-8859-1";
+ public static final String MIMENAME_ISO_8859_2 = "iso-8859-2";
+ public static final String MIMENAME_ISO_8859_3 = "iso-8859-3";
+ public static final String MIMENAME_ISO_8859_4 = "iso-8859-4";
+ public static final String MIMENAME_ISO_8859_5 = "iso-8859-5";
+ public static final String MIMENAME_ISO_8859_6 = "iso-8859-6";
+ public static final String MIMENAME_ISO_8859_7 = "iso-8859-7";
+ public static final String MIMENAME_ISO_8859_8 = "iso-8859-8";
+ public static final String MIMENAME_ISO_8859_9 = "iso-8859-9";
+ public static final String MIMENAME_SHIFT_JIS = "shift_JIS";
+ public static final String MIMENAME_UTF_8 = "utf-8";
+ public static final String MIMENAME_BIG5 = "big5";
+ public static final String MIMENAME_UCS2 = "iso-10646-ucs-2";
+ public static final String MIMENAME_UTF_16 = "utf-16";
+
+ public static final String DEFAULT_CHARSET_NAME = MIMENAME_UTF_8;
+
+ /**
+ * Array of the names of character sets.
+ */
+ private static final String[] MIME_NAMES = {
+ MIMENAME_ANY_CHARSET,
+ MIMENAME_US_ASCII,
+ MIMENAME_ISO_8859_1,
+ MIMENAME_ISO_8859_2,
+ MIMENAME_ISO_8859_3,
+ MIMENAME_ISO_8859_4,
+ MIMENAME_ISO_8859_5,
+ MIMENAME_ISO_8859_6,
+ MIMENAME_ISO_8859_7,
+ MIMENAME_ISO_8859_8,
+ MIMENAME_ISO_8859_9,
+ MIMENAME_SHIFT_JIS,
+ MIMENAME_UTF_8,
+ MIMENAME_BIG5,
+ MIMENAME_UCS2,
+ MIMENAME_UTF_16,
+ };
+
+ private static final HashMap<Integer, String> MIBENUM_TO_NAME_MAP;
+ private static final HashMap<String, Integer> NAME_TO_MIBENUM_MAP;
+
+ static {
+ // Create the HashMaps.
+ MIBENUM_TO_NAME_MAP = new HashMap<Integer, String>();
+ NAME_TO_MIBENUM_MAP = new HashMap<String, Integer>();
+ assert(MIBENUM_NUMBERS.length == MIME_NAMES.length);
+ int count = MIBENUM_NUMBERS.length - 1;
+ for(int i = 0; i <= count; i++) {
+ MIBENUM_TO_NAME_MAP.put(MIBENUM_NUMBERS[i], MIME_NAMES[i]);
+ NAME_TO_MIBENUM_MAP.put(MIME_NAMES[i], MIBENUM_NUMBERS[i]);
+ }
+ }
+
+ private CharacterSets() {} // Non-instantiatable
+
+ /**
+ * Map an MIBEnum number to the name of the charset which this number
+ * is assigned to by IANA.
+ *
+ * @param mibEnumValue An IANA assigned MIBEnum number.
+ * @return The name string of the charset.
+ * @throws UnsupportedEncodingException
+ */
+ @UnsupportedAppUsage
+ public static String getMimeName(int mibEnumValue)
+ throws UnsupportedEncodingException {
+ String name = MIBENUM_TO_NAME_MAP.get(mibEnumValue);
+ if (name == null) {
+ throw new UnsupportedEncodingException();
+ }
+ return name;
+ }
+
+ /**
+ * Map a well-known charset name to its assigned MIBEnum number.
+ *
+ * @param mimeName The charset name.
+ * @return The MIBEnum number assigned by IANA for this charset.
+ * @throws UnsupportedEncodingException
+ */
+ @UnsupportedAppUsage
+ public static int getMibEnumValue(String mimeName)
+ throws UnsupportedEncodingException {
+ if(null == mimeName) {
+ return -1;
+ }
+
+ Integer mibEnumValue = NAME_TO_MIBENUM_MAP.get(mimeName);
+ if (mibEnumValue == null) {
+ throw new UnsupportedEncodingException();
+ }
+ return mibEnumValue;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/DeliveryInd.java b/telephony/common/com/google/android/mms/pdu/DeliveryInd.java
new file mode 100644
index 000000000000..7093ac63338c
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/DeliveryInd.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * M-Delivery.Ind Pdu.
+ */
+public class DeliveryInd extends GenericPdu {
+ /**
+ * Empty constructor.
+ * Since the Pdu corresponding to this class is constructed
+ * by the Proxy-Relay server, this class is only instantiated
+ * by the Pdu Parser.
+ *
+ * @throws InvalidHeaderValueException if error occurs.
+ */
+ public DeliveryInd() throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_DELIVERY_IND);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ DeliveryInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get Date value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getDate() {
+ return mPduHeaders.getLongInteger(PduHeaders.DATE);
+ }
+
+ /**
+ * Set Date value.
+ *
+ * @param value the value
+ */
+ public void setDate(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.DATE);
+ }
+
+ /**
+ * Get Message-ID value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageId() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Set Message-ID value.
+ *
+ * @param value the value, should not be null
+ * @throws NullPointerException if the value is null.
+ */
+ public void setMessageId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Get Status value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getStatus() {
+ return mPduHeaders.getOctet(PduHeaders.STATUS);
+ }
+
+ /**
+ * Set Status value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ public void setStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.STATUS);
+ }
+
+ /**
+ * Get To value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue[] getTo() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
+ }
+
+ /**
+ * set To value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setTo(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ *
+ * public EncodedStringValue getStatusText() {return null;}
+ * public void setStatusText(EncodedStringValue value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java
new file mode 100644
index 000000000000..41662750842f
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/EncodedStringValue.java
@@ -0,0 +1,298 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+
+/**
+ * Encoded-string-value = Text-string | Value-length Char-set Text-string
+ */
+public class EncodedStringValue implements Cloneable {
+ private static final String TAG = "EncodedStringValue";
+ private static final boolean DEBUG = false;
+ private static final boolean LOCAL_LOGV = false;
+
+ /**
+ * The Char-set value.
+ */
+ private int mCharacterSet;
+
+ /**
+ * The Text-string value.
+ */
+ private byte[] mData;
+
+ /**
+ * Constructor.
+ *
+ * @param charset the Char-set value
+ * @param data the Text-string value
+ * @throws NullPointerException if Text-string value is null.
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue(int charset, byte[] data) {
+ // TODO: CharSet needs to be validated against MIBEnum.
+ if(null == data) {
+ throw new NullPointerException("EncodedStringValue: Text-string is null.");
+ }
+
+ mCharacterSet = charset;
+ mData = new byte[data.length];
+ System.arraycopy(data, 0, mData, 0, data.length);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param data the Text-string value
+ * @throws NullPointerException if Text-string value is null.
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue(byte[] data) {
+ this(CharacterSets.DEFAULT_CHARSET, data);
+ }
+
+ @UnsupportedAppUsage
+ public EncodedStringValue(String data) {
+ try {
+ mData = data.getBytes(CharacterSets.DEFAULT_CHARSET_NAME);
+ mCharacterSet = CharacterSets.DEFAULT_CHARSET;
+ } catch (UnsupportedEncodingException e) {
+ Log.e(TAG, "Default encoding must be supported.", e);
+ }
+ }
+
+ /**
+ * Get Char-set value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getCharacterSet() {
+ return mCharacterSet;
+ }
+
+ /**
+ * Set Char-set value.
+ *
+ * @param charset the Char-set value
+ */
+ @UnsupportedAppUsage
+ public void setCharacterSet(int charset) {
+ // TODO: CharSet needs to be validated against MIBEnum.
+ mCharacterSet = charset;
+ }
+
+ /**
+ * Get Text-string value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getTextString() {
+ byte[] byteArray = new byte[mData.length];
+
+ System.arraycopy(mData, 0, byteArray, 0, mData.length);
+ return byteArray;
+ }
+
+ /**
+ * Set Text-string value.
+ *
+ * @param textString the Text-string value
+ * @throws NullPointerException if Text-string value is null.
+ */
+ @UnsupportedAppUsage
+ public void setTextString(byte[] textString) {
+ if(null == textString) {
+ throw new NullPointerException("EncodedStringValue: Text-string is null.");
+ }
+
+ mData = new byte[textString.length];
+ System.arraycopy(textString, 0, mData, 0, textString.length);
+ }
+
+ /**
+ * Convert this object to a {@link java.lang.String}. If the encoding of
+ * the EncodedStringValue is null or unsupported, it will be
+ * treated as iso-8859-1 encoding.
+ *
+ * @return The decoded String.
+ */
+ @UnsupportedAppUsage
+ public String getString() {
+ if (CharacterSets.ANY_CHARSET == mCharacterSet) {
+ return new String(mData); // system default encoding.
+ } else {
+ try {
+ String name = CharacterSets.getMimeName(mCharacterSet);
+ return new String(mData, name);
+ } catch (UnsupportedEncodingException e) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, e.getMessage(), e);
+ }
+ try {
+ return new String(mData, CharacterSets.MIMENAME_ISO_8859_1);
+ } catch (UnsupportedEncodingException e2) {
+ return new String(mData); // system default encoding.
+ }
+ }
+ }
+ }
+
+ /**
+ * Append to Text-string.
+ *
+ * @param textString the textString to append
+ * @throws NullPointerException if the text String is null
+ * or an IOException occurred.
+ */
+ @UnsupportedAppUsage
+ public void appendTextString(byte[] textString) {
+ if(null == textString) {
+ throw new NullPointerException("Text-string is null.");
+ }
+
+ if(null == mData) {
+ mData = new byte[textString.length];
+ System.arraycopy(textString, 0, mData, 0, textString.length);
+ } else {
+ ByteArrayOutputStream newTextString = new ByteArrayOutputStream();
+ try {
+ newTextString.write(mData);
+ newTextString.write(textString);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new NullPointerException(
+ "appendTextString: failed when write a new Text-string");
+ }
+
+ mData = newTextString.toByteArray();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ super.clone();
+ int len = mData.length;
+ byte[] dstBytes = new byte[len];
+ System.arraycopy(mData, 0, dstBytes, 0, len);
+
+ try {
+ return new EncodedStringValue(mCharacterSet, dstBytes);
+ } catch (Exception e) {
+ Log.e(TAG, "failed to clone an EncodedStringValue: " + this);
+ e.printStackTrace();
+ throw new CloneNotSupportedException(e.getMessage());
+ }
+ }
+
+ /**
+ * Split this encoded string around matches of the given pattern.
+ *
+ * @param pattern the delimiting pattern
+ * @return the array of encoded strings computed by splitting this encoded
+ * string around matches of the given pattern
+ */
+ public EncodedStringValue[] split(String pattern) {
+ String[] temp = getString().split(pattern);
+ EncodedStringValue[] ret = new EncodedStringValue[temp.length];
+ for (int i = 0; i < ret.length; ++i) {
+ try {
+ ret[i] = new EncodedStringValue(mCharacterSet,
+ temp[i].getBytes());
+ } catch (NullPointerException e) {
+ // Can't arrive here
+ return null;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Extract an EncodedStringValue[] from a given String.
+ */
+ @UnsupportedAppUsage
+ public static EncodedStringValue[] extract(String src) {
+ String[] values = src.split(";");
+
+ ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
+ for (int i = 0; i < values.length; i++) {
+ if (values[i].length() > 0) {
+ list.add(new EncodedStringValue(values[i]));
+ }
+ }
+
+ int len = list.size();
+ if (len > 0) {
+ return list.toArray(new EncodedStringValue[len]);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Concatenate an EncodedStringValue[] into a single String.
+ */
+ @UnsupportedAppUsage
+ public static String concat(EncodedStringValue[] addr) {
+ StringBuilder sb = new StringBuilder();
+ int maxIndex = addr.length - 1;
+ for (int i = 0; i <= maxIndex; i++) {
+ sb.append(addr[i].getString());
+ if (i < maxIndex) {
+ sb.append(";");
+ }
+ }
+
+ return sb.toString();
+ }
+
+ @UnsupportedAppUsage
+ public static EncodedStringValue copy(EncodedStringValue value) {
+ if (value == null) {
+ return null;
+ }
+
+ return new EncodedStringValue(value.mCharacterSet, value.mData);
+ }
+
+ @UnsupportedAppUsage
+ public static EncodedStringValue[] encodeStrings(String[] array) {
+ int count = array.length;
+ if (count > 0) {
+ EncodedStringValue[] encodedArray = new EncodedStringValue[count];
+ for (int i = 0; i < count; i++) {
+ encodedArray[i] = new EncodedStringValue(array[i]);
+ }
+ return encodedArray;
+ }
+ return null;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/GenericPdu.java b/telephony/common/com/google/android/mms/pdu/GenericPdu.java
new file mode 100644
index 000000000000..ebf16ac7e632
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/GenericPdu.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+public class GenericPdu {
+ /**
+ * The headers of pdu.
+ */
+ @UnsupportedAppUsage
+ PduHeaders mPduHeaders = null;
+
+ /**
+ * Constructor.
+ */
+ @UnsupportedAppUsage
+ public GenericPdu() {
+ mPduHeaders = new PduHeaders();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param headers Headers for this PDU.
+ */
+ GenericPdu(PduHeaders headers) {
+ mPduHeaders = headers;
+ }
+
+ /**
+ * Get the headers of this PDU.
+ *
+ * @return A PduHeaders of this PDU.
+ */
+ @UnsupportedAppUsage
+ PduHeaders getPduHeaders() {
+ return mPduHeaders;
+ }
+
+ /**
+ * Get X-Mms-Message-Type field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ @UnsupportedAppUsage
+ public int getMessageType() {
+ return mPduHeaders.getOctet(PduHeaders.MESSAGE_TYPE);
+ }
+
+ /**
+ * Set X-Mms-Message-Type field value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if field's value is not Octet.
+ */
+ @UnsupportedAppUsage
+ public void setMessageType(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.MESSAGE_TYPE);
+ }
+
+ /**
+ * Get X-Mms-MMS-Version field value.
+ *
+ * @return the X-Mms-MMS-Version value
+ */
+ public int getMmsVersion() {
+ return mPduHeaders.getOctet(PduHeaders.MMS_VERSION);
+ }
+
+ /**
+ * Set X-Mms-MMS-Version field value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if field's value is not Octet.
+ */
+ public void setMmsVersion(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.MMS_VERSION);
+ }
+
+ /**
+ * Get From value.
+ * From-value = Value-length
+ * (Address-present-token Encoded-string-value | Insert-address-token)
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getFrom() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
+ }
+
+ /**
+ * Set From value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setFrom(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java b/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java
new file mode 100644
index 000000000000..e108f7600baf
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/MultimediaMessagePdu.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * Multimedia message PDU.
+ */
+public class MultimediaMessagePdu extends GenericPdu{
+ /**
+ * The body.
+ */
+ private PduBody mMessageBody;
+
+ /**
+ * Constructor.
+ */
+ @UnsupportedAppUsage
+ public MultimediaMessagePdu() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param header the header of this PDU
+ * @param body the body of this PDU
+ */
+ @UnsupportedAppUsage
+ public MultimediaMessagePdu(PduHeaders header, PduBody body) {
+ super(header);
+ mMessageBody = body;
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ MultimediaMessagePdu(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get body of the PDU.
+ *
+ * @return the body
+ */
+ @UnsupportedAppUsage
+ public PduBody getBody() {
+ return mMessageBody;
+ }
+
+ /**
+ * Set body of the PDU.
+ *
+ * @param body the body
+ */
+ @UnsupportedAppUsage
+ public void setBody(PduBody body) {
+ mMessageBody = body;
+ }
+
+ /**
+ * Get subject.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getSubject() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT);
+ }
+
+ /**
+ * Set subject.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setSubject(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT);
+ }
+
+ /**
+ * Get To value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue[] getTo() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
+ }
+
+ /**
+ * Add a "To" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void addTo(EncodedStringValue value) {
+ mPduHeaders.appendEncodedStringValue(value, PduHeaders.TO);
+ }
+
+ /**
+ * Get X-Mms-Priority value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getPriority() {
+ return mPduHeaders.getOctet(PduHeaders.PRIORITY);
+ }
+
+ /**
+ * Set X-Mms-Priority value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setPriority(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.PRIORITY);
+ }
+
+ /**
+ * Get Date value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getDate() {
+ return mPduHeaders.getLongInteger(PduHeaders.DATE);
+ }
+
+ /**
+ * Set Date value in seconds.
+ *
+ * @param value the value
+ */
+ @UnsupportedAppUsage
+ public void setDate(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.DATE);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/NotificationInd.java b/telephony/common/com/google/android/mms/pdu/NotificationInd.java
new file mode 100644
index 000000000000..b561bd4ab3a7
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/NotificationInd.java
@@ -0,0 +1,307 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * M-Notification.ind PDU.
+ */
+public class NotificationInd extends GenericPdu {
+ /**
+ * Empty constructor.
+ * Since the Pdu corresponding to this class is constructed
+ * by the Proxy-Relay server, this class is only instantiated
+ * by the Pdu Parser.
+ *
+ * @throws InvalidHeaderValueException if error occurs.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public NotificationInd() throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ NotificationInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get X-Mms-Content-Class Value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getContentClass() {
+ return mPduHeaders.getOctet(PduHeaders.CONTENT_CLASS);
+ }
+
+ /**
+ * Set X-Mms-Content-Class Value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setContentClass(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.CONTENT_CLASS);
+ }
+
+ /**
+ * Get X-Mms-Content-Location value.
+ * When used in a PDU other than M-Mbox-Delete.conf and M-Delete.conf:
+ * Content-location-value = Uri-value
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentLocation() {
+ return mPduHeaders.getTextString(PduHeaders.CONTENT_LOCATION);
+ }
+
+ /**
+ * Set X-Mms-Content-Location value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setContentLocation(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.CONTENT_LOCATION);
+ }
+
+ /**
+ * Get X-Mms-Expiry value.
+ *
+ * Expiry-value = Value-length
+ * (Absolute-token Date-value | Relative-token Delta-seconds-value)
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getExpiry() {
+ return mPduHeaders.getLongInteger(PduHeaders.EXPIRY);
+ }
+
+ /**
+ * Set X-Mms-Expiry value.
+ *
+ * @param value the value
+ * @throws RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setExpiry(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY);
+ }
+
+ /**
+ * Get From value.
+ * From-value = Value-length
+ * (Address-present-token Encoded-string-value | Insert-address-token)
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getFrom() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
+ }
+
+ /**
+ * Set From value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setFrom(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
+ }
+
+ /**
+ * Get X-Mms-Message-Class value.
+ * Message-class-value = Class-identifier | Token-text
+ * Class-identifier = Personal | Advertisement | Informational | Auto
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageClass() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Set X-Mms-Message-Class value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setMessageClass(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Get X-Mms-Message-Size value.
+ * Message-size-value = Long-integer
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getMessageSize() {
+ return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE);
+ }
+
+ /**
+ * Set X-Mms-Message-Size value.
+ *
+ * @param value the value
+ * @throws RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setMessageSize(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE);
+ }
+
+ /**
+ * Get subject.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getSubject() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.SUBJECT);
+ }
+
+ /**
+ * Set subject.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setSubject(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.SUBJECT);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Get X-Mms-Delivery-Report Value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getDeliveryReport() {
+ return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
+ }
+
+ /**
+ * Set X-Mms-Delivery-Report Value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setDeliveryReport(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte getDrmContent() {return 0x00;}
+ * public void setDrmContent(byte value) {}
+ *
+ * public byte getDistributionIndicator() {return 0x00;}
+ * public void setDistributionIndicator(byte value) {}
+ *
+ * public ElementDescriptorValue getElementDescriptor() {return null;}
+ * public void getElementDescriptor(ElementDescriptorValue value) {}
+ *
+ * public byte getPriority() {return 0x00;}
+ * public void setPriority(byte value) {}
+ *
+ * public byte getRecommendedRetrievalMode() {return 0x00;}
+ * public void setRecommendedRetrievalMode(byte value) {}
+ *
+ * public byte getRecommendedRetrievalModeText() {return 0x00;}
+ * public void setRecommendedRetrievalModeText(byte value) {}
+ *
+ * public byte[] getReplaceId() {return 0x00;}
+ * public void setReplaceId(byte[] value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ *
+ * public byte getReplyCharging() {return 0x00;}
+ * public void setReplyCharging(byte value) {}
+ *
+ * public byte getReplyChargingDeadline() {return 0x00;}
+ * public void setReplyChargingDeadline(byte value) {}
+ *
+ * public byte[] getReplyChargingId() {return 0x00;}
+ * public void setReplyChargingId(byte[] value) {}
+ *
+ * public long getReplyChargingSize() {return 0;}
+ * public void setReplyChargingSize(long value) {}
+ *
+ * public byte getStored() {return 0x00;}
+ * public void setStored(byte value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java b/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java
new file mode 100644
index 000000000000..3c70f86a0890
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/NotifyRespInd.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * M-NofifyResp.ind PDU.
+ */
+public class NotifyRespInd extends GenericPdu {
+ /**
+ * Constructor, used when composing a M-NotifyResp.ind pdu.
+ *
+ * @param mmsVersion current version of mms
+ * @param transactionId the transaction-id value
+ * @param status the status value
+ * @throws InvalidHeaderValueException if parameters are invalid.
+ * NullPointerException if transactionId is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public NotifyRespInd(int mmsVersion,
+ byte[] transactionId,
+ int status) throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND);
+ setMmsVersion(mmsVersion);
+ setTransactionId(transactionId);
+ setStatus(status);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ NotifyRespInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get X-Mms-Report-Allowed field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ public int getReportAllowed() {
+ return mPduHeaders.getOctet(PduHeaders.REPORT_ALLOWED);
+ }
+
+ /**
+ * Set X-Mms-Report-Allowed field value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setReportAllowed(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.REPORT_ALLOWED);
+ }
+
+ /**
+ * Set X-Mms-Status field value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.STATUS);
+ }
+
+ /**
+ * GetX-Mms-Status field value.
+ *
+ * @return the X-Mms-Status value
+ */
+ public int getStatus() {
+ return mPduHeaders.getOctet(PduHeaders.STATUS);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id field value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ * RuntimeException if an undeclared error occurs.
+ */
+ @UnsupportedAppUsage
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduBody.java b/telephony/common/com/google/android/mms/pdu/PduBody.java
new file mode 100644
index 000000000000..51914e4110b0
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduBody.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Vector;
+
+public class PduBody {
+ private Vector<PduPart> mParts = null;
+
+ private Map<String, PduPart> mPartMapByContentId = null;
+ private Map<String, PduPart> mPartMapByContentLocation = null;
+ private Map<String, PduPart> mPartMapByName = null;
+ private Map<String, PduPart> mPartMapByFileName = null;
+
+ /**
+ * Constructor.
+ */
+ @UnsupportedAppUsage
+ public PduBody() {
+ mParts = new Vector<PduPart>();
+
+ mPartMapByContentId = new HashMap<String, PduPart>();
+ mPartMapByContentLocation = new HashMap<String, PduPart>();
+ mPartMapByName = new HashMap<String, PduPart>();
+ mPartMapByFileName = new HashMap<String, PduPart>();
+ }
+
+ private void putPartToMaps(PduPart part) {
+ // Put part to mPartMapByContentId.
+ byte[] contentId = part.getContentId();
+ if(null != contentId) {
+ mPartMapByContentId.put(new String(contentId), part);
+ }
+
+ // Put part to mPartMapByContentLocation.
+ byte[] contentLocation = part.getContentLocation();
+ if(null != contentLocation) {
+ String clc = new String(contentLocation);
+ mPartMapByContentLocation.put(clc, part);
+ }
+
+ // Put part to mPartMapByName.
+ byte[] name = part.getName();
+ if(null != name) {
+ String clc = new String(name);
+ mPartMapByName.put(clc, part);
+ }
+
+ // Put part to mPartMapByFileName.
+ byte[] fileName = part.getFilename();
+ if(null != fileName) {
+ String clc = new String(fileName);
+ mPartMapByFileName.put(clc, part);
+ }
+ }
+
+ /**
+ * Appends the specified part to the end of this body.
+ *
+ * @param part part to be appended
+ * @return true when success, false when fail
+ * @throws NullPointerException when part is null
+ */
+ @UnsupportedAppUsage
+ public boolean addPart(PduPart part) {
+ if(null == part) {
+ throw new NullPointerException();
+ }
+
+ putPartToMaps(part);
+ return mParts.add(part);
+ }
+
+ /**
+ * Inserts the specified part at the specified position.
+ *
+ * @param index index at which the specified part is to be inserted
+ * @param part part to be inserted
+ * @throws NullPointerException when part is null
+ */
+ @UnsupportedAppUsage
+ public void addPart(int index, PduPart part) {
+ if(null == part) {
+ throw new NullPointerException();
+ }
+
+ putPartToMaps(part);
+ mParts.add(index, part);
+ }
+
+ /**
+ * Removes the part at the specified position.
+ *
+ * @param index index of the part to return
+ * @return part at the specified index
+ */
+ @UnsupportedAppUsage
+ public PduPart removePart(int index) {
+ return mParts.remove(index);
+ }
+
+ /**
+ * Remove all of the parts.
+ */
+ public void removeAll() {
+ mParts.clear();
+ }
+
+ /**
+ * Get the part at the specified position.
+ *
+ * @param index index of the part to return
+ * @return part at the specified index
+ */
+ @UnsupportedAppUsage
+ public PduPart getPart(int index) {
+ return mParts.get(index);
+ }
+
+ /**
+ * Get the index of the specified part.
+ *
+ * @param part the part object
+ * @return index the index of the first occurrence of the part in this body
+ */
+ @UnsupportedAppUsage
+ public int getPartIndex(PduPart part) {
+ return mParts.indexOf(part);
+ }
+
+ /**
+ * Get the number of parts.
+ *
+ * @return the number of parts
+ */
+ @UnsupportedAppUsage
+ public int getPartsNum() {
+ return mParts.size();
+ }
+
+ /**
+ * Get pdu part by content id.
+ *
+ * @param cid the value of content id.
+ * @return the pdu part.
+ */
+ @UnsupportedAppUsage
+ public PduPart getPartByContentId(String cid) {
+ return mPartMapByContentId.get(cid);
+ }
+
+ /**
+ * Get pdu part by Content-Location. Content-Location of part is
+ * the same as filename and name(param of content-type).
+ *
+ * @param fileName the value of filename.
+ * @return the pdu part.
+ */
+ @UnsupportedAppUsage
+ public PduPart getPartByContentLocation(String contentLocation) {
+ return mPartMapByContentLocation.get(contentLocation);
+ }
+
+ /**
+ * Get pdu part by name.
+ *
+ * @param fileName the value of filename.
+ * @return the pdu part.
+ */
+ @UnsupportedAppUsage
+ public PduPart getPartByName(String name) {
+ return mPartMapByName.get(name);
+ }
+
+ /**
+ * Get pdu part by filename.
+ *
+ * @param fileName the value of filename.
+ * @return the pdu part.
+ */
+ @UnsupportedAppUsage
+ public PduPart getPartByFileName(String filename) {
+ return mPartMapByFileName.get(filename);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduComposer.java b/telephony/common/com/google/android/mms/pdu/PduComposer.java
new file mode 100644
index 000000000000..e24bf21a11b5
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduComposer.java
@@ -0,0 +1,1229 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.text.TextUtils;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+
+public class PduComposer {
+ /**
+ * Address type.
+ */
+ static private final int PDU_PHONE_NUMBER_ADDRESS_TYPE = 1;
+ static private final int PDU_EMAIL_ADDRESS_TYPE = 2;
+ static private final int PDU_IPV4_ADDRESS_TYPE = 3;
+ static private final int PDU_IPV6_ADDRESS_TYPE = 4;
+ static private final int PDU_UNKNOWN_ADDRESS_TYPE = 5;
+
+ /**
+ * Address regular expression string.
+ */
+ static final String REGEXP_PHONE_NUMBER_ADDRESS_TYPE = "\\+?[0-9|\\.|\\-]+";
+ static final String REGEXP_EMAIL_ADDRESS_TYPE = "[a-zA-Z| ]*\\<{0,1}[a-zA-Z| ]+@{1}" +
+ "[a-zA-Z| ]+\\.{1}[a-zA-Z| ]+\\>{0,1}";
+ static final String REGEXP_IPV6_ADDRESS_TYPE =
+ "[a-fA-F]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}" +
+ "[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}\\:{1}" +
+ "[a-fA-F0-9]{4}\\:{1}[a-fA-F0-9]{4}";
+ static final String REGEXP_IPV4_ADDRESS_TYPE = "[0-9]{1,3}\\.{1}[0-9]{1,3}\\.{1}" +
+ "[0-9]{1,3}\\.{1}[0-9]{1,3}";
+
+ /**
+ * The postfix strings of address.
+ */
+ static final String STRING_PHONE_NUMBER_ADDRESS_TYPE = "/TYPE=PLMN";
+ static final String STRING_IPV4_ADDRESS_TYPE = "/TYPE=IPV4";
+ static final String STRING_IPV6_ADDRESS_TYPE = "/TYPE=IPV6";
+
+ /**
+ * Error values.
+ */
+ static private final int PDU_COMPOSE_SUCCESS = 0;
+ static private final int PDU_COMPOSE_CONTENT_ERROR = 1;
+ static private final int PDU_COMPOSE_FIELD_NOT_SET = 2;
+ static private final int PDU_COMPOSE_FIELD_NOT_SUPPORTED = 3;
+
+ /**
+ * WAP values defined in WSP spec.
+ */
+ static private final int QUOTED_STRING_FLAG = 34;
+ static private final int END_STRING_FLAG = 0;
+ static private final int LENGTH_QUOTE = 31;
+ static private final int TEXT_MAX = 127;
+ static private final int SHORT_INTEGER_MAX = 127;
+ static private final int LONG_INTEGER_LENGTH_MAX = 8;
+
+ /**
+ * Block size when read data from InputStream.
+ */
+ static private final int PDU_COMPOSER_BLOCK_SIZE = 1024;
+
+ /**
+ * The output message.
+ */
+ @UnsupportedAppUsage
+ protected ByteArrayOutputStream mMessage = null;
+
+ /**
+ * The PDU.
+ */
+ @UnsupportedAppUsage
+ private GenericPdu mPdu = null;
+
+ /**
+ * Current visiting position of the mMessage.
+ */
+ @UnsupportedAppUsage
+ protected int mPosition = 0;
+
+ /**
+ * Message compose buffer stack.
+ */
+ @UnsupportedAppUsage
+ private BufferStack mStack = null;
+
+ /**
+ * Content resolver.
+ */
+ @UnsupportedAppUsage
+ private final ContentResolver mResolver;
+
+ /**
+ * Header of this pdu.
+ */
+ @UnsupportedAppUsage
+ private PduHeaders mPduHeader = null;
+
+ /**
+ * Map of all content type
+ */
+ @UnsupportedAppUsage
+ private static HashMap<String, Integer> mContentTypeMap = null;
+
+ static {
+ mContentTypeMap = new HashMap<String, Integer>();
+
+ int i;
+ for (i = 0; i < PduContentTypes.contentTypes.length; i++) {
+ mContentTypeMap.put(PduContentTypes.contentTypes[i], i);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param context the context
+ * @param pdu the pdu to be composed
+ */
+ @UnsupportedAppUsage
+ public PduComposer(Context context, GenericPdu pdu) {
+ mPdu = pdu;
+ mResolver = context.getContentResolver();
+ mPduHeader = pdu.getPduHeaders();
+ mStack = new BufferStack();
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ /**
+ * Make the message. No need to check whether mandatory fields are set,
+ * because the constructors of outgoing pdus are taking care of this.
+ *
+ * @return OutputStream of maked message. Return null if
+ * the PDU is invalid.
+ */
+ @UnsupportedAppUsage
+ public byte[] make() {
+ // Get Message-type.
+ int type = mPdu.getMessageType();
+
+ /* make the message */
+ switch (type) {
+ case PduHeaders.MESSAGE_TYPE_SEND_REQ:
+ case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
+ if (makeSendRetrievePdu(type) != PDU_COMPOSE_SUCCESS) {
+ return null;
+ }
+ break;
+ case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND:
+ if (makeNotifyResp() != PDU_COMPOSE_SUCCESS) {
+ return null;
+ }
+ break;
+ case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND:
+ if (makeAckInd() != PDU_COMPOSE_SUCCESS) {
+ return null;
+ }
+ break;
+ case PduHeaders.MESSAGE_TYPE_READ_REC_IND:
+ if (makeReadRecInd() != PDU_COMPOSE_SUCCESS) {
+ return null;
+ }
+ break;
+ default:
+ return null;
+ }
+
+ return mMessage.toByteArray();
+ }
+
+ /**
+ * Copy buf to mMessage.
+ */
+ @UnsupportedAppUsage
+ protected void arraycopy(byte[] buf, int pos, int length) {
+ mMessage.write(buf, pos, length);
+ mPosition = mPosition + length;
+ }
+
+ /**
+ * Append a byte to mMessage.
+ */
+ protected void append(int value) {
+ mMessage.write(value);
+ mPosition ++;
+ }
+
+ /**
+ * Append short integer value to mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendShortInteger(int value) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Short-integer = OCTET
+ * ; Integers in range 0-127 shall be encoded as a one octet value
+ * ; with the most significant bit set to one (1xxx xxxx) and with
+ * ; the value in the remaining least significant bits.
+ * In our implementation, only low 7 bits are stored and otherwise
+ * bits are ignored.
+ */
+ append((value | 0x80) & 0xff);
+ }
+
+ /**
+ * Append an octet number between 128 and 255 into mMessage.
+ * NOTE:
+ * A value between 0 and 127 should be appended by using appendShortInteger.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendOctet(int number) {
+ append(number);
+ }
+
+ /**
+ * Append a short length into mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ protected void appendShortLength(int value) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Short-length = <Any octet 0-30>
+ */
+ append(value);
+ }
+
+ /**
+ * Append long integer into mMessage. it's used for really long integers.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendLongInteger(long longInt) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Long-integer = Short-length Multi-octet-integer
+ * ; The Short-length indicates the length of the Multi-octet-integer
+ * Multi-octet-integer = 1*30 OCTET
+ * ; The content octets shall be an unsigned integer value with the
+ * ; most significant octet encoded first (big-endian representation).
+ * ; The minimum number of octets must be used to encode the value.
+ */
+ int size;
+ long temp = longInt;
+
+ // Count the length of the long integer.
+ for(size = 0; (temp != 0) && (size < LONG_INTEGER_LENGTH_MAX); size++) {
+ temp = (temp >>> 8);
+ }
+
+ // Set Length.
+ appendShortLength(size);
+
+ // Count and set the long integer.
+ int i;
+ int shift = (size -1) * 8;
+
+ for (i = 0; i < size; i++) {
+ append((int)((longInt >>> shift) & 0xff));
+ shift = shift - 8;
+ }
+ }
+
+ /**
+ * Append text string into mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendTextString(byte[] text) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Text-string = [Quote] *TEXT End-of-string
+ * ; If the first character in the TEXT is in the range of 128-255,
+ * ; a Quote character must precede it. Otherwise the Quote character
+ * ;must be omitted. The Quote is not part of the contents.
+ */
+ if (((text[0])&0xff) > TEXT_MAX) { // No need to check for <= 255
+ append(TEXT_MAX);
+ }
+
+ arraycopy(text, 0, text.length);
+ append(0);
+ }
+
+ /**
+ * Append text string into mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendTextString(String str) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Text-string = [Quote] *TEXT End-of-string
+ * ; If the first character in the TEXT is in the range of 128-255,
+ * ; a Quote character must precede it. Otherwise the Quote character
+ * ;must be omitted. The Quote is not part of the contents.
+ */
+ appendTextString(str.getBytes());
+ }
+
+ /**
+ * Append encoded string value to mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendEncodedString(EncodedStringValue enStr) {
+ /*
+ * From OMA-TS-MMS-ENC-V1_3-20050927-C:
+ * Encoded-string-value = Text-string | Value-length Char-set Text-string
+ */
+ assert(enStr != null);
+
+ int charset = enStr.getCharacterSet();
+ byte[] textString = enStr.getTextString();
+ if (null == textString) {
+ return;
+ }
+
+ /*
+ * In the implementation of EncodedStringValue, the charset field will
+ * never be 0. It will always be composed as
+ * Encoded-string-value = Value-length Char-set Text-string
+ */
+ mStack.newbuf();
+ PositionMarker start = mStack.mark();
+
+ appendShortInteger(charset);
+ appendTextString(textString);
+
+ int len = start.getLength();
+ mStack.pop();
+ appendValueLength(len);
+ mStack.copy();
+ }
+
+ /**
+ * Append uintvar integer into mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendUintvarInteger(long value) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * To encode a large unsigned integer, split it into 7-bit fragments
+ * and place them in the payloads of multiple octets. The most significant
+ * bits are placed in the first octets with the least significant bits
+ * ending up in the last octet. All octets MUST set the Continue bit to 1
+ * except the last octet, which MUST set the Continue bit to 0.
+ */
+ int i;
+ long max = SHORT_INTEGER_MAX;
+
+ for (i = 0; i < 5; i++) {
+ if (value < max) {
+ break;
+ }
+
+ max = (max << 7) | 0x7fl;
+ }
+
+ while(i > 0) {
+ long temp = value >>> (i * 7);
+ temp = temp & 0x7f;
+
+ append((int)((temp | 0x80) & 0xff));
+
+ i--;
+ }
+
+ append((int)(value & 0x7f));
+ }
+
+ /**
+ * Append date value into mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ protected void appendDateValue(long date) {
+ /*
+ * From OMA-TS-MMS-ENC-V1_3-20050927-C:
+ * Date-value = Long-integer
+ */
+ appendLongInteger(date);
+ }
+
+ /**
+ * Append value length to mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendValueLength(long value) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Value-length = Short-length | (Length-quote Length)
+ * ; Value length is used to indicate the length of the value to follow
+ * Short-length = <Any octet 0-30>
+ * Length-quote = <Octet 31>
+ * Length = Uintvar-integer
+ */
+ if (value < LENGTH_QUOTE) {
+ appendShortLength((int) value);
+ return;
+ }
+
+ append(LENGTH_QUOTE);
+ appendUintvarInteger(value);
+ }
+
+ /**
+ * Append quoted string to mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendQuotedString(byte[] text) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Quoted-string = <Octet 34> *TEXT End-of-string
+ * ;The TEXT encodes an RFC2616 Quoted-string with the enclosing
+ * ;quotation-marks <"> removed.
+ */
+ append(QUOTED_STRING_FLAG);
+ arraycopy(text, 0, text.length);
+ append(END_STRING_FLAG);
+ }
+
+ /**
+ * Append quoted string to mMessage.
+ * This implementation doesn't check the validity of parameter, since it
+ * assumes that the values are validated in the GenericPdu setter methods.
+ */
+ @UnsupportedAppUsage
+ protected void appendQuotedString(String str) {
+ /*
+ * From WAP-230-WSP-20010705-a:
+ * Quoted-string = <Octet 34> *TEXT End-of-string
+ * ;The TEXT encodes an RFC2616 Quoted-string with the enclosing
+ * ;quotation-marks <"> removed.
+ */
+ appendQuotedString(str.getBytes());
+ }
+
+ private EncodedStringValue appendAddressType(EncodedStringValue address) {
+ EncodedStringValue temp = null;
+
+ try {
+ int addressType = checkAddressType(address.getString());
+ temp = EncodedStringValue.copy(address);
+ if (PDU_PHONE_NUMBER_ADDRESS_TYPE == addressType) {
+ // Phone number.
+ temp.appendTextString(STRING_PHONE_NUMBER_ADDRESS_TYPE.getBytes());
+ } else if (PDU_IPV4_ADDRESS_TYPE == addressType) {
+ // Ipv4 address.
+ temp.appendTextString(STRING_IPV4_ADDRESS_TYPE.getBytes());
+ } else if (PDU_IPV6_ADDRESS_TYPE == addressType) {
+ // Ipv6 address.
+ temp.appendTextString(STRING_IPV6_ADDRESS_TYPE.getBytes());
+ }
+ } catch (NullPointerException e) {
+ return null;
+ }
+
+ return temp;
+ }
+
+ /**
+ * Append header to mMessage.
+ */
+ @UnsupportedAppUsage
+ private int appendHeader(int field) {
+ switch (field) {
+ case PduHeaders.MMS_VERSION:
+ appendOctet(field);
+
+ int version = mPduHeader.getOctet(field);
+ if (0 == version) {
+ appendShortInteger(PduHeaders.CURRENT_MMS_VERSION);
+ } else {
+ appendShortInteger(version);
+ }
+
+ break;
+
+ case PduHeaders.MESSAGE_ID:
+ case PduHeaders.TRANSACTION_ID:
+ byte[] textString = mPduHeader.getTextString(field);
+ if (null == textString) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+ appendTextString(textString);
+ break;
+
+ case PduHeaders.TO:
+ case PduHeaders.BCC:
+ case PduHeaders.CC:
+ EncodedStringValue[] addr = mPduHeader.getEncodedStringValues(field);
+
+ if (null == addr) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ EncodedStringValue temp;
+ for (int i = 0; i < addr.length; i++) {
+ temp = appendAddressType(addr[i]);
+ if (temp == null) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ appendOctet(field);
+ appendEncodedString(temp);
+ }
+ break;
+
+ case PduHeaders.FROM:
+ // Value-length (Address-present-token Encoded-string-value | Insert-address-token)
+ appendOctet(field);
+
+ EncodedStringValue from = mPduHeader.getEncodedStringValue(field);
+ if ((from == null)
+ || TextUtils.isEmpty(from.getString())
+ || new String(from.getTextString()).equals(
+ PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR)) {
+ // Length of from = 1
+ append(1);
+ // Insert-address-token = <Octet 129>
+ append(PduHeaders.FROM_INSERT_ADDRESS_TOKEN);
+ } else {
+ mStack.newbuf();
+ PositionMarker fstart = mStack.mark();
+
+ // Address-present-token = <Octet 128>
+ append(PduHeaders.FROM_ADDRESS_PRESENT_TOKEN);
+
+ temp = appendAddressType(from);
+ if (temp == null) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ appendEncodedString(temp);
+
+ int flen = fstart.getLength();
+ mStack.pop();
+ appendValueLength(flen);
+ mStack.copy();
+ }
+ break;
+
+ case PduHeaders.READ_STATUS:
+ case PduHeaders.STATUS:
+ case PduHeaders.REPORT_ALLOWED:
+ case PduHeaders.PRIORITY:
+ case PduHeaders.DELIVERY_REPORT:
+ case PduHeaders.READ_REPORT:
+ case PduHeaders.RETRIEVE_STATUS:
+ int octet = mPduHeader.getOctet(field);
+ if (0 == octet) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+ appendOctet(octet);
+ break;
+
+ case PduHeaders.DATE:
+ long date = mPduHeader.getLongInteger(field);
+ if (-1 == date) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+ appendDateValue(date);
+ break;
+
+ case PduHeaders.SUBJECT:
+ case PduHeaders.RETRIEVE_TEXT:
+ EncodedStringValue enString =
+ mPduHeader.getEncodedStringValue(field);
+ if (null == enString) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+ appendEncodedString(enString);
+ break;
+
+ case PduHeaders.MESSAGE_CLASS:
+ byte[] messageClass = mPduHeader.getTextString(field);
+ if (null == messageClass) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+ if (Arrays.equals(messageClass,
+ PduHeaders.MESSAGE_CLASS_ADVERTISEMENT_STR.getBytes())) {
+ appendOctet(PduHeaders.MESSAGE_CLASS_ADVERTISEMENT);
+ } else if (Arrays.equals(messageClass,
+ PduHeaders.MESSAGE_CLASS_AUTO_STR.getBytes())) {
+ appendOctet(PduHeaders.MESSAGE_CLASS_AUTO);
+ } else if (Arrays.equals(messageClass,
+ PduHeaders.MESSAGE_CLASS_PERSONAL_STR.getBytes())) {
+ appendOctet(PduHeaders.MESSAGE_CLASS_PERSONAL);
+ } else if (Arrays.equals(messageClass,
+ PduHeaders.MESSAGE_CLASS_INFORMATIONAL_STR.getBytes())) {
+ appendOctet(PduHeaders.MESSAGE_CLASS_INFORMATIONAL);
+ } else {
+ appendTextString(messageClass);
+ }
+ break;
+
+ case PduHeaders.EXPIRY:
+ long expiry = mPduHeader.getLongInteger(field);
+ if (-1 == expiry) {
+ return PDU_COMPOSE_FIELD_NOT_SET;
+ }
+
+ appendOctet(field);
+
+ mStack.newbuf();
+ PositionMarker expiryStart = mStack.mark();
+
+ append(PduHeaders.VALUE_RELATIVE_TOKEN);
+ appendLongInteger(expiry);
+
+ int expiryLength = expiryStart.getLength();
+ mStack.pop();
+ appendValueLength(expiryLength);
+ mStack.copy();
+ break;
+
+ default:
+ return PDU_COMPOSE_FIELD_NOT_SUPPORTED;
+ }
+
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ /**
+ * Make ReadRec.Ind.
+ */
+ private int makeReadRecInd() {
+ if (mMessage == null) {
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ // X-Mms-Message-Type
+ appendOctet(PduHeaders.MESSAGE_TYPE);
+ appendOctet(PduHeaders.MESSAGE_TYPE_READ_REC_IND);
+
+ // X-Mms-MMS-Version
+ if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // Message-ID
+ if (appendHeader(PduHeaders.MESSAGE_ID) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // To
+ if (appendHeader(PduHeaders.TO) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // From
+ if (appendHeader(PduHeaders.FROM) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // Date Optional
+ appendHeader(PduHeaders.DATE);
+
+ // X-Mms-Read-Status
+ if (appendHeader(PduHeaders.READ_STATUS) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-Applic-ID Optional(not support)
+ // X-Mms-Reply-Applic-ID Optional(not support)
+ // X-Mms-Aux-Applic-Info Optional(not support)
+
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ /**
+ * Make NotifyResp.Ind.
+ */
+ private int makeNotifyResp() {
+ if (mMessage == null) {
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ // X-Mms-Message-Type
+ appendOctet(PduHeaders.MESSAGE_TYPE);
+ appendOctet(PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND);
+
+ // X-Mms-Transaction-ID
+ if (appendHeader(PduHeaders.TRANSACTION_ID) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-MMS-Version
+ if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-Status
+ if (appendHeader(PduHeaders.STATUS) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-Report-Allowed Optional (not support)
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ /**
+ * Make Acknowledge.Ind.
+ */
+ private int makeAckInd() {
+ if (mMessage == null) {
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ // X-Mms-Message-Type
+ appendOctet(PduHeaders.MESSAGE_TYPE);
+ appendOctet(PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND);
+
+ // X-Mms-Transaction-ID
+ if (appendHeader(PduHeaders.TRANSACTION_ID) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-MMS-Version
+ if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // X-Mms-Report-Allowed Optional
+ appendHeader(PduHeaders.REPORT_ALLOWED);
+
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ /**
+ * Make Send.req.
+ */
+ private int makeSendRetrievePdu(int type) {
+ if (mMessage == null) {
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ // X-Mms-Message-Type
+ appendOctet(PduHeaders.MESSAGE_TYPE);
+ appendOctet(type);
+
+ // X-Mms-Transaction-ID
+ appendOctet(PduHeaders.TRANSACTION_ID);
+
+ byte[] trid = mPduHeader.getTextString(PduHeaders.TRANSACTION_ID);
+ if (trid == null) {
+ // Transaction-ID should be set(by Transaction) before make().
+ throw new IllegalArgumentException("Transaction-ID is null.");
+ }
+ appendTextString(trid);
+
+ // X-Mms-MMS-Version
+ if (appendHeader(PduHeaders.MMS_VERSION) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // Date Date-value Optional.
+ appendHeader(PduHeaders.DATE);
+
+ // From
+ if (appendHeader(PduHeaders.FROM) != PDU_COMPOSE_SUCCESS) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ boolean recipient = false;
+
+ // To
+ if (appendHeader(PduHeaders.TO) != PDU_COMPOSE_CONTENT_ERROR) {
+ recipient = true;
+ }
+
+ // Cc
+ if (appendHeader(PduHeaders.CC) != PDU_COMPOSE_CONTENT_ERROR) {
+ recipient = true;
+ }
+
+ // Bcc
+ if (appendHeader(PduHeaders.BCC) != PDU_COMPOSE_CONTENT_ERROR) {
+ recipient = true;
+ }
+
+ // Need at least one of "cc", "bcc" and "to".
+ if (false == recipient) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // Subject Optional
+ appendHeader(PduHeaders.SUBJECT);
+
+ // X-Mms-Message-Class Optional
+ // Message-class-value = Class-identifier | Token-text
+ appendHeader(PduHeaders.MESSAGE_CLASS);
+
+ // X-Mms-Expiry Optional
+ appendHeader(PduHeaders.EXPIRY);
+
+ // X-Mms-Priority Optional
+ appendHeader(PduHeaders.PRIORITY);
+
+ // X-Mms-Delivery-Report Optional
+ appendHeader(PduHeaders.DELIVERY_REPORT);
+
+ // X-Mms-Read-Report Optional
+ appendHeader(PduHeaders.READ_REPORT);
+
+ if (type == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) {
+ // X-Mms-Retrieve-Status Optional
+ appendHeader(PduHeaders.RETRIEVE_STATUS);
+ // X-Mms-Retrieve-Text Optional
+ appendHeader(PduHeaders.RETRIEVE_TEXT);
+ }
+
+
+ // Content-Type
+ appendOctet(PduHeaders.CONTENT_TYPE);
+
+ // Message body
+ return makeMessageBody(type);
+ }
+
+ /**
+ * Make message body.
+ */
+ private int makeMessageBody(int type) {
+ // 1. add body informations
+ mStack.newbuf(); // Switching buffer because we need to
+
+ PositionMarker ctStart = mStack.mark();
+
+ // This contentTypeIdentifier should be used for type of attachment...
+ String contentType = new String(mPduHeader.getTextString(PduHeaders.CONTENT_TYPE));
+ Integer contentTypeIdentifier = mContentTypeMap.get(contentType);
+ if (contentTypeIdentifier == null) {
+ // content type is mandatory
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ appendShortInteger(contentTypeIdentifier.intValue());
+
+ // content-type parameter: start
+ PduBody body;
+ if (type == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF) {
+ body = ((RetrieveConf) mPdu).getBody();
+ } else {
+ body = ((SendReq) mPdu).getBody();
+ }
+ if (null == body || body.getPartsNum() == 0) {
+ // empty message
+ appendUintvarInteger(0);
+ mStack.pop();
+ mStack.copy();
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ PduPart part;
+ try {
+ part = body.getPart(0);
+
+ byte[] start = part.getContentId();
+ if (start != null) {
+ appendOctet(PduPart.P_DEP_START);
+ if (('<' == start[0]) && ('>' == start[start.length - 1])) {
+ appendTextString(start);
+ } else {
+ appendTextString("<" + new String(start) + ">");
+ }
+ }
+
+ // content-type parameter: type
+ appendOctet(PduPart.P_CT_MR_TYPE);
+ appendTextString(part.getContentType());
+ }
+ catch (ArrayIndexOutOfBoundsException e){
+ e.printStackTrace();
+ }
+
+ int ctLength = ctStart.getLength();
+ mStack.pop();
+ appendValueLength(ctLength);
+ mStack.copy();
+
+ // 3. add content
+ int partNum = body.getPartsNum();
+ appendUintvarInteger(partNum);
+ for (int i = 0; i < partNum; i++) {
+ part = body.getPart(i);
+ mStack.newbuf(); // Leaving space for header lengh and data length
+ PositionMarker attachment = mStack.mark();
+
+ mStack.newbuf(); // Leaving space for Content-Type length
+ PositionMarker contentTypeBegin = mStack.mark();
+
+ byte[] partContentType = part.getContentType();
+
+ if (partContentType == null) {
+ // content type is mandatory
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+
+ // content-type value
+ Integer partContentTypeIdentifier =
+ mContentTypeMap.get(new String(partContentType));
+ if (partContentTypeIdentifier == null) {
+ appendTextString(partContentType);
+ } else {
+ appendShortInteger(partContentTypeIdentifier.intValue());
+ }
+
+ /* Content-type parameter : name.
+ * The value of name, filename, content-location is the same.
+ * Just one of them is enough for this PDU.
+ */
+ byte[] name = part.getName();
+
+ if (null == name) {
+ name = part.getFilename();
+
+ if (null == name) {
+ name = part.getContentLocation();
+
+ if (null == name) {
+ /* at lease one of name, filename, Content-location
+ * should be available.
+ */
+ return PDU_COMPOSE_CONTENT_ERROR;
+ }
+ }
+ }
+ appendOctet(PduPart.P_DEP_NAME);
+ appendTextString(name);
+
+ // content-type parameter : charset
+ int charset = part.getCharset();
+ if (charset != 0) {
+ appendOctet(PduPart.P_CHARSET);
+ appendShortInteger(charset);
+ }
+
+ int contentTypeLength = contentTypeBegin.getLength();
+ mStack.pop();
+ appendValueLength(contentTypeLength);
+ mStack.copy();
+
+ // content id
+ byte[] contentId = part.getContentId();
+
+ if (null != contentId) {
+ appendOctet(PduPart.P_CONTENT_ID);
+ if (('<' == contentId[0]) && ('>' == contentId[contentId.length - 1])) {
+ appendQuotedString(contentId);
+ } else {
+ appendQuotedString("<" + new String(contentId) + ">");
+ }
+ }
+
+ // content-location
+ byte[] contentLocation = part.getContentLocation();
+ if (null != contentLocation) {
+ appendOctet(PduPart.P_CONTENT_LOCATION);
+ appendTextString(contentLocation);
+ }
+
+ // content
+ int headerLength = attachment.getLength();
+
+ int dataLength = 0; // Just for safety...
+ byte[] partData = part.getData();
+
+ if (partData != null) {
+ arraycopy(partData, 0, partData.length);
+ dataLength = partData.length;
+ } else {
+ InputStream cr = null;
+ try {
+ byte[] buffer = new byte[PDU_COMPOSER_BLOCK_SIZE];
+ cr = mResolver.openInputStream(part.getDataUri());
+ int len = 0;
+ while ((len = cr.read(buffer)) != -1) {
+ mMessage.write(buffer, 0, len);
+ mPosition += len;
+ dataLength += len;
+ }
+ } catch (FileNotFoundException e) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ } catch (IOException e) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ } catch (RuntimeException e) {
+ return PDU_COMPOSE_CONTENT_ERROR;
+ } finally {
+ if (cr != null) {
+ try {
+ cr.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ if (dataLength != (attachment.getLength() - headerLength)) {
+ throw new RuntimeException("BUG: Length sanity check failed");
+ }
+
+ mStack.pop();
+ appendUintvarInteger(headerLength);
+ appendUintvarInteger(dataLength);
+ mStack.copy();
+ }
+
+ return PDU_COMPOSE_SUCCESS;
+ }
+
+ /**
+ * Record current message informations.
+ */
+ static private class LengthRecordNode {
+ ByteArrayOutputStream currentMessage = null;
+ public int currentPosition = 0;
+
+ public LengthRecordNode next = null;
+ }
+
+ /**
+ * Mark current message position and stact size.
+ */
+ private class PositionMarker {
+ private int c_pos; // Current position
+ private int currentStackSize; // Current stack size
+
+ @UnsupportedAppUsage
+ int getLength() {
+ // If these assert fails, likely that you are finding the
+ // size of buffer that is deep in BufferStack you can only
+ // find the length of the buffer that is on top
+ if (currentStackSize != mStack.stackSize) {
+ throw new RuntimeException("BUG: Invalid call to getLength()");
+ }
+
+ return mPosition - c_pos;
+ }
+ }
+
+ /**
+ * This implementation can be OPTIMIZED to use only
+ * 2 buffers. This optimization involves changing BufferStack
+ * only... Its usage (interface) will not change.
+ */
+ private class BufferStack {
+ private LengthRecordNode stack = null;
+ private LengthRecordNode toCopy = null;
+
+ int stackSize = 0;
+
+ /**
+ * Create a new message buffer and push it into the stack.
+ */
+ @UnsupportedAppUsage
+ void newbuf() {
+ // You can't create a new buff when toCopy != null
+ // That is after calling pop() and before calling copy()
+ // If you do, it is a bug
+ if (toCopy != null) {
+ throw new RuntimeException("BUG: Invalid newbuf() before copy()");
+ }
+
+ LengthRecordNode temp = new LengthRecordNode();
+
+ temp.currentMessage = mMessage;
+ temp.currentPosition = mPosition;
+
+ temp.next = stack;
+ stack = temp;
+
+ stackSize = stackSize + 1;
+
+ mMessage = new ByteArrayOutputStream();
+ mPosition = 0;
+ }
+
+ /**
+ * Pop the message before and record current message in the stack.
+ */
+ @UnsupportedAppUsage
+ void pop() {
+ ByteArrayOutputStream currentMessage = mMessage;
+ int currentPosition = mPosition;
+
+ mMessage = stack.currentMessage;
+ mPosition = stack.currentPosition;
+
+ toCopy = stack;
+ // Re using the top element of the stack to avoid memory allocation
+
+ stack = stack.next;
+ stackSize = stackSize - 1;
+
+ toCopy.currentMessage = currentMessage;
+ toCopy.currentPosition = currentPosition;
+ }
+
+ /**
+ * Append current message to the message before.
+ */
+ @UnsupportedAppUsage
+ void copy() {
+ arraycopy(toCopy.currentMessage.toByteArray(), 0,
+ toCopy.currentPosition);
+
+ toCopy = null;
+ }
+
+ /**
+ * Mark current message position
+ */
+ @UnsupportedAppUsage
+ PositionMarker mark() {
+ PositionMarker m = new PositionMarker();
+
+ m.c_pos = mPosition;
+ m.currentStackSize = stackSize;
+
+ return m;
+ }
+ }
+
+ /**
+ * Check address type.
+ *
+ * @param address address string without the postfix stinng type,
+ * such as "/TYPE=PLMN", "/TYPE=IPv6" and "/TYPE=IPv4"
+ * @return PDU_PHONE_NUMBER_ADDRESS_TYPE if it is phone number,
+ * PDU_EMAIL_ADDRESS_TYPE if it is email address,
+ * PDU_IPV4_ADDRESS_TYPE if it is ipv4 address,
+ * PDU_IPV6_ADDRESS_TYPE if it is ipv6 address,
+ * PDU_UNKNOWN_ADDRESS_TYPE if it is unknown.
+ */
+ protected static int checkAddressType(String address) {
+ /**
+ * From OMA-TS-MMS-ENC-V1_3-20050927-C.pdf, section 8.
+ * address = ( e-mail / device-address / alphanum-shortcode / num-shortcode)
+ * e-mail = mailbox; to the definition of mailbox as described in
+ * section 3.4 of [RFC2822], but excluding the
+ * obsolete definitions as indicated by the "obs-" prefix.
+ * device-address = ( global-phone-number "/TYPE=PLMN" )
+ * / ( ipv4 "/TYPE=IPv4" ) / ( ipv6 "/TYPE=IPv6" )
+ * / ( escaped-value "/TYPE=" address-type )
+ *
+ * global-phone-number = ["+"] 1*( DIGIT / written-sep )
+ * written-sep =("-"/".")
+ *
+ * ipv4 = 1*3DIGIT 3( "." 1*3DIGIT ) ; IPv4 address value
+ *
+ * ipv6 = 4HEXDIG 7( ":" 4HEXDIG ) ; IPv6 address per RFC 2373
+ */
+
+ if (null == address) {
+ return PDU_UNKNOWN_ADDRESS_TYPE;
+ }
+
+ if (address.matches(REGEXP_IPV4_ADDRESS_TYPE)) {
+ // Ipv4 address.
+ return PDU_IPV4_ADDRESS_TYPE;
+ }else if (address.matches(REGEXP_PHONE_NUMBER_ADDRESS_TYPE)) {
+ // Phone number.
+ return PDU_PHONE_NUMBER_ADDRESS_TYPE;
+ } else if (address.matches(REGEXP_EMAIL_ADDRESS_TYPE)) {
+ // Email address.
+ return PDU_EMAIL_ADDRESS_TYPE;
+ } else if (address.matches(REGEXP_IPV6_ADDRESS_TYPE)) {
+ // Ipv6 address.
+ return PDU_IPV6_ADDRESS_TYPE;
+ } else {
+ // Unknown address.
+ return PDU_UNKNOWN_ADDRESS_TYPE;
+ }
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduContentTypes.java b/telephony/common/com/google/android/mms/pdu/PduContentTypes.java
new file mode 100644
index 000000000000..8551b2f9b693
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduContentTypes.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+public class PduContentTypes {
+ /**
+ * All content types. From:
+ * http://www.openmobilealliance.org/tech/omna/omna-wsp-content-type.htm
+ */
+ @UnsupportedAppUsage
+ static final String[] contentTypes = {
+ "*/*", /* 0x00 */
+ "text/*", /* 0x01 */
+ "text/html", /* 0x02 */
+ "text/plain", /* 0x03 */
+ "text/x-hdml", /* 0x04 */
+ "text/x-ttml", /* 0x05 */
+ "text/x-vCalendar", /* 0x06 */
+ "text/x-vCard", /* 0x07 */
+ "text/vnd.wap.wml", /* 0x08 */
+ "text/vnd.wap.wmlscript", /* 0x09 */
+ "text/vnd.wap.wta-event", /* 0x0A */
+ "multipart/*", /* 0x0B */
+ "multipart/mixed", /* 0x0C */
+ "multipart/form-data", /* 0x0D */
+ "multipart/byterantes", /* 0x0E */
+ "multipart/alternative", /* 0x0F */
+ "application/*", /* 0x10 */
+ "application/java-vm", /* 0x11 */
+ "application/x-www-form-urlencoded", /* 0x12 */
+ "application/x-hdmlc", /* 0x13 */
+ "application/vnd.wap.wmlc", /* 0x14 */
+ "application/vnd.wap.wmlscriptc", /* 0x15 */
+ "application/vnd.wap.wta-eventc", /* 0x16 */
+ "application/vnd.wap.uaprof", /* 0x17 */
+ "application/vnd.wap.wtls-ca-certificate", /* 0x18 */
+ "application/vnd.wap.wtls-user-certificate", /* 0x19 */
+ "application/x-x509-ca-cert", /* 0x1A */
+ "application/x-x509-user-cert", /* 0x1B */
+ "image/*", /* 0x1C */
+ "image/gif", /* 0x1D */
+ "image/jpeg", /* 0x1E */
+ "image/tiff", /* 0x1F */
+ "image/png", /* 0x20 */
+ "image/vnd.wap.wbmp", /* 0x21 */
+ "application/vnd.wap.multipart.*", /* 0x22 */
+ "application/vnd.wap.multipart.mixed", /* 0x23 */
+ "application/vnd.wap.multipart.form-data", /* 0x24 */
+ "application/vnd.wap.multipart.byteranges", /* 0x25 */
+ "application/vnd.wap.multipart.alternative", /* 0x26 */
+ "application/xml", /* 0x27 */
+ "text/xml", /* 0x28 */
+ "application/vnd.wap.wbxml", /* 0x29 */
+ "application/x-x968-cross-cert", /* 0x2A */
+ "application/x-x968-ca-cert", /* 0x2B */
+ "application/x-x968-user-cert", /* 0x2C */
+ "text/vnd.wap.si", /* 0x2D */
+ "application/vnd.wap.sic", /* 0x2E */
+ "text/vnd.wap.sl", /* 0x2F */
+ "application/vnd.wap.slc", /* 0x30 */
+ "text/vnd.wap.co", /* 0x31 */
+ "application/vnd.wap.coc", /* 0x32 */
+ "application/vnd.wap.multipart.related", /* 0x33 */
+ "application/vnd.wap.sia", /* 0x34 */
+ "text/vnd.wap.connectivity-xml", /* 0x35 */
+ "application/vnd.wap.connectivity-wbxml", /* 0x36 */
+ "application/pkcs7-mime", /* 0x37 */
+ "application/vnd.wap.hashed-certificate", /* 0x38 */
+ "application/vnd.wap.signed-certificate", /* 0x39 */
+ "application/vnd.wap.cert-response", /* 0x3A */
+ "application/xhtml+xml", /* 0x3B */
+ "application/wml+xml", /* 0x3C */
+ "text/css", /* 0x3D */
+ "application/vnd.wap.mms-message", /* 0x3E */
+ "application/vnd.wap.rollover-certificate", /* 0x3F */
+ "application/vnd.wap.locc+wbxml", /* 0x40 */
+ "application/vnd.wap.loc+xml", /* 0x41 */
+ "application/vnd.syncml.dm+wbxml", /* 0x42 */
+ "application/vnd.syncml.dm+xml", /* 0x43 */
+ "application/vnd.syncml.notification", /* 0x44 */
+ "application/vnd.wap.xhtml+xml", /* 0x45 */
+ "application/vnd.wv.csp.cir", /* 0x46 */
+ "application/vnd.oma.dd+xml", /* 0x47 */
+ "application/vnd.oma.drm.message", /* 0x48 */
+ "application/vnd.oma.drm.content", /* 0x49 */
+ "application/vnd.oma.drm.rights+xml", /* 0x4A */
+ "application/vnd.oma.drm.rights+wbxml", /* 0x4B */
+ "application/vnd.wv.csp+xml", /* 0x4C */
+ "application/vnd.wv.csp+wbxml", /* 0x4D */
+ "application/vnd.syncml.ds.notification", /* 0x4E */
+ "audio/*", /* 0x4F */
+ "video/*", /* 0x50 */
+ "application/vnd.oma.dd2+xml", /* 0x51 */
+ "application/mikey" /* 0x52 */
+ };
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduHeaders.java b/telephony/common/com/google/android/mms/pdu/PduHeaders.java
new file mode 100644
index 000000000000..b5244645fda1
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduHeaders.java
@@ -0,0 +1,733 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+public class PduHeaders {
+ /**
+ * All pdu header fields.
+ */
+ public static final int BCC = 0x81;
+ public static final int CC = 0x82;
+ public static final int CONTENT_LOCATION = 0x83;
+ public static final int CONTENT_TYPE = 0x84;
+ public static final int DATE = 0x85;
+ public static final int DELIVERY_REPORT = 0x86;
+ public static final int DELIVERY_TIME = 0x87;
+ public static final int EXPIRY = 0x88;
+ public static final int FROM = 0x89;
+ public static final int MESSAGE_CLASS = 0x8A;
+ public static final int MESSAGE_ID = 0x8B;
+ public static final int MESSAGE_TYPE = 0x8C;
+ public static final int MMS_VERSION = 0x8D;
+ public static final int MESSAGE_SIZE = 0x8E;
+ public static final int PRIORITY = 0x8F;
+
+ public static final int READ_REPLY = 0x90;
+ public static final int READ_REPORT = 0x90;
+ public static final int REPORT_ALLOWED = 0x91;
+ public static final int RESPONSE_STATUS = 0x92;
+ public static final int RESPONSE_TEXT = 0x93;
+ public static final int SENDER_VISIBILITY = 0x94;
+ public static final int STATUS = 0x95;
+ public static final int SUBJECT = 0x96;
+ public static final int TO = 0x97;
+ public static final int TRANSACTION_ID = 0x98;
+ public static final int RETRIEVE_STATUS = 0x99;
+ public static final int RETRIEVE_TEXT = 0x9A;
+ public static final int READ_STATUS = 0x9B;
+ public static final int REPLY_CHARGING = 0x9C;
+ public static final int REPLY_CHARGING_DEADLINE = 0x9D;
+ public static final int REPLY_CHARGING_ID = 0x9E;
+ public static final int REPLY_CHARGING_SIZE = 0x9F;
+
+ public static final int PREVIOUSLY_SENT_BY = 0xA0;
+ public static final int PREVIOUSLY_SENT_DATE = 0xA1;
+ public static final int STORE = 0xA2;
+ public static final int MM_STATE = 0xA3;
+ public static final int MM_FLAGS = 0xA4;
+ public static final int STORE_STATUS = 0xA5;
+ public static final int STORE_STATUS_TEXT = 0xA6;
+ public static final int STORED = 0xA7;
+ public static final int ATTRIBUTES = 0xA8;
+ public static final int TOTALS = 0xA9;
+ public static final int MBOX_TOTALS = 0xAA;
+ public static final int QUOTAS = 0xAB;
+ public static final int MBOX_QUOTAS = 0xAC;
+ public static final int MESSAGE_COUNT = 0xAD;
+ public static final int CONTENT = 0xAE;
+ public static final int START = 0xAF;
+
+ public static final int ADDITIONAL_HEADERS = 0xB0;
+ public static final int DISTRIBUTION_INDICATOR = 0xB1;
+ public static final int ELEMENT_DESCRIPTOR = 0xB2;
+ public static final int LIMIT = 0xB3;
+ public static final int RECOMMENDED_RETRIEVAL_MODE = 0xB4;
+ public static final int RECOMMENDED_RETRIEVAL_MODE_TEXT = 0xB5;
+ public static final int STATUS_TEXT = 0xB6;
+ public static final int APPLIC_ID = 0xB7;
+ public static final int REPLY_APPLIC_ID = 0xB8;
+ public static final int AUX_APPLIC_ID = 0xB9;
+ public static final int CONTENT_CLASS = 0xBA;
+ public static final int DRM_CONTENT = 0xBB;
+ public static final int ADAPTATION_ALLOWED = 0xBC;
+ public static final int REPLACE_ID = 0xBD;
+ public static final int CANCEL_ID = 0xBE;
+ public static final int CANCEL_STATUS = 0xBF;
+
+ /**
+ * X-Mms-Message-Type field types.
+ */
+ public static final int MESSAGE_TYPE_SEND_REQ = 0x80;
+ public static final int MESSAGE_TYPE_SEND_CONF = 0x81;
+ public static final int MESSAGE_TYPE_NOTIFICATION_IND = 0x82;
+ public static final int MESSAGE_TYPE_NOTIFYRESP_IND = 0x83;
+ public static final int MESSAGE_TYPE_RETRIEVE_CONF = 0x84;
+ public static final int MESSAGE_TYPE_ACKNOWLEDGE_IND = 0x85;
+ public static final int MESSAGE_TYPE_DELIVERY_IND = 0x86;
+ public static final int MESSAGE_TYPE_READ_REC_IND = 0x87;
+ public static final int MESSAGE_TYPE_READ_ORIG_IND = 0x88;
+ public static final int MESSAGE_TYPE_FORWARD_REQ = 0x89;
+ public static final int MESSAGE_TYPE_FORWARD_CONF = 0x8A;
+ public static final int MESSAGE_TYPE_MBOX_STORE_REQ = 0x8B;
+ public static final int MESSAGE_TYPE_MBOX_STORE_CONF = 0x8C;
+ public static final int MESSAGE_TYPE_MBOX_VIEW_REQ = 0x8D;
+ public static final int MESSAGE_TYPE_MBOX_VIEW_CONF = 0x8E;
+ public static final int MESSAGE_TYPE_MBOX_UPLOAD_REQ = 0x8F;
+ public static final int MESSAGE_TYPE_MBOX_UPLOAD_CONF = 0x90;
+ public static final int MESSAGE_TYPE_MBOX_DELETE_REQ = 0x91;
+ public static final int MESSAGE_TYPE_MBOX_DELETE_CONF = 0x92;
+ public static final int MESSAGE_TYPE_MBOX_DESCR = 0x93;
+ public static final int MESSAGE_TYPE_DELETE_REQ = 0x94;
+ public static final int MESSAGE_TYPE_DELETE_CONF = 0x95;
+ public static final int MESSAGE_TYPE_CANCEL_REQ = 0x96;
+ public static final int MESSAGE_TYPE_CANCEL_CONF = 0x97;
+
+ /**
+ * X-Mms-Delivery-Report |
+ * X-Mms-Read-Report |
+ * X-Mms-Report-Allowed |
+ * X-Mms-Sender-Visibility |
+ * X-Mms-Store |
+ * X-Mms-Stored |
+ * X-Mms-Totals |
+ * X-Mms-Quotas |
+ * X-Mms-Distribution-Indicator |
+ * X-Mms-DRM-Content |
+ * X-Mms-Adaptation-Allowed |
+ * field types.
+ */
+ public static final int VALUE_YES = 0x80;
+ public static final int VALUE_NO = 0x81;
+
+ /**
+ * Delivery-Time |
+ * Expiry and Reply-Charging-Deadline |
+ * field type components.
+ */
+ public static final int VALUE_ABSOLUTE_TOKEN = 0x80;
+ public static final int VALUE_RELATIVE_TOKEN = 0x81;
+
+ /**
+ * X-Mms-MMS-Version field types.
+ */
+ public static final int MMS_VERSION_1_3 = ((1 << 4) | 3);
+ public static final int MMS_VERSION_1_2 = ((1 << 4) | 2);
+ public static final int MMS_VERSION_1_1 = ((1 << 4) | 1);
+ public static final int MMS_VERSION_1_0 = ((1 << 4) | 0);
+
+ // Current version is 1.2.
+ public static final int CURRENT_MMS_VERSION = MMS_VERSION_1_2;
+
+ /**
+ * From field type components.
+ */
+ public static final int FROM_ADDRESS_PRESENT_TOKEN = 0x80;
+ public static final int FROM_INSERT_ADDRESS_TOKEN = 0x81;
+
+ public static final String FROM_ADDRESS_PRESENT_TOKEN_STR = "address-present-token";
+ public static final String FROM_INSERT_ADDRESS_TOKEN_STR = "insert-address-token";
+
+ /**
+ * X-Mms-Status Field.
+ */
+ public static final int STATUS_EXPIRED = 0x80;
+ public static final int STATUS_RETRIEVED = 0x81;
+ public static final int STATUS_REJECTED = 0x82;
+ public static final int STATUS_DEFERRED = 0x83;
+ public static final int STATUS_UNRECOGNIZED = 0x84;
+ public static final int STATUS_INDETERMINATE = 0x85;
+ public static final int STATUS_FORWARDED = 0x86;
+ public static final int STATUS_UNREACHABLE = 0x87;
+
+ /**
+ * MM-Flags field type components.
+ */
+ public static final int MM_FLAGS_ADD_TOKEN = 0x80;
+ public static final int MM_FLAGS_REMOVE_TOKEN = 0x81;
+ public static final int MM_FLAGS_FILTER_TOKEN = 0x82;
+
+ /**
+ * X-Mms-Message-Class field types.
+ */
+ public static final int MESSAGE_CLASS_PERSONAL = 0x80;
+ public static final int MESSAGE_CLASS_ADVERTISEMENT = 0x81;
+ public static final int MESSAGE_CLASS_INFORMATIONAL = 0x82;
+ public static final int MESSAGE_CLASS_AUTO = 0x83;
+
+ public static final String MESSAGE_CLASS_PERSONAL_STR = "personal";
+ public static final String MESSAGE_CLASS_ADVERTISEMENT_STR = "advertisement";
+ public static final String MESSAGE_CLASS_INFORMATIONAL_STR = "informational";
+ public static final String MESSAGE_CLASS_AUTO_STR = "auto";
+
+ /**
+ * X-Mms-Priority field types.
+ */
+ public static final int PRIORITY_LOW = 0x80;
+ public static final int PRIORITY_NORMAL = 0x81;
+ public static final int PRIORITY_HIGH = 0x82;
+
+ /**
+ * X-Mms-Response-Status field types.
+ */
+ public static final int RESPONSE_STATUS_OK = 0x80;
+ public static final int RESPONSE_STATUS_ERROR_UNSPECIFIED = 0x81;
+ public static final int RESPONSE_STATUS_ERROR_SERVICE_DENIED = 0x82;
+
+ public static final int RESPONSE_STATUS_ERROR_MESSAGE_FORMAT_CORRUPT = 0x83;
+ public static final int RESPONSE_STATUS_ERROR_SENDING_ADDRESS_UNRESOLVED = 0x84;
+
+ public static final int RESPONSE_STATUS_ERROR_MESSAGE_NOT_FOUND = 0x85;
+ public static final int RESPONSE_STATUS_ERROR_NETWORK_PROBLEM = 0x86;
+ public static final int RESPONSE_STATUS_ERROR_CONTENT_NOT_ACCEPTED = 0x87;
+ public static final int RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE = 0x88;
+ public static final int RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
+
+ public static final int RESPONSE_STATUS_ERROR_TRANSIENT_SENDNG_ADDRESS_UNRESOLVED = 0xC1;
+ public static final int RESPONSE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC2;
+ public static final int RESPONSE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC3;
+ public static final int RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS = 0xC4;
+
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_SENDING_ADDRESS_UNRESOLVED = 0xE3;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE4;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_CONTENT_NOT_ACCEPTED = 0xE5;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_LIMITATIONS_NOT_MET = 0xE6;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_REQUEST_NOT_ACCEPTED = 0xE6;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_FORWARDING_DENIED = 0xE8;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_REPLY_CHARGING_NOT_SUPPORTED = 0xE9;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_ADDRESS_HIDING_NOT_SUPPORTED = 0xEA;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID = 0xEB;
+ public static final int RESPONSE_STATUS_ERROR_PERMANENT_END = 0xFF;
+
+ /**
+ * X-Mms-Retrieve-Status field types.
+ */
+ public static final int RETRIEVE_STATUS_OK = 0x80;
+ public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
+ public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_MESSAGE_NOT_FOUND = 0xC1;
+ public static final int RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC2;
+ public static final int RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
+ public static final int RETRIEVE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
+ public static final int RETRIEVE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE2;
+ public static final int RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED = 0xE3;
+ public static final int RETRIEVE_STATUS_ERROR_END = 0xFF;
+
+ /**
+ * X-Mms-Sender-Visibility field types.
+ */
+ public static final int SENDER_VISIBILITY_HIDE = 0x80;
+ public static final int SENDER_VISIBILITY_SHOW = 0x81;
+
+ /**
+ * X-Mms-Read-Status field types.
+ */
+ public static final int READ_STATUS_READ = 0x80;
+ public static final int READ_STATUS__DELETED_WITHOUT_BEING_READ = 0x81;
+
+ /**
+ * X-Mms-Cancel-Status field types.
+ */
+ public static final int CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED = 0x80;
+ public static final int CANCEL_STATUS_REQUEST_CORRUPTED = 0x81;
+
+ /**
+ * X-Mms-Reply-Charging field types.
+ */
+ public static final int REPLY_CHARGING_REQUESTED = 0x80;
+ public static final int REPLY_CHARGING_REQUESTED_TEXT_ONLY = 0x81;
+ public static final int REPLY_CHARGING_ACCEPTED = 0x82;
+ public static final int REPLY_CHARGING_ACCEPTED_TEXT_ONLY = 0x83;
+
+ /**
+ * X-Mms-MM-State field types.
+ */
+ public static final int MM_STATE_DRAFT = 0x80;
+ public static final int MM_STATE_SENT = 0x81;
+ public static final int MM_STATE_NEW = 0x82;
+ public static final int MM_STATE_RETRIEVED = 0x83;
+ public static final int MM_STATE_FORWARDED = 0x84;
+
+ /**
+ * X-Mms-Recommended-Retrieval-Mode field types.
+ */
+ public static final int RECOMMENDED_RETRIEVAL_MODE_MANUAL = 0x80;
+
+ /**
+ * X-Mms-Content-Class field types.
+ */
+ public static final int CONTENT_CLASS_TEXT = 0x80;
+ public static final int CONTENT_CLASS_IMAGE_BASIC = 0x81;
+ public static final int CONTENT_CLASS_IMAGE_RICH = 0x82;
+ public static final int CONTENT_CLASS_VIDEO_BASIC = 0x83;
+ public static final int CONTENT_CLASS_VIDEO_RICH = 0x84;
+ public static final int CONTENT_CLASS_MEGAPIXEL = 0x85;
+ public static final int CONTENT_CLASS_CONTENT_BASIC = 0x86;
+ public static final int CONTENT_CLASS_CONTENT_RICH = 0x87;
+
+ /**
+ * X-Mms-Store-Status field types.
+ */
+ public static final int STORE_STATUS_SUCCESS = 0x80;
+ public static final int STORE_STATUS_ERROR_TRANSIENT_FAILURE = 0xC0;
+ public static final int STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM = 0xC1;
+ public static final int STORE_STATUS_ERROR_PERMANENT_FAILURE = 0xE0;
+ public static final int STORE_STATUS_ERROR_PERMANENT_SERVICE_DENIED = 0xE1;
+ public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_FORMAT_CORRUPT = 0xE2;
+ public static final int STORE_STATUS_ERROR_PERMANENT_MESSAGE_NOT_FOUND = 0xE3;
+ public static final int STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL = 0xE4;
+ public static final int STORE_STATUS_ERROR_END = 0xFF;
+
+ /**
+ * The map contains the value of all headers.
+ */
+ private HashMap<Integer, Object> mHeaderMap = null;
+
+ /**
+ * Constructor of PduHeaders.
+ */
+ @UnsupportedAppUsage
+ public PduHeaders() {
+ mHeaderMap = new HashMap<Integer, Object>();
+ }
+
+ /**
+ * Get octet value by header field.
+ *
+ * @param field the field
+ * @return the octet value of the pdu header
+ * with specified header field. Return 0 if
+ * the value is not set.
+ */
+ @UnsupportedAppUsage
+ protected int getOctet(int field) {
+ Integer octet = (Integer) mHeaderMap.get(field);
+ if (null == octet) {
+ return 0;
+ }
+
+ return octet;
+ }
+
+ /**
+ * Set octet value to pdu header by header field.
+ *
+ * @param value the value
+ * @param field the field
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ protected void setOctet(int value, int field)
+ throws InvalidHeaderValueException{
+ /**
+ * Check whether this field can be set for specific
+ * header and check validity of the field.
+ */
+ switch (field) {
+ case REPORT_ALLOWED:
+ case ADAPTATION_ALLOWED:
+ case DELIVERY_REPORT:
+ case DRM_CONTENT:
+ case DISTRIBUTION_INDICATOR:
+ case QUOTAS:
+ case READ_REPORT:
+ case STORE:
+ case STORED:
+ case TOTALS:
+ case SENDER_VISIBILITY:
+ if ((VALUE_YES != value) && (VALUE_NO != value)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case READ_STATUS:
+ if ((READ_STATUS_READ != value) &&
+ (READ_STATUS__DELETED_WITHOUT_BEING_READ != value)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case CANCEL_STATUS:
+ if ((CANCEL_STATUS_REQUEST_SUCCESSFULLY_RECEIVED != value) &&
+ (CANCEL_STATUS_REQUEST_CORRUPTED != value)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case PRIORITY:
+ if ((value < PRIORITY_LOW) || (value > PRIORITY_HIGH)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case STATUS:
+ if ((value < STATUS_EXPIRED) || (value > STATUS_UNREACHABLE)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case REPLY_CHARGING:
+ if ((value < REPLY_CHARGING_REQUESTED)
+ || (value > REPLY_CHARGING_ACCEPTED_TEXT_ONLY)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case MM_STATE:
+ if ((value < MM_STATE_DRAFT) || (value > MM_STATE_FORWARDED)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case RECOMMENDED_RETRIEVAL_MODE:
+ if (RECOMMENDED_RETRIEVAL_MODE_MANUAL != value) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case CONTENT_CLASS:
+ if ((value < CONTENT_CLASS_TEXT)
+ || (value > CONTENT_CLASS_CONTENT_RICH)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ case RETRIEVE_STATUS:
+ // According to oma-ts-mms-enc-v1_3, section 7.3.50, we modify the invalid value.
+ if ((value > RETRIEVE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
+ (value < RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE)) {
+ value = RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE;
+ } else if ((value > RETRIEVE_STATUS_ERROR_PERMANENT_CONTENT_UNSUPPORTED) &&
+ (value <= RETRIEVE_STATUS_ERROR_END)) {
+ value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
+ } else if ((value < RETRIEVE_STATUS_OK) ||
+ ((value > RETRIEVE_STATUS_OK) &&
+ (value < RETRIEVE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
+ (value > RETRIEVE_STATUS_ERROR_END)) {
+ value = RETRIEVE_STATUS_ERROR_PERMANENT_FAILURE;
+ }
+ break;
+ case STORE_STATUS:
+ // According to oma-ts-mms-enc-v1_3, section 7.3.58, we modify the invalid value.
+ if ((value > STORE_STATUS_ERROR_TRANSIENT_NETWORK_PROBLEM) &&
+ (value < STORE_STATUS_ERROR_PERMANENT_FAILURE)) {
+ value = STORE_STATUS_ERROR_TRANSIENT_FAILURE;
+ } else if ((value > STORE_STATUS_ERROR_PERMANENT_MMBOX_FULL) &&
+ (value <= STORE_STATUS_ERROR_END)) {
+ value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
+ } else if ((value < STORE_STATUS_SUCCESS) ||
+ ((value > STORE_STATUS_SUCCESS) &&
+ (value < STORE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
+ (value > STORE_STATUS_ERROR_END)) {
+ value = STORE_STATUS_ERROR_PERMANENT_FAILURE;
+ }
+ break;
+ case RESPONSE_STATUS:
+ // According to oma-ts-mms-enc-v1_3, section 7.3.48, we modify the invalid value.
+ if ((value > RESPONSE_STATUS_ERROR_TRANSIENT_PARTIAL_SUCCESS) &&
+ (value < RESPONSE_STATUS_ERROR_PERMANENT_FAILURE)) {
+ value = RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE;
+ } else if (((value > RESPONSE_STATUS_ERROR_PERMANENT_LACK_OF_PREPAID) &&
+ (value <= RESPONSE_STATUS_ERROR_PERMANENT_END)) ||
+ (value < RESPONSE_STATUS_OK) ||
+ ((value > RESPONSE_STATUS_ERROR_UNSUPPORTED_MESSAGE) &&
+ (value < RESPONSE_STATUS_ERROR_TRANSIENT_FAILURE)) ||
+ (value > RESPONSE_STATUS_ERROR_PERMANENT_END)) {
+ value = RESPONSE_STATUS_ERROR_PERMANENT_FAILURE;
+ }
+ break;
+ case MMS_VERSION:
+ if ((value < MMS_VERSION_1_0)|| (value > MMS_VERSION_1_3)) {
+ value = CURRENT_MMS_VERSION; // Current version is the default value.
+ }
+ break;
+ case MESSAGE_TYPE:
+ if ((value < MESSAGE_TYPE_SEND_REQ) || (value > MESSAGE_TYPE_CANCEL_CONF)) {
+ // Invalid value.
+ throw new InvalidHeaderValueException("Invalid Octet value!");
+ }
+ break;
+ default:
+ // This header value should not be Octect.
+ throw new RuntimeException("Invalid header field!");
+ }
+ mHeaderMap.put(field, value);
+ }
+
+ /**
+ * Get TextString value by header field.
+ *
+ * @param field the field
+ * @return the TextString value of the pdu header
+ * with specified header field
+ */
+ @UnsupportedAppUsage
+ protected byte[] getTextString(int field) {
+ return (byte[]) mHeaderMap.get(field);
+ }
+
+ /**
+ * Set TextString value to pdu header by header field.
+ *
+ * @param value the value
+ * @param field the field
+ * @return the TextString value of the pdu header
+ * with specified header field
+ * @throws NullPointerException if the value is null.
+ */
+ protected void setTextString(byte[] value, int field) {
+ /**
+ * Check whether this field can be set for specific
+ * header and check validity of the field.
+ */
+ if (null == value) {
+ throw new NullPointerException();
+ }
+
+ switch (field) {
+ case TRANSACTION_ID:
+ case REPLY_CHARGING_ID:
+ case AUX_APPLIC_ID:
+ case APPLIC_ID:
+ case REPLY_APPLIC_ID:
+ case MESSAGE_ID:
+ case REPLACE_ID:
+ case CANCEL_ID:
+ case CONTENT_LOCATION:
+ case MESSAGE_CLASS:
+ case CONTENT_TYPE:
+ break;
+ default:
+ // This header value should not be Text-String.
+ throw new RuntimeException("Invalid header field!");
+ }
+ mHeaderMap.put(field, value);
+ }
+
+ /**
+ * Get EncodedStringValue value by header field.
+ *
+ * @param field the field
+ * @return the EncodedStringValue value of the pdu header
+ * with specified header field
+ */
+ @UnsupportedAppUsage
+ protected EncodedStringValue getEncodedStringValue(int field) {
+ return (EncodedStringValue) mHeaderMap.get(field);
+ }
+
+ /**
+ * Get TO, CC or BCC header value.
+ *
+ * @param field the field
+ * @return the EncodeStringValue array of the pdu header
+ * with specified header field
+ */
+ @UnsupportedAppUsage
+ protected EncodedStringValue[] getEncodedStringValues(int field) {
+ ArrayList<EncodedStringValue> list =
+ (ArrayList<EncodedStringValue>) mHeaderMap.get(field);
+ if (null == list) {
+ return null;
+ }
+ EncodedStringValue[] values = new EncodedStringValue[list.size()];
+ return list.toArray(values);
+ }
+
+ /**
+ * Set EncodedStringValue value to pdu header by header field.
+ *
+ * @param value the value
+ * @param field the field
+ * @return the EncodedStringValue value of the pdu header
+ * with specified header field
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ protected void setEncodedStringValue(EncodedStringValue value, int field) {
+ /**
+ * Check whether this field can be set for specific
+ * header and check validity of the field.
+ */
+ if (null == value) {
+ throw new NullPointerException();
+ }
+
+ switch (field) {
+ case SUBJECT:
+ case RECOMMENDED_RETRIEVAL_MODE_TEXT:
+ case RETRIEVE_TEXT:
+ case STATUS_TEXT:
+ case STORE_STATUS_TEXT:
+ case RESPONSE_TEXT:
+ case FROM:
+ case PREVIOUSLY_SENT_BY:
+ case MM_FLAGS:
+ break;
+ default:
+ // This header value should not be Encoded-String-Value.
+ throw new RuntimeException("Invalid header field!");
+ }
+
+ mHeaderMap.put(field, value);
+ }
+
+ /**
+ * Set TO, CC or BCC header value.
+ *
+ * @param value the value
+ * @param field the field
+ * @return the EncodedStringValue value array of the pdu header
+ * with specified header field
+ * @throws NullPointerException if the value is null.
+ */
+ protected void setEncodedStringValues(EncodedStringValue[] value, int field) {
+ /**
+ * Check whether this field can be set for specific
+ * header and check validity of the field.
+ */
+ if (null == value) {
+ throw new NullPointerException();
+ }
+
+ switch (field) {
+ case BCC:
+ case CC:
+ case TO:
+ break;
+ default:
+ // This header value should not be Encoded-String-Value.
+ throw new RuntimeException("Invalid header field!");
+ }
+
+ ArrayList<EncodedStringValue> list = new ArrayList<EncodedStringValue>();
+ for (int i = 0; i < value.length; i++) {
+ list.add(value[i]);
+ }
+ mHeaderMap.put(field, list);
+ }
+
+ /**
+ * Append one EncodedStringValue to another.
+ *
+ * @param value the EncodedStringValue to append
+ * @param field the field
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ protected void appendEncodedStringValue(EncodedStringValue value,
+ int field) {
+ if (null == value) {
+ throw new NullPointerException();
+ }
+
+ switch (field) {
+ case BCC:
+ case CC:
+ case TO:
+ break;
+ default:
+ throw new RuntimeException("Invalid header field!");
+ }
+
+ ArrayList<EncodedStringValue> list =
+ (ArrayList<EncodedStringValue>) mHeaderMap.get(field);
+ if (null == list) {
+ list = new ArrayList<EncodedStringValue>();
+ }
+ list.add(value);
+ mHeaderMap.put(field, list);
+ }
+
+ /**
+ * Get LongInteger value by header field.
+ *
+ * @param field the field
+ * @return the LongInteger value of the pdu header
+ * with specified header field. if return -1, the
+ * field is not existed in pdu header.
+ */
+ @UnsupportedAppUsage
+ protected long getLongInteger(int field) {
+ Long longInteger = (Long) mHeaderMap.get(field);
+ if (null == longInteger) {
+ return -1;
+ }
+
+ return longInteger.longValue();
+ }
+
+ /**
+ * Set LongInteger value to pdu header by header field.
+ *
+ * @param value the value
+ * @param field the field
+ */
+ @UnsupportedAppUsage
+ protected void setLongInteger(long value, int field) {
+ /**
+ * Check whether this field can be set for specific
+ * header and check validity of the field.
+ */
+ switch (field) {
+ case DATE:
+ case REPLY_CHARGING_SIZE:
+ case MESSAGE_SIZE:
+ case MESSAGE_COUNT:
+ case START:
+ case LIMIT:
+ case DELIVERY_TIME:
+ case EXPIRY:
+ case REPLY_CHARGING_DEADLINE:
+ case PREVIOUSLY_SENT_DATE:
+ break;
+ default:
+ // This header value should not be LongInteger.
+ throw new RuntimeException("Invalid header field!");
+ }
+ mHeaderMap.put(field, value);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduParser.java b/telephony/common/com/google/android/mms/pdu/PduParser.java
new file mode 100755
index 000000000000..f48399410723
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduParser.java
@@ -0,0 +1,2023 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.ContentType;
+import com.google.android.mms.InvalidHeaderValueException;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.HashMap;
+
+public class PduParser {
+ /**
+ * The next are WAP values defined in WSP specification.
+ */
+ private static final int QUOTE = 127;
+ private static final int LENGTH_QUOTE = 31;
+ private static final int TEXT_MIN = 32;
+ private static final int TEXT_MAX = 127;
+ private static final int SHORT_INTEGER_MAX = 127;
+ private static final int SHORT_LENGTH_MAX = 30;
+ private static final int LONG_INTEGER_LENGTH_MAX = 8;
+ private static final int QUOTED_STRING_FLAG = 34;
+ private static final int END_STRING_FLAG = 0x00;
+ //The next two are used by the interface "parseWapString" to
+ //distinguish Text-String and Quoted-String.
+ private static final int TYPE_TEXT_STRING = 0;
+ private static final int TYPE_QUOTED_STRING = 1;
+ private static final int TYPE_TOKEN_STRING = 2;
+
+ /**
+ * Specify the part position.
+ */
+ private static final int THE_FIRST_PART = 0;
+ private static final int THE_LAST_PART = 1;
+
+ /**
+ * The pdu data.
+ */
+ private ByteArrayInputStream mPduDataStream = null;
+
+ /**
+ * Store pdu headers
+ */
+ private PduHeaders mHeaders = null;
+
+ /**
+ * Store pdu parts.
+ */
+ private PduBody mBody = null;
+
+ /**
+ * Store the "type" parameter in "Content-Type" header field.
+ */
+ private static byte[] mTypeParam = null;
+
+ /**
+ * Store the "start" parameter in "Content-Type" header field.
+ */
+ private static byte[] mStartParam = null;
+
+ /**
+ * The log tag.
+ */
+ private static final String LOG_TAG = "PduParser";
+ private static final boolean DEBUG = false;
+ private static final boolean LOCAL_LOGV = false;
+
+ /**
+ * Whether to parse content-disposition part header
+ */
+ private final boolean mParseContentDisposition;
+
+ /**
+ * Constructor.
+ *
+ * @param pduDataStream pdu data to be parsed
+ * @param parseContentDisposition whether to parse the Content-Disposition part header
+ */
+ @UnsupportedAppUsage
+ public PduParser(byte[] pduDataStream, boolean parseContentDisposition) {
+ mPduDataStream = new ByteArrayInputStream(pduDataStream);
+ mParseContentDisposition = parseContentDisposition;
+ }
+
+ /**
+ * Parse the pdu.
+ *
+ * @return the pdu structure if parsing successfully.
+ * null if parsing error happened or mandatory fields are not set.
+ */
+ @UnsupportedAppUsage
+ public GenericPdu parse(){
+ if (mPduDataStream == null) {
+ return null;
+ }
+
+ /* parse headers */
+ mHeaders = parseHeaders(mPduDataStream);
+ if (null == mHeaders) {
+ // Parse headers failed.
+ return null;
+ }
+
+ /* get the message type */
+ int messageType = mHeaders.getOctet(PduHeaders.MESSAGE_TYPE);
+
+ /* check mandatory header fields */
+ if (false == checkMandatoryHeader(mHeaders)) {
+ log("check mandatory headers failed!");
+ return null;
+ }
+
+ if ((PduHeaders.MESSAGE_TYPE_SEND_REQ == messageType) ||
+ (PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF == messageType)) {
+ /* need to parse the parts */
+ mBody = parseParts(mPduDataStream);
+ if (null == mBody) {
+ // Parse parts failed.
+ return null;
+ }
+ }
+
+ switch (messageType) {
+ case PduHeaders.MESSAGE_TYPE_SEND_REQ:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_SEND_REQ");
+ }
+ SendReq sendReq = new SendReq(mHeaders, mBody);
+ return sendReq;
+ case PduHeaders.MESSAGE_TYPE_SEND_CONF:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_SEND_CONF");
+ }
+ SendConf sendConf = new SendConf(mHeaders);
+ return sendConf;
+ case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_NOTIFICATION_IND");
+ }
+ NotificationInd notificationInd =
+ new NotificationInd(mHeaders);
+ return notificationInd;
+ case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_NOTIFYRESP_IND");
+ }
+ NotifyRespInd notifyRespInd =
+ new NotifyRespInd(mHeaders);
+ return notifyRespInd;
+ case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_RETRIEVE_CONF");
+ }
+ RetrieveConf retrieveConf =
+ new RetrieveConf(mHeaders, mBody);
+
+ byte[] contentType = retrieveConf.getContentType();
+ if (null == contentType) {
+ return null;
+ }
+ String ctTypeStr = new String(contentType);
+ if (ctTypeStr.equals(ContentType.MULTIPART_MIXED)
+ || ctTypeStr.equals(ContentType.MULTIPART_RELATED)
+ || ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) {
+ // The MMS content type must be "application/vnd.wap.multipart.mixed"
+ // or "application/vnd.wap.multipart.related"
+ // or "application/vnd.wap.multipart.alternative"
+ return retrieveConf;
+ } else if (ctTypeStr.equals(ContentType.MULTIPART_ALTERNATIVE)) {
+ // "application/vnd.wap.multipart.alternative"
+ // should take only the first part.
+ PduPart firstPart = mBody.getPart(0);
+ mBody.removeAll();
+ mBody.addPart(0, firstPart);
+ return retrieveConf;
+ }
+ return null;
+ case PduHeaders.MESSAGE_TYPE_DELIVERY_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_DELIVERY_IND");
+ }
+ DeliveryInd deliveryInd =
+ new DeliveryInd(mHeaders);
+ return deliveryInd;
+ case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_ACKNOWLEDGE_IND");
+ }
+ AcknowledgeInd acknowledgeInd =
+ new AcknowledgeInd(mHeaders);
+ return acknowledgeInd;
+ case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_READ_ORIG_IND");
+ }
+ ReadOrigInd readOrigInd =
+ new ReadOrigInd(mHeaders);
+ return readOrigInd;
+ case PduHeaders.MESSAGE_TYPE_READ_REC_IND:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parse: MESSAGE_TYPE_READ_REC_IND");
+ }
+ ReadRecInd readRecInd =
+ new ReadRecInd(mHeaders);
+ return readRecInd;
+ default:
+ log("Parser doesn't support this message type in this version!");
+ return null;
+ }
+ }
+
+ /**
+ * Parse pdu headers.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return headers in PduHeaders structure, null when parse fail
+ */
+ protected PduHeaders parseHeaders(ByteArrayInputStream pduDataStream){
+ if (pduDataStream == null) {
+ return null;
+ }
+ boolean keepParsing = true;
+ PduHeaders headers = new PduHeaders();
+
+ while (keepParsing && (pduDataStream.available() > 0)) {
+ pduDataStream.mark(1);
+ int headerField = extractByteValue(pduDataStream);
+ /* parse custom text header */
+ if ((headerField >= TEXT_MIN) && (headerField <= TEXT_MAX)) {
+ pduDataStream.reset();
+ byte [] bVal = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "TextHeader: " + new String(bVal));
+ }
+ /* we should ignore it at the moment */
+ continue;
+ }
+ switch (headerField) {
+ case PduHeaders.MESSAGE_TYPE:
+ {
+ int messageType = extractByteValue(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: messageType: " + messageType);
+ }
+ switch (messageType) {
+ // We don't support these kind of messages now.
+ case PduHeaders.MESSAGE_TYPE_FORWARD_REQ:
+ case PduHeaders.MESSAGE_TYPE_FORWARD_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_STORE_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_STORE_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DESCR:
+ case PduHeaders.MESSAGE_TYPE_DELETE_REQ:
+ case PduHeaders.MESSAGE_TYPE_DELETE_CONF:
+ case PduHeaders.MESSAGE_TYPE_CANCEL_REQ:
+ case PduHeaders.MESSAGE_TYPE_CANCEL_CONF:
+ return null;
+ }
+ try {
+ headers.setOctet(messageType, headerField);
+ } catch(InvalidHeaderValueException e) {
+ log("Set invalid Octet value: " + messageType +
+ " into the header filed: " + headerField);
+ return null;
+ } catch(RuntimeException e) {
+ log(headerField + "is not Octet header field!");
+ return null;
+ }
+ break;
+ }
+ /* Octect value */
+ case PduHeaders.REPORT_ALLOWED:
+ case PduHeaders.ADAPTATION_ALLOWED:
+ case PduHeaders.DELIVERY_REPORT:
+ case PduHeaders.DRM_CONTENT:
+ case PduHeaders.DISTRIBUTION_INDICATOR:
+ case PduHeaders.QUOTAS:
+ case PduHeaders.READ_REPORT:
+ case PduHeaders.STORE:
+ case PduHeaders.STORED:
+ case PduHeaders.TOTALS:
+ case PduHeaders.SENDER_VISIBILITY:
+ case PduHeaders.READ_STATUS:
+ case PduHeaders.CANCEL_STATUS:
+ case PduHeaders.PRIORITY:
+ case PduHeaders.STATUS:
+ case PduHeaders.REPLY_CHARGING:
+ case PduHeaders.MM_STATE:
+ case PduHeaders.RECOMMENDED_RETRIEVAL_MODE:
+ case PduHeaders.CONTENT_CLASS:
+ case PduHeaders.RETRIEVE_STATUS:
+ case PduHeaders.STORE_STATUS:
+ /**
+ * The following field has a different value when
+ * used in the M-Mbox-Delete.conf and M-Delete.conf PDU.
+ * For now we ignore this fact, since we do not support these PDUs
+ */
+ case PduHeaders.RESPONSE_STATUS:
+ {
+ int value = extractByteValue(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: byte: " + headerField + " value: " +
+ value);
+ }
+
+ try {
+ headers.setOctet(value, headerField);
+ } catch(InvalidHeaderValueException e) {
+ log("Set invalid Octet value: " + value +
+ " into the header filed: " + headerField);
+ return null;
+ } catch(RuntimeException e) {
+ log(headerField + "is not Octet header field!");
+ return null;
+ }
+ break;
+ }
+
+ /* Long-Integer */
+ case PduHeaders.DATE:
+ case PduHeaders.REPLY_CHARGING_SIZE:
+ case PduHeaders.MESSAGE_SIZE:
+ {
+ try {
+ long value = parseLongInteger(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: longint: " + headerField + " value: " +
+ value);
+ }
+ headers.setLongInteger(value, headerField);
+ } catch(RuntimeException e) {
+ log(headerField + "is not Long-Integer header field!");
+ return null;
+ }
+ break;
+ }
+
+ /* Integer-Value */
+ case PduHeaders.MESSAGE_COUNT:
+ case PduHeaders.START:
+ case PduHeaders.LIMIT:
+ {
+ try {
+ long value = parseIntegerValue(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: int: " + headerField + " value: " +
+ value);
+ }
+ headers.setLongInteger(value, headerField);
+ } catch(RuntimeException e) {
+ log(headerField + "is not Long-Integer header field!");
+ return null;
+ }
+ break;
+ }
+
+ /* Text-String */
+ case PduHeaders.TRANSACTION_ID:
+ case PduHeaders.REPLY_CHARGING_ID:
+ case PduHeaders.AUX_APPLIC_ID:
+ case PduHeaders.APPLIC_ID:
+ case PduHeaders.REPLY_APPLIC_ID:
+ /**
+ * The next three header fields are email addresses
+ * as defined in RFC2822,
+ * not including the characters "<" and ">"
+ */
+ case PduHeaders.MESSAGE_ID:
+ case PduHeaders.REPLACE_ID:
+ case PduHeaders.CANCEL_ID:
+ /**
+ * The following field has a different value when
+ * used in the M-Mbox-Delete.conf and M-Delete.conf PDU.
+ * For now we ignore this fact, since we do not support these PDUs
+ */
+ case PduHeaders.CONTENT_LOCATION:
+ {
+ byte[] value = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if (null != value) {
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: string: " + headerField + " value: " +
+ new String(value));
+ }
+ headers.setTextString(value, headerField);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Text-String header field!");
+ return null;
+ }
+ }
+ break;
+ }
+
+ /* Encoded-string-value */
+ case PduHeaders.SUBJECT:
+ case PduHeaders.RECOMMENDED_RETRIEVAL_MODE_TEXT:
+ case PduHeaders.RETRIEVE_TEXT:
+ case PduHeaders.STATUS_TEXT:
+ case PduHeaders.STORE_STATUS_TEXT:
+ /* the next one is not support
+ * M-Mbox-Delete.conf and M-Delete.conf now */
+ case PduHeaders.RESPONSE_TEXT:
+ {
+ EncodedStringValue value =
+ parseEncodedStringValue(pduDataStream);
+ if (null != value) {
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: encoded string: " + headerField
+ + " value: " + value.getString());
+ }
+ headers.setEncodedStringValue(value, headerField);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch (RuntimeException e) {
+ log(headerField + "is not Encoded-String-Value header field!");
+ return null;
+ }
+ }
+ break;
+ }
+
+ /* Addressing model */
+ case PduHeaders.BCC:
+ case PduHeaders.CC:
+ case PduHeaders.TO:
+ {
+ EncodedStringValue value =
+ parseEncodedStringValue(pduDataStream);
+ if (null != value) {
+ byte[] address = value.getTextString();
+ if (null != address) {
+ String str = new String(address);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: (to/cc/bcc) address: " + headerField
+ + " value: " + str);
+ }
+ int endIndex = str.indexOf("/");
+ if (endIndex > 0) {
+ str = str.substring(0, endIndex);
+ }
+ try {
+ value.setTextString(str.getBytes());
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ return null;
+ }
+ }
+
+ try {
+ headers.appendEncodedStringValue(value, headerField);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Encoded-String-Value header field!");
+ return null;
+ }
+ }
+ break;
+ }
+
+ /* Value-length
+ * (Absolute-token Date-value | Relative-token Delta-seconds-value) */
+ case PduHeaders.DELIVERY_TIME:
+ case PduHeaders.EXPIRY:
+ case PduHeaders.REPLY_CHARGING_DEADLINE:
+ {
+ /* parse Value-length */
+ parseValueLength(pduDataStream);
+
+ /* Absolute-token or Relative-token */
+ int token = extractByteValue(pduDataStream);
+
+ /* Date-value or Delta-seconds-value */
+ long timeValue;
+ try {
+ timeValue = parseLongInteger(pduDataStream);
+ } catch(RuntimeException e) {
+ log(headerField + "is not Long-Integer header field!");
+ return null;
+ }
+ if (PduHeaders.VALUE_RELATIVE_TOKEN == token) {
+ /* need to convert the Delta-seconds-value
+ * into Date-value */
+ timeValue = System.currentTimeMillis()/1000 + timeValue;
+ }
+
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: time value: " + headerField
+ + " value: " + timeValue);
+ }
+ headers.setLongInteger(timeValue, headerField);
+ } catch(RuntimeException e) {
+ log(headerField + "is not Long-Integer header field!");
+ return null;
+ }
+ break;
+ }
+
+ case PduHeaders.FROM: {
+ /* From-value =
+ * Value-length
+ * (Address-present-token Encoded-string-value | Insert-address-token)
+ */
+ EncodedStringValue from = null;
+ parseValueLength(pduDataStream); /* parse value-length */
+
+ /* Address-present-token or Insert-address-token */
+ int fromToken = extractByteValue(pduDataStream);
+
+ /* Address-present-token or Insert-address-token */
+ if (PduHeaders.FROM_ADDRESS_PRESENT_TOKEN == fromToken) {
+ /* Encoded-string-value */
+ from = parseEncodedStringValue(pduDataStream);
+ if (null != from) {
+ byte[] address = from.getTextString();
+ if (null != address) {
+ String str = new String(address);
+ int endIndex = str.indexOf("/");
+ if (endIndex > 0) {
+ str = str.substring(0, endIndex);
+ }
+ try {
+ from.setTextString(str.getBytes());
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ return null;
+ }
+ }
+ }
+ } else {
+ try {
+ from = new EncodedStringValue(
+ PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes());
+ } catch(NullPointerException e) {
+ log(headerField + "is not Encoded-String-Value header field!");
+ return null;
+ }
+ }
+
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: from address: " + headerField
+ + " value: " + from.getString());
+ }
+ headers.setEncodedStringValue(from, PduHeaders.FROM);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Encoded-String-Value header field!");
+ return null;
+ }
+ break;
+ }
+
+ case PduHeaders.MESSAGE_CLASS: {
+ /* Message-class-value = Class-identifier | Token-text */
+ pduDataStream.mark(1);
+ int messageClass = extractByteValue(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: MESSAGE_CLASS: " + headerField
+ + " value: " + messageClass);
+ }
+
+ if (messageClass >= PduHeaders.MESSAGE_CLASS_PERSONAL) {
+ /* Class-identifier */
+ try {
+ if (PduHeaders.MESSAGE_CLASS_PERSONAL == messageClass) {
+ headers.setTextString(
+ PduHeaders.MESSAGE_CLASS_PERSONAL_STR.getBytes(),
+ PduHeaders.MESSAGE_CLASS);
+ } else if (PduHeaders.MESSAGE_CLASS_ADVERTISEMENT == messageClass) {
+ headers.setTextString(
+ PduHeaders.MESSAGE_CLASS_ADVERTISEMENT_STR.getBytes(),
+ PduHeaders.MESSAGE_CLASS);
+ } else if (PduHeaders.MESSAGE_CLASS_INFORMATIONAL == messageClass) {
+ headers.setTextString(
+ PduHeaders.MESSAGE_CLASS_INFORMATIONAL_STR.getBytes(),
+ PduHeaders.MESSAGE_CLASS);
+ } else if (PduHeaders.MESSAGE_CLASS_AUTO == messageClass) {
+ headers.setTextString(
+ PduHeaders.MESSAGE_CLASS_AUTO_STR.getBytes(),
+ PduHeaders.MESSAGE_CLASS);
+ }
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Text-String header field!");
+ return null;
+ }
+ } else {
+ /* Token-text */
+ pduDataStream.reset();
+ byte[] messageClassString = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if (null != messageClassString) {
+ try {
+ headers.setTextString(messageClassString, PduHeaders.MESSAGE_CLASS);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Text-String header field!");
+ return null;
+ }
+ }
+ }
+ break;
+ }
+
+ case PduHeaders.MMS_VERSION: {
+ int version = parseShortInteger(pduDataStream);
+
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: MMS_VERSION: " + headerField
+ + " value: " + version);
+ }
+ headers.setOctet(version, PduHeaders.MMS_VERSION);
+ } catch(InvalidHeaderValueException e) {
+ log("Set invalid Octet value: " + version +
+ " into the header filed: " + headerField);
+ return null;
+ } catch(RuntimeException e) {
+ log(headerField + "is not Octet header field!");
+ return null;
+ }
+ break;
+ }
+
+ case PduHeaders.PREVIOUSLY_SENT_BY: {
+ /* Previously-sent-by-value =
+ * Value-length Forwarded-count-value Encoded-string-value */
+ /* parse value-length */
+ parseValueLength(pduDataStream);
+
+ /* parse Forwarded-count-value */
+ try {
+ parseIntegerValue(pduDataStream);
+ } catch(RuntimeException e) {
+ log(headerField + " is not Integer-Value");
+ return null;
+ }
+
+ /* parse Encoded-string-value */
+ EncodedStringValue previouslySentBy =
+ parseEncodedStringValue(pduDataStream);
+ if (null != previouslySentBy) {
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: PREVIOUSLY_SENT_BY: " + headerField
+ + " value: " + previouslySentBy.getString());
+ }
+ headers.setEncodedStringValue(previouslySentBy,
+ PduHeaders.PREVIOUSLY_SENT_BY);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Encoded-String-Value header field!");
+ return null;
+ }
+ }
+ break;
+ }
+
+ case PduHeaders.PREVIOUSLY_SENT_DATE: {
+ /* Previously-sent-date-value =
+ * Value-length Forwarded-count-value Date-value */
+ /* parse value-length */
+ parseValueLength(pduDataStream);
+
+ /* parse Forwarded-count-value */
+ try {
+ parseIntegerValue(pduDataStream);
+ } catch(RuntimeException e) {
+ log(headerField + " is not Integer-Value");
+ return null;
+ }
+
+ /* Date-value */
+ try {
+ long perviouslySentDate = parseLongInteger(pduDataStream);
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: PREVIOUSLY_SENT_DATE: " + headerField
+ + " value: " + perviouslySentDate);
+ }
+ headers.setLongInteger(perviouslySentDate,
+ PduHeaders.PREVIOUSLY_SENT_DATE);
+ } catch(RuntimeException e) {
+ log(headerField + "is not Long-Integer header field!");
+ return null;
+ }
+ break;
+ }
+
+ case PduHeaders.MM_FLAGS: {
+ /* MM-flags-value =
+ * Value-length
+ * ( Add-token | Remove-token | Filter-token )
+ * Encoded-string-value
+ */
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: MM_FLAGS: " + headerField
+ + " NOT REALLY SUPPORTED");
+ }
+
+ /* parse Value-length */
+ parseValueLength(pduDataStream);
+
+ /* Add-token | Remove-token | Filter-token */
+ extractByteValue(pduDataStream);
+
+ /* Encoded-string-value */
+ parseEncodedStringValue(pduDataStream);
+
+ /* not store this header filed in "headers",
+ * because now PduHeaders doesn't support it */
+ break;
+ }
+
+ /* Value-length
+ * (Message-total-token | Size-total-token) Integer-Value */
+ case PduHeaders.MBOX_TOTALS:
+ case PduHeaders.MBOX_QUOTAS:
+ {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: MBOX_TOTALS: " + headerField);
+ }
+ /* Value-length */
+ parseValueLength(pduDataStream);
+
+ /* Message-total-token | Size-total-token */
+ extractByteValue(pduDataStream);
+
+ /*Integer-Value*/
+ try {
+ parseIntegerValue(pduDataStream);
+ } catch(RuntimeException e) {
+ log(headerField + " is not Integer-Value");
+ return null;
+ }
+
+ /* not store these headers filed in "headers",
+ because now PduHeaders doesn't support them */
+ break;
+ }
+
+ case PduHeaders.ELEMENT_DESCRIPTOR: {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: ELEMENT_DESCRIPTOR: " + headerField);
+ }
+ parseContentType(pduDataStream, null);
+
+ /* not store this header filed in "headers",
+ because now PduHeaders doesn't support it */
+ break;
+ }
+
+ case PduHeaders.CONTENT_TYPE: {
+ HashMap<Integer, Object> map =
+ new HashMap<Integer, Object>();
+ byte[] contentType =
+ parseContentType(pduDataStream, map);
+
+ if (null != contentType) {
+ try {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: CONTENT_TYPE: " + headerField +
+ contentType.toString());
+ }
+ headers.setTextString(contentType, PduHeaders.CONTENT_TYPE);
+ } catch(NullPointerException e) {
+ log("null pointer error!");
+ } catch(RuntimeException e) {
+ log(headerField + "is not Text-String header field!");
+ return null;
+ }
+ }
+
+ /* get start parameter */
+ mStartParam = (byte[]) map.get(PduPart.P_START);
+
+ /* get charset parameter */
+ mTypeParam= (byte[]) map.get(PduPart.P_TYPE);
+
+ keepParsing = false;
+ break;
+ }
+
+ case PduHeaders.CONTENT:
+ case PduHeaders.ADDITIONAL_HEADERS:
+ case PduHeaders.ATTRIBUTES:
+ default: {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "parseHeaders: Unknown header: " + headerField);
+ }
+ log("Unknown header");
+ }
+ }
+ }
+
+ return headers;
+ }
+
+ /**
+ * Parse pdu parts.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return parts in PduBody structure
+ */
+ protected PduBody parseParts(ByteArrayInputStream pduDataStream) {
+ if (pduDataStream == null) {
+ return null;
+ }
+
+ int count = parseUnsignedInt(pduDataStream); // get the number of parts
+ PduBody body = new PduBody();
+
+ for (int i = 0 ; i < count ; i++) {
+ int headerLength = parseUnsignedInt(pduDataStream);
+ int dataLength = parseUnsignedInt(pduDataStream);
+ PduPart part = new PduPart();
+ int startPos = pduDataStream.available();
+ if (startPos <= 0) {
+ // Invalid part.
+ return null;
+ }
+
+ /* parse part's content-type */
+ HashMap<Integer, Object> map = new HashMap<Integer, Object>();
+ byte[] contentType = parseContentType(pduDataStream, map);
+ if (null != contentType) {
+ part.setContentType(contentType);
+ } else {
+ part.setContentType((PduContentTypes.contentTypes[0]).getBytes()); //"*/*"
+ }
+
+ /* get name parameter */
+ byte[] name = (byte[]) map.get(PduPart.P_NAME);
+ if (null != name) {
+ part.setName(name);
+ }
+
+ /* get charset parameter */
+ Integer charset = (Integer) map.get(PduPart.P_CHARSET);
+ if (null != charset) {
+ part.setCharset(charset);
+ }
+
+ /* parse part's headers */
+ int endPos = pduDataStream.available();
+ int partHeaderLen = headerLength - (startPos - endPos);
+ if (partHeaderLen > 0) {
+ if (false == parsePartHeaders(pduDataStream, part, partHeaderLen)) {
+ // Parse part header faild.
+ return null;
+ }
+ } else if (partHeaderLen < 0) {
+ // Invalid length of content-type.
+ return null;
+ }
+
+ /* FIXME: check content-id, name, filename and content location,
+ * if not set anyone of them, generate a default content-location
+ */
+ if ((null == part.getContentLocation())
+ && (null == part.getName())
+ && (null == part.getFilename())
+ && (null == part.getContentId())) {
+ part.setContentLocation(Long.toOctalString(
+ System.currentTimeMillis()).getBytes());
+ }
+
+ /* get part's data */
+ if (dataLength > 0) {
+ byte[] partData = new byte[dataLength];
+ String partContentType = new String(part.getContentType());
+ pduDataStream.read(partData, 0, dataLength);
+ if (partContentType.equalsIgnoreCase(ContentType.MULTIPART_ALTERNATIVE)) {
+ // parse "multipart/vnd.wap.multipart.alternative".
+ PduBody childBody = parseParts(new ByteArrayInputStream(partData));
+ // take the first part of children.
+ part = childBody.getPart(0);
+ } else {
+ // Check Content-Transfer-Encoding.
+ byte[] partDataEncoding = part.getContentTransferEncoding();
+ if (null != partDataEncoding) {
+ String encoding = new String(partDataEncoding);
+ if (encoding.equalsIgnoreCase(PduPart.P_BASE64)) {
+ // Decode "base64" into "binary".
+ partData = Base64.decodeBase64(partData);
+ } else if (encoding.equalsIgnoreCase(PduPart.P_QUOTED_PRINTABLE)) {
+ // Decode "quoted-printable" into "binary".
+ partData = QuotedPrintable.decodeQuotedPrintable(partData);
+ } else {
+ // "binary" is the default encoding.
+ }
+ }
+ if (null == partData) {
+ log("Decode part data error!");
+ return null;
+ }
+ part.setData(partData);
+ }
+ }
+
+ /* add this part to body */
+ if (THE_FIRST_PART == checkPartPosition(part)) {
+ /* this is the first part */
+ body.addPart(0, part);
+ } else {
+ /* add the part to the end */
+ body.addPart(part);
+ }
+ }
+
+ return body;
+ }
+
+ /**
+ * Log status.
+ *
+ * @param text log information
+ */
+ @UnsupportedAppUsage
+ private static void log(String text) {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, text);
+ }
+ }
+
+ /**
+ * Parse unsigned integer.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return the integer, -1 when failed
+ */
+ @UnsupportedAppUsage
+ protected static int parseUnsignedInt(ByteArrayInputStream pduDataStream) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * The maximum size of a uintvar is 32 bits.
+ * So it will be encoded in no more than 5 octets.
+ */
+ assert(null != pduDataStream);
+ int result = 0;
+ int temp = pduDataStream.read();
+ if (temp == -1) {
+ return temp;
+ }
+
+ while((temp & 0x80) != 0) {
+ result = result << 7;
+ result |= temp & 0x7F;
+ temp = pduDataStream.read();
+ if (temp == -1) {
+ return temp;
+ }
+ }
+
+ result = result << 7;
+ result |= temp & 0x7F;
+
+ return result;
+ }
+
+ /**
+ * Parse value length.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return the integer
+ */
+ @UnsupportedAppUsage
+ protected static int parseValueLength(ByteArrayInputStream pduDataStream) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Value-length = Short-length | (Length-quote Length)
+ * Short-length = <Any octet 0-30>
+ * Length-quote = <Octet 31>
+ * Length = Uintvar-integer
+ * Uintvar-integer = 1*5 OCTET
+ */
+ assert(null != pduDataStream);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ int first = temp & 0xFF;
+
+ if (first <= SHORT_LENGTH_MAX) {
+ return first;
+ } else if (first == LENGTH_QUOTE) {
+ return parseUnsignedInt(pduDataStream);
+ }
+
+ throw new RuntimeException ("Value length > LENGTH_QUOTE!");
+ }
+
+ /**
+ * Parse encoded string value.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return the EncodedStringValue
+ */
+ protected static EncodedStringValue parseEncodedStringValue(ByteArrayInputStream pduDataStream){
+ /**
+ * From OMA-TS-MMS-ENC-V1_3-20050927-C.pdf
+ * Encoded-string-value = Text-string | Value-length Char-set Text-string
+ */
+ assert(null != pduDataStream);
+ pduDataStream.mark(1);
+ EncodedStringValue returnValue = null;
+ int charset = 0;
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ int first = temp & 0xFF;
+ if (first == 0) {
+ return new EncodedStringValue("");
+ }
+
+ pduDataStream.reset();
+ if (first < TEXT_MIN) {
+ parseValueLength(pduDataStream);
+
+ charset = parseShortInteger(pduDataStream); //get the "Charset"
+ }
+
+ byte[] textString = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+
+ try {
+ if (0 != charset) {
+ returnValue = new EncodedStringValue(charset, textString);
+ } else {
+ returnValue = new EncodedStringValue(textString);
+ }
+ } catch(Exception e) {
+ return null;
+ }
+
+ return returnValue;
+ }
+
+ /**
+ * Parse Text-String or Quoted-String.
+ *
+ * @param pduDataStream pdu data input stream
+ * @param stringType TYPE_TEXT_STRING or TYPE_QUOTED_STRING
+ * @return the string without End-of-string in byte array
+ */
+ @UnsupportedAppUsage
+ protected static byte[] parseWapString(ByteArrayInputStream pduDataStream,
+ int stringType) {
+ assert(null != pduDataStream);
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Text-string = [Quote] *TEXT End-of-string
+ * If the first character in the TEXT is in the range of 128-255,
+ * a Quote character must precede it.
+ * Otherwise the Quote character must be omitted.
+ * The Quote is not part of the contents.
+ * Quote = <Octet 127>
+ * End-of-string = <Octet 0>
+ *
+ * Quoted-string = <Octet 34> *TEXT End-of-string
+ *
+ * Token-text = Token End-of-string
+ */
+
+ // Mark supposed beginning of Text-string
+ // We will have to mark again if first char is QUOTE or QUOTED_STRING_FLAG
+ pduDataStream.mark(1);
+
+ // Check first char
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ if ((TYPE_QUOTED_STRING == stringType) &&
+ (QUOTED_STRING_FLAG == temp)) {
+ // Mark again if QUOTED_STRING_FLAG and ignore it
+ pduDataStream.mark(1);
+ } else if ((TYPE_TEXT_STRING == stringType) &&
+ (QUOTE == temp)) {
+ // Mark again if QUOTE and ignore it
+ pduDataStream.mark(1);
+ } else {
+ // Otherwise go back to origin
+ pduDataStream.reset();
+ }
+
+ // We are now definitely at the beginning of string
+ /**
+ * Return *TOKEN or *TEXT (Text-String without QUOTE,
+ * Quoted-String without QUOTED_STRING_FLAG and without End-of-string)
+ */
+ return getWapString(pduDataStream, stringType);
+ }
+
+ /**
+ * Check TOKEN data defined in RFC2616.
+ * @param ch checking data
+ * @return true when ch is TOKEN, false when ch is not TOKEN
+ */
+ protected static boolean isTokenCharacter(int ch) {
+ /**
+ * Token = 1*<any CHAR except CTLs or separators>
+ * separators = "("(40) | ")"(41) | "<"(60) | ">"(62) | "@"(64)
+ * | ","(44) | ";"(59) | ":"(58) | "\"(92) | <">(34)
+ * | "/"(47) | "["(91) | "]"(93) | "?"(63) | "="(61)
+ * | "{"(123) | "}"(125) | SP(32) | HT(9)
+ * CHAR = <any US-ASCII character (octets 0 - 127)>
+ * CTL = <any US-ASCII control character
+ * (octets 0 - 31) and DEL (127)>
+ * SP = <US-ASCII SP, space (32)>
+ * HT = <US-ASCII HT, horizontal-tab (9)>
+ */
+ if((ch < 33) || (ch > 126)) {
+ return false;
+ }
+
+ switch(ch) {
+ case '"': /* '"' */
+ case '(': /* '(' */
+ case ')': /* ')' */
+ case ',': /* ',' */
+ case '/': /* '/' */
+ case ':': /* ':' */
+ case ';': /* ';' */
+ case '<': /* '<' */
+ case '=': /* '=' */
+ case '>': /* '>' */
+ case '?': /* '?' */
+ case '@': /* '@' */
+ case '[': /* '[' */
+ case '\\': /* '\' */
+ case ']': /* ']' */
+ case '{': /* '{' */
+ case '}': /* '}' */
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Check TEXT data defined in RFC2616.
+ * @param ch checking data
+ * @return true when ch is TEXT, false when ch is not TEXT
+ */
+ protected static boolean isText(int ch) {
+ /**
+ * TEXT = <any OCTET except CTLs,
+ * but including LWS>
+ * CTL = <any US-ASCII control character
+ * (octets 0 - 31) and DEL (127)>
+ * LWS = [CRLF] 1*( SP | HT )
+ * CRLF = CR LF
+ * CR = <US-ASCII CR, carriage return (13)>
+ * LF = <US-ASCII LF, linefeed (10)>
+ */
+ if(((ch >= 32) && (ch <= 126)) || ((ch >= 128) && (ch <= 255))) {
+ return true;
+ }
+
+ switch(ch) {
+ case '\t': /* '\t' */
+ case '\n': /* '\n' */
+ case '\r': /* '\r' */
+ return true;
+ }
+
+ return false;
+ }
+
+ protected static byte[] getWapString(ByteArrayInputStream pduDataStream,
+ int stringType) {
+ assert(null != pduDataStream);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ while((-1 != temp) && ('\0' != temp)) {
+ // check each of the character
+ if (stringType == TYPE_TOKEN_STRING) {
+ if (isTokenCharacter(temp)) {
+ out.write(temp);
+ }
+ } else {
+ if (isText(temp)) {
+ out.write(temp);
+ }
+ }
+
+ temp = pduDataStream.read();
+ assert(-1 != temp);
+ }
+
+ if (out.size() > 0) {
+ return out.toByteArray();
+ }
+
+ return null;
+ }
+
+ /**
+ * Extract a byte value from the input stream.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return the byte
+ */
+ protected static int extractByteValue(ByteArrayInputStream pduDataStream) {
+ assert(null != pduDataStream);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ return temp & 0xFF;
+ }
+
+ /**
+ * Parse Short-Integer.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return the byte
+ */
+ @UnsupportedAppUsage
+ protected static int parseShortInteger(ByteArrayInputStream pduDataStream) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Short-integer = OCTET
+ * Integers in range 0-127 shall be encoded as a one
+ * octet value with the most significant bit set to one (1xxx xxxx)
+ * and with the value in the remaining least significant bits.
+ */
+ assert(null != pduDataStream);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ return temp & 0x7F;
+ }
+
+ /**
+ * Parse Long-Integer.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return long integer
+ */
+ protected static long parseLongInteger(ByteArrayInputStream pduDataStream) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Long-integer = Short-length Multi-octet-integer
+ * The Short-length indicates the length of the Multi-octet-integer
+ * Multi-octet-integer = 1*30 OCTET
+ * The content octets shall be an unsigned integer value
+ * with the most significant octet encoded first (big-endian representation).
+ * The minimum number of octets must be used to encode the value.
+ * Short-length = <Any octet 0-30>
+ */
+ assert(null != pduDataStream);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ int count = temp & 0xFF;
+
+ if (count > LONG_INTEGER_LENGTH_MAX) {
+ throw new RuntimeException("Octet count greater than 8 and I can't represent that!");
+ }
+
+ long result = 0;
+
+ for (int i = 0 ; i < count ; i++) {
+ temp = pduDataStream.read();
+ assert(-1 != temp);
+ result <<= 8;
+ result += (temp & 0xFF);
+ }
+
+ return result;
+ }
+
+ /**
+ * Parse Integer-Value.
+ *
+ * @param pduDataStream pdu data input stream
+ * @return long integer
+ */
+ protected static long parseIntegerValue(ByteArrayInputStream pduDataStream) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Integer-Value = Short-integer | Long-integer
+ */
+ assert(null != pduDataStream);
+ pduDataStream.mark(1);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ pduDataStream.reset();
+ if (temp > SHORT_INTEGER_MAX) {
+ return parseShortInteger(pduDataStream);
+ } else {
+ return parseLongInteger(pduDataStream);
+ }
+ }
+
+ /**
+ * To skip length of the wap value.
+ *
+ * @param pduDataStream pdu data input stream
+ * @param length area size
+ * @return the values in this area
+ */
+ protected static int skipWapValue(ByteArrayInputStream pduDataStream, int length) {
+ assert(null != pduDataStream);
+ byte[] area = new byte[length];
+ int readLen = pduDataStream.read(area, 0, length);
+ if (readLen < length) { //The actually read length is lower than the length
+ return -1;
+ } else {
+ return readLen;
+ }
+ }
+
+ /**
+ * Parse content type parameters. For now we just support
+ * four parameters used in mms: "type", "start", "name", "charset".
+ *
+ * @param pduDataStream pdu data input stream
+ * @param map to store parameters of Content-Type field
+ * @param length length of all the parameters
+ */
+ protected static void parseContentTypeParams(ByteArrayInputStream pduDataStream,
+ HashMap<Integer, Object> map, Integer length) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Parameter = Typed-parameter | Untyped-parameter
+ * Typed-parameter = Well-known-parameter-token Typed-value
+ * the actual expected type of the value is implied by the well-known parameter
+ * Well-known-parameter-token = Integer-value
+ * the code values used for parameters are specified in the Assigned Numbers appendix
+ * Typed-value = Compact-value | Text-value
+ * In addition to the expected type, there may be no value.
+ * If the value cannot be encoded using the expected type, it shall be encoded as text.
+ * Compact-value = Integer-value |
+ * Date-value | Delta-seconds-value | Q-value | Version-value |
+ * Uri-value
+ * Untyped-parameter = Token-text Untyped-value
+ * the type of the value is unknown, but it shall be encoded as an integer,
+ * if that is possible.
+ * Untyped-value = Integer-value | Text-value
+ */
+ assert(null != pduDataStream);
+ assert(length > 0);
+
+ int startPos = pduDataStream.available();
+ int tempPos = 0;
+ int lastLen = length;
+ while(0 < lastLen) {
+ int param = pduDataStream.read();
+ assert(-1 != param);
+ lastLen--;
+
+ switch (param) {
+ /**
+ * From rfc2387, chapter 3.1
+ * The type parameter must be specified and its value is the MIME media
+ * type of the "root" body part. It permits a MIME user agent to
+ * determine the content-type without reference to the enclosed body
+ * part. If the value of the type parameter and the root body part's
+ * content-type differ then the User Agent's behavior is undefined.
+ *
+ * From wap-230-wsp-20010705-a.pdf
+ * type = Constrained-encoding
+ * Constrained-encoding = Extension-Media | Short-integer
+ * Extension-media = *TEXT End-of-string
+ */
+ case PduPart.P_TYPE:
+ case PduPart.P_CT_MR_TYPE:
+ pduDataStream.mark(1);
+ int first = extractByteValue(pduDataStream);
+ pduDataStream.reset();
+ if (first > TEXT_MAX) {
+ // Short-integer (well-known type)
+ int index = parseShortInteger(pduDataStream);
+
+ if (index < PduContentTypes.contentTypes.length) {
+ byte[] type = (PduContentTypes.contentTypes[index]).getBytes();
+ map.put(PduPart.P_TYPE, type);
+ } else {
+ //not support this type, ignore it.
+ }
+ } else {
+ // Text-String (extension-media)
+ byte[] type = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if ((null != type) && (null != map)) {
+ map.put(PduPart.P_TYPE, type);
+ }
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+
+ /**
+ * From oma-ts-mms-conf-v1_3.pdf, chapter 10.2.3.
+ * Start Parameter Referring to Presentation
+ *
+ * From rfc2387, chapter 3.2
+ * The start parameter, if given, is the content-ID of the compound
+ * object's "root". If not present the "root" is the first body part in
+ * the Multipart/Related entity. The "root" is the element the
+ * applications processes first.
+ *
+ * From wap-230-wsp-20010705-a.pdf
+ * start = Text-String
+ */
+ case PduPart.P_START:
+ case PduPart.P_DEP_START:
+ byte[] start = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if ((null != start) && (null != map)) {
+ map.put(PduPart.P_START, start);
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+
+ /**
+ * From oma-ts-mms-conf-v1_3.pdf
+ * In creation, the character set SHALL be either us-ascii
+ * (IANA MIBenum 3) or utf-8 (IANA MIBenum 106)[Unicode].
+ * In retrieval, both us-ascii and utf-8 SHALL be supported.
+ *
+ * From wap-230-wsp-20010705-a.pdf
+ * charset = Well-known-charset|Text-String
+ * Well-known-charset = Any-charset | Integer-value
+ * Both are encoded using values from Character Set
+ * Assignments table in Assigned Numbers
+ * Any-charset = <Octet 128>
+ * Equivalent to the special RFC2616 charset value "*"
+ */
+ case PduPart.P_CHARSET:
+ pduDataStream.mark(1);
+ int firstValue = extractByteValue(pduDataStream);
+ pduDataStream.reset();
+ //Check first char
+ if (((firstValue > TEXT_MIN) && (firstValue < TEXT_MAX)) ||
+ (END_STRING_FLAG == firstValue)) {
+ //Text-String (extension-charset)
+ byte[] charsetStr = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ try {
+ int charsetInt = CharacterSets.getMibEnumValue(
+ new String(charsetStr));
+ map.put(PduPart.P_CHARSET, charsetInt);
+ } catch (UnsupportedEncodingException e) {
+ // Not a well-known charset, use "*".
+ Log.e(LOG_TAG, Arrays.toString(charsetStr), e);
+ map.put(PduPart.P_CHARSET, CharacterSets.ANY_CHARSET);
+ }
+ } else {
+ //Well-known-charset
+ int charset = (int) parseIntegerValue(pduDataStream);
+ if (map != null) {
+ map.put(PduPart.P_CHARSET, charset);
+ }
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+
+ /**
+ * From oma-ts-mms-conf-v1_3.pdf
+ * A name for multipart object SHALL be encoded using name-parameter
+ * for Content-Type header in WSP multipart headers.
+ *
+ * From wap-230-wsp-20010705-a.pdf
+ * name = Text-String
+ */
+ case PduPart.P_DEP_NAME:
+ case PduPart.P_NAME:
+ byte[] name = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if ((null != name) && (null != map)) {
+ map.put(PduPart.P_NAME, name);
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+ default:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "Not supported Content-Type parameter");
+ }
+ if (-1 == skipWapValue(pduDataStream, lastLen)) {
+ Log.e(LOG_TAG, "Corrupt Content-Type");
+ } else {
+ lastLen = 0;
+ }
+ break;
+ }
+ }
+
+ if (0 != lastLen) {
+ Log.e(LOG_TAG, "Corrupt Content-Type");
+ }
+ }
+
+ /**
+ * Parse content type.
+ *
+ * @param pduDataStream pdu data input stream
+ * @param map to store parameters in Content-Type header field
+ * @return Content-Type value
+ */
+ @UnsupportedAppUsage
+ protected static byte[] parseContentType(ByteArrayInputStream pduDataStream,
+ HashMap<Integer, Object> map) {
+ /**
+ * From wap-230-wsp-20010705-a.pdf
+ * Content-type-value = Constrained-media | Content-general-form
+ * Content-general-form = Value-length Media-type
+ * Media-type = (Well-known-media | Extension-Media) *(Parameter)
+ */
+ assert(null != pduDataStream);
+
+ byte[] contentType = null;
+ pduDataStream.mark(1);
+ int temp = pduDataStream.read();
+ assert(-1 != temp);
+ pduDataStream.reset();
+
+ int cur = (temp & 0xFF);
+
+ if (cur < TEXT_MIN) {
+ int length = parseValueLength(pduDataStream);
+ int startPos = pduDataStream.available();
+ pduDataStream.mark(1);
+ temp = pduDataStream.read();
+ assert(-1 != temp);
+ pduDataStream.reset();
+ int first = (temp & 0xFF);
+
+ if ((first >= TEXT_MIN) && (first <= TEXT_MAX)) {
+ contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ } else if (first > TEXT_MAX) {
+ int index = parseShortInteger(pduDataStream);
+
+ if (index < PduContentTypes.contentTypes.length) { //well-known type
+ contentType = (PduContentTypes.contentTypes[index]).getBytes();
+ } else {
+ pduDataStream.reset();
+ contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ }
+ } else {
+ Log.e(LOG_TAG, "Corrupt content-type");
+ return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*"
+ }
+
+ int endPos = pduDataStream.available();
+ int parameterLen = length - (startPos - endPos);
+ if (parameterLen > 0) {//have parameters
+ parseContentTypeParams(pduDataStream, map, parameterLen);
+ }
+
+ if (parameterLen < 0) {
+ Log.e(LOG_TAG, "Corrupt MMS message");
+ return (PduContentTypes.contentTypes[0]).getBytes(); //"*/*"
+ }
+ } else if (cur <= TEXT_MAX) {
+ contentType = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ } else {
+ contentType =
+ (PduContentTypes.contentTypes[parseShortInteger(pduDataStream)]).getBytes();
+ }
+
+ return contentType;
+ }
+
+ /**
+ * Parse part's headers.
+ *
+ * @param pduDataStream pdu data input stream
+ * @param part to store the header informations of the part
+ * @param length length of the headers
+ * @return true if parse successfully, false otherwise
+ */
+ @UnsupportedAppUsage
+ protected boolean parsePartHeaders(ByteArrayInputStream pduDataStream,
+ PduPart part, int length) {
+ assert(null != pduDataStream);
+ assert(null != part);
+ assert(length > 0);
+
+ /**
+ * From oma-ts-mms-conf-v1_3.pdf, chapter 10.2.
+ * A name for multipart object SHALL be encoded using name-parameter
+ * for Content-Type header in WSP multipart headers.
+ * In decoding, name-parameter of Content-Type SHALL be used if available.
+ * If name-parameter of Content-Type is not available,
+ * filename parameter of Content-Disposition header SHALL be used if available.
+ * If neither name-parameter of Content-Type header nor filename parameter
+ * of Content-Disposition header is available,
+ * Content-Location header SHALL be used if available.
+ *
+ * Within SMIL part the reference to the media object parts SHALL use
+ * either Content-ID or Content-Location mechanism [RFC2557]
+ * and the corresponding WSP part headers in media object parts
+ * contain the corresponding definitions.
+ */
+ int startPos = pduDataStream.available();
+ int tempPos = 0;
+ int lastLen = length;
+ while(0 < lastLen) {
+ int header = pduDataStream.read();
+ assert(-1 != header);
+ lastLen--;
+
+ if (header > TEXT_MAX) {
+ // Number assigned headers.
+ switch (header) {
+ case PduPart.P_CONTENT_LOCATION:
+ /**
+ * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21
+ * Content-location-value = Uri-value
+ */
+ byte[] contentLocation = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ if (null != contentLocation) {
+ part.setContentLocation(contentLocation);
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+ case PduPart.P_CONTENT_ID:
+ /**
+ * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21
+ * Content-ID-value = Quoted-string
+ */
+ byte[] contentId = parseWapString(pduDataStream, TYPE_QUOTED_STRING);
+ if (null != contentId) {
+ part.setContentId(contentId);
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ break;
+ case PduPart.P_DEP_CONTENT_DISPOSITION:
+ case PduPart.P_CONTENT_DISPOSITION:
+ /**
+ * From wap-230-wsp-20010705-a.pdf, chapter 8.4.2.21
+ * Content-disposition-value = Value-length Disposition *(Parameter)
+ * Disposition = Form-data | Attachment | Inline | Token-text
+ * Form-data = <Octet 128>
+ * Attachment = <Octet 129>
+ * Inline = <Octet 130>
+ */
+
+ /*
+ * some carrier mmsc servers do not support content_disposition
+ * field correctly
+ */
+ if (mParseContentDisposition) {
+ int len = parseValueLength(pduDataStream);
+ pduDataStream.mark(1);
+ int thisStartPos = pduDataStream.available();
+ int thisEndPos = 0;
+ int value = pduDataStream.read();
+
+ if (value == PduPart.P_DISPOSITION_FROM_DATA ) {
+ part.setContentDisposition(PduPart.DISPOSITION_FROM_DATA);
+ } else if (value == PduPart.P_DISPOSITION_ATTACHMENT) {
+ part.setContentDisposition(PduPart.DISPOSITION_ATTACHMENT);
+ } else if (value == PduPart.P_DISPOSITION_INLINE) {
+ part.setContentDisposition(PduPart.DISPOSITION_INLINE);
+ } else {
+ pduDataStream.reset();
+ /* Token-text */
+ part.setContentDisposition(parseWapString(pduDataStream
+ , TYPE_TEXT_STRING));
+ }
+
+ /* get filename parameter and skip other parameters */
+ thisEndPos = pduDataStream.available();
+ if (thisStartPos - thisEndPos < len) {
+ value = pduDataStream.read();
+ if (value == PduPart.P_FILENAME) { //filename is text-string
+ part.setFilename(parseWapString(pduDataStream
+ , TYPE_TEXT_STRING));
+ }
+
+ /* skip other parameters */
+ thisEndPos = pduDataStream.available();
+ if (thisStartPos - thisEndPos < len) {
+ int last = len - (thisStartPos - thisEndPos);
+ byte[] temp = new byte[last];
+ pduDataStream.read(temp, 0, last);
+ }
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ }
+ break;
+ default:
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "Not supported Part headers: " + header);
+ }
+ if (-1 == skipWapValue(pduDataStream, lastLen)) {
+ Log.e(LOG_TAG, "Corrupt Part headers");
+ return false;
+ }
+ lastLen = 0;
+ break;
+ }
+ } else if ((header >= TEXT_MIN) && (header <= TEXT_MAX)) {
+ // Not assigned header.
+ byte[] tempHeader = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+ byte[] tempValue = parseWapString(pduDataStream, TYPE_TEXT_STRING);
+
+ // Check the header whether it is "Content-Transfer-Encoding".
+ if (true ==
+ PduPart.CONTENT_TRANSFER_ENCODING.equalsIgnoreCase(new String(tempHeader))) {
+ part.setContentTransferEncoding(tempValue);
+ }
+
+ tempPos = pduDataStream.available();
+ lastLen = length - (startPos - tempPos);
+ } else {
+ if (LOCAL_LOGV) {
+ Log.v(LOG_TAG, "Not supported Part headers: " + header);
+ }
+ // Skip all headers of this part.
+ if (-1 == skipWapValue(pduDataStream, lastLen)) {
+ Log.e(LOG_TAG, "Corrupt Part headers");
+ return false;
+ }
+ lastLen = 0;
+ }
+ }
+
+ if (0 != lastLen) {
+ Log.e(LOG_TAG, "Corrupt Part headers");
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Check the position of a specified part.
+ *
+ * @param part the part to be checked
+ * @return part position, THE_FIRST_PART when it's the
+ * first one, THE_LAST_PART when it's the last one.
+ */
+ @UnsupportedAppUsage
+ private static int checkPartPosition(PduPart part) {
+ assert(null != part);
+ if ((null == mTypeParam) &&
+ (null == mStartParam)) {
+ return THE_LAST_PART;
+ }
+
+ /* check part's content-id */
+ if (null != mStartParam) {
+ byte[] contentId = part.getContentId();
+ if (null != contentId) {
+ if (true == Arrays.equals(mStartParam, contentId)) {
+ return THE_FIRST_PART;
+ }
+ }
+ // This is not the first part, so append to end (keeping the original order)
+ // Check b/19607294 for details of this change
+ return THE_LAST_PART;
+ }
+
+ /* check part's content-type */
+ if (null != mTypeParam) {
+ byte[] contentType = part.getContentType();
+ if (null != contentType) {
+ if (true == Arrays.equals(mTypeParam, contentType)) {
+ return THE_FIRST_PART;
+ }
+ }
+ }
+
+ return THE_LAST_PART;
+ }
+
+ /**
+ * Check mandatory headers of a pdu.
+ *
+ * @param headers pdu headers
+ * @return true if the pdu has all of the mandatory headers, false otherwise.
+ */
+ protected static boolean checkMandatoryHeader(PduHeaders headers) {
+ if (null == headers) {
+ return false;
+ }
+
+ /* get message type */
+ int messageType = headers.getOctet(PduHeaders.MESSAGE_TYPE);
+
+ /* check Mms-Version field */
+ int mmsVersion = headers.getOctet(PduHeaders.MMS_VERSION);
+ if (0 == mmsVersion) {
+ // Every message should have Mms-Version field.
+ return false;
+ }
+
+ /* check mandatory header fields */
+ switch (messageType) {
+ case PduHeaders.MESSAGE_TYPE_SEND_REQ:
+ // Content-Type field.
+ byte[] srContentType = headers.getTextString(PduHeaders.CONTENT_TYPE);
+ if (null == srContentType) {
+ return false;
+ }
+
+ // From field.
+ EncodedStringValue srFrom = headers.getEncodedStringValue(PduHeaders.FROM);
+ if (null == srFrom) {
+ return false;
+ }
+
+ // Transaction-Id field.
+ byte[] srTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID);
+ if (null == srTransactionId) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_SEND_CONF:
+ // Response-Status field.
+ int scResponseStatus = headers.getOctet(PduHeaders.RESPONSE_STATUS);
+ if (0 == scResponseStatus) {
+ return false;
+ }
+
+ // Transaction-Id field.
+ byte[] scTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID);
+ if (null == scTransactionId) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND:
+ // Content-Location field.
+ byte[] niContentLocation = headers.getTextString(PduHeaders.CONTENT_LOCATION);
+ if (null == niContentLocation) {
+ return false;
+ }
+
+ // Expiry field.
+ long niExpiry = headers.getLongInteger(PduHeaders.EXPIRY);
+ if (-1 == niExpiry) {
+ return false;
+ }
+
+ // Message-Class field.
+ byte[] niMessageClass = headers.getTextString(PduHeaders.MESSAGE_CLASS);
+ if (null == niMessageClass) {
+ return false;
+ }
+
+ // Message-Size field.
+ long niMessageSize = headers.getLongInteger(PduHeaders.MESSAGE_SIZE);
+ if (-1 == niMessageSize) {
+ return false;
+ }
+
+ // Transaction-Id field.
+ byte[] niTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID);
+ if (null == niTransactionId) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND:
+ // Status field.
+ int nriStatus = headers.getOctet(PduHeaders.STATUS);
+ if (0 == nriStatus) {
+ return false;
+ }
+
+ // Transaction-Id field.
+ byte[] nriTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID);
+ if (null == nriTransactionId) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
+ // Content-Type field.
+ byte[] rcContentType = headers.getTextString(PduHeaders.CONTENT_TYPE);
+ if (null == rcContentType) {
+ return false;
+ }
+
+ // Date field.
+ long rcDate = headers.getLongInteger(PduHeaders.DATE);
+ if (-1 == rcDate) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_DELIVERY_IND:
+ // Date field.
+ long diDate = headers.getLongInteger(PduHeaders.DATE);
+ if (-1 == diDate) {
+ return false;
+ }
+
+ // Message-Id field.
+ byte[] diMessageId = headers.getTextString(PduHeaders.MESSAGE_ID);
+ if (null == diMessageId) {
+ return false;
+ }
+
+ // Status field.
+ int diStatus = headers.getOctet(PduHeaders.STATUS);
+ if (0 == diStatus) {
+ return false;
+ }
+
+ // To field.
+ EncodedStringValue[] diTo = headers.getEncodedStringValues(PduHeaders.TO);
+ if (null == diTo) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND:
+ // Transaction-Id field.
+ byte[] aiTransactionId = headers.getTextString(PduHeaders.TRANSACTION_ID);
+ if (null == aiTransactionId) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND:
+ // Date field.
+ long roDate = headers.getLongInteger(PduHeaders.DATE);
+ if (-1 == roDate) {
+ return false;
+ }
+
+ // From field.
+ EncodedStringValue roFrom = headers.getEncodedStringValue(PduHeaders.FROM);
+ if (null == roFrom) {
+ return false;
+ }
+
+ // Message-Id field.
+ byte[] roMessageId = headers.getTextString(PduHeaders.MESSAGE_ID);
+ if (null == roMessageId) {
+ return false;
+ }
+
+ // Read-Status field.
+ int roReadStatus = headers.getOctet(PduHeaders.READ_STATUS);
+ if (0 == roReadStatus) {
+ return false;
+ }
+
+ // To field.
+ EncodedStringValue[] roTo = headers.getEncodedStringValues(PduHeaders.TO);
+ if (null == roTo) {
+ return false;
+ }
+
+ break;
+ case PduHeaders.MESSAGE_TYPE_READ_REC_IND:
+ // From field.
+ EncodedStringValue rrFrom = headers.getEncodedStringValue(PduHeaders.FROM);
+ if (null == rrFrom) {
+ return false;
+ }
+
+ // Message-Id field.
+ byte[] rrMessageId = headers.getTextString(PduHeaders.MESSAGE_ID);
+ if (null == rrMessageId) {
+ return false;
+ }
+
+ // Read-Status field.
+ int rrReadStatus = headers.getOctet(PduHeaders.READ_STATUS);
+ if (0 == rrReadStatus) {
+ return false;
+ }
+
+ // To field.
+ EncodedStringValue[] rrTo = headers.getEncodedStringValues(PduHeaders.TO);
+ if (null == rrTo) {
+ return false;
+ }
+
+ break;
+ default:
+ // Parser doesn't support this message type in this version.
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/PduPart.java b/telephony/common/com/google/android/mms/pdu/PduPart.java
new file mode 100644
index 000000000000..09b775118dc3
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduPart.java
@@ -0,0 +1,439 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.net.Uri;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The pdu part.
+ */
+public class PduPart {
+ /**
+ * Well-Known Parameters.
+ */
+ public static final int P_Q = 0x80;
+ public static final int P_CHARSET = 0x81;
+ public static final int P_LEVEL = 0x82;
+ public static final int P_TYPE = 0x83;
+ public static final int P_DEP_NAME = 0x85;
+ public static final int P_DEP_FILENAME = 0x86;
+ public static final int P_DIFFERENCES = 0x87;
+ public static final int P_PADDING = 0x88;
+ // This value of "TYPE" s used with Content-Type: multipart/related
+ public static final int P_CT_MR_TYPE = 0x89;
+ public static final int P_DEP_START = 0x8A;
+ public static final int P_DEP_START_INFO = 0x8B;
+ public static final int P_DEP_COMMENT = 0x8C;
+ public static final int P_DEP_DOMAIN = 0x8D;
+ public static final int P_MAX_AGE = 0x8E;
+ public static final int P_DEP_PATH = 0x8F;
+ public static final int P_SECURE = 0x90;
+ public static final int P_SEC = 0x91;
+ public static final int P_MAC = 0x92;
+ public static final int P_CREATION_DATE = 0x93;
+ public static final int P_MODIFICATION_DATE = 0x94;
+ public static final int P_READ_DATE = 0x95;
+ public static final int P_SIZE = 0x96;
+ public static final int P_NAME = 0x97;
+ public static final int P_FILENAME = 0x98;
+ public static final int P_START = 0x99;
+ public static final int P_START_INFO = 0x9A;
+ public static final int P_COMMENT = 0x9B;
+ public static final int P_DOMAIN = 0x9C;
+ public static final int P_PATH = 0x9D;
+
+ /**
+ * Header field names.
+ */
+ public static final int P_CONTENT_TYPE = 0x91;
+ public static final int P_CONTENT_LOCATION = 0x8E;
+ public static final int P_CONTENT_ID = 0xC0;
+ public static final int P_DEP_CONTENT_DISPOSITION = 0xAE;
+ public static final int P_CONTENT_DISPOSITION = 0xC5;
+ // The next header is unassigned header, use reserved header(0x48) value.
+ public static final int P_CONTENT_TRANSFER_ENCODING = 0xC8;
+
+ /**
+ * Content=Transfer-Encoding string.
+ */
+ public static final String CONTENT_TRANSFER_ENCODING =
+ "Content-Transfer-Encoding";
+
+ /**
+ * Value of Content-Transfer-Encoding.
+ */
+ public static final String P_BINARY = "binary";
+ public static final String P_7BIT = "7bit";
+ public static final String P_8BIT = "8bit";
+ public static final String P_BASE64 = "base64";
+ public static final String P_QUOTED_PRINTABLE = "quoted-printable";
+
+ /**
+ * Value of disposition can be set to PduPart when the value is octet in
+ * the PDU.
+ * "from-data" instead of Form-data<Octet 128>.
+ * "attachment" instead of Attachment<Octet 129>.
+ * "inline" instead of Inline<Octet 130>.
+ */
+ static final byte[] DISPOSITION_FROM_DATA = "from-data".getBytes();
+ static final byte[] DISPOSITION_ATTACHMENT = "attachment".getBytes();
+ static final byte[] DISPOSITION_INLINE = "inline".getBytes();
+
+ /**
+ * Content-Disposition value.
+ */
+ public static final int P_DISPOSITION_FROM_DATA = 0x80;
+ public static final int P_DISPOSITION_ATTACHMENT = 0x81;
+ public static final int P_DISPOSITION_INLINE = 0x82;
+
+ /**
+ * Header of part.
+ */
+ private Map<Integer, Object> mPartHeader = null;
+
+ /**
+ * Data uri.
+ */
+ private Uri mUri = null;
+
+ /**
+ * Part data.
+ */
+ private byte[] mPartData = null;
+
+ private static final String TAG = "PduPart";
+
+ /**
+ * Empty Constructor.
+ */
+ @UnsupportedAppUsage
+ public PduPart() {
+ mPartHeader = new HashMap<Integer, Object>();
+ }
+
+ /**
+ * Set part data. The data are stored as byte array.
+ *
+ * @param data the data
+ */
+ @UnsupportedAppUsage
+ public void setData(byte[] data) {
+ if(data == null) {
+ return;
+ }
+
+ mPartData = new byte[data.length];
+ System.arraycopy(data, 0, mPartData, 0, data.length);
+ }
+
+ /**
+ * @return A copy of the part data or null if the data wasn't set or
+ * the data is stored as Uri.
+ * @see #getDataUri
+ */
+ @UnsupportedAppUsage
+ public byte[] getData() {
+ if(mPartData == null) {
+ return null;
+ }
+
+ byte[] byteArray = new byte[mPartData.length];
+ System.arraycopy(mPartData, 0, byteArray, 0, mPartData.length);
+ return byteArray;
+ }
+
+ /**
+ * @return The length of the data, if this object have data, else 0.
+ */
+ @UnsupportedAppUsage
+ public int getDataLength() {
+ if(mPartData != null){
+ return mPartData.length;
+ } else {
+ return 0;
+ }
+ }
+
+
+ /**
+ * Set data uri. The data are stored as Uri.
+ *
+ * @param uri the uri
+ */
+ @UnsupportedAppUsage
+ public void setDataUri(Uri uri) {
+ mUri = uri;
+ }
+
+ /**
+ * @return The Uri of the part data or null if the data wasn't set or
+ * the data is stored as byte array.
+ * @see #getData
+ */
+ @UnsupportedAppUsage
+ public Uri getDataUri() {
+ return mUri;
+ }
+
+ /**
+ * Set Content-id value
+ *
+ * @param contentId the content-id value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentId(byte[] contentId) {
+ if((contentId == null) || (contentId.length == 0)) {
+ throw new IllegalArgumentException(
+ "Content-Id may not be null or empty.");
+ }
+
+ if ((contentId.length > 1)
+ && ((char) contentId[0] == '<')
+ && ((char) contentId[contentId.length - 1] == '>')) {
+ mPartHeader.put(P_CONTENT_ID, contentId);
+ return;
+ }
+
+ // Insert beginning '<' and trailing '>' for Content-Id.
+ byte[] buffer = new byte[contentId.length + 2];
+ buffer[0] = (byte) (0xff & '<');
+ buffer[buffer.length - 1] = (byte) (0xff & '>');
+ System.arraycopy(contentId, 0, buffer, 1, contentId.length);
+ mPartHeader.put(P_CONTENT_ID, buffer);
+ }
+
+ /**
+ * Get Content-id value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentId() {
+ return (byte[]) mPartHeader.get(P_CONTENT_ID);
+ }
+
+ /**
+ * Set Char-set value.
+ *
+ * @param charset the value
+ */
+ @UnsupportedAppUsage
+ public void setCharset(int charset) {
+ mPartHeader.put(P_CHARSET, charset);
+ }
+
+ /**
+ * Get Char-set value
+ *
+ * @return the charset value. Return 0 if charset was not set.
+ */
+ @UnsupportedAppUsage
+ public int getCharset() {
+ Integer charset = (Integer) mPartHeader.get(P_CHARSET);
+ if(charset == null) {
+ return 0;
+ } else {
+ return charset.intValue();
+ }
+ }
+
+ /**
+ * Set Content-Location value.
+ *
+ * @param contentLocation the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentLocation(byte[] contentLocation) {
+ if(contentLocation == null) {
+ throw new NullPointerException("null content-location");
+ }
+
+ mPartHeader.put(P_CONTENT_LOCATION, contentLocation);
+ }
+
+ /**
+ * Get Content-Location value.
+ *
+ * @return the value
+ * return PduPart.disposition[0] instead of <Octet 128> (Form-data).
+ * return PduPart.disposition[1] instead of <Octet 129> (Attachment).
+ * return PduPart.disposition[2] instead of <Octet 130> (Inline).
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentLocation() {
+ return (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
+ }
+
+ /**
+ * Set Content-Disposition value.
+ * Use PduPart.disposition[0] instead of <Octet 128> (Form-data).
+ * Use PduPart.disposition[1] instead of <Octet 129> (Attachment).
+ * Use PduPart.disposition[2] instead of <Octet 130> (Inline).
+ *
+ * @param contentDisposition the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentDisposition(byte[] contentDisposition) {
+ if(contentDisposition == null) {
+ throw new NullPointerException("null content-disposition");
+ }
+
+ mPartHeader.put(P_CONTENT_DISPOSITION, contentDisposition);
+ }
+
+ /**
+ * Get Content-Disposition value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentDisposition() {
+ return (byte[]) mPartHeader.get(P_CONTENT_DISPOSITION);
+ }
+
+ /**
+ * Set Content-Type value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentType(byte[] contentType) {
+ if(contentType == null) {
+ throw new NullPointerException("null content-type");
+ }
+
+ mPartHeader.put(P_CONTENT_TYPE, contentType);
+ }
+
+ /**
+ * Get Content-Type value of part.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentType() {
+ return (byte[]) mPartHeader.get(P_CONTENT_TYPE);
+ }
+
+ /**
+ * Set Content-Transfer-Encoding value
+ *
+ * @param contentId the content-id value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentTransferEncoding(byte[] contentTransferEncoding) {
+ if(contentTransferEncoding == null) {
+ throw new NullPointerException("null content-transfer-encoding");
+ }
+
+ mPartHeader.put(P_CONTENT_TRANSFER_ENCODING, contentTransferEncoding);
+ }
+
+ /**
+ * Get Content-Transfer-Encoding value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentTransferEncoding() {
+ return (byte[]) mPartHeader.get(P_CONTENT_TRANSFER_ENCODING);
+ }
+
+ /**
+ * Set Content-type parameter: name.
+ *
+ * @param name the name value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setName(byte[] name) {
+ if(null == name) {
+ throw new NullPointerException("null content-id");
+ }
+
+ mPartHeader.put(P_NAME, name);
+ }
+
+ /**
+ * Get content-type parameter: name.
+ *
+ * @return the name
+ */
+ @UnsupportedAppUsage
+ public byte[] getName() {
+ return (byte[]) mPartHeader.get(P_NAME);
+ }
+
+ /**
+ * Get Content-disposition parameter: filename
+ *
+ * @param fileName the filename value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setFilename(byte[] fileName) {
+ if(null == fileName) {
+ throw new NullPointerException("null content-id");
+ }
+
+ mPartHeader.put(P_FILENAME, fileName);
+ }
+
+ /**
+ * Set Content-disposition parameter: filename
+ *
+ * @return the filename
+ */
+ @UnsupportedAppUsage
+ public byte[] getFilename() {
+ return (byte[]) mPartHeader.get(P_FILENAME);
+ }
+
+ @UnsupportedAppUsage
+ public String generateLocation() {
+ // Assumption: At least one of the content-location / name / filename
+ // or content-id should be set. This is guaranteed by the PduParser
+ // for incoming messages and by MM composer for outgoing messages.
+ byte[] location = (byte[]) mPartHeader.get(P_NAME);
+ if(null == location) {
+ location = (byte[]) mPartHeader.get(P_FILENAME);
+
+ if (null == location) {
+ location = (byte[]) mPartHeader.get(P_CONTENT_LOCATION);
+ }
+ }
+
+ if (null == location) {
+ byte[] contentId = (byte[]) mPartHeader.get(P_CONTENT_ID);
+ return "cid:" + new String(contentId);
+ } else {
+ return new String(location);
+ }
+ }
+}
+
diff --git a/telephony/common/com/google/android/mms/pdu/PduPersister.java b/telephony/common/com/google/android/mms/pdu/PduPersister.java
new file mode 100755
index 000000000000..95ae4096ed86
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/PduPersister.java
@@ -0,0 +1,1574 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.DatabaseUtils;
+import android.drm.DrmManagerClient;
+import android.net.Uri;
+import android.os.ParcelFileDescriptor;
+import android.provider.Telephony;
+import android.provider.Telephony.Mms;
+import android.provider.Telephony.Mms.Addr;
+import android.provider.Telephony.Mms.Part;
+import android.provider.Telephony.MmsSms;
+import android.provider.Telephony.MmsSms.PendingMessages;
+import android.provider.Telephony.Threads;
+import android.telephony.PhoneNumberUtils;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.ContentType;
+import com.google.android.mms.InvalidHeaderValueException;
+import com.google.android.mms.MmsException;
+import com.google.android.mms.util.DownloadDrmHelper;
+import com.google.android.mms.util.DrmConvertSession;
+import com.google.android.mms.util.PduCache;
+import com.google.android.mms.util.PduCacheEntry;
+import com.google.android.mms.util.SqliteWrapper;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * This class is the high-level manager of PDU storage.
+ */
+public class PduPersister {
+ private static final String TAG = "PduPersister";
+ private static final boolean DEBUG = false;
+ private static final boolean LOCAL_LOGV = false;
+
+ private static final long DUMMY_THREAD_ID = Long.MAX_VALUE;
+
+ /**
+ * The uri of temporary drm objects.
+ */
+ public static final String TEMPORARY_DRM_OBJECT_URI =
+ "content://mms/" + Long.MAX_VALUE + "/part";
+ /**
+ * Indicate that we transiently failed to process a MM.
+ */
+ public static final int PROC_STATUS_TRANSIENT_FAILURE = 1;
+ /**
+ * Indicate that we permanently failed to process a MM.
+ */
+ public static final int PROC_STATUS_PERMANENTLY_FAILURE = 2;
+ /**
+ * Indicate that we have successfully processed a MM.
+ */
+ public static final int PROC_STATUS_COMPLETED = 3;
+
+ private static PduPersister sPersister;
+ @UnsupportedAppUsage
+ private static final PduCache PDU_CACHE_INSTANCE;
+
+ @UnsupportedAppUsage
+ private static final int[] ADDRESS_FIELDS = new int[] {
+ PduHeaders.BCC,
+ PduHeaders.CC,
+ PduHeaders.FROM,
+ PduHeaders.TO
+ };
+
+ private static final String[] PDU_PROJECTION = new String[] {
+ Mms._ID,
+ Mms.MESSAGE_BOX,
+ Mms.THREAD_ID,
+ Mms.RETRIEVE_TEXT,
+ Mms.SUBJECT,
+ Mms.CONTENT_LOCATION,
+ Mms.CONTENT_TYPE,
+ Mms.MESSAGE_CLASS,
+ Mms.MESSAGE_ID,
+ Mms.RESPONSE_TEXT,
+ Mms.TRANSACTION_ID,
+ Mms.CONTENT_CLASS,
+ Mms.DELIVERY_REPORT,
+ Mms.MESSAGE_TYPE,
+ Mms.MMS_VERSION,
+ Mms.PRIORITY,
+ Mms.READ_REPORT,
+ Mms.READ_STATUS,
+ Mms.REPORT_ALLOWED,
+ Mms.RETRIEVE_STATUS,
+ Mms.STATUS,
+ Mms.DATE,
+ Mms.DELIVERY_TIME,
+ Mms.EXPIRY,
+ Mms.MESSAGE_SIZE,
+ Mms.SUBJECT_CHARSET,
+ Mms.RETRIEVE_TEXT_CHARSET,
+ };
+
+ private static final int PDU_COLUMN_ID = 0;
+ private static final int PDU_COLUMN_MESSAGE_BOX = 1;
+ private static final int PDU_COLUMN_THREAD_ID = 2;
+ private static final int PDU_COLUMN_RETRIEVE_TEXT = 3;
+ private static final int PDU_COLUMN_SUBJECT = 4;
+ private static final int PDU_COLUMN_CONTENT_LOCATION = 5;
+ private static final int PDU_COLUMN_CONTENT_TYPE = 6;
+ private static final int PDU_COLUMN_MESSAGE_CLASS = 7;
+ private static final int PDU_COLUMN_MESSAGE_ID = 8;
+ private static final int PDU_COLUMN_RESPONSE_TEXT = 9;
+ private static final int PDU_COLUMN_TRANSACTION_ID = 10;
+ private static final int PDU_COLUMN_CONTENT_CLASS = 11;
+ private static final int PDU_COLUMN_DELIVERY_REPORT = 12;
+ private static final int PDU_COLUMN_MESSAGE_TYPE = 13;
+ private static final int PDU_COLUMN_MMS_VERSION = 14;
+ private static final int PDU_COLUMN_PRIORITY = 15;
+ private static final int PDU_COLUMN_READ_REPORT = 16;
+ private static final int PDU_COLUMN_READ_STATUS = 17;
+ private static final int PDU_COLUMN_REPORT_ALLOWED = 18;
+ private static final int PDU_COLUMN_RETRIEVE_STATUS = 19;
+ private static final int PDU_COLUMN_STATUS = 20;
+ private static final int PDU_COLUMN_DATE = 21;
+ private static final int PDU_COLUMN_DELIVERY_TIME = 22;
+ private static final int PDU_COLUMN_EXPIRY = 23;
+ private static final int PDU_COLUMN_MESSAGE_SIZE = 24;
+ private static final int PDU_COLUMN_SUBJECT_CHARSET = 25;
+ private static final int PDU_COLUMN_RETRIEVE_TEXT_CHARSET = 26;
+
+ @UnsupportedAppUsage
+ private static final String[] PART_PROJECTION = new String[] {
+ Part._ID,
+ Part.CHARSET,
+ Part.CONTENT_DISPOSITION,
+ Part.CONTENT_ID,
+ Part.CONTENT_LOCATION,
+ Part.CONTENT_TYPE,
+ Part.FILENAME,
+ Part.NAME,
+ Part.TEXT
+ };
+
+ private static final int PART_COLUMN_ID = 0;
+ private static final int PART_COLUMN_CHARSET = 1;
+ private static final int PART_COLUMN_CONTENT_DISPOSITION = 2;
+ private static final int PART_COLUMN_CONTENT_ID = 3;
+ private static final int PART_COLUMN_CONTENT_LOCATION = 4;
+ private static final int PART_COLUMN_CONTENT_TYPE = 5;
+ private static final int PART_COLUMN_FILENAME = 6;
+ private static final int PART_COLUMN_NAME = 7;
+ private static final int PART_COLUMN_TEXT = 8;
+
+ @UnsupportedAppUsage
+ private static final HashMap<Uri, Integer> MESSAGE_BOX_MAP;
+ // These map are used for convenience in persist() and load().
+ private static final HashMap<Integer, Integer> CHARSET_COLUMN_INDEX_MAP;
+ private static final HashMap<Integer, Integer> ENCODED_STRING_COLUMN_INDEX_MAP;
+ private static final HashMap<Integer, Integer> TEXT_STRING_COLUMN_INDEX_MAP;
+ private static final HashMap<Integer, Integer> OCTET_COLUMN_INDEX_MAP;
+ private static final HashMap<Integer, Integer> LONG_COLUMN_INDEX_MAP;
+ @UnsupportedAppUsage
+ private static final HashMap<Integer, String> CHARSET_COLUMN_NAME_MAP;
+ @UnsupportedAppUsage
+ private static final HashMap<Integer, String> ENCODED_STRING_COLUMN_NAME_MAP;
+ @UnsupportedAppUsage
+ private static final HashMap<Integer, String> TEXT_STRING_COLUMN_NAME_MAP;
+ @UnsupportedAppUsage
+ private static final HashMap<Integer, String> OCTET_COLUMN_NAME_MAP;
+ @UnsupportedAppUsage
+ private static final HashMap<Integer, String> LONG_COLUMN_NAME_MAP;
+
+ static {
+ MESSAGE_BOX_MAP = new HashMap<Uri, Integer>();
+ MESSAGE_BOX_MAP.put(Mms.Inbox.CONTENT_URI, Mms.MESSAGE_BOX_INBOX);
+ MESSAGE_BOX_MAP.put(Mms.Sent.CONTENT_URI, Mms.MESSAGE_BOX_SENT);
+ MESSAGE_BOX_MAP.put(Mms.Draft.CONTENT_URI, Mms.MESSAGE_BOX_DRAFTS);
+ MESSAGE_BOX_MAP.put(Mms.Outbox.CONTENT_URI, Mms.MESSAGE_BOX_OUTBOX);
+
+ CHARSET_COLUMN_INDEX_MAP = new HashMap<Integer, Integer>();
+ CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT_CHARSET);
+ CHARSET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT_CHARSET);
+
+ CHARSET_COLUMN_NAME_MAP = new HashMap<Integer, String>();
+ CHARSET_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT_CHARSET);
+ CHARSET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT_CHARSET);
+
+ // Encoded string field code -> column index/name map.
+ ENCODED_STRING_COLUMN_INDEX_MAP = new HashMap<Integer, Integer>();
+ ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_TEXT, PDU_COLUMN_RETRIEVE_TEXT);
+ ENCODED_STRING_COLUMN_INDEX_MAP.put(PduHeaders.SUBJECT, PDU_COLUMN_SUBJECT);
+
+ ENCODED_STRING_COLUMN_NAME_MAP = new HashMap<Integer, String>();
+ ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_TEXT, Mms.RETRIEVE_TEXT);
+ ENCODED_STRING_COLUMN_NAME_MAP.put(PduHeaders.SUBJECT, Mms.SUBJECT);
+
+ // Text string field code -> column index/name map.
+ TEXT_STRING_COLUMN_INDEX_MAP = new HashMap<Integer, Integer>();
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_LOCATION, PDU_COLUMN_CONTENT_LOCATION);
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_TYPE, PDU_COLUMN_CONTENT_TYPE);
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_CLASS, PDU_COLUMN_MESSAGE_CLASS);
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_ID, PDU_COLUMN_MESSAGE_ID);
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.RESPONSE_TEXT, PDU_COLUMN_RESPONSE_TEXT);
+ TEXT_STRING_COLUMN_INDEX_MAP.put(PduHeaders.TRANSACTION_ID, PDU_COLUMN_TRANSACTION_ID);
+
+ TEXT_STRING_COLUMN_NAME_MAP = new HashMap<Integer, String>();
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_LOCATION, Mms.CONTENT_LOCATION);
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_TYPE, Mms.CONTENT_TYPE);
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_CLASS, Mms.MESSAGE_CLASS);
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_ID, Mms.MESSAGE_ID);
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.RESPONSE_TEXT, Mms.RESPONSE_TEXT);
+ TEXT_STRING_COLUMN_NAME_MAP.put(PduHeaders.TRANSACTION_ID, Mms.TRANSACTION_ID);
+
+ // Octet field code -> column index/name map.
+ OCTET_COLUMN_INDEX_MAP = new HashMap<Integer, Integer>();
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.CONTENT_CLASS, PDU_COLUMN_CONTENT_CLASS);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.DELIVERY_REPORT, PDU_COLUMN_DELIVERY_REPORT);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_TYPE, PDU_COLUMN_MESSAGE_TYPE);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.MMS_VERSION, PDU_COLUMN_MMS_VERSION);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.PRIORITY, PDU_COLUMN_PRIORITY);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.READ_REPORT, PDU_COLUMN_READ_REPORT);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.READ_STATUS, PDU_COLUMN_READ_STATUS);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.REPORT_ALLOWED, PDU_COLUMN_REPORT_ALLOWED);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.RETRIEVE_STATUS, PDU_COLUMN_RETRIEVE_STATUS);
+ OCTET_COLUMN_INDEX_MAP.put(PduHeaders.STATUS, PDU_COLUMN_STATUS);
+
+ OCTET_COLUMN_NAME_MAP = new HashMap<Integer, String>();
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.CONTENT_CLASS, Mms.CONTENT_CLASS);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_REPORT, Mms.DELIVERY_REPORT);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_TYPE, Mms.MESSAGE_TYPE);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.MMS_VERSION, Mms.MMS_VERSION);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.PRIORITY, Mms.PRIORITY);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.READ_REPORT, Mms.READ_REPORT);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.READ_STATUS, Mms.READ_STATUS);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.REPORT_ALLOWED, Mms.REPORT_ALLOWED);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.RETRIEVE_STATUS, Mms.RETRIEVE_STATUS);
+ OCTET_COLUMN_NAME_MAP.put(PduHeaders.STATUS, Mms.STATUS);
+
+ // Long field code -> column index/name map.
+ LONG_COLUMN_INDEX_MAP = new HashMap<Integer, Integer>();
+ LONG_COLUMN_INDEX_MAP.put(PduHeaders.DATE, PDU_COLUMN_DATE);
+ LONG_COLUMN_INDEX_MAP.put(PduHeaders.DELIVERY_TIME, PDU_COLUMN_DELIVERY_TIME);
+ LONG_COLUMN_INDEX_MAP.put(PduHeaders.EXPIRY, PDU_COLUMN_EXPIRY);
+ LONG_COLUMN_INDEX_MAP.put(PduHeaders.MESSAGE_SIZE, PDU_COLUMN_MESSAGE_SIZE);
+
+ LONG_COLUMN_NAME_MAP = new HashMap<Integer, String>();
+ LONG_COLUMN_NAME_MAP.put(PduHeaders.DATE, Mms.DATE);
+ LONG_COLUMN_NAME_MAP.put(PduHeaders.DELIVERY_TIME, Mms.DELIVERY_TIME);
+ LONG_COLUMN_NAME_MAP.put(PduHeaders.EXPIRY, Mms.EXPIRY);
+ LONG_COLUMN_NAME_MAP.put(PduHeaders.MESSAGE_SIZE, Mms.MESSAGE_SIZE);
+
+ PDU_CACHE_INSTANCE = PduCache.getInstance();
+ }
+
+ @UnsupportedAppUsage
+ private final Context mContext;
+ @UnsupportedAppUsage
+ private final ContentResolver mContentResolver;
+ private final DrmManagerClient mDrmManagerClient;
+ @UnsupportedAppUsage
+ private final TelephonyManager mTelephonyManager;
+
+ private PduPersister(Context context) {
+ mContext = context;
+ mContentResolver = context.getContentResolver();
+ mDrmManagerClient = new DrmManagerClient(context);
+ mTelephonyManager = (TelephonyManager)context
+ .getSystemService(Context.TELEPHONY_SERVICE);
+ }
+
+ /** Get(or create if not exist) an instance of PduPersister */
+ @UnsupportedAppUsage
+ public static PduPersister getPduPersister(Context context) {
+ if ((sPersister == null)) {
+ sPersister = new PduPersister(context);
+ } else if (!context.equals(sPersister.mContext)) {
+ sPersister.release();
+ sPersister = new PduPersister(context);
+ }
+
+ return sPersister;
+ }
+
+ private void setEncodedStringValueToHeaders(
+ Cursor c, int columnIndex,
+ PduHeaders headers, int mapColumn) {
+ String s = c.getString(columnIndex);
+ if ((s != null) && (s.length() > 0)) {
+ int charsetColumnIndex = CHARSET_COLUMN_INDEX_MAP.get(mapColumn);
+ int charset = c.getInt(charsetColumnIndex);
+ EncodedStringValue value = new EncodedStringValue(
+ charset, getBytes(s));
+ headers.setEncodedStringValue(value, mapColumn);
+ }
+ }
+
+ private void setTextStringToHeaders(
+ Cursor c, int columnIndex,
+ PduHeaders headers, int mapColumn) {
+ String s = c.getString(columnIndex);
+ if (s != null) {
+ headers.setTextString(getBytes(s), mapColumn);
+ }
+ }
+
+ private void setOctetToHeaders(
+ Cursor c, int columnIndex,
+ PduHeaders headers, int mapColumn) throws InvalidHeaderValueException {
+ if (!c.isNull(columnIndex)) {
+ int b = c.getInt(columnIndex);
+ headers.setOctet(b, mapColumn);
+ }
+ }
+
+ private void setLongToHeaders(
+ Cursor c, int columnIndex,
+ PduHeaders headers, int mapColumn) {
+ if (!c.isNull(columnIndex)) {
+ long l = c.getLong(columnIndex);
+ headers.setLongInteger(l, mapColumn);
+ }
+ }
+
+ @UnsupportedAppUsage
+ private Integer getIntegerFromPartColumn(Cursor c, int columnIndex) {
+ if (!c.isNull(columnIndex)) {
+ return c.getInt(columnIndex);
+ }
+ return null;
+ }
+
+ @UnsupportedAppUsage
+ private byte[] getByteArrayFromPartColumn(Cursor c, int columnIndex) {
+ if (!c.isNull(columnIndex)) {
+ return getBytes(c.getString(columnIndex));
+ }
+ return null;
+ }
+
+ private PduPart[] loadParts(long msgId) throws MmsException {
+ Cursor c = SqliteWrapper.query(mContext, mContentResolver,
+ Uri.parse("content://mms/" + msgId + "/part"),
+ PART_PROJECTION, null, null, null);
+
+ PduPart[] parts = null;
+
+ try {
+ if ((c == null) || (c.getCount() == 0)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "loadParts(" + msgId + "): no part to load.");
+ }
+ return null;
+ }
+
+ int partCount = c.getCount();
+ int partIdx = 0;
+ parts = new PduPart[partCount];
+ while (c.moveToNext()) {
+ PduPart part = new PduPart();
+ Integer charset = getIntegerFromPartColumn(
+ c, PART_COLUMN_CHARSET);
+ if (charset != null) {
+ part.setCharset(charset);
+ }
+
+ byte[] contentDisposition = getByteArrayFromPartColumn(
+ c, PART_COLUMN_CONTENT_DISPOSITION);
+ if (contentDisposition != null) {
+ part.setContentDisposition(contentDisposition);
+ }
+
+ byte[] contentId = getByteArrayFromPartColumn(
+ c, PART_COLUMN_CONTENT_ID);
+ if (contentId != null) {
+ part.setContentId(contentId);
+ }
+
+ byte[] contentLocation = getByteArrayFromPartColumn(
+ c, PART_COLUMN_CONTENT_LOCATION);
+ if (contentLocation != null) {
+ part.setContentLocation(contentLocation);
+ }
+
+ byte[] contentType = getByteArrayFromPartColumn(
+ c, PART_COLUMN_CONTENT_TYPE);
+ if (contentType != null) {
+ part.setContentType(contentType);
+ } else {
+ throw new MmsException("Content-Type must be set.");
+ }
+
+ byte[] fileName = getByteArrayFromPartColumn(
+ c, PART_COLUMN_FILENAME);
+ if (fileName != null) {
+ part.setFilename(fileName);
+ }
+
+ byte[] name = getByteArrayFromPartColumn(
+ c, PART_COLUMN_NAME);
+ if (name != null) {
+ part.setName(name);
+ }
+
+ // Construct a Uri for this part.
+ long partId = c.getLong(PART_COLUMN_ID);
+ Uri partURI = Uri.parse("content://mms/part/" + partId);
+ part.setDataUri(partURI);
+
+ // For images/audio/video, we won't keep their data in Part
+ // because their renderer accept Uri as source.
+ String type = toIsoString(contentType);
+ if (!ContentType.isImageType(type)
+ && !ContentType.isAudioType(type)
+ && !ContentType.isVideoType(type)) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ InputStream is = null;
+
+ // Store simple string values directly in the database instead of an
+ // external file. This makes the text searchable and retrieval slightly
+ // faster.
+ if (ContentType.TEXT_PLAIN.equals(type) || ContentType.APP_SMIL.equals(type)
+ || ContentType.TEXT_HTML.equals(type)) {
+ String text = c.getString(PART_COLUMN_TEXT);
+ byte [] blob = new EncodedStringValue(text != null ? text : "")
+ .getTextString();
+ baos.write(blob, 0, blob.length);
+ } else {
+
+ try {
+ is = mContentResolver.openInputStream(partURI);
+
+ byte[] buffer = new byte[256];
+ int len = is.read(buffer);
+ while (len >= 0) {
+ baos.write(buffer, 0, len);
+ len = is.read(buffer);
+ }
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to load part data", e);
+ c.close();
+ throw new MmsException(e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to close stream", e);
+ } // Ignore
+ }
+ }
+ }
+ part.setData(baos.toByteArray());
+ }
+ parts[partIdx++] = part;
+ }
+ } finally {
+ if (c != null) {
+ c.close();
+ }
+ }
+
+ return parts;
+ }
+
+ private void loadAddress(long msgId, PduHeaders headers) {
+ Cursor c = SqliteWrapper.query(mContext, mContentResolver,
+ Uri.parse("content://mms/" + msgId + "/addr"),
+ new String[] { Addr.ADDRESS, Addr.CHARSET, Addr.TYPE },
+ null, null, null);
+
+ if (c != null) {
+ try {
+ while (c.moveToNext()) {
+ String addr = c.getString(0);
+ if (!TextUtils.isEmpty(addr)) {
+ int addrType = c.getInt(2);
+ switch (addrType) {
+ case PduHeaders.FROM:
+ headers.setEncodedStringValue(
+ new EncodedStringValue(c.getInt(1), getBytes(addr)),
+ addrType);
+ break;
+ case PduHeaders.TO:
+ case PduHeaders.CC:
+ case PduHeaders.BCC:
+ headers.appendEncodedStringValue(
+ new EncodedStringValue(c.getInt(1), getBytes(addr)),
+ addrType);
+ break;
+ default:
+ Log.e(TAG, "Unknown address type: " + addrType);
+ break;
+ }
+ }
+ }
+ } finally {
+ c.close();
+ }
+ }
+ }
+
+ /**
+ * Load a PDU from storage by given Uri.
+ *
+ * @param uri The Uri of the PDU to be loaded.
+ * @return A generic PDU object, it may be cast to dedicated PDU.
+ * @throws MmsException Failed to load some fields of a PDU.
+ */
+ @UnsupportedAppUsage
+ public GenericPdu load(Uri uri) throws MmsException {
+ GenericPdu pdu = null;
+ PduCacheEntry cacheEntry = null;
+ int msgBox = 0;
+ long threadId = -1;
+ try {
+ synchronized(PDU_CACHE_INSTANCE) {
+ if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "load: " + uri + " blocked by isUpdating()");
+ }
+ try {
+ PDU_CACHE_INSTANCE.wait();
+ } catch (InterruptedException e) {
+ Log.e(TAG, "load: ", e);
+ }
+ cacheEntry = PDU_CACHE_INSTANCE.get(uri);
+ if (cacheEntry != null) {
+ return cacheEntry.getPdu();
+ }
+ }
+ // Tell the cache to indicate to other callers that this item
+ // is currently being updated.
+ PDU_CACHE_INSTANCE.setUpdating(uri, true);
+ }
+
+ Cursor c = SqliteWrapper.query(mContext, mContentResolver, uri,
+ PDU_PROJECTION, null, null, null);
+ PduHeaders headers = new PduHeaders();
+ Set<Entry<Integer, Integer>> set;
+ long msgId = ContentUris.parseId(uri);
+
+ try {
+ if ((c == null) || (c.getCount() != 1) || !c.moveToFirst()) {
+ throw new MmsException("Bad uri: " + uri);
+ }
+
+ msgBox = c.getInt(PDU_COLUMN_MESSAGE_BOX);
+ threadId = c.getLong(PDU_COLUMN_THREAD_ID);
+
+ set = ENCODED_STRING_COLUMN_INDEX_MAP.entrySet();
+ for (Entry<Integer, Integer> e : set) {
+ setEncodedStringValueToHeaders(
+ c, e.getValue(), headers, e.getKey());
+ }
+
+ set = TEXT_STRING_COLUMN_INDEX_MAP.entrySet();
+ for (Entry<Integer, Integer> e : set) {
+ setTextStringToHeaders(
+ c, e.getValue(), headers, e.getKey());
+ }
+
+ set = OCTET_COLUMN_INDEX_MAP.entrySet();
+ for (Entry<Integer, Integer> e : set) {
+ setOctetToHeaders(
+ c, e.getValue(), headers, e.getKey());
+ }
+
+ set = LONG_COLUMN_INDEX_MAP.entrySet();
+ for (Entry<Integer, Integer> e : set) {
+ setLongToHeaders(
+ c, e.getValue(), headers, e.getKey());
+ }
+ } finally {
+ if (c != null) {
+ c.close();
+ }
+ }
+
+ // Check whether 'msgId' has been assigned a valid value.
+ if (msgId == -1L) {
+ throw new MmsException("Error! ID of the message: -1.");
+ }
+
+ // Load address information of the MM.
+ loadAddress(msgId, headers);
+
+ int msgType = headers.getOctet(PduHeaders.MESSAGE_TYPE);
+ PduBody body = new PduBody();
+
+ // For PDU which type is M_retrieve.conf or Send.req, we should
+ // load multiparts and put them into the body of the PDU.
+ if ((msgType == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF)
+ || (msgType == PduHeaders.MESSAGE_TYPE_SEND_REQ)) {
+ PduPart[] parts = loadParts(msgId);
+ if (parts != null) {
+ int partsNum = parts.length;
+ for (int i = 0; i < partsNum; i++) {
+ body.addPart(parts[i]);
+ }
+ }
+ }
+
+ switch (msgType) {
+ case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND:
+ pdu = new NotificationInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_DELIVERY_IND:
+ pdu = new DeliveryInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_READ_ORIG_IND:
+ pdu = new ReadOrigInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
+ pdu = new RetrieveConf(headers, body);
+ break;
+ case PduHeaders.MESSAGE_TYPE_SEND_REQ:
+ pdu = new SendReq(headers, body);
+ break;
+ case PduHeaders.MESSAGE_TYPE_ACKNOWLEDGE_IND:
+ pdu = new AcknowledgeInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_NOTIFYRESP_IND:
+ pdu = new NotifyRespInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_READ_REC_IND:
+ pdu = new ReadRecInd(headers);
+ break;
+ case PduHeaders.MESSAGE_TYPE_SEND_CONF:
+ case PduHeaders.MESSAGE_TYPE_FORWARD_REQ:
+ case PduHeaders.MESSAGE_TYPE_FORWARD_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_STORE_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_STORE_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_VIEW_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_UPLOAD_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_REQ:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DELETE_CONF:
+ case PduHeaders.MESSAGE_TYPE_MBOX_DESCR:
+ case PduHeaders.MESSAGE_TYPE_DELETE_REQ:
+ case PduHeaders.MESSAGE_TYPE_DELETE_CONF:
+ case PduHeaders.MESSAGE_TYPE_CANCEL_REQ:
+ case PduHeaders.MESSAGE_TYPE_CANCEL_CONF:
+ throw new MmsException(
+ "Unsupported PDU type: " + Integer.toHexString(msgType));
+
+ default:
+ throw new MmsException(
+ "Unrecognized PDU type: " + Integer.toHexString(msgType));
+ }
+ } finally {
+ synchronized(PDU_CACHE_INSTANCE) {
+ if (pdu != null) {
+ assert(PDU_CACHE_INSTANCE.get(uri) == null);
+ // Update the cache entry with the real info
+ cacheEntry = new PduCacheEntry(pdu, msgBox, threadId);
+ PDU_CACHE_INSTANCE.put(uri, cacheEntry);
+ }
+ PDU_CACHE_INSTANCE.setUpdating(uri, false);
+ PDU_CACHE_INSTANCE.notifyAll(); // tell anybody waiting on this entry to go ahead
+ }
+ }
+ return pdu;
+ }
+
+ @UnsupportedAppUsage
+ private void persistAddress(
+ long msgId, int type, EncodedStringValue[] array) {
+ ContentValues values = new ContentValues(3);
+
+ for (EncodedStringValue addr : array) {
+ values.clear(); // Clear all values first.
+ values.put(Addr.ADDRESS, toIsoString(addr.getTextString()));
+ values.put(Addr.CHARSET, addr.getCharacterSet());
+ values.put(Addr.TYPE, type);
+
+ Uri uri = Uri.parse("content://mms/" + msgId + "/addr");
+ SqliteWrapper.insert(mContext, mContentResolver, uri, values);
+ }
+ }
+
+ @UnsupportedAppUsage
+ private static String getPartContentType(PduPart part) {
+ return part.getContentType() == null ? null : toIsoString(part.getContentType());
+ }
+
+ @UnsupportedAppUsage
+ public Uri persistPart(PduPart part, long msgId, HashMap<Uri, InputStream> preOpenedFiles)
+ throws MmsException {
+ Uri uri = Uri.parse("content://mms/" + msgId + "/part");
+ ContentValues values = new ContentValues(8);
+
+ int charset = part.getCharset();
+ if (charset != 0 ) {
+ values.put(Part.CHARSET, charset);
+ }
+
+ String contentType = getPartContentType(part);
+ if (contentType != null) {
+ // There is no "image/jpg" in Android (and it's an invalid mimetype).
+ // Change it to "image/jpeg"
+ if (ContentType.IMAGE_JPG.equals(contentType)) {
+ contentType = ContentType.IMAGE_JPEG;
+ }
+
+ values.put(Part.CONTENT_TYPE, contentType);
+ // To ensure the SMIL part is always the first part.
+ if (ContentType.APP_SMIL.equals(contentType)) {
+ values.put(Part.SEQ, -1);
+ }
+ } else {
+ throw new MmsException("MIME type of the part must be set.");
+ }
+
+ if (part.getFilename() != null) {
+ String fileName = new String(part.getFilename());
+ values.put(Part.FILENAME, fileName);
+ }
+
+ if (part.getName() != null) {
+ String name = new String(part.getName());
+ values.put(Part.NAME, name);
+ }
+
+ Object value = null;
+ if (part.getContentDisposition() != null) {
+ value = toIsoString(part.getContentDisposition());
+ values.put(Part.CONTENT_DISPOSITION, (String) value);
+ }
+
+ if (part.getContentId() != null) {
+ value = toIsoString(part.getContentId());
+ values.put(Part.CONTENT_ID, (String) value);
+ }
+
+ if (part.getContentLocation() != null) {
+ value = toIsoString(part.getContentLocation());
+ values.put(Part.CONTENT_LOCATION, (String) value);
+ }
+
+ Uri res = SqliteWrapper.insert(mContext, mContentResolver, uri, values);
+ if (res == null) {
+ throw new MmsException("Failed to persist part, return null.");
+ }
+
+ persistData(part, res, contentType, preOpenedFiles);
+ // After successfully store the data, we should update
+ // the dataUri of the part.
+ part.setDataUri(res);
+
+ return res;
+ }
+
+ /**
+ * Save data of the part into storage. The source data may be given
+ * by a byte[] or a Uri. If it's a byte[], directly save it
+ * into storage, otherwise load source data from the dataUri and then
+ * save it. If the data is an image, we may scale down it according
+ * to user preference.
+ *
+ * @param part The PDU part which contains data to be saved.
+ * @param uri The URI of the part.
+ * @param contentType The MIME type of the part.
+ * @param preOpenedFiles if not null, a map of preopened InputStreams for the parts.
+ * @throws MmsException Cannot find source data or error occurred
+ * while saving the data.
+ */
+ private void persistData(PduPart part, Uri uri,
+ String contentType, HashMap<Uri, InputStream> preOpenedFiles)
+ throws MmsException {
+ OutputStream os = null;
+ InputStream is = null;
+ DrmConvertSession drmConvertSession = null;
+ Uri dataUri = null;
+ String path = null;
+
+ try {
+ byte[] data = part.getData();
+ if (ContentType.TEXT_PLAIN.equals(contentType)
+ || ContentType.APP_SMIL.equals(contentType)
+ || ContentType.TEXT_HTML.equals(contentType)) {
+ ContentValues cv = new ContentValues();
+ if (data == null) {
+ data = new String("").getBytes(CharacterSets.DEFAULT_CHARSET_NAME);
+ }
+ cv.put(Telephony.Mms.Part.TEXT, new EncodedStringValue(data).getString());
+ if (mContentResolver.update(uri, cv, null, null) != 1) {
+ throw new MmsException("unable to update " + uri.toString());
+ }
+ } else {
+ boolean isDrm = DownloadDrmHelper.isDrmConvertNeeded(contentType);
+ if (isDrm) {
+ if (uri != null) {
+ try (ParcelFileDescriptor pfd =
+ mContentResolver.openFileDescriptor(uri, "r")) {
+ if (pfd.getStatSize() > 0) {
+ // we're not going to re-persist and re-encrypt an already
+ // converted drm file
+ return;
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Can't get file info for: " + part.getDataUri(), e);
+ }
+ }
+ // We haven't converted the file yet, start the conversion
+ drmConvertSession = DrmConvertSession.open(mContext, contentType);
+ if (drmConvertSession == null) {
+ throw new MmsException("Mimetype " + contentType +
+ " can not be converted.");
+ }
+ }
+ // uri can look like:
+ // content://mms/part/98
+ os = mContentResolver.openOutputStream(uri);
+ if (data == null) {
+ dataUri = part.getDataUri();
+ if ((dataUri == null) || (dataUri.equals(uri))) {
+ Log.w(TAG, "Can't find data for this part.");
+ return;
+ }
+ // dataUri can look like:
+ // content://com.google.android.gallery3d.provider/picasa/item/5720646660183715586
+ if (preOpenedFiles != null && preOpenedFiles.containsKey(dataUri)) {
+ is = preOpenedFiles.get(dataUri);
+ }
+ if (is == null) {
+ is = mContentResolver.openInputStream(dataUri);
+ }
+
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Saving data to: " + uri);
+ }
+
+ byte[] buffer = new byte[8192];
+ for (int len = 0; (len = is.read(buffer)) != -1; ) {
+ if (!isDrm) {
+ os.write(buffer, 0, len);
+ } else {
+ byte[] convertedData = drmConvertSession.convert(buffer, len);
+ if (convertedData != null) {
+ os.write(convertedData, 0, convertedData.length);
+ } else {
+ throw new MmsException("Error converting drm data.");
+ }
+ }
+ }
+ } else {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Saving data to: " + uri);
+ }
+ if (!isDrm) {
+ os.write(data);
+ } else {
+ dataUri = uri;
+ byte[] convertedData = drmConvertSession.convert(data, data.length);
+ if (convertedData != null) {
+ os.write(convertedData, 0, convertedData.length);
+ } else {
+ throw new MmsException("Error converting drm data.");
+ }
+ }
+ }
+ }
+ } catch (FileNotFoundException e) {
+ Log.e(TAG, "Failed to open Input/Output stream.", e);
+ throw new MmsException(e);
+ } catch (IOException e) {
+ Log.e(TAG, "Failed to read/write data.", e);
+ throw new MmsException(e);
+ } finally {
+ if (os != null) {
+ try {
+ os.close();
+ } catch (IOException e) {
+ Log.e(TAG, "IOException while closing: " + os, e);
+ } // Ignore
+ }
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ Log.e(TAG, "IOException while closing: " + is, e);
+ } // Ignore
+ }
+ if (drmConvertSession != null) {
+ drmConvertSession.close(path);
+
+ // Reset the permissions on the encrypted part file so everyone has only read
+ // permission.
+ File f = new File(path);
+ ContentValues values = new ContentValues(0);
+ SqliteWrapper.update(mContext, mContentResolver,
+ Uri.parse("content://mms/resetFilePerm/" + f.getName()),
+ values, null, null);
+ }
+ }
+ }
+
+ @UnsupportedAppUsage
+ private void updateAddress(
+ long msgId, int type, EncodedStringValue[] array) {
+ // Delete old address information and then insert new ones.
+ SqliteWrapper.delete(mContext, mContentResolver,
+ Uri.parse("content://mms/" + msgId + "/addr"),
+ Addr.TYPE + "=" + type, null);
+
+ persistAddress(msgId, type, array);
+ }
+
+ /**
+ * Update headers of a SendReq.
+ *
+ * @param uri The PDU which need to be updated.
+ * @param pdu New headers.
+ * @throws MmsException Bad URI or updating failed.
+ */
+ @UnsupportedAppUsage
+ public void updateHeaders(Uri uri, SendReq sendReq) {
+ synchronized(PDU_CACHE_INSTANCE) {
+ // If the cache item is getting updated, wait until it's done updating before
+ // purging it.
+ if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "updateHeaders: " + uri + " blocked by isUpdating()");
+ }
+ try {
+ PDU_CACHE_INSTANCE.wait();
+ } catch (InterruptedException e) {
+ Log.e(TAG, "updateHeaders: ", e);
+ }
+ }
+ }
+ PDU_CACHE_INSTANCE.purge(uri);
+
+ ContentValues values = new ContentValues(10);
+ byte[] contentType = sendReq.getContentType();
+ if (contentType != null) {
+ values.put(Mms.CONTENT_TYPE, toIsoString(contentType));
+ }
+
+ long date = sendReq.getDate();
+ if (date != -1) {
+ values.put(Mms.DATE, date);
+ }
+
+ int deliveryReport = sendReq.getDeliveryReport();
+ if (deliveryReport != 0) {
+ values.put(Mms.DELIVERY_REPORT, deliveryReport);
+ }
+
+ long expiry = sendReq.getExpiry();
+ if (expiry != -1) {
+ values.put(Mms.EXPIRY, expiry);
+ }
+
+ byte[] msgClass = sendReq.getMessageClass();
+ if (msgClass != null) {
+ values.put(Mms.MESSAGE_CLASS, toIsoString(msgClass));
+ }
+
+ int priority = sendReq.getPriority();
+ if (priority != 0) {
+ values.put(Mms.PRIORITY, priority);
+ }
+
+ int readReport = sendReq.getReadReport();
+ if (readReport != 0) {
+ values.put(Mms.READ_REPORT, readReport);
+ }
+
+ byte[] transId = sendReq.getTransactionId();
+ if (transId != null) {
+ values.put(Mms.TRANSACTION_ID, toIsoString(transId));
+ }
+
+ EncodedStringValue subject = sendReq.getSubject();
+ if (subject != null) {
+ values.put(Mms.SUBJECT, toIsoString(subject.getTextString()));
+ values.put(Mms.SUBJECT_CHARSET, subject.getCharacterSet());
+ } else {
+ values.put(Mms.SUBJECT, "");
+ }
+
+ long messageSize = sendReq.getMessageSize();
+ if (messageSize > 0) {
+ values.put(Mms.MESSAGE_SIZE, messageSize);
+ }
+
+ PduHeaders headers = sendReq.getPduHeaders();
+ HashSet<String> recipients = new HashSet<String>();
+ for (int addrType : ADDRESS_FIELDS) {
+ EncodedStringValue[] array = null;
+ if (addrType == PduHeaders.FROM) {
+ EncodedStringValue v = headers.getEncodedStringValue(addrType);
+ if (v != null) {
+ array = new EncodedStringValue[1];
+ array[0] = v;
+ }
+ } else {
+ array = headers.getEncodedStringValues(addrType);
+ }
+
+ if (array != null) {
+ long msgId = ContentUris.parseId(uri);
+ updateAddress(msgId, addrType, array);
+ if (addrType == PduHeaders.TO) {
+ for (EncodedStringValue v : array) {
+ if (v != null) {
+ recipients.add(v.getString());
+ }
+ }
+ }
+ }
+ }
+ if (!recipients.isEmpty()) {
+ long threadId = Threads.getOrCreateThreadId(mContext, recipients);
+ values.put(Mms.THREAD_ID, threadId);
+ }
+
+ SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null);
+ }
+
+ private void updatePart(Uri uri, PduPart part, HashMap<Uri, InputStream> preOpenedFiles)
+ throws MmsException {
+ ContentValues values = new ContentValues(7);
+
+ int charset = part.getCharset();
+ if (charset != 0 ) {
+ values.put(Part.CHARSET, charset);
+ }
+
+ String contentType = null;
+ if (part.getContentType() != null) {
+ contentType = toIsoString(part.getContentType());
+ values.put(Part.CONTENT_TYPE, contentType);
+ } else {
+ throw new MmsException("MIME type of the part must be set.");
+ }
+
+ if (part.getFilename() != null) {
+ String fileName = new String(part.getFilename());
+ values.put(Part.FILENAME, fileName);
+ }
+
+ if (part.getName() != null) {
+ String name = new String(part.getName());
+ values.put(Part.NAME, name);
+ }
+
+ Object value = null;
+ if (part.getContentDisposition() != null) {
+ value = toIsoString(part.getContentDisposition());
+ values.put(Part.CONTENT_DISPOSITION, (String) value);
+ }
+
+ if (part.getContentId() != null) {
+ value = toIsoString(part.getContentId());
+ values.put(Part.CONTENT_ID, (String) value);
+ }
+
+ if (part.getContentLocation() != null) {
+ value = toIsoString(part.getContentLocation());
+ values.put(Part.CONTENT_LOCATION, (String) value);
+ }
+
+ SqliteWrapper.update(mContext, mContentResolver, uri, values, null, null);
+
+ // Only update the data when:
+ // 1. New binary data supplied or
+ // 2. The Uri of the part is different from the current one.
+ if ((part.getData() != null)
+ || (!uri.equals(part.getDataUri()))) {
+ persistData(part, uri, contentType, preOpenedFiles);
+ }
+ }
+
+ /**
+ * Update all parts of a PDU.
+ *
+ * @param uri The PDU which need to be updated.
+ * @param body New message body of the PDU.
+ * @param preOpenedFiles if not null, a map of preopened InputStreams for the parts.
+ * @throws MmsException Bad URI or updating failed.
+ */
+ @UnsupportedAppUsage
+ public void updateParts(Uri uri, PduBody body, HashMap<Uri, InputStream> preOpenedFiles)
+ throws MmsException {
+ try {
+ PduCacheEntry cacheEntry;
+ synchronized(PDU_CACHE_INSTANCE) {
+ if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "updateParts: " + uri + " blocked by isUpdating()");
+ }
+ try {
+ PDU_CACHE_INSTANCE.wait();
+ } catch (InterruptedException e) {
+ Log.e(TAG, "updateParts: ", e);
+ }
+ cacheEntry = PDU_CACHE_INSTANCE.get(uri);
+ if (cacheEntry != null) {
+ ((MultimediaMessagePdu) cacheEntry.getPdu()).setBody(body);
+ }
+ }
+ // Tell the cache to indicate to other callers that this item
+ // is currently being updated.
+ PDU_CACHE_INSTANCE.setUpdating(uri, true);
+ }
+
+ ArrayList<PduPart> toBeCreated = new ArrayList<PduPart>();
+ HashMap<Uri, PduPart> toBeUpdated = new HashMap<Uri, PduPart>();
+
+ int partsNum = body.getPartsNum();
+ StringBuilder filter = new StringBuilder().append('(');
+ for (int i = 0; i < partsNum; i++) {
+ PduPart part = body.getPart(i);
+ Uri partUri = part.getDataUri();
+ if ((partUri == null) || TextUtils.isEmpty(partUri.getAuthority())
+ || !partUri.getAuthority().startsWith("mms")) {
+ toBeCreated.add(part);
+ } else {
+ toBeUpdated.put(partUri, part);
+
+ // Don't use 'i > 0' to determine whether we should append
+ // 'AND' since 'i = 0' may be skipped in another branch.
+ if (filter.length() > 1) {
+ filter.append(" AND ");
+ }
+
+ filter.append(Part._ID);
+ filter.append("!=");
+ DatabaseUtils.appendEscapedSQLString(filter, partUri.getLastPathSegment());
+ }
+ }
+ filter.append(')');
+
+ long msgId = ContentUris.parseId(uri);
+
+ // Remove the parts which doesn't exist anymore.
+ SqliteWrapper.delete(mContext, mContentResolver,
+ Uri.parse(Mms.CONTENT_URI + "/" + msgId + "/part"),
+ filter.length() > 2 ? filter.toString() : null, null);
+
+ // Create new parts which didn't exist before.
+ for (PduPart part : toBeCreated) {
+ persistPart(part, msgId, preOpenedFiles);
+ }
+
+ // Update the modified parts.
+ for (Map.Entry<Uri, PduPart> e : toBeUpdated.entrySet()) {
+ updatePart(e.getKey(), e.getValue(), preOpenedFiles);
+ }
+ } finally {
+ synchronized(PDU_CACHE_INSTANCE) {
+ PDU_CACHE_INSTANCE.setUpdating(uri, false);
+ PDU_CACHE_INSTANCE.notifyAll();
+ }
+ }
+ }
+
+ /**
+ * Persist a PDU object to specific location in the storage.
+ *
+ * @param pdu The PDU object to be stored.
+ * @param uri Where to store the given PDU object.
+ * @param createThreadId if true, this function may create a thread id for the recipients
+ * @param groupMmsEnabled if true, all of the recipients addressed in the PDU will be used
+ * to create the associated thread. When false, only the sender will be used in finding or
+ * creating the appropriate thread or conversation.
+ * @param preOpenedFiles if not null, a map of preopened InputStreams for the parts.
+ * @return A Uri which can be used to access the stored PDU.
+ */
+
+ @UnsupportedAppUsage
+ public Uri persist(GenericPdu pdu, Uri uri, boolean createThreadId, boolean groupMmsEnabled,
+ HashMap<Uri, InputStream> preOpenedFiles)
+ throws MmsException {
+ if (uri == null) {
+ throw new MmsException("Uri may not be null.");
+ }
+ long msgId = -1;
+ try {
+ msgId = ContentUris.parseId(uri);
+ } catch (NumberFormatException e) {
+ // the uri ends with "inbox" or something else like that
+ }
+ boolean existingUri = msgId != -1;
+
+ if (!existingUri && MESSAGE_BOX_MAP.get(uri) == null) {
+ throw new MmsException(
+ "Bad destination, must be one of "
+ + "content://mms/inbox, content://mms/sent, "
+ + "content://mms/drafts, content://mms/outbox, "
+ + "content://mms/temp.");
+ }
+ synchronized(PDU_CACHE_INSTANCE) {
+ // If the cache item is getting updated, wait until it's done updating before
+ // purging it.
+ if (PDU_CACHE_INSTANCE.isUpdating(uri)) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "persist: " + uri + " blocked by isUpdating()");
+ }
+ try {
+ PDU_CACHE_INSTANCE.wait();
+ } catch (InterruptedException e) {
+ Log.e(TAG, "persist1: ", e);
+ }
+ }
+ }
+ PDU_CACHE_INSTANCE.purge(uri);
+
+ PduHeaders header = pdu.getPduHeaders();
+ PduBody body = null;
+ ContentValues values = new ContentValues();
+ Set<Entry<Integer, String>> set;
+
+ set = ENCODED_STRING_COLUMN_NAME_MAP.entrySet();
+ for (Entry<Integer, String> e : set) {
+ int field = e.getKey();
+ EncodedStringValue encodedString = header.getEncodedStringValue(field);
+ if (encodedString != null) {
+ String charsetColumn = CHARSET_COLUMN_NAME_MAP.get(field);
+ values.put(e.getValue(), toIsoString(encodedString.getTextString()));
+ values.put(charsetColumn, encodedString.getCharacterSet());
+ }
+ }
+
+ set = TEXT_STRING_COLUMN_NAME_MAP.entrySet();
+ for (Entry<Integer, String> e : set){
+ byte[] text = header.getTextString(e.getKey());
+ if (text != null) {
+ values.put(e.getValue(), toIsoString(text));
+ }
+ }
+
+ set = OCTET_COLUMN_NAME_MAP.entrySet();
+ for (Entry<Integer, String> e : set){
+ int b = header.getOctet(e.getKey());
+ if (b != 0) {
+ values.put(e.getValue(), b);
+ }
+ }
+
+ set = LONG_COLUMN_NAME_MAP.entrySet();
+ for (Entry<Integer, String> e : set){
+ long l = header.getLongInteger(e.getKey());
+ if (l != -1L) {
+ values.put(e.getValue(), l);
+ }
+ }
+
+ HashMap<Integer, EncodedStringValue[]> addressMap =
+ new HashMap<Integer, EncodedStringValue[]>(ADDRESS_FIELDS.length);
+ // Save address information.
+ for (int addrType : ADDRESS_FIELDS) {
+ EncodedStringValue[] array = null;
+ if (addrType == PduHeaders.FROM) {
+ EncodedStringValue v = header.getEncodedStringValue(addrType);
+ if (v != null) {
+ array = new EncodedStringValue[1];
+ array[0] = v;
+ }
+ } else {
+ array = header.getEncodedStringValues(addrType);
+ }
+ addressMap.put(addrType, array);
+ }
+
+ HashSet<String> recipients = new HashSet<String>();
+ int msgType = pdu.getMessageType();
+ // Here we only allocate thread ID for M-Notification.ind,
+ // M-Retrieve.conf and M-Send.req.
+ // Some of other PDU types may be allocated a thread ID outside
+ // this scope.
+ if ((msgType == PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND)
+ || (msgType == PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF)
+ || (msgType == PduHeaders.MESSAGE_TYPE_SEND_REQ)) {
+ switch (msgType) {
+ case PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND:
+ case PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF:
+ loadRecipients(PduHeaders.FROM, recipients, addressMap, false);
+
+ // For received messages when group MMS is enabled, we want to associate this
+ // message with the thread composed of all the recipients -- all but our own
+ // number, that is. This includes the person who sent the
+ // message or the FROM field (above) in addition to the other people the message
+ // was addressed to or the TO field. Our own number is in that TO field and
+ // we have to ignore it in loadRecipients.
+ if (groupMmsEnabled) {
+ loadRecipients(PduHeaders.TO, recipients, addressMap, true);
+
+ // Also load any numbers in the CC field to address group messaging
+ // compatibility issues with devices that place numbers in this field
+ // for group messages.
+ loadRecipients(PduHeaders.CC, recipients, addressMap, true);
+ }
+ break;
+ case PduHeaders.MESSAGE_TYPE_SEND_REQ:
+ loadRecipients(PduHeaders.TO, recipients, addressMap, false);
+ break;
+ }
+ long threadId = 0;
+ if (createThreadId && !recipients.isEmpty()) {
+ // Given all the recipients associated with this message, find (or create) the
+ // correct thread.
+ threadId = Threads.getOrCreateThreadId(mContext, recipients);
+ }
+ values.put(Mms.THREAD_ID, threadId);
+ }
+
+ // Save parts first to avoid inconsistent message is loaded
+ // while saving the parts.
+ long dummyId = System.currentTimeMillis(); // Dummy ID of the msg.
+
+ // Figure out if this PDU is a text-only message
+ boolean textOnly = true;
+
+ // Sum up the total message size
+ int messageSize = 0;
+
+ // Get body if the PDU is a RetrieveConf or SendReq.
+ if (pdu instanceof MultimediaMessagePdu) {
+ body = ((MultimediaMessagePdu) pdu).getBody();
+ // Start saving parts if necessary.
+ if (body != null) {
+ int partsNum = body.getPartsNum();
+ if (partsNum > 2) {
+ // For a text-only message there will be two parts: 1-the SMIL, 2-the text.
+ // Down a few lines below we're checking to make sure we've only got SMIL or
+ // text. We also have to check then we don't have more than two parts.
+ // Otherwise, a slideshow with two text slides would be marked as textOnly.
+ textOnly = false;
+ }
+ for (int i = 0; i < partsNum; i++) {
+ PduPart part = body.getPart(i);
+ messageSize += part.getDataLength();
+ persistPart(part, dummyId, preOpenedFiles);
+
+ // If we've got anything besides text/plain or SMIL part, then we've got
+ // an mms message with some other type of attachment.
+ String contentType = getPartContentType(part);
+ if (contentType != null && !ContentType.APP_SMIL.equals(contentType)
+ && !ContentType.TEXT_PLAIN.equals(contentType)) {
+ textOnly = false;
+ }
+ }
+ }
+ }
+ // Record whether this mms message is a simple plain text or not. This is a hint for the
+ // UI.
+ values.put(Mms.TEXT_ONLY, textOnly ? 1 : 0);
+ // The message-size might already have been inserted when parsing the
+ // PDU header. If not, then we insert the message size as well.
+ if (values.getAsInteger(Mms.MESSAGE_SIZE) == null) {
+ values.put(Mms.MESSAGE_SIZE, messageSize);
+ }
+
+ Uri res = null;
+ if (existingUri) {
+ res = uri;
+ SqliteWrapper.update(mContext, mContentResolver, res, values, null, null);
+ } else {
+ res = SqliteWrapper.insert(mContext, mContentResolver, uri, values);
+ if (res == null) {
+ throw new MmsException("persist() failed: return null.");
+ }
+ // Get the real ID of the PDU and update all parts which were
+ // saved with the dummy ID.
+ msgId = ContentUris.parseId(res);
+ }
+
+ values = new ContentValues(1);
+ values.put(Part.MSG_ID, msgId);
+ SqliteWrapper.update(mContext, mContentResolver,
+ Uri.parse("content://mms/" + dummyId + "/part"),
+ values, null, null);
+ // We should return the longest URI of the persisted PDU, for
+ // example, if input URI is "content://mms/inbox" and the _ID of
+ // persisted PDU is '8', we should return "content://mms/inbox/8"
+ // instead of "content://mms/8".
+ // FIXME: Should the MmsProvider be responsible for this???
+ if (!existingUri) {
+ res = Uri.parse(uri + "/" + msgId);
+ }
+
+ // Save address information.
+ for (int addrType : ADDRESS_FIELDS) {
+ EncodedStringValue[] array = addressMap.get(addrType);
+ if (array != null) {
+ persistAddress(msgId, addrType, array);
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * For a given address type, extract the recipients from the headers.
+ *
+ * @param addressType can be PduHeaders.FROM, PduHeaders.TO or PduHeaders.CC
+ * @param recipients a HashSet that is loaded with the recipients from the FROM, TO or CC headers
+ * @param addressMap a HashMap of the addresses from the ADDRESS_FIELDS header
+ * @param excludeMyNumber if true, the number of this phone will be excluded from recipients
+ */
+ @UnsupportedAppUsage
+ private void loadRecipients(int addressType, HashSet<String> recipients,
+ HashMap<Integer, EncodedStringValue[]> addressMap, boolean excludeMyNumber) {
+ EncodedStringValue[] array = addressMap.get(addressType);
+ if (array == null) {
+ return;
+ }
+ // If the TO recipients is only a single address, then we can skip loadRecipients when
+ // we're excluding our own number because we know that address is our own.
+ if (excludeMyNumber && array.length == 1) {
+ return;
+ }
+ final SubscriptionManager subscriptionManager = SubscriptionManager.from(mContext);
+ final Set<String> myPhoneNumbers = new HashSet<String>();
+ if (excludeMyNumber) {
+ // Build a list of my phone numbers from the various sims.
+ for (int subid : subscriptionManager.getActiveSubscriptionIdList()) {
+ final String myNumber = mTelephonyManager.getLine1Number(subid);
+ if (myNumber != null) {
+ myPhoneNumbers.add(myNumber);
+ }
+ }
+ }
+
+ for (EncodedStringValue v : array) {
+ if (v != null) {
+ final String number = v.getString();
+ if (excludeMyNumber) {
+ for (final String myNumber : myPhoneNumbers) {
+ if (!PhoneNumberUtils.compare(number, myNumber)
+ && !recipients.contains(number)) {
+ // Only add numbers which aren't my own number.
+ recipients.add(number);
+ break;
+ }
+ }
+ } else if (!recipients.contains(number)){
+ recipients.add(number);
+ }
+ }
+ }
+ }
+
+ /**
+ * Move a PDU object from one location to another.
+ *
+ * @param from Specify the PDU object to be moved.
+ * @param to The destination location, should be one of the following:
+ * "content://mms/inbox", "content://mms/sent",
+ * "content://mms/drafts", "content://mms/outbox",
+ * "content://mms/trash".
+ * @return New Uri of the moved PDU.
+ * @throws MmsException Error occurred while moving the message.
+ */
+ @UnsupportedAppUsage
+ public Uri move(Uri from, Uri to) throws MmsException {
+ // Check whether the 'msgId' has been assigned a valid value.
+ long msgId = ContentUris.parseId(from);
+ if (msgId == -1L) {
+ throw new MmsException("Error! ID of the message: -1.");
+ }
+
+ // Get corresponding int value of destination box.
+ Integer msgBox = MESSAGE_BOX_MAP.get(to);
+ if (msgBox == null) {
+ throw new MmsException(
+ "Bad destination, must be one of "
+ + "content://mms/inbox, content://mms/sent, "
+ + "content://mms/drafts, content://mms/outbox, "
+ + "content://mms/temp.");
+ }
+
+ ContentValues values = new ContentValues(1);
+ values.put(Mms.MESSAGE_BOX, msgBox);
+ SqliteWrapper.update(mContext, mContentResolver, from, values, null, null);
+ return ContentUris.withAppendedId(to, msgId);
+ }
+
+ /**
+ * Wrap a byte[] into a String.
+ */
+ @UnsupportedAppUsage
+ public static String toIsoString(byte[] bytes) {
+ try {
+ return new String(bytes, CharacterSets.MIMENAME_ISO_8859_1);
+ } catch (UnsupportedEncodingException e) {
+ // Impossible to reach here!
+ Log.e(TAG, "ISO_8859_1 must be supported!", e);
+ return "";
+ }
+ }
+
+ /**
+ * Unpack a given String into a byte[].
+ */
+ @UnsupportedAppUsage
+ public static byte[] getBytes(String data) {
+ try {
+ return data.getBytes(CharacterSets.MIMENAME_ISO_8859_1);
+ } catch (UnsupportedEncodingException e) {
+ // Impossible to reach here!
+ Log.e(TAG, "ISO_8859_1 must be supported!", e);
+ return new byte[0];
+ }
+ }
+
+ /**
+ * Remove all objects in the temporary path.
+ */
+ public void release() {
+ Uri uri = Uri.parse(TEMPORARY_DRM_OBJECT_URI);
+ SqliteWrapper.delete(mContext, mContentResolver, uri, null, null);
+ mDrmManagerClient.release();
+ }
+
+ /**
+ * Find all messages to be sent or downloaded before certain time.
+ */
+ @UnsupportedAppUsage
+ public Cursor getPendingMessages(long dueTime) {
+ Uri.Builder uriBuilder = PendingMessages.CONTENT_URI.buildUpon();
+ uriBuilder.appendQueryParameter("protocol", "mms");
+
+ String selection = PendingMessages.ERROR_TYPE + " < ?"
+ + " AND " + PendingMessages.DUE_TIME + " <= ?";
+
+ String[] selectionArgs = new String[] {
+ String.valueOf(MmsSms.ERR_TYPE_GENERIC_PERMANENT),
+ String.valueOf(dueTime)
+ };
+
+ return SqliteWrapper.query(mContext, mContentResolver,
+ uriBuilder.build(), null, selection, selectionArgs,
+ PendingMessages.DUE_TIME);
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java b/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java
new file mode 100644
index 000000000000..9d6535c72e90
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/QuotedPrintable.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.io.ByteArrayOutputStream;
+
+public class QuotedPrintable {
+ private static byte ESCAPE_CHAR = '=';
+
+ /**
+ * Decodes an array quoted-printable characters into an array of original bytes.
+ * Escaped characters are converted back to their original representation.
+ *
+ * <p>
+ * This function implements a subset of
+ * quoted-printable encoding specification (rule #1 and rule #2)
+ * as defined in RFC 1521.
+ * </p>
+ *
+ * @param bytes array of quoted-printable characters
+ * @return array of original bytes,
+ * null if quoted-printable decoding is unsuccessful.
+ */
+ @UnsupportedAppUsage
+ public static final byte[] decodeQuotedPrintable(byte[] bytes) {
+ if (bytes == null) {
+ return null;
+ }
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ for (int i = 0; i < bytes.length; i++) {
+ int b = bytes[i];
+ if (b == ESCAPE_CHAR) {
+ try {
+ if('\r' == (char)bytes[i + 1] &&
+ '\n' == (char)bytes[i + 2]) {
+ i += 2;
+ continue;
+ }
+ int u = Character.digit((char) bytes[++i], 16);
+ int l = Character.digit((char) bytes[++i], 16);
+ if (u == -1 || l == -1) {
+ return null;
+ }
+ buffer.write((char) ((u << 4) + l));
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ } else {
+ buffer.write(b);
+ }
+ }
+ return buffer.toByteArray();
+ }
+}
diff --git a/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java b/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java
new file mode 100644
index 000000000000..e38c62dde622
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/ReadOrigInd.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+public class ReadOrigInd extends GenericPdu {
+ /**
+ * Empty constructor.
+ * Since the Pdu corresponding to this class is constructed
+ * by the Proxy-Relay server, this class is only instantiated
+ * by the Pdu Parser.
+ *
+ * @throws InvalidHeaderValueException if error occurs.
+ */
+ public ReadOrigInd() throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_READ_ORIG_IND);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ ReadOrigInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get Date value.
+ *
+ * @return the value
+ */
+ public long getDate() {
+ return mPduHeaders.getLongInteger(PduHeaders.DATE);
+ }
+
+ /**
+ * Set Date value.
+ *
+ * @param value the value
+ */
+ public void setDate(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.DATE);
+ }
+
+ /**
+ * Get From value.
+ * From-value = Value-length
+ * (Address-present-token Encoded-string-value | Insert-address-token)
+ *
+ * @return the value
+ */
+ public EncodedStringValue getFrom() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
+ }
+
+ /**
+ * Set From value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setFrom(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
+ }
+
+ /**
+ * Get Message-ID value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageId() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Set Message-ID value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setMessageId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Get X-MMS-Read-status value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getReadStatus() {
+ return mPduHeaders.getOctet(PduHeaders.READ_STATUS);
+ }
+
+ /**
+ * Set X-MMS-Read-status value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ public void setReadStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.READ_STATUS);
+ }
+
+ /**
+ * Get To value.
+ *
+ * @return the value
+ */
+ public EncodedStringValue[] getTo() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
+ }
+
+ /**
+ * Set To value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setTo(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/ReadRecInd.java b/telephony/common/com/google/android/mms/pdu/ReadRecInd.java
new file mode 100644
index 000000000000..9696bc259d00
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/ReadRecInd.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+public class ReadRecInd extends GenericPdu {
+ /**
+ * Constructor, used when composing a M-ReadRec.ind pdu.
+ *
+ * @param from the from value
+ * @param messageId the message ID value
+ * @param mmsVersion current viersion of mms
+ * @param readStatus the read status value
+ * @param to the to value
+ * @throws InvalidHeaderValueException if parameters are invalid.
+ * NullPointerException if messageId or to is null.
+ */
+ @UnsupportedAppUsage
+ public ReadRecInd(EncodedStringValue from,
+ byte[] messageId,
+ int mmsVersion,
+ int readStatus,
+ EncodedStringValue[] to) throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_READ_REC_IND);
+ setFrom(from);
+ setMessageId(messageId);
+ setMmsVersion(mmsVersion);
+ setTo(to);
+ setReadStatus(readStatus);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ ReadRecInd(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get Date value.
+ *
+ * @return the value
+ */
+ public long getDate() {
+ return mPduHeaders.getLongInteger(PduHeaders.DATE);
+ }
+
+ /**
+ * Set Date value.
+ *
+ * @param value the value
+ */
+ @UnsupportedAppUsage
+ public void setDate(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.DATE);
+ }
+
+ /**
+ * Get Message-ID value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageId() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Set Message-ID value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setMessageId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Get To value.
+ *
+ * @return the value
+ */
+ public EncodedStringValue[] getTo() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.TO);
+ }
+
+ /**
+ * Set To value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setTo(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
+ }
+
+ /**
+ * Get X-MMS-Read-status value.
+ *
+ * @return the value
+ */
+ public int getReadStatus() {
+ return mPduHeaders.getOctet(PduHeaders.READ_STATUS);
+ }
+
+ /**
+ * Set X-MMS-Read-status value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ public void setReadStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.READ_STATUS);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/RetrieveConf.java b/telephony/common/com/google/android/mms/pdu/RetrieveConf.java
new file mode 100644
index 000000000000..03755af4189c
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/RetrieveConf.java
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+/**
+ * M-Retrieve.conf Pdu.
+ */
+public class RetrieveConf extends MultimediaMessagePdu {
+ /**
+ * Empty constructor.
+ * Since the Pdu corresponding to this class is constructed
+ * by the Proxy-Relay server, this class is only instantiated
+ * by the Pdu Parser.
+ *
+ * @throws InvalidHeaderValueException if error occurs.
+ */
+ @UnsupportedAppUsage
+ public RetrieveConf() throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ RetrieveConf(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Constructor with given headers and body
+ *
+ * @param headers Headers for this PDU.
+ * @param body Body of this PDu.
+ */
+ @UnsupportedAppUsage
+ RetrieveConf(PduHeaders headers, PduBody body) {
+ super(headers, body);
+ }
+
+ /**
+ * Get CC value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue[] getCc() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.CC);
+ }
+
+ /**
+ * Add a "CC" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void addCc(EncodedStringValue value) {
+ mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC);
+ }
+
+ /**
+ * Get Content-type value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentType() {
+ return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE);
+ }
+
+ /**
+ * Set Content-type value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentType(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE);
+ }
+
+ /**
+ * Get X-Mms-Delivery-Report value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getDeliveryReport() {
+ return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
+ }
+
+ /**
+ * Set X-Mms-Delivery-Report value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setDeliveryReport(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
+ }
+
+ /**
+ * Get From value.
+ * From-value = Value-length
+ * (Address-present-token Encoded-string-value | Insert-address-token)
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getFrom() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.FROM);
+ }
+
+ /**
+ * Set From value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setFrom(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.FROM);
+ }
+
+ /**
+ * Get X-Mms-Message-Class value.
+ * Message-class-value = Class-identifier | Token-text
+ * Class-identifier = Personal | Advertisement | Informational | Auto
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageClass() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Set X-Mms-Message-Class value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setMessageClass(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Get Message-ID value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageId() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Set Message-ID value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setMessageId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Get X-Mms-Read-Report value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getReadReport() {
+ return mPduHeaders.getOctet(PduHeaders.READ_REPORT);
+ }
+
+ /**
+ * Set X-Mms-Read-Report value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setReadReport(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.READ_REPORT);
+ }
+
+ /**
+ * Get X-Mms-Retrieve-Status value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getRetrieveStatus() {
+ return mPduHeaders.getOctet(PduHeaders.RETRIEVE_STATUS);
+ }
+
+ /**
+ * Set X-Mms-Retrieve-Status value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setRetrieveStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.RETRIEVE_STATUS);
+ }
+
+ /**
+ * Get X-Mms-Retrieve-Text value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue getRetrieveText() {
+ return mPduHeaders.getEncodedStringValue(PduHeaders.RETRIEVE_TEXT);
+ }
+
+ /**
+ * Set X-Mms-Retrieve-Text value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setRetrieveText(EncodedStringValue value) {
+ mPduHeaders.setEncodedStringValue(value, PduHeaders.RETRIEVE_TEXT);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte getContentClass() {return 0x00;}
+ * public void setApplicId(byte value) {}
+ *
+ * public byte getDrmContent() {return 0x00;}
+ * public void setDrmContent(byte value) {}
+ *
+ * public byte getDistributionIndicator() {return 0x00;}
+ * public void setDistributionIndicator(byte value) {}
+ *
+ * public PreviouslySentByValue getPreviouslySentBy() {return null;}
+ * public void setPreviouslySentBy(PreviouslySentByValue value) {}
+ *
+ * public PreviouslySentDateValue getPreviouslySentDate() {}
+ * public void setPreviouslySentDate(PreviouslySentDateValue value) {}
+ *
+ * public MmFlagsValue getMmFlags() {return null;}
+ * public void setMmFlags(MmFlagsValue value) {}
+ *
+ * public MmStateValue getMmState() {return null;}
+ * public void getMmState(MmStateValue value) {}
+ *
+ * public byte[] getReplaceId() {return 0x00;}
+ * public void setReplaceId(byte[] value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ *
+ * public byte getReplyCharging() {return 0x00;}
+ * public void setReplyCharging(byte value) {}
+ *
+ * public byte getReplyChargingDeadline() {return 0x00;}
+ * public void setReplyChargingDeadline(byte value) {}
+ *
+ * public byte[] getReplyChargingId() {return 0x00;}
+ * public void setReplyChargingId(byte[] value) {}
+ *
+ * public long getReplyChargingSize() {return 0;}
+ * public void setReplyChargingSize(long value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/SendConf.java b/telephony/common/com/google/android/mms/pdu/SendConf.java
new file mode 100644
index 000000000000..b85982791ada
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/SendConf.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2007 Esmertec AG.
+ * Copyright (C) 2007 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 com.google.android.mms.pdu;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+public class SendConf extends GenericPdu {
+ /**
+ * Empty constructor.
+ * Since the Pdu corresponding to this class is constructed
+ * by the Proxy-Relay server, this class is only instantiated
+ * by the Pdu Parser.
+ *
+ * @throws InvalidHeaderValueException if error occurs.
+ */
+ @UnsupportedAppUsage
+ public SendConf() throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_SEND_CONF);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ @UnsupportedAppUsage
+ SendConf(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Get Message-ID value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageId() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Set Message-ID value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setMessageId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_ID);
+ }
+
+ /**
+ * Get X-Mms-Response-Status.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getResponseStatus() {
+ return mPduHeaders.getOctet(PduHeaders.RESPONSE_STATUS);
+ }
+
+ /**
+ * Set X-Mms-Response-Status.
+ *
+ * @param value the values
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ public void setResponseStatus(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.RESPONSE_STATUS);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ @UnsupportedAppUsage
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id field value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte[] getContentLocation() {return null;}
+ * public void setContentLocation(byte[] value) {}
+ *
+ * public EncodedStringValue getResponseText() {return null;}
+ * public void setResponseText(EncodedStringValue value) {}
+ *
+ * public byte getStoreStatus() {return 0x00;}
+ * public void setStoreStatus(byte value) {}
+ *
+ * public byte[] getStoreStatusText() {return null;}
+ * public void setStoreStatusText(byte[] value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/SendReq.java b/telephony/common/com/google/android/mms/pdu/SendReq.java
new file mode 100644
index 000000000000..c1b7f934c0f7
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/SendReq.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright (C) 2007-2008 Esmertec AG.
+ * Copyright (C) 2007-2008 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 com.google.android.mms.pdu;
+
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.InvalidHeaderValueException;
+
+public class SendReq extends MultimediaMessagePdu {
+ private static final String TAG = "SendReq";
+
+ @UnsupportedAppUsage
+ public SendReq() {
+ super();
+
+ try {
+ setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ);
+ setMmsVersion(PduHeaders.CURRENT_MMS_VERSION);
+ // FIXME: Content-type must be decided according to whether
+ // SMIL part present.
+ setContentType("application/vnd.wap.multipart.related".getBytes());
+ setFrom(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()));
+ setTransactionId(generateTransactionId());
+ } catch (InvalidHeaderValueException e) {
+ // Impossible to reach here since all headers we set above are valid.
+ Log.e(TAG, "Unexpected InvalidHeaderValueException.", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ private byte[] generateTransactionId() {
+ String transactionId = "T" + Long.toHexString(System.currentTimeMillis());
+ return transactionId.getBytes();
+ }
+
+ /**
+ * Constructor, used when composing a M-Send.req pdu.
+ *
+ * @param contentType the content type value
+ * @param from the from value
+ * @param mmsVersion current viersion of mms
+ * @param transactionId the transaction-id value
+ * @throws InvalidHeaderValueException if parameters are invalid.
+ * NullPointerException if contentType, form or transactionId is null.
+ */
+ public SendReq(byte[] contentType,
+ EncodedStringValue from,
+ int mmsVersion,
+ byte[] transactionId) throws InvalidHeaderValueException {
+ super();
+ setMessageType(PduHeaders.MESSAGE_TYPE_SEND_REQ);
+ setContentType(contentType);
+ setFrom(from);
+ setMmsVersion(mmsVersion);
+ setTransactionId(transactionId);
+ }
+
+ /**
+ * Constructor with given headers.
+ *
+ * @param headers Headers for this PDU.
+ */
+ SendReq(PduHeaders headers) {
+ super(headers);
+ }
+
+ /**
+ * Constructor with given headers and body
+ *
+ * @param headers Headers for this PDU.
+ * @param body Body of this PDu.
+ */
+ @UnsupportedAppUsage
+ SendReq(PduHeaders headers, PduBody body) {
+ super(headers, body);
+ }
+
+ /**
+ * Get Bcc value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue[] getBcc() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.BCC);
+ }
+
+ /**
+ * Add a "BCC" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void addBcc(EncodedStringValue value) {
+ mPduHeaders.appendEncodedStringValue(value, PduHeaders.BCC);
+ }
+
+ /**
+ * Set "BCC" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setBcc(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.BCC);
+ }
+
+ /**
+ * Get CC value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public EncodedStringValue[] getCc() {
+ return mPduHeaders.getEncodedStringValues(PduHeaders.CC);
+ }
+
+ /**
+ * Add a "CC" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void addCc(EncodedStringValue value) {
+ mPduHeaders.appendEncodedStringValue(value, PduHeaders.CC);
+ }
+
+ /**
+ * Set "CC" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setCc(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.CC);
+ }
+
+ /**
+ * Get Content-type value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getContentType() {
+ return mPduHeaders.getTextString(PduHeaders.CONTENT_TYPE);
+ }
+
+ /**
+ * Set Content-type value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setContentType(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.CONTENT_TYPE);
+ }
+
+ /**
+ * Get X-Mms-Delivery-Report value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getDeliveryReport() {
+ return mPduHeaders.getOctet(PduHeaders.DELIVERY_REPORT);
+ }
+
+ /**
+ * Set X-Mms-Delivery-Report value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setDeliveryReport(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.DELIVERY_REPORT);
+ }
+
+ /**
+ * Get X-Mms-Expiry value.
+ *
+ * Expiry-value = Value-length
+ * (Absolute-token Date-value | Relative-token Delta-seconds-value)
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getExpiry() {
+ return mPduHeaders.getLongInteger(PduHeaders.EXPIRY);
+ }
+
+ /**
+ * Set X-Mms-Expiry value.
+ *
+ * @param value the value
+ */
+ @UnsupportedAppUsage
+ public void setExpiry(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.EXPIRY);
+ }
+
+ /**
+ * Get X-Mms-MessageSize value.
+ *
+ * Expiry-value = size of message
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public long getMessageSize() {
+ return mPduHeaders.getLongInteger(PduHeaders.MESSAGE_SIZE);
+ }
+
+ /**
+ * Set X-Mms-MessageSize value.
+ *
+ * @param value the value
+ */
+ @UnsupportedAppUsage
+ public void setMessageSize(long value) {
+ mPduHeaders.setLongInteger(value, PduHeaders.MESSAGE_SIZE);
+ }
+
+ /**
+ * Get X-Mms-Message-Class value.
+ * Message-class-value = Class-identifier | Token-text
+ * Class-identifier = Personal | Advertisement | Informational | Auto
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public byte[] getMessageClass() {
+ return mPduHeaders.getTextString(PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Set X-Mms-Message-Class value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setMessageClass(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.MESSAGE_CLASS);
+ }
+
+ /**
+ * Get X-Mms-Read-Report value.
+ *
+ * @return the value
+ */
+ @UnsupportedAppUsage
+ public int getReadReport() {
+ return mPduHeaders.getOctet(PduHeaders.READ_REPORT);
+ }
+
+ /**
+ * Set X-Mms-Read-Report value.
+ *
+ * @param value the value
+ * @throws InvalidHeaderValueException if the value is invalid.
+ */
+ @UnsupportedAppUsage
+ public void setReadReport(int value) throws InvalidHeaderValueException {
+ mPduHeaders.setOctet(value, PduHeaders.READ_REPORT);
+ }
+
+ /**
+ * Set "To" value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setTo(EncodedStringValue[] value) {
+ mPduHeaders.setEncodedStringValues(value, PduHeaders.TO);
+ }
+
+ /**
+ * Get X-Mms-Transaction-Id field value.
+ *
+ * @return the X-Mms-Report-Allowed value
+ */
+ @UnsupportedAppUsage
+ public byte[] getTransactionId() {
+ return mPduHeaders.getTextString(PduHeaders.TRANSACTION_ID);
+ }
+
+ /**
+ * Set X-Mms-Transaction-Id field value.
+ *
+ * @param value the value
+ * @throws NullPointerException if the value is null.
+ */
+ @UnsupportedAppUsage
+ public void setTransactionId(byte[] value) {
+ mPduHeaders.setTextString(value, PduHeaders.TRANSACTION_ID);
+ }
+
+ /*
+ * Optional, not supported header fields:
+ *
+ * public byte getAdaptationAllowed() {return 0};
+ * public void setAdaptationAllowed(btye value) {};
+ *
+ * public byte[] getApplicId() {return null;}
+ * public void setApplicId(byte[] value) {}
+ *
+ * public byte[] getAuxApplicId() {return null;}
+ * public void getAuxApplicId(byte[] value) {}
+ *
+ * public byte getContentClass() {return 0x00;}
+ * public void setApplicId(byte value) {}
+ *
+ * public long getDeliveryTime() {return 0};
+ * public void setDeliveryTime(long value) {};
+ *
+ * public byte getDrmContent() {return 0x00;}
+ * public void setDrmContent(byte value) {}
+ *
+ * public MmFlagsValue getMmFlags() {return null;}
+ * public void setMmFlags(MmFlagsValue value) {}
+ *
+ * public MmStateValue getMmState() {return null;}
+ * public void getMmState(MmStateValue value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ *
+ * public byte getReplyCharging() {return 0x00;}
+ * public void setReplyCharging(byte value) {}
+ *
+ * public byte getReplyChargingDeadline() {return 0x00;}
+ * public void setReplyChargingDeadline(byte value) {}
+ *
+ * public byte[] getReplyChargingId() {return 0x00;}
+ * public void setReplyChargingId(byte[] value) {}
+ *
+ * public long getReplyChargingSize() {return 0;}
+ * public void setReplyChargingSize(long value) {}
+ *
+ * public byte[] getReplyApplicId() {return 0x00;}
+ * public void setReplyApplicId(byte[] value) {}
+ *
+ * public byte getStore() {return 0x00;}
+ * public void setStore(byte value) {}
+ */
+}
diff --git a/telephony/common/com/google/android/mms/pdu/package.html b/telephony/common/com/google/android/mms/pdu/package.html
new file mode 100755
index 000000000000..c9f96a66ab3b
--- /dev/null
+++ b/telephony/common/com/google/android/mms/pdu/package.html
@@ -0,0 +1,5 @@
+<body>
+
+{@hide}
+
+</body>
diff --git a/telephony/common/com/google/android/mms/util/AbstractCache.java b/telephony/common/com/google/android/mms/util/AbstractCache.java
new file mode 100644
index 000000000000..ab5d48a4ce3d
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/AbstractCache.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 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 com.google.android.mms.util;
+
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.util.HashMap;
+
+public abstract class AbstractCache<K, V> {
+ private static final String TAG = "AbstractCache";
+ private static final boolean DEBUG = false;
+ private static final boolean LOCAL_LOGV = false;
+
+ private static final int MAX_CACHED_ITEMS = 500;
+
+ private final HashMap<K, CacheEntry<V>> mCacheMap;
+
+ @UnsupportedAppUsage
+ protected AbstractCache() {
+ mCacheMap = new HashMap<K, CacheEntry<V>>();
+ }
+
+ @UnsupportedAppUsage
+ public boolean put(K key, V value) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Trying to put " + key + " into cache.");
+ }
+
+ if (mCacheMap.size() >= MAX_CACHED_ITEMS) {
+ // TODO Should remove the oldest or least hit cached entry
+ // and then cache the new one.
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Failed! size limitation reached.");
+ }
+ return false;
+ }
+
+ if (key != null) {
+ CacheEntry<V> cacheEntry = new CacheEntry<V>();
+ cacheEntry.value = value;
+ mCacheMap.put(key, cacheEntry);
+
+ if (LOCAL_LOGV) {
+ Log.v(TAG, key + " cached, " + mCacheMap.size() + " items total.");
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @UnsupportedAppUsage
+ public V get(K key) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Trying to get " + key + " from cache.");
+ }
+
+ if (key != null) {
+ CacheEntry<V> cacheEntry = mCacheMap.get(key);
+ if (cacheEntry != null) {
+ cacheEntry.hit++;
+ if (LOCAL_LOGV) {
+ Log.v(TAG, key + " hit " + cacheEntry.hit + " times.");
+ }
+ return cacheEntry.value;
+ }
+ }
+ return null;
+ }
+
+ @UnsupportedAppUsage
+ public V purge(K key) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Trying to purge " + key);
+ }
+
+ CacheEntry<V> v = mCacheMap.remove(key);
+
+ if (LOCAL_LOGV) {
+ Log.v(TAG, mCacheMap.size() + " items cached.");
+ }
+
+ return v != null ? v.value : null;
+ }
+
+ @UnsupportedAppUsage
+ public void purgeAll() {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Purging cache, " + mCacheMap.size()
+ + " items dropped.");
+ }
+ mCacheMap.clear();
+ }
+
+ public int size() {
+ return mCacheMap.size();
+ }
+
+ private static class CacheEntry<V> {
+ int hit;
+ V value;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java b/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java
new file mode 100644
index 000000000000..118de465a518
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/DownloadDrmHelper.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2012 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 com.google.android.mms.util;
+
+import android.content.Context;
+import android.drm.DrmManagerClient;
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+public class DownloadDrmHelper {
+ private static final String TAG = "DownloadDrmHelper";
+
+ /** The MIME type of special DRM files */
+ public static final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
+
+ /** The extensions of special DRM files */
+ public static final String EXTENSION_DRM_MESSAGE = ".dm";
+
+ public static final String EXTENSION_INTERNAL_FWDL = ".fl";
+
+ /**
+ * Checks if the Media Type is a DRM Media Type
+ *
+ * @param drmManagerClient A DrmManagerClient
+ * @param mimetype Media Type to check
+ * @return True if the Media Type is DRM else false
+ */
+ public static boolean isDrmMimeType(Context context, String mimetype) {
+ boolean result = false;
+ if (context != null) {
+ try {
+ DrmManagerClient drmClient = new DrmManagerClient(context);
+ if (drmClient != null && mimetype != null && mimetype.length() > 0) {
+ result = drmClient.canHandle("", mimetype);
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG,
+ "DrmManagerClient instance could not be created, context is Illegal.");
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Checks if the Media Type needs to be DRM converted
+ *
+ * @param mimetype Media type of the content
+ * @return True if convert is needed else false
+ */
+ @UnsupportedAppUsage
+ public static boolean isDrmConvertNeeded(String mimetype) {
+ return MIMETYPE_DRM_MESSAGE.equals(mimetype);
+ }
+
+ /**
+ * Modifies the file extension for a DRM Forward Lock file NOTE: This
+ * function shouldn't be called if the file shouldn't be DRM converted
+ */
+ @UnsupportedAppUsage
+ public static String modifyDrmFwLockFileExtension(String filename) {
+ if (filename != null) {
+ int extensionIndex;
+ extensionIndex = filename.lastIndexOf(".");
+ if (extensionIndex != -1) {
+ filename = filename.substring(0, extensionIndex);
+ }
+ filename = filename.concat(EXTENSION_INTERNAL_FWDL);
+ }
+ return filename;
+ }
+
+ /**
+ * Gets the original mime type of DRM protected content.
+ *
+ * @param context The context
+ * @param path Path to the file
+ * @param containingMime The current mime type of the file i.e. the
+ * containing mime type
+ * @return The original mime type of the file if DRM protected else the
+ * currentMime
+ */
+ public static String getOriginalMimeType(Context context, String path, String containingMime) {
+ String result = containingMime;
+ DrmManagerClient drmClient = new DrmManagerClient(context);
+ try {
+ if (drmClient.canHandle(path, null)) {
+ result = drmClient.getOriginalMimeType(path);
+ }
+ } catch (IllegalArgumentException ex) {
+ Log.w(TAG,
+ "Can't get original mime type since path is null or empty string.");
+ } catch (IllegalStateException ex) {
+ Log.w(TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ return result;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/DrmConvertSession.java b/telephony/common/com/google/android/mms/util/DrmConvertSession.java
new file mode 100644
index 000000000000..0e8ec91f4ef6
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/DrmConvertSession.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2012 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 com.google.android.mms.util;
+
+import android.content.Context;
+import android.drm.DrmConvertedStatus;
+import android.drm.DrmManagerClient;
+import android.provider.Downloads;
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+
+public class DrmConvertSession {
+ private DrmManagerClient mDrmClient;
+ private int mConvertSessionId;
+ private static final String TAG = "DrmConvertSession";
+
+ private DrmConvertSession(DrmManagerClient drmClient, int convertSessionId) {
+ mDrmClient = drmClient;
+ mConvertSessionId = convertSessionId;
+ }
+
+ /**
+ * Start of converting a file.
+ *
+ * @param context The context of the application running the convert session.
+ * @param mimeType Mimetype of content that shall be converted.
+ * @return A convert session or null in case an error occurs.
+ */
+ @UnsupportedAppUsage
+ public static DrmConvertSession open(Context context, String mimeType) {
+ DrmManagerClient drmClient = null;
+ int convertSessionId = -1;
+ if (context != null && mimeType != null && !mimeType.equals("")) {
+ try {
+ drmClient = new DrmManagerClient(context);
+ try {
+ convertSessionId = drmClient.openConvertSession(mimeType);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "Conversion of Mimetype: " + mimeType
+ + " is not supported.", e);
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not access Open DrmFramework.", e);
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG,
+ "DrmManagerClient instance could not be created, context is Illegal.");
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ }
+
+ if (drmClient == null || convertSessionId < 0) {
+ return null;
+ } else {
+ return new DrmConvertSession(drmClient, convertSessionId);
+ }
+ }
+ /**
+ * Convert a buffer of data to protected format.
+ *
+ * @param buffer Buffer filled with data to convert.
+ * @param size The number of bytes that shall be converted.
+ * @return A Buffer filled with converted data, if execution is ok, in all
+ * other case null.
+ */
+ @UnsupportedAppUsage
+ public byte [] convert(byte[] inBuffer, int size) {
+ byte[] result = null;
+ if (inBuffer != null) {
+ DrmConvertedStatus convertedStatus = null;
+ try {
+ if (size != inBuffer.length) {
+ byte[] buf = new byte[size];
+ System.arraycopy(inBuffer, 0, buf, 0, size);
+ convertedStatus = mDrmClient.convertData(mConvertSessionId, buf);
+ } else {
+ convertedStatus = mDrmClient.convertData(mConvertSessionId, inBuffer);
+ }
+
+ if (convertedStatus != null &&
+ convertedStatus.statusCode == DrmConvertedStatus.STATUS_OK &&
+ convertedStatus.convertedData != null) {
+ result = convertedStatus.convertedData;
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "Buffer with data to convert is illegal. Convertsession: "
+ + mConvertSessionId, e);
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not convert data. Convertsession: " +
+ mConvertSessionId, e);
+ }
+ } else {
+ throw new IllegalArgumentException("Parameter inBuffer is null");
+ }
+ return result;
+ }
+
+ /**
+ * Ends a conversion session of a file.
+ *
+ * @param fileName The filename of the converted file.
+ * @return Downloads.Impl.STATUS_SUCCESS if execution is ok.
+ * Downloads.Impl.STATUS_FILE_ERROR in case converted file can not
+ * be accessed. Downloads.Impl.STATUS_NOT_ACCEPTABLE if a problem
+ * occurs when accessing drm framework.
+ * Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred.
+ */
+ @UnsupportedAppUsage
+ public int close(String filename) {
+ DrmConvertedStatus convertedStatus = null;
+ int result = Downloads.Impl.STATUS_UNKNOWN_ERROR;
+ if (mDrmClient != null && mConvertSessionId >= 0) {
+ try {
+ convertedStatus = mDrmClient.closeConvertSession(mConvertSessionId);
+ if (convertedStatus == null ||
+ convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+ convertedStatus.convertedData == null) {
+ result = Downloads.Impl.STATUS_NOT_ACCEPTABLE;
+ } else {
+ RandomAccessFile rndAccessFile = null;
+ try {
+ rndAccessFile = new RandomAccessFile(filename, "rw");
+ rndAccessFile.seek(convertedStatus.offset);
+ rndAccessFile.write(convertedStatus.convertedData);
+ result = Downloads.Impl.STATUS_SUCCESS;
+ } catch (FileNotFoundException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(TAG, "File: " + filename + " could not be found.", e);
+ } catch (IOException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(TAG, "Could not access File: " + filename + " .", e);
+ } catch (IllegalArgumentException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(TAG, "Could not open file in mode: rw", e);
+ } catch (SecurityException e) {
+ Log.w(TAG, "Access to File: " + filename +
+ " was denied denied by SecurityManager.", e);
+ } finally {
+ if (rndAccessFile != null) {
+ try {
+ rndAccessFile.close();
+ } catch (IOException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(TAG, "Failed to close File:" + filename
+ + ".", e);
+ }
+ }
+ }
+ }
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not close convertsession. Convertsession: " +
+ mConvertSessionId, e);
+ }
+ }
+ return result;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/PduCache.java b/telephony/common/com/google/android/mms/util/PduCache.java
new file mode 100644
index 000000000000..94e38946f632
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/PduCache.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 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 com.google.android.mms.util;
+
+import android.content.ContentUris;
+import android.content.UriMatcher;
+import android.net.Uri;
+import android.provider.Telephony.Mms;
+import android.util.Log;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+public final class PduCache extends AbstractCache<Uri, PduCacheEntry> {
+ private static final String TAG = "PduCache";
+ private static final boolean DEBUG = false;
+ private static final boolean LOCAL_LOGV = false;
+
+ private static final int MMS_ALL = 0;
+ private static final int MMS_ALL_ID = 1;
+ private static final int MMS_INBOX = 2;
+ private static final int MMS_INBOX_ID = 3;
+ private static final int MMS_SENT = 4;
+ private static final int MMS_SENT_ID = 5;
+ private static final int MMS_DRAFTS = 6;
+ private static final int MMS_DRAFTS_ID = 7;
+ private static final int MMS_OUTBOX = 8;
+ private static final int MMS_OUTBOX_ID = 9;
+ private static final int MMS_CONVERSATION = 10;
+ private static final int MMS_CONVERSATION_ID = 11;
+
+ private static final UriMatcher URI_MATCHER;
+ private static final HashMap<Integer, Integer> MATCH_TO_MSGBOX_ID_MAP;
+
+ private static PduCache sInstance;
+
+ static {
+ URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH);
+ URI_MATCHER.addURI("mms", null, MMS_ALL);
+ URI_MATCHER.addURI("mms", "#", MMS_ALL_ID);
+ URI_MATCHER.addURI("mms", "inbox", MMS_INBOX);
+ URI_MATCHER.addURI("mms", "inbox/#", MMS_INBOX_ID);
+ URI_MATCHER.addURI("mms", "sent", MMS_SENT);
+ URI_MATCHER.addURI("mms", "sent/#", MMS_SENT_ID);
+ URI_MATCHER.addURI("mms", "drafts", MMS_DRAFTS);
+ URI_MATCHER.addURI("mms", "drafts/#", MMS_DRAFTS_ID);
+ URI_MATCHER.addURI("mms", "outbox", MMS_OUTBOX);
+ URI_MATCHER.addURI("mms", "outbox/#", MMS_OUTBOX_ID);
+ URI_MATCHER.addURI("mms-sms", "conversations", MMS_CONVERSATION);
+ URI_MATCHER.addURI("mms-sms", "conversations/#", MMS_CONVERSATION_ID);
+
+ MATCH_TO_MSGBOX_ID_MAP = new HashMap<Integer, Integer>();
+ MATCH_TO_MSGBOX_ID_MAP.put(MMS_INBOX, Mms.MESSAGE_BOX_INBOX);
+ MATCH_TO_MSGBOX_ID_MAP.put(MMS_SENT, Mms.MESSAGE_BOX_SENT);
+ MATCH_TO_MSGBOX_ID_MAP.put(MMS_DRAFTS, Mms.MESSAGE_BOX_DRAFTS);
+ MATCH_TO_MSGBOX_ID_MAP.put(MMS_OUTBOX, Mms.MESSAGE_BOX_OUTBOX);
+ }
+
+ private final HashMap<Integer, HashSet<Uri>> mMessageBoxes;
+ private final HashMap<Long, HashSet<Uri>> mThreads;
+ private final HashSet<Uri> mUpdating;
+
+ @UnsupportedAppUsage
+ private PduCache() {
+ mMessageBoxes = new HashMap<Integer, HashSet<Uri>>();
+ mThreads = new HashMap<Long, HashSet<Uri>>();
+ mUpdating = new HashSet<Uri>();
+ }
+
+ @UnsupportedAppUsage
+ synchronized public static final PduCache getInstance() {
+ if (sInstance == null) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Constructing new PduCache instance.");
+ }
+ sInstance = new PduCache();
+ }
+ return sInstance;
+ }
+
+ @Override
+ synchronized public boolean put(Uri uri, PduCacheEntry entry) {
+ int msgBoxId = entry.getMessageBox();
+ HashSet<Uri> msgBox = mMessageBoxes.get(msgBoxId);
+ if (msgBox == null) {
+ msgBox = new HashSet<Uri>();
+ mMessageBoxes.put(msgBoxId, msgBox);
+ }
+
+ long threadId = entry.getThreadId();
+ HashSet<Uri> thread = mThreads.get(threadId);
+ if (thread == null) {
+ thread = new HashSet<Uri>();
+ mThreads.put(threadId, thread);
+ }
+
+ Uri finalKey = normalizeKey(uri);
+ boolean result = super.put(finalKey, entry);
+ if (result) {
+ msgBox.add(finalKey);
+ thread.add(finalKey);
+ }
+ setUpdating(uri, false);
+ return result;
+ }
+
+ synchronized public void setUpdating(Uri uri, boolean updating) {
+ if (updating) {
+ mUpdating.add(uri);
+ } else {
+ mUpdating.remove(uri);
+ }
+ }
+
+ @UnsupportedAppUsage
+ synchronized public boolean isUpdating(Uri uri) {
+ return mUpdating.contains(uri);
+ }
+
+ @Override
+ @UnsupportedAppUsage
+ synchronized public PduCacheEntry purge(Uri uri) {
+ int match = URI_MATCHER.match(uri);
+ switch (match) {
+ case MMS_ALL_ID:
+ return purgeSingleEntry(uri);
+ case MMS_INBOX_ID:
+ case MMS_SENT_ID:
+ case MMS_DRAFTS_ID:
+ case MMS_OUTBOX_ID:
+ String msgId = uri.getLastPathSegment();
+ return purgeSingleEntry(Uri.withAppendedPath(Mms.CONTENT_URI, msgId));
+ // Implicit batch of purge, return null.
+ case MMS_ALL:
+ case MMS_CONVERSATION:
+ purgeAll();
+ return null;
+ case MMS_INBOX:
+ case MMS_SENT:
+ case MMS_DRAFTS:
+ case MMS_OUTBOX:
+ purgeByMessageBox(MATCH_TO_MSGBOX_ID_MAP.get(match));
+ return null;
+ case MMS_CONVERSATION_ID:
+ purgeByThreadId(ContentUris.parseId(uri));
+ return null;
+ default:
+ return null;
+ }
+ }
+
+ private PduCacheEntry purgeSingleEntry(Uri key) {
+ mUpdating.remove(key);
+ PduCacheEntry entry = super.purge(key);
+ if (entry != null) {
+ removeFromThreads(key, entry);
+ removeFromMessageBoxes(key, entry);
+ return entry;
+ }
+ return null;
+ }
+
+ @UnsupportedAppUsage
+ @Override
+ synchronized public void purgeAll() {
+ super.purgeAll();
+
+ mMessageBoxes.clear();
+ mThreads.clear();
+ mUpdating.clear();
+ }
+
+ /**
+ * @param uri The Uri to be normalized.
+ * @return Uri The normalized key of cached entry.
+ */
+ private Uri normalizeKey(Uri uri) {
+ int match = URI_MATCHER.match(uri);
+ Uri normalizedKey = null;
+
+ switch (match) {
+ case MMS_ALL_ID:
+ normalizedKey = uri;
+ break;
+ case MMS_INBOX_ID:
+ case MMS_SENT_ID:
+ case MMS_DRAFTS_ID:
+ case MMS_OUTBOX_ID:
+ String msgId = uri.getLastPathSegment();
+ normalizedKey = Uri.withAppendedPath(Mms.CONTENT_URI, msgId);
+ break;
+ default:
+ return null;
+ }
+
+ if (LOCAL_LOGV) {
+ Log.v(TAG, uri + " -> " + normalizedKey);
+ }
+ return normalizedKey;
+ }
+
+ private void purgeByMessageBox(Integer msgBoxId) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Purge cache in message box: " + msgBoxId);
+ }
+
+ if (msgBoxId != null) {
+ HashSet<Uri> msgBox = mMessageBoxes.remove(msgBoxId);
+ if (msgBox != null) {
+ for (Uri key : msgBox) {
+ mUpdating.remove(key);
+ PduCacheEntry entry = super.purge(key);
+ if (entry != null) {
+ removeFromThreads(key, entry);
+ }
+ }
+ }
+ }
+ }
+
+ private void removeFromThreads(Uri key, PduCacheEntry entry) {
+ HashSet<Uri> thread = mThreads.get(entry.getThreadId());
+ if (thread != null) {
+ thread.remove(key);
+ }
+ }
+
+ private void purgeByThreadId(long threadId) {
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Purge cache in thread: " + threadId);
+ }
+
+ HashSet<Uri> thread = mThreads.remove(threadId);
+ if (thread != null) {
+ for (Uri key : thread) {
+ mUpdating.remove(key);
+ PduCacheEntry entry = super.purge(key);
+ if (entry != null) {
+ removeFromMessageBoxes(key, entry);
+ }
+ }
+ }
+ }
+
+ private void removeFromMessageBoxes(Uri key, PduCacheEntry entry) {
+ HashSet<Uri> msgBox = mThreads.get(Long.valueOf(entry.getMessageBox()));
+ if (msgBox != null) {
+ msgBox.remove(key);
+ }
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/PduCacheEntry.java b/telephony/common/com/google/android/mms/util/PduCacheEntry.java
new file mode 100644
index 000000000000..1ecd1bf93e7f
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/PduCacheEntry.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 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 com.google.android.mms.util;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import com.google.android.mms.pdu.GenericPdu;
+
+public final class PduCacheEntry {
+ private final GenericPdu mPdu;
+ private final int mMessageBox;
+ private final long mThreadId;
+
+ @UnsupportedAppUsage
+ public PduCacheEntry(GenericPdu pdu, int msgBox, long threadId) {
+ mPdu = pdu;
+ mMessageBox = msgBox;
+ mThreadId = threadId;
+ }
+
+ @UnsupportedAppUsage
+ public GenericPdu getPdu() {
+ return mPdu;
+ }
+
+ @UnsupportedAppUsage
+ public int getMessageBox() {
+ return mMessageBox;
+ }
+
+ @UnsupportedAppUsage
+ public long getThreadId() {
+ return mThreadId;
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/SqliteWrapper.java b/telephony/common/com/google/android/mms/util/SqliteWrapper.java
new file mode 100644
index 000000000000..2dd1dc11c2a9
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/SqliteWrapper.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2008 Esmertec AG.
+ * Copyright (C) 2008 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 com.google.android.mms.util;
+
+import android.app.ActivityManager;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteException;
+import android.net.Uri;
+import android.util.Log;
+import android.widget.Toast;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+public final class SqliteWrapper {
+ private static final String TAG = "SqliteWrapper";
+ private static final String SQLITE_EXCEPTION_DETAIL_MESSAGE
+ = "unable to open database file";
+
+ private SqliteWrapper() {
+ // Forbidden being instantiated.
+ }
+
+ // FIXME: It looks like outInfo.lowMemory does not work well as we expected.
+ // after run command: adb shell fillup -p 100, outInfo.lowMemory is still false.
+ private static boolean isLowMemory(Context context) {
+ if (null == context) {
+ return false;
+ }
+
+ ActivityManager am = (ActivityManager)
+ context.getSystemService(Context.ACTIVITY_SERVICE);
+ ActivityManager.MemoryInfo outInfo = new ActivityManager.MemoryInfo();
+ am.getMemoryInfo(outInfo);
+
+ return outInfo.lowMemory;
+ }
+
+ // FIXME: need to optimize this method.
+ private static boolean isLowMemory(SQLiteException e) {
+ return e.getMessage().equals(SQLITE_EXCEPTION_DETAIL_MESSAGE);
+ }
+
+ @UnsupportedAppUsage
+ public static void checkSQLiteException(Context context, SQLiteException e) {
+ if (isLowMemory(e)) {
+ Toast.makeText(context, com.android.internal.R.string.low_memory,
+ Toast.LENGTH_SHORT).show();
+ } else {
+ throw e;
+ }
+ }
+
+ @UnsupportedAppUsage
+ public static Cursor query(Context context, ContentResolver resolver, Uri uri,
+ String[] projection, String selection, String[] selectionArgs, String sortOrder) {
+ try {
+ return resolver.query(uri, projection, selection, selectionArgs, sortOrder);
+ } catch (SQLiteException e) {
+ Log.e(TAG, "Catch a SQLiteException when query: ", e);
+ checkSQLiteException(context, e);
+ return null;
+ }
+ }
+
+ @UnsupportedAppUsage
+ public static boolean requery(Context context, Cursor cursor) {
+ try {
+ return cursor.requery();
+ } catch (SQLiteException e) {
+ Log.e(TAG, "Catch a SQLiteException when requery: ", e);
+ checkSQLiteException(context, e);
+ return false;
+ }
+ }
+ @UnsupportedAppUsage
+ public static int update(Context context, ContentResolver resolver, Uri uri,
+ ContentValues values, String where, String[] selectionArgs) {
+ try {
+ return resolver.update(uri, values, where, selectionArgs);
+ } catch (SQLiteException e) {
+ Log.e(TAG, "Catch a SQLiteException when update: ", e);
+ checkSQLiteException(context, e);
+ return -1;
+ }
+ }
+
+ @UnsupportedAppUsage
+ public static int delete(Context context, ContentResolver resolver, Uri uri,
+ String where, String[] selectionArgs) {
+ try {
+ return resolver.delete(uri, where, selectionArgs);
+ } catch (SQLiteException e) {
+ Log.e(TAG, "Catch a SQLiteException when delete: ", e);
+ checkSQLiteException(context, e);
+ return -1;
+ }
+ }
+
+ @UnsupportedAppUsage
+ public static Uri insert(Context context, ContentResolver resolver,
+ Uri uri, ContentValues values) {
+ try {
+ return resolver.insert(uri, values);
+ } catch (SQLiteException e) {
+ Log.e(TAG, "Catch a SQLiteException when insert: ", e);
+ checkSQLiteException(context, e);
+ return null;
+ }
+ }
+}
diff --git a/telephony/common/com/google/android/mms/util/package.html b/telephony/common/com/google/android/mms/util/package.html
new file mode 100755
index 000000000000..c9f96a66ab3b
--- /dev/null
+++ b/telephony/common/com/google/android/mms/util/package.html
@@ -0,0 +1,5 @@
+<body>
+
+{@hide}
+
+</body>
diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java
index ddda010a94a4..d3728a6dd178 100644
--- a/telephony/java/android/provider/Telephony.java
+++ b/telephony/java/android/provider/Telephony.java
@@ -3963,13 +3963,21 @@ public final class Telephony {
public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
/**
- * The id of the subscription which received this cell broadcast message.
+ * The subscription which received this cell broadcast message.
+ * @deprecated use {@link #SLOT_INDEX} instead.
* <P>Type: INTEGER</P>
* @hide
*/
public static final String SUB_ID = "sub_id";
/**
+ * The slot which received this cell broadcast message.
+ * <P>Type: INTEGER</P>
+ * @hide
+ */
+ public static final String SLOT_INDEX = "slot_index";
+
+ /**
* Message geographical scope. Valid values are:
* <ul>
* <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE}. meaning the
@@ -4203,7 +4211,7 @@ public final class Telephony {
public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time";
/**
- * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
+ * Query columns for instantiating com.android.cellbroadcastreceiver.CellBroadcastMessage.
* @hide
*/
@NonNull
@@ -4236,6 +4244,7 @@ public final class Telephony {
*/
public static final String[] QUERY_COLUMNS_FWK = {
_ID,
+ SLOT_INDEX,
GEOGRAPHICAL_SCOPE,
PLMN,
LAC,
diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java
new file mode 100644
index 000000000000..a884a7039d5b
--- /dev/null
+++ b/telephony/java/android/telephony/Annotation.java
@@ -0,0 +1,472 @@
+package android.telephony;
+
+import android.annotation.IntDef;
+import android.telephony.data.ApnSetting;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Telephony Annotations.
+ * Telephony sdk is a mainline module and others cannot reference hidden @IntDef. Moving some
+ * telephony annotations to a separate class to allow others statically link to it.
+ *
+ * @hide
+ */
+public class Annotation {
+ @IntDef(prefix = {"DATA_"}, value = {
+ TelephonyManager.DATA_ACTIVITY_NONE,
+ TelephonyManager.DATA_ACTIVITY_IN,
+ TelephonyManager.DATA_ACTIVITY_OUT,
+ TelephonyManager.DATA_ACTIVITY_INOUT,
+ TelephonyManager.DATA_ACTIVITY_DORMANT,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataActivityType {
+ }
+
+ @IntDef(prefix = {"DATA_"}, value = {
+ TelephonyManager.DATA_UNKNOWN,
+ TelephonyManager.DATA_DISCONNECTED,
+ TelephonyManager.DATA_CONNECTING,
+ TelephonyManager.DATA_CONNECTED,
+ TelephonyManager.DATA_SUSPENDED,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataState {
+ }
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"RADIO_POWER_"},
+ value = {
+ TelephonyManager.RADIO_POWER_OFF,
+ TelephonyManager.RADIO_POWER_ON,
+ TelephonyManager.RADIO_POWER_UNAVAILABLE,
+ })
+ public @interface RadioPowerState {
+ }
+
+ @IntDef({
+ TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN,
+ TelephonyManager.SIM_ACTIVATION_STATE_ACTIVATING,
+ TelephonyManager.SIM_ACTIVATION_STATE_ACTIVATED,
+ TelephonyManager.SIM_ACTIVATION_STATE_DEACTIVATED,
+ TelephonyManager.SIM_ACTIVATION_STATE_RESTRICTED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface SimActivationState {
+ }
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"SRVCC_STATE_"},
+ value = {
+ TelephonyManager.SRVCC_STATE_HANDOVER_NONE,
+ TelephonyManager.SRVCC_STATE_HANDOVER_STARTED,
+ TelephonyManager.SRVCC_STATE_HANDOVER_COMPLETED,
+ TelephonyManager.SRVCC_STATE_HANDOVER_FAILED,
+ TelephonyManager.SRVCC_STATE_HANDOVER_CANCELED})
+ public @interface SrvccState {
+ }
+
+ @IntDef(prefix = {"CALL_STATE_"}, value = {
+ TelephonyManager.CALL_STATE_IDLE,
+ TelephonyManager.CALL_STATE_RINGING,
+ TelephonyManager.CALL_STATE_OFFHOOK
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface CallState {
+ }
+
+ @IntDef({
+ TelephonyManager.NETWORK_TYPE_UNKNOWN,
+ TelephonyManager.NETWORK_TYPE_GPRS,
+ TelephonyManager.NETWORK_TYPE_EDGE,
+ TelephonyManager.NETWORK_TYPE_UMTS,
+ TelephonyManager.NETWORK_TYPE_CDMA,
+ TelephonyManager.NETWORK_TYPE_EVDO_0,
+ TelephonyManager.NETWORK_TYPE_EVDO_A,
+ TelephonyManager.NETWORK_TYPE_1xRTT,
+ TelephonyManager.NETWORK_TYPE_HSDPA,
+ TelephonyManager.NETWORK_TYPE_HSUPA,
+ TelephonyManager.NETWORK_TYPE_HSPA,
+ TelephonyManager.NETWORK_TYPE_IDEN,
+ TelephonyManager.NETWORK_TYPE_EVDO_B,
+ TelephonyManager.NETWORK_TYPE_LTE,
+ TelephonyManager.NETWORK_TYPE_EHRPD,
+ TelephonyManager.NETWORK_TYPE_HSPAP,
+ TelephonyManager.NETWORK_TYPE_GSM,
+ TelephonyManager.NETWORK_TYPE_TD_SCDMA,
+ TelephonyManager.NETWORK_TYPE_IWLAN,
+ TelephonyManager.NETWORK_TYPE_LTE_CA,
+ TelephonyManager.NETWORK_TYPE_NR,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface NetworkType {
+ }
+
+ @IntDef(flag = true, prefix = {"TYPE_"}, value = {
+ ApnSetting.TYPE_DEFAULT,
+ ApnSetting.TYPE_MMS,
+ ApnSetting.TYPE_SUPL,
+ ApnSetting.TYPE_DUN,
+ ApnSetting.TYPE_HIPRI,
+ ApnSetting.TYPE_FOTA,
+ ApnSetting.TYPE_IMS,
+ ApnSetting.TYPE_CBS,
+ ApnSetting.TYPE_IA,
+ ApnSetting.TYPE_EMERGENCY,
+ ApnSetting.TYPE_MCX
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ApnType {
+ }
+
+ @IntDef(value = {
+ DataFailCause.NONE,
+ DataFailCause.OPERATOR_BARRED,
+ DataFailCause.NAS_SIGNALLING,
+ DataFailCause.LLC_SNDCP,
+ DataFailCause.INSUFFICIENT_RESOURCES,
+ DataFailCause.MISSING_UNKNOWN_APN,
+ DataFailCause.UNKNOWN_PDP_ADDRESS_TYPE,
+ DataFailCause.USER_AUTHENTICATION,
+ DataFailCause.ACTIVATION_REJECT_GGSN,
+ DataFailCause.ACTIVATION_REJECT_UNSPECIFIED,
+ DataFailCause.SERVICE_OPTION_NOT_SUPPORTED,
+ DataFailCause.SERVICE_OPTION_NOT_SUBSCRIBED,
+ DataFailCause.SERVICE_OPTION_OUT_OF_ORDER,
+ DataFailCause.NSAPI_IN_USE,
+ DataFailCause.REGULAR_DEACTIVATION,
+ DataFailCause.QOS_NOT_ACCEPTED,
+ DataFailCause.NETWORK_FAILURE,
+ DataFailCause.UMTS_REACTIVATION_REQ,
+ DataFailCause.FEATURE_NOT_SUPP,
+ DataFailCause.TFT_SEMANTIC_ERROR,
+ DataFailCause.TFT_SYTAX_ERROR,
+ DataFailCause.UNKNOWN_PDP_CONTEXT,
+ DataFailCause.FILTER_SEMANTIC_ERROR,
+ DataFailCause.FILTER_SYTAX_ERROR,
+ DataFailCause.PDP_WITHOUT_ACTIVE_TFT,
+ DataFailCause.ACTIVATION_REJECTED_BCM_VIOLATION,
+ DataFailCause.ONLY_IPV4_ALLOWED,
+ DataFailCause.ONLY_IPV6_ALLOWED,
+ DataFailCause.ONLY_SINGLE_BEARER_ALLOWED,
+ DataFailCause.ESM_INFO_NOT_RECEIVED,
+ DataFailCause.PDN_CONN_DOES_NOT_EXIST,
+ DataFailCause.MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED,
+ DataFailCause.COLLISION_WITH_NETWORK_INITIATED_REQUEST,
+ DataFailCause.ONLY_IPV4V6_ALLOWED,
+ DataFailCause.ONLY_NON_IP_ALLOWED,
+ DataFailCause.UNSUPPORTED_QCI_VALUE,
+ DataFailCause.BEARER_HANDLING_NOT_SUPPORTED,
+ DataFailCause.ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED,
+ DataFailCause.UNSUPPORTED_APN_IN_CURRENT_PLMN,
+ DataFailCause.INVALID_TRANSACTION_ID,
+ DataFailCause.MESSAGE_INCORRECT_SEMANTIC,
+ DataFailCause.INVALID_MANDATORY_INFO,
+ DataFailCause.MESSAGE_TYPE_UNSUPPORTED,
+ DataFailCause.MSG_TYPE_NONCOMPATIBLE_STATE,
+ DataFailCause.UNKNOWN_INFO_ELEMENT,
+ DataFailCause.CONDITIONAL_IE_ERROR,
+ DataFailCause.MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE,
+ DataFailCause.PROTOCOL_ERRORS,
+ DataFailCause.APN_TYPE_CONFLICT,
+ DataFailCause.INVALID_PCSCF_ADDR,
+ DataFailCause.INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN,
+ DataFailCause.EMM_ACCESS_BARRED,
+ DataFailCause.EMERGENCY_IFACE_ONLY,
+ DataFailCause.IFACE_MISMATCH,
+ DataFailCause.COMPANION_IFACE_IN_USE,
+ DataFailCause.IP_ADDRESS_MISMATCH,
+ DataFailCause.IFACE_AND_POL_FAMILY_MISMATCH,
+ DataFailCause.EMM_ACCESS_BARRED_INFINITE_RETRY,
+ DataFailCause.AUTH_FAILURE_ON_EMERGENCY_CALL,
+ DataFailCause.INVALID_DNS_ADDR,
+ DataFailCause.INVALID_PCSCF_OR_DNS_ADDRESS,
+ DataFailCause.CALL_PREEMPT_BY_EMERGENCY_APN,
+ DataFailCause.UE_INITIATED_DETACH_OR_DISCONNECT,
+ DataFailCause.MIP_FA_REASON_UNSPECIFIED,
+ DataFailCause.MIP_FA_ADMIN_PROHIBITED,
+ DataFailCause.MIP_FA_INSUFFICIENT_RESOURCES,
+ DataFailCause.MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE,
+ DataFailCause.MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE,
+ DataFailCause.MIP_FA_REQUESTED_LIFETIME_TOO_LONG,
+ DataFailCause.MIP_FA_MALFORMED_REQUEST,
+ DataFailCause.MIP_FA_MALFORMED_REPLY,
+ DataFailCause.MIP_FA_ENCAPSULATION_UNAVAILABLE,
+ DataFailCause.MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE,
+ DataFailCause.MIP_FA_REVERSE_TUNNEL_UNAVAILABLE,
+ DataFailCause.MIP_FA_REVERSE_TUNNEL_IS_MANDATORY,
+ DataFailCause.MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED,
+ DataFailCause.MIP_FA_MISSING_NAI,
+ DataFailCause.MIP_FA_MISSING_HOME_AGENT,
+ DataFailCause.MIP_FA_MISSING_HOME_ADDRESS,
+ DataFailCause.MIP_FA_UNKNOWN_CHALLENGE,
+ DataFailCause.MIP_FA_MISSING_CHALLENGE,
+ DataFailCause.MIP_FA_STALE_CHALLENGE,
+ DataFailCause.MIP_HA_REASON_UNSPECIFIED,
+ DataFailCause.MIP_HA_ADMIN_PROHIBITED,
+ DataFailCause.MIP_HA_INSUFFICIENT_RESOURCES,
+ DataFailCause.MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE,
+ DataFailCause.MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE,
+ DataFailCause.MIP_HA_REGISTRATION_ID_MISMATCH,
+ DataFailCause.MIP_HA_MALFORMED_REQUEST,
+ DataFailCause.MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS,
+ DataFailCause.MIP_HA_REVERSE_TUNNEL_UNAVAILABLE,
+ DataFailCause.MIP_HA_REVERSE_TUNNEL_IS_MANDATORY,
+ DataFailCause.MIP_HA_ENCAPSULATION_UNAVAILABLE,
+ DataFailCause.CLOSE_IN_PROGRESS,
+ DataFailCause.NETWORK_INITIATED_TERMINATION,
+ DataFailCause.MODEM_APP_PREEMPTED,
+ DataFailCause.PDN_IPV4_CALL_DISALLOWED,
+ DataFailCause.PDN_IPV4_CALL_THROTTLED,
+ DataFailCause.PDN_IPV6_CALL_DISALLOWED,
+ DataFailCause.PDN_IPV6_CALL_THROTTLED,
+ DataFailCause.MODEM_RESTART,
+ DataFailCause.PDP_PPP_NOT_SUPPORTED,
+ DataFailCause.UNPREFERRED_RAT,
+ DataFailCause.PHYSICAL_LINK_CLOSE_IN_PROGRESS,
+ DataFailCause.APN_PENDING_HANDOVER,
+ DataFailCause.PROFILE_BEARER_INCOMPATIBLE,
+ DataFailCause.SIM_CARD_CHANGED,
+ DataFailCause.LOW_POWER_MODE_OR_POWERING_DOWN,
+ DataFailCause.APN_DISABLED,
+ DataFailCause.MAX_PPP_INACTIVITY_TIMER_EXPIRED,
+ DataFailCause.IPV6_ADDRESS_TRANSFER_FAILED,
+ DataFailCause.TRAT_SWAP_FAILED,
+ DataFailCause.EHRPD_TO_HRPD_FALLBACK,
+ DataFailCause.MIP_CONFIG_FAILURE,
+ DataFailCause.PDN_INACTIVITY_TIMER_EXPIRED,
+ DataFailCause.MAX_IPV4_CONNECTIONS,
+ DataFailCause.MAX_IPV6_CONNECTIONS,
+ DataFailCause.APN_MISMATCH,
+ DataFailCause.IP_VERSION_MISMATCH,
+ DataFailCause.DUN_CALL_DISALLOWED,
+ DataFailCause.INTERNAL_EPC_NONEPC_TRANSITION,
+ DataFailCause.INTERFACE_IN_USE,
+ DataFailCause.APN_DISALLOWED_ON_ROAMING,
+ DataFailCause.APN_PARAMETERS_CHANGED,
+ DataFailCause.NULL_APN_DISALLOWED,
+ DataFailCause.THERMAL_MITIGATION,
+ DataFailCause.DATA_SETTINGS_DISABLED,
+ DataFailCause.DATA_ROAMING_SETTINGS_DISABLED,
+ DataFailCause.DDS_SWITCHED,
+ DataFailCause.FORBIDDEN_APN_NAME,
+ DataFailCause.DDS_SWITCH_IN_PROGRESS,
+ DataFailCause.CALL_DISALLOWED_IN_ROAMING,
+ DataFailCause.NON_IP_NOT_SUPPORTED,
+ DataFailCause.PDN_NON_IP_CALL_THROTTLED,
+ DataFailCause.PDN_NON_IP_CALL_DISALLOWED,
+ DataFailCause.CDMA_LOCK,
+ DataFailCause.CDMA_INTERCEPT,
+ DataFailCause.CDMA_REORDER,
+ DataFailCause.CDMA_RELEASE_DUE_TO_SO_REJECTION,
+ DataFailCause.CDMA_INCOMING_CALL,
+ DataFailCause.CDMA_ALERT_STOP,
+ DataFailCause.CHANNEL_ACQUISITION_FAILURE,
+ DataFailCause.MAX_ACCESS_PROBE,
+ DataFailCause.CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION,
+ DataFailCause.NO_RESPONSE_FROM_BASE_STATION,
+ DataFailCause.REJECTED_BY_BASE_STATION,
+ DataFailCause.CONCURRENT_SERVICES_INCOMPATIBLE,
+ DataFailCause.NO_CDMA_SERVICE,
+ DataFailCause.RUIM_NOT_PRESENT,
+ DataFailCause.CDMA_RETRY_ORDER,
+ DataFailCause.ACCESS_BLOCK,
+ DataFailCause.ACCESS_BLOCK_ALL,
+ DataFailCause.IS707B_MAX_ACCESS_PROBES,
+ DataFailCause.THERMAL_EMERGENCY,
+ DataFailCause.CONCURRENT_SERVICES_NOT_ALLOWED,
+ DataFailCause.INCOMING_CALL_REJECTED,
+ DataFailCause.NO_SERVICE_ON_GATEWAY,
+ DataFailCause.NO_GPRS_CONTEXT,
+ DataFailCause.ILLEGAL_MS,
+ DataFailCause.ILLEGAL_ME,
+ DataFailCause.GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED,
+ DataFailCause.GPRS_SERVICES_NOT_ALLOWED,
+ DataFailCause.MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK,
+ DataFailCause.IMPLICITLY_DETACHED,
+ DataFailCause.PLMN_NOT_ALLOWED,
+ DataFailCause.LOCATION_AREA_NOT_ALLOWED,
+ DataFailCause.GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
+ DataFailCause.PDP_DUPLICATE,
+ DataFailCause.UE_RAT_CHANGE,
+ DataFailCause.CONGESTION,
+ DataFailCause.NO_PDP_CONTEXT_ACTIVATED,
+ DataFailCause.ACCESS_CLASS_DSAC_REJECTION,
+ DataFailCause.PDP_ACTIVATE_MAX_RETRY_FAILED,
+ DataFailCause.RADIO_ACCESS_BEARER_FAILURE,
+ DataFailCause.ESM_UNKNOWN_EPS_BEARER_CONTEXT,
+ DataFailCause.DRB_RELEASED_BY_RRC,
+ DataFailCause.CONNECTION_RELEASED,
+ DataFailCause.EMM_DETACHED,
+ DataFailCause.EMM_ATTACH_FAILED,
+ DataFailCause.EMM_ATTACH_STARTED,
+ DataFailCause.LTE_NAS_SERVICE_REQUEST_FAILED,
+ DataFailCause.DUPLICATE_BEARER_ID,
+ DataFailCause.ESM_COLLISION_SCENARIOS,
+ DataFailCause.ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK,
+ DataFailCause.ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER,
+ DataFailCause.ESM_BAD_OTA_MESSAGE,
+ DataFailCause.ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL,
+ DataFailCause.ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT,
+ DataFailCause.DS_EXPLICIT_DEACTIVATION,
+ DataFailCause.ESM_LOCAL_CAUSE_NONE,
+ DataFailCause.LTE_THROTTLING_NOT_REQUIRED,
+ DataFailCause.ACCESS_CONTROL_LIST_CHECK_FAILURE,
+ DataFailCause.SERVICE_NOT_ALLOWED_ON_PLMN,
+ DataFailCause.EMM_T3417_EXPIRED,
+ DataFailCause.EMM_T3417_EXT_EXPIRED,
+ DataFailCause.RRC_UPLINK_DATA_TRANSMISSION_FAILURE,
+ DataFailCause.RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER,
+ DataFailCause.RRC_UPLINK_CONNECTION_RELEASE,
+ DataFailCause.RRC_UPLINK_RADIO_LINK_FAILURE,
+ DataFailCause.RRC_UPLINK_ERROR_REQUEST_FROM_NAS,
+ DataFailCause.RRC_CONNECTION_ACCESS_STRATUM_FAILURE,
+ DataFailCause.RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS,
+ DataFailCause.RRC_CONNECTION_ACCESS_BARRED,
+ DataFailCause.RRC_CONNECTION_CELL_RESELECTION,
+ DataFailCause.RRC_CONNECTION_CONFIG_FAILURE,
+ DataFailCause.RRC_CONNECTION_TIMER_EXPIRED,
+ DataFailCause.RRC_CONNECTION_LINK_FAILURE,
+ DataFailCause.RRC_CONNECTION_CELL_NOT_CAMPED,
+ DataFailCause.RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE,
+ DataFailCause.RRC_CONNECTION_REJECT_BY_NETWORK,
+ DataFailCause.RRC_CONNECTION_NORMAL_RELEASE,
+ DataFailCause.RRC_CONNECTION_RADIO_LINK_FAILURE,
+ DataFailCause.RRC_CONNECTION_REESTABLISHMENT_FAILURE,
+ DataFailCause.RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER,
+ DataFailCause.RRC_CONNECTION_ABORT_REQUEST,
+ DataFailCause.RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR,
+ DataFailCause.NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH,
+ DataFailCause.NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH,
+ DataFailCause.ESM_PROCEDURE_TIME_OUT,
+ DataFailCause.INVALID_CONNECTION_ID,
+ DataFailCause.MAXIMIUM_NSAPIS_EXCEEDED,
+ DataFailCause.INVALID_PRIMARY_NSAPI,
+ DataFailCause.CANNOT_ENCODE_OTA_MESSAGE,
+ DataFailCause.RADIO_ACCESS_BEARER_SETUP_FAILURE,
+ DataFailCause.PDP_ESTABLISH_TIMEOUT_EXPIRED,
+ DataFailCause.PDP_MODIFY_TIMEOUT_EXPIRED,
+ DataFailCause.PDP_INACTIVE_TIMEOUT_EXPIRED,
+ DataFailCause.PDP_LOWERLAYER_ERROR,
+ DataFailCause.PDP_MODIFY_COLLISION,
+ DataFailCause.MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED,
+ DataFailCause.NAS_REQUEST_REJECTED_BY_NETWORK,
+ DataFailCause.RRC_CONNECTION_INVALID_REQUEST,
+ DataFailCause.RRC_CONNECTION_TRACKING_AREA_ID_CHANGED,
+ DataFailCause.RRC_CONNECTION_RF_UNAVAILABLE,
+ DataFailCause.RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE,
+ DataFailCause.RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE,
+ DataFailCause.RRC_CONNECTION_ABORTED_AFTER_HANDOVER,
+ DataFailCause.RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE,
+ DataFailCause.RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE,
+ DataFailCause.IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER,
+ DataFailCause.IMEI_NOT_ACCEPTED,
+ DataFailCause.EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED,
+ DataFailCause.EPS_SERVICES_NOT_ALLOWED_IN_PLMN,
+ DataFailCause.MSC_TEMPORARILY_NOT_REACHABLE,
+ DataFailCause.CS_DOMAIN_NOT_AVAILABLE,
+ DataFailCause.ESM_FAILURE,
+ DataFailCause.MAC_FAILURE,
+ DataFailCause.SYNCHRONIZATION_FAILURE,
+ DataFailCause.UE_SECURITY_CAPABILITIES_MISMATCH,
+ DataFailCause.SECURITY_MODE_REJECTED,
+ DataFailCause.UNACCEPTABLE_NON_EPS_AUTHENTICATION,
+ DataFailCause.CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED,
+ DataFailCause.NO_EPS_BEARER_CONTEXT_ACTIVATED,
+ DataFailCause.INVALID_EMM_STATE,
+ DataFailCause.NAS_LAYER_FAILURE,
+ DataFailCause.MULTIPLE_PDP_CALL_NOT_ALLOWED,
+ DataFailCause.EMBMS_NOT_ENABLED,
+ DataFailCause.IRAT_HANDOVER_FAILED,
+ DataFailCause.EMBMS_REGULAR_DEACTIVATION,
+ DataFailCause.TEST_LOOPBACK_REGULAR_DEACTIVATION,
+ DataFailCause.LOWER_LAYER_REGISTRATION_FAILURE,
+ DataFailCause.DATA_PLAN_EXPIRED,
+ DataFailCause.UMTS_HANDOVER_TO_IWLAN,
+ DataFailCause.EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY,
+ DataFailCause.EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE,
+ DataFailCause.EVDO_HDR_CHANGED,
+ DataFailCause.EVDO_HDR_EXITED,
+ DataFailCause.EVDO_HDR_NO_SESSION,
+ DataFailCause.EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL,
+ DataFailCause.EVDO_HDR_CONNECTION_SETUP_TIMEOUT,
+ DataFailCause.FAILED_TO_ACQUIRE_COLOCATED_HDR,
+ DataFailCause.OTASP_COMMIT_IN_PROGRESS,
+ DataFailCause.NO_HYBRID_HDR_SERVICE,
+ DataFailCause.HDR_NO_LOCK_GRANTED,
+ DataFailCause.DBM_OR_SMS_IN_PROGRESS,
+ DataFailCause.HDR_FADE,
+ DataFailCause.HDR_ACCESS_FAILURE,
+ DataFailCause.UNSUPPORTED_1X_PREV,
+ DataFailCause.LOCAL_END,
+ DataFailCause.NO_SERVICE,
+ DataFailCause.FADE,
+ DataFailCause.NORMAL_RELEASE,
+ DataFailCause.ACCESS_ATTEMPT_ALREADY_IN_PROGRESS,
+ DataFailCause.REDIRECTION_OR_HANDOFF_IN_PROGRESS,
+ DataFailCause.EMERGENCY_MODE,
+ DataFailCause.PHONE_IN_USE,
+ DataFailCause.INVALID_MODE,
+ DataFailCause.INVALID_SIM_STATE,
+ DataFailCause.NO_COLLOCATED_HDR,
+ DataFailCause.UE_IS_ENTERING_POWERSAVE_MODE,
+ DataFailCause.DUAL_SWITCH,
+ DataFailCause.PPP_TIMEOUT,
+ DataFailCause.PPP_AUTH_FAILURE,
+ DataFailCause.PPP_OPTION_MISMATCH,
+ DataFailCause.PPP_PAP_FAILURE,
+ DataFailCause.PPP_CHAP_FAILURE,
+ DataFailCause.PPP_CLOSE_IN_PROGRESS,
+ DataFailCause.LIMITED_TO_IPV4,
+ DataFailCause.LIMITED_TO_IPV6,
+ DataFailCause.VSNCP_TIMEOUT,
+ DataFailCause.VSNCP_GEN_ERROR,
+ DataFailCause.VSNCP_APN_UNATHORIZED,
+ DataFailCause.VSNCP_PDN_LIMIT_EXCEEDED,
+ DataFailCause.VSNCP_NO_PDN_GATEWAY_ADDRESS,
+ DataFailCause.VSNCP_PDN_GATEWAY_UNREACHABLE,
+ DataFailCause.VSNCP_PDN_GATEWAY_REJECT,
+ DataFailCause.VSNCP_INSUFFICIENT_PARAMETERS,
+ DataFailCause.VSNCP_RESOURCE_UNAVAILABLE,
+ DataFailCause.VSNCP_ADMINISTRATIVELY_PROHIBITED,
+ DataFailCause.VSNCP_PDN_ID_IN_USE,
+ DataFailCause.VSNCP_SUBSCRIBER_LIMITATION,
+ DataFailCause.VSNCP_PDN_EXISTS_FOR_THIS_APN,
+ DataFailCause.VSNCP_RECONNECT_NOT_ALLOWED,
+ DataFailCause.IPV6_PREFIX_UNAVAILABLE,
+ DataFailCause.HANDOFF_PREFERENCE_CHANGED,
+ DataFailCause.OEM_DCFAILCAUSE_1,
+ DataFailCause.OEM_DCFAILCAUSE_2,
+ DataFailCause.OEM_DCFAILCAUSE_3,
+ DataFailCause.OEM_DCFAILCAUSE_4,
+ DataFailCause.OEM_DCFAILCAUSE_5,
+ DataFailCause.OEM_DCFAILCAUSE_6,
+ DataFailCause.OEM_DCFAILCAUSE_7,
+ DataFailCause.OEM_DCFAILCAUSE_8,
+ DataFailCause.OEM_DCFAILCAUSE_9,
+ DataFailCause.OEM_DCFAILCAUSE_10,
+ DataFailCause.OEM_DCFAILCAUSE_11,
+ DataFailCause.OEM_DCFAILCAUSE_12,
+ DataFailCause.OEM_DCFAILCAUSE_13,
+ DataFailCause.OEM_DCFAILCAUSE_14,
+ DataFailCause.OEM_DCFAILCAUSE_15,
+ DataFailCause.REGISTRATION_FAIL,
+ DataFailCause.GPRS_REGISTRATION_FAIL,
+ DataFailCause.SIGNAL_LOST,
+ DataFailCause.PREF_RADIO_TECH_CHANGED,
+ DataFailCause.RADIO_POWER_OFF,
+ DataFailCause.TETHERED_CALL_ACTIVE,
+ DataFailCause.ERROR_UNSPECIFIED,
+ DataFailCause.UNKNOWN,
+ DataFailCause.RADIO_NOT_AVAILABLE,
+ DataFailCause.UNACCEPTABLE_NETWORK_PARAMETER,
+ DataFailCause.CONNECTION_TO_DATACONNECTIONAC_BROKEN,
+ DataFailCause.LOST_CONNECTION,
+ DataFailCause.RESET_BY_FRAMEWORK
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataFailureCause {
+ }
+}
diff --git a/telephony/java/android/telephony/CallAttributes.java b/telephony/java/android/telephony/CallAttributes.java
index 1c03d8089df7..cd830adf23b0 100644
--- a/telephony/java/android/telephony/CallAttributes.java
+++ b/telephony/java/android/telephony/CallAttributes.java
@@ -21,8 +21,8 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.telephony.TelephonyManager.NetworkType;
+import android.telephony.Annotation.NetworkType;
import java.util.Objects;
/**
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index dc9d0763adb7..90a61f9aa207 100755..100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -1448,6 +1448,15 @@ public class CarrierConfigManager {
"stk_disable_launch_browser_bool";
/**
+ * Boolean indicating if the helper text for STK GET INKEY/INPUT commands with the digit only
+ * mode is displayed on the input screen.
+ * The helper text is dispayed regardless of the input mode, if {@code false}.
+ * @hide
+ */
+ public static final String KEY_HIDE_DIGITS_HELPER_TEXT_ON_STK_INPUT_SCREEN_BOOL =
+ "hide_digits_helper_text_on_stk_input_screen_bool";
+
+ /**
* Boolean indicating if show data RAT icon on status bar even when data is disabled
* @hide
*/
@@ -1829,6 +1838,13 @@ public class CarrierConfigManager {
"support_direct_fdn_dialing_bool";
/**
+ * Int indicating the max number length for FDN
+ * @hide
+ */
+ public static final String KEY_FDN_NUMBER_LENGTH_LIMIT_INT =
+ "fdn_number_length_limit_int";
+
+ /**
* Report IMEI as device id even if it's a CDMA/LTE phone.
*
* @hide
@@ -2826,6 +2842,28 @@ public class CarrierConfigManager {
"ping_test_before_data_switch_bool";
/**
+ * Controls whether to switch data to primary from opportunistic subscription
+ * if primary is out of service. This control only affects system or 1st party app
+ * initiated data switch, but will not override data switch initiated by privileged carrier apps
+ * This carrier config is used to disable this feature.
+ * @hide
+ */
+ public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL =
+ "switch_data_to_primary_if_primary_is_oos_bool";
+
+ /**
+ * Controls back off time in milli seconds for switching back to
+ * opportunistic subscription. This time will be added to
+ * {@link CarrierConfigManager#KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG} to
+ * determine hysteresis time if there is frequent switching
+ * (determined by system app or 1st party app) between primary and opportunistic
+ * subscription.
+ * @hide
+ */
+ public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG =
+ "opportunistic_network_backoff_time_long";
+
+ /**
* Indicates zero or more emergency number prefix(es), because some carrier requires
* if users dial an emergency number address with a specific prefix, the combination of the
* prefix and the address is also a valid emergency number to dial. For example, an emergency
@@ -2865,6 +2903,16 @@ public class CarrierConfigManager {
"always_show_primary_signal_bar_in_opportunistic_network_boolean";
/**
+ * Upon data switching between subscriptions within a carrier group, if switch depends on
+ * validation result, this value defines customized value of how long we wait for validation
+ * success before we fail and revoke the switch.
+ * Time out is in milliseconds.
+ * @hide
+ */
+ public static final String KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG =
+ "data_switch_validation_timeout_long";
+
+ /**
* GPS configs. See android.hardware.gnss@1.0 IGnssConfiguration.
* @hide
*/
@@ -3209,6 +3257,14 @@ public class CarrierConfigManager {
public static final String KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY =
"disconnect_cause_play_busytone_int_array";
+ /**
+ * Flag specifying whether to prevent sending CLIR activation("*31#") and deactivation("#31#")
+ * code only without dialing number.
+ * When {@code true}, these are prevented, {@code false} otherwise.
+ */
+ public static final String KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL =
+ "prevent_clir_activation_and_deactivation_code_bool";
+
/** The default value for every variable. */
private final static PersistableBundle sDefaults;
@@ -3411,6 +3467,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_CDMA_HOME_REGISTERED_PLMN_NAME_OVERRIDE_BOOL, false);
sDefaults.putString(KEY_CDMA_HOME_REGISTERED_PLMN_NAME_STRING, "");
sDefaults.putBoolean(KEY_SUPPORT_DIRECT_FDN_DIALING_BOOL, false);
+ sDefaults.putInt(KEY_FDN_NUMBER_LENGTH_LIMIT_INT, 20);
sDefaults.putBoolean(KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL, false);
sDefaults.putBoolean(KEY_SKIP_CF_FAIL_TO_DISABLE_DIALOG_BOOL, false);
sDefaults.putBoolean(KEY_SUPPORT_ENHANCED_CALL_BLOCKING_BOOL, true);
@@ -3519,6 +3576,7 @@ public class CarrierConfigManager {
sDefaults.putBoolean(KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL, false);
sDefaults.putBoolean(KEY_STK_DISABLE_LAUNCH_BROWSER_BOOL, false);
sDefaults.putBoolean(KEY_ALLOW_METERED_NETWORK_FOR_CERT_DOWNLOAD_BOOL, false);
+ sDefaults.putBoolean(KEY_HIDE_DIGITS_HELPER_TEXT_ON_STK_INPUT_SCREEN_BOOL, true);
sDefaults.putStringArray(KEY_CARRIER_WIFI_STRING_ARRAY, null);
sDefaults.putInt(KEY_PREF_NETWORK_NOTIFICATION_DELAY_INT, -1);
sDefaults.putInt(KEY_EMERGENCY_NOTIFICATION_DELAY_INT, -1);
@@ -3612,6 +3670,9 @@ public class CarrierConfigManager {
/* Default value is 3 seconds. */
sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG, 3000);
sDefaults.putBoolean(KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL, true);
+ sDefaults.putBoolean(KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL, true);
+ /* Default value is 10 seconds. */
+ sDefaults.putLong(KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG, 10000);
sDefaults.putAll(Gps.getDefaults());
sDefaults.putAll(Wifi.getDefaults());
sDefaults.putIntArray(KEY_CDMA_ENHANCED_ROAMING_INDICATOR_FOR_HOME_NETWORK_INT_ARRAY,
@@ -3639,6 +3700,8 @@ public class CarrierConfigManager {
sDefaults.putStringArray(KEY_CARRIER_CERTIFICATE_STRING_ARRAY, null);
sDefaults.putIntArray(KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY,
new int[] {4 /* BUSY */});
+ sDefaults.putBoolean(KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL, false);
+ sDefaults.putLong(KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG, 2000);
}
/**
diff --git a/telephony/java/android/telephony/CellBroadcastService.java b/telephony/java/android/telephony/CellBroadcastService.java
index d5e447e6c73d..f841df2320e0 100644
--- a/telephony/java/android/telephony/CellBroadcastService.java
+++ b/telephony/java/android/telephony/CellBroadcastService.java
@@ -17,10 +17,18 @@
package android.telephony;
import android.annotation.CallSuper;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
+import android.os.Bundle;
import android.os.IBinder;
+import android.os.RemoteCallback;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+
+import java.util.List;
+import java.util.function.Consumer;
/**
* A service which exposes the cell broadcast handling module to the system.
@@ -45,6 +53,7 @@ import android.os.IBinder;
* </service>
* </manifest>
* }</pre>
+ *
* @hide
*/
@SystemApi
@@ -61,17 +70,36 @@ public abstract class CellBroadcastService extends Service {
/**
* Handle a GSM cell broadcast SMS message forwarded from the system.
+ *
* @param slotIndex the index of the slot which received the message
- * @param message the SMS PDU
+ * @param message the SMS PDU
*/
- public abstract void onGsmCellBroadcastSms(int slotIndex, byte[] message);
+ public abstract void onGsmCellBroadcastSms(int slotIndex, @NonNull byte[] message);
/**
* Handle a CDMA cell broadcast SMS message forwarded from the system.
- * @param slotIndex the index of the slot which received the message
- * @param message the SMS PDU
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param bearerData the CDMA SMS bearer data
+ * @param serviceCategory the CDMA SCPT service category
+ */
+ public abstract void onCdmaCellBroadcastSms(int slotIndex, @NonNull byte[] bearerData,
+ @CdmaSmsCbProgramData.Category int serviceCategory);
+
+ /**
+ * Handle a CDMA cell broadcast SMS message forwarded from the system.
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param smsCbProgramData the SMS CB program data of the message
+ * @param originatingAddress the originating address of the message, as a non-separated dial
+ * string
+ * @param callback a callback to run after each cell broadcast receiver has handled
+ * the SCP message. The bundle will contain a non-separated
+ * dial string as and an ArrayList of {@link CdmaSmsCbProgramResults}.
*/
- public abstract void onCdmaCellBroadcastSms(int slotIndex, byte[] message);
+ public abstract void onCdmaScpMessage(int slotIndex,
+ @NonNull List<CdmaSmsCbProgramData> smsCbProgramData,
+ @NonNull String originatingAddress, @NonNull Consumer<Bundle> callback);
/**
* If overriding this method, call through to the super method for any unknown actions.
@@ -79,20 +107,23 @@ public abstract class CellBroadcastService extends Service {
*/
@Override
@CallSuper
- public IBinder onBind(Intent intent) {
+ @NonNull
+ public IBinder onBind(@Nullable Intent intent) {
return mStubWrapper;
}
/**
* A wrapper around ICellBroadcastService that forwards calls to implementations of
* {@link CellBroadcastService}.
+ *
* @hide
*/
public class ICellBroadcastServiceWrapper extends ICellBroadcastService.Stub {
/**
* Handle a GSM cell broadcast SMS.
+ *
* @param slotIndex the index of the slot which received the broadcast
- * @param message the SMS message PDU
+ * @param message the SMS message PDU
*/
@Override
public void handleGsmCellBroadcastSms(int slotIndex, byte[] message) {
@@ -101,12 +132,36 @@ public abstract class CellBroadcastService extends Service {
/**
* Handle a CDMA cell broadcast SMS.
- * @param slotIndex the index of the slot which received the broadcast
- * @param message the SMS message PDU
+ *
+ * @param slotIndex the index of the slot which received the broadcast
+ * @param bearerData the CDMA SMS bearer data
+ * @param serviceCategory the CDMA SCPT service category
+ */
+ @Override
+ public void handleCdmaCellBroadcastSms(int slotIndex, byte[] bearerData,
+ int serviceCategory) {
+ CellBroadcastService.this.onCdmaCellBroadcastSms(slotIndex, bearerData,
+ serviceCategory);
+ }
+
+ /**
+ * Handle a CDMA Service Category Program message.
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param smsCbProgramData the SMS CB program data of the message
+ * @param originatingAddress the originating address of the message
+ * @param callback a callback to run after each cell broadcast receiver has
+ * handled the SCP message
*/
@Override
- public void handleCdmaCellBroadcastSms(int slotIndex, byte[] message) {
- CellBroadcastService.this.onCdmaCellBroadcastSms(slotIndex, message);
+ public void handleCdmaScpMessage(int slotIndex,
+ List<CdmaSmsCbProgramData> smsCbProgramData, String originatingAddress,
+ RemoteCallback callback) {
+ Consumer<Bundle> consumer = bundle -> {
+ callback.sendResult(bundle);
+ };
+ CellBroadcastService.this.onCdmaScpMessage(slotIndex, smsCbProgramData,
+ originatingAddress, consumer);
}
}
}
diff --git a/telephony/java/android/telephony/CellInfo.java b/telephony/java/android/telephony/CellInfo.java
index 7edc91cd67e8..18687d400faf 100644
--- a/telephony/java/android/telephony/CellInfo.java
+++ b/telephony/java/android/telephony/CellInfo.java
@@ -189,11 +189,15 @@ public abstract class CellInfo implements Parcelable {
mTimeStamp = ts;
}
- /** @hide */
+ /**
+ * @return a {@link CellIdentity} instance.
+ */
@NonNull
public abstract CellIdentity getCellIdentity();
- /** @hide */
+ /**
+ * @return a {@link CellSignalStrength} instance.
+ */
@NonNull
public abstract CellSignalStrength getCellSignalStrength();
diff --git a/telephony/java/android/telephony/CellSignalStrengthNr.java b/telephony/java/android/telephony/CellSignalStrengthNr.java
index 1912c60ac122..f9b7f6dbc193 100644
--- a/telephony/java/android/telephony/CellSignalStrengthNr.java
+++ b/telephony/java/android/telephony/CellSignalStrengthNr.java
@@ -194,13 +194,13 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa
/** @hide */
@Override
public void updateLevel(PersistableBundle cc, ServiceState ss) {
- if (mCsiRsrp == CellInfo.UNAVAILABLE) {
+ if (mSsRsrp == CellInfo.UNAVAILABLE) {
mLevel = SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
- } else if (mCsiRsrp >= SIGNAL_GREAT_THRESHOLD) {
+ } else if (mSsRsrp >= SIGNAL_GREAT_THRESHOLD) {
mLevel = SIGNAL_STRENGTH_GREAT;
- } else if (mCsiRsrp >= SIGNAL_GOOD_THRESHOLD) {
+ } else if (mSsRsrp >= SIGNAL_GOOD_THRESHOLD) {
mLevel = SIGNAL_STRENGTH_GOOD;
- } else if (mCsiRsrp >= SIGNAL_MODERATE_THRESHOLD) {
+ } else if (mSsRsrp >= SIGNAL_MODERATE_THRESHOLD) {
mLevel = SIGNAL_STRENGTH_MODERATE;
} else {
mLevel = SIGNAL_STRENGTH_POOR;
@@ -212,7 +212,7 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa
*
* Asu is calculated based on 3GPP RSRP. Refer to 3GPP 27.007 (Ver 10.3.0) Sec 8.69
*
- * @return RSCP in ASU 0..97, 255, or UNAVAILABLE
+ * @return RSRP in ASU 0..97, 255, or UNAVAILABLE
*/
@Override
public int getAsuLevel() {
@@ -231,11 +231,11 @@ public final class CellSignalStrengthNr extends CellSignalStrength implements Pa
}
/**
- * Get the CSI-RSRP as dBm value -140..-44dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
+ * Get the SS-RSRP as dBm value -140..-44dBm or {@link CellInfo#UNAVAILABLE UNAVAILABLE}.
*/
@Override
public int getDbm() {
- return mCsiRsrp;
+ return mSsRsrp;
}
/** @hide */
diff --git a/telephony/java/android/telephony/CellSignalStrengthWcdma.java b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
index cdf01dab0059..4dc54f0fef58 100644
--- a/telephony/java/android/telephony/CellSignalStrengthWcdma.java
+++ b/telephony/java/android/telephony/CellSignalStrengthWcdma.java
@@ -245,9 +245,12 @@ public final class CellSignalStrengthWcdma extends CellSignalStrength implements
}
/**
- * Get the Ec/No as dB
+ * Get the Ec/No (Energy per chip over the noise spectral density) as dB.
*
- * @hide
+ * Reference: TS 25.133 Section 9.1.2.3
+ *
+ * @return the Ec/No of the measured cell in the range [-24, 1] or
+ * {@link android.telephony.CellInfo#UNAVAILABLE UNAVAILABLE} if unavailable
*/
public int getEcNo() {
return mEcNo;
diff --git a/telephony/java/android/telephony/DataFailCause.java b/telephony/java/android/telephony/DataFailCause.java
index ca264f738e1d..246bec7de59e 100644
--- a/telephony/java/android/telephony/DataFailCause.java
+++ b/telephony/java/android/telephony/DataFailCause.java
@@ -21,6 +21,7 @@ import android.annotation.SystemApi;
import android.content.Context;
import android.os.PersistableBundle;
+import android.telephony.Annotation.DataFailureCause;
import com.android.internal.util.ArrayUtils;
import java.lang.annotation.Retention;
@@ -968,355 +969,6 @@ public final class DataFailCause {
*/
public static final int HANDOVER_FAILED = 0x10006;
- /** @hide */
- @IntDef(value = {
- NONE,
- OPERATOR_BARRED,
- NAS_SIGNALLING,
- LLC_SNDCP,
- INSUFFICIENT_RESOURCES,
- MISSING_UNKNOWN_APN,
- UNKNOWN_PDP_ADDRESS_TYPE,
- USER_AUTHENTICATION,
- ACTIVATION_REJECT_GGSN,
- ACTIVATION_REJECT_UNSPECIFIED,
- SERVICE_OPTION_NOT_SUPPORTED,
- SERVICE_OPTION_NOT_SUBSCRIBED,
- SERVICE_OPTION_OUT_OF_ORDER,
- NSAPI_IN_USE,
- REGULAR_DEACTIVATION,
- QOS_NOT_ACCEPTED,
- NETWORK_FAILURE,
- UMTS_REACTIVATION_REQ,
- FEATURE_NOT_SUPP,
- TFT_SEMANTIC_ERROR,
- TFT_SYTAX_ERROR,
- UNKNOWN_PDP_CONTEXT,
- FILTER_SEMANTIC_ERROR,
- FILTER_SYTAX_ERROR,
- PDP_WITHOUT_ACTIVE_TFT,
- ACTIVATION_REJECTED_BCM_VIOLATION,
- ONLY_IPV4_ALLOWED,
- ONLY_IPV6_ALLOWED,
- ONLY_SINGLE_BEARER_ALLOWED,
- ESM_INFO_NOT_RECEIVED,
- PDN_CONN_DOES_NOT_EXIST,
- MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED,
- COLLISION_WITH_NETWORK_INITIATED_REQUEST,
- ONLY_IPV4V6_ALLOWED,
- ONLY_NON_IP_ALLOWED,
- UNSUPPORTED_QCI_VALUE,
- BEARER_HANDLING_NOT_SUPPORTED,
- ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED,
- UNSUPPORTED_APN_IN_CURRENT_PLMN,
- INVALID_TRANSACTION_ID,
- MESSAGE_INCORRECT_SEMANTIC,
- INVALID_MANDATORY_INFO,
- MESSAGE_TYPE_UNSUPPORTED,
- MSG_TYPE_NONCOMPATIBLE_STATE,
- UNKNOWN_INFO_ELEMENT,
- CONDITIONAL_IE_ERROR,
- MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE,
- PROTOCOL_ERRORS,
- APN_TYPE_CONFLICT,
- INVALID_PCSCF_ADDR,
- INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN,
- EMM_ACCESS_BARRED,
- EMERGENCY_IFACE_ONLY,
- IFACE_MISMATCH,
- COMPANION_IFACE_IN_USE,
- IP_ADDRESS_MISMATCH,
- IFACE_AND_POL_FAMILY_MISMATCH,
- EMM_ACCESS_BARRED_INFINITE_RETRY,
- AUTH_FAILURE_ON_EMERGENCY_CALL,
- INVALID_DNS_ADDR,
- INVALID_PCSCF_OR_DNS_ADDRESS,
- CALL_PREEMPT_BY_EMERGENCY_APN,
- UE_INITIATED_DETACH_OR_DISCONNECT,
- MIP_FA_REASON_UNSPECIFIED,
- MIP_FA_ADMIN_PROHIBITED,
- MIP_FA_INSUFFICIENT_RESOURCES,
- MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE,
- MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE,
- MIP_FA_REQUESTED_LIFETIME_TOO_LONG,
- MIP_FA_MALFORMED_REQUEST,
- MIP_FA_MALFORMED_REPLY,
- MIP_FA_ENCAPSULATION_UNAVAILABLE,
- MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE,
- MIP_FA_REVERSE_TUNNEL_UNAVAILABLE,
- MIP_FA_REVERSE_TUNNEL_IS_MANDATORY,
- MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED,
- MIP_FA_MISSING_NAI,
- MIP_FA_MISSING_HOME_AGENT,
- MIP_FA_MISSING_HOME_ADDRESS,
- MIP_FA_UNKNOWN_CHALLENGE,
- MIP_FA_MISSING_CHALLENGE,
- MIP_FA_STALE_CHALLENGE,
- MIP_HA_REASON_UNSPECIFIED,
- MIP_HA_ADMIN_PROHIBITED,
- MIP_HA_INSUFFICIENT_RESOURCES,
- MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE,
- MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE,
- MIP_HA_REGISTRATION_ID_MISMATCH,
- MIP_HA_MALFORMED_REQUEST,
- MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS,
- MIP_HA_REVERSE_TUNNEL_UNAVAILABLE,
- MIP_HA_REVERSE_TUNNEL_IS_MANDATORY,
- MIP_HA_ENCAPSULATION_UNAVAILABLE,
- CLOSE_IN_PROGRESS,
- NETWORK_INITIATED_TERMINATION,
- MODEM_APP_PREEMPTED,
- PDN_IPV4_CALL_DISALLOWED,
- PDN_IPV4_CALL_THROTTLED,
- PDN_IPV6_CALL_DISALLOWED,
- PDN_IPV6_CALL_THROTTLED,
- MODEM_RESTART,
- PDP_PPP_NOT_SUPPORTED,
- UNPREFERRED_RAT,
- PHYSICAL_LINK_CLOSE_IN_PROGRESS,
- APN_PENDING_HANDOVER,
- PROFILE_BEARER_INCOMPATIBLE,
- SIM_CARD_CHANGED,
- LOW_POWER_MODE_OR_POWERING_DOWN,
- APN_DISABLED,
- MAX_PPP_INACTIVITY_TIMER_EXPIRED,
- IPV6_ADDRESS_TRANSFER_FAILED,
- TRAT_SWAP_FAILED,
- EHRPD_TO_HRPD_FALLBACK,
- MIP_CONFIG_FAILURE,
- PDN_INACTIVITY_TIMER_EXPIRED,
- MAX_IPV4_CONNECTIONS,
- MAX_IPV6_CONNECTIONS,
- APN_MISMATCH,
- IP_VERSION_MISMATCH,
- DUN_CALL_DISALLOWED,
- INTERNAL_EPC_NONEPC_TRANSITION,
- INTERFACE_IN_USE,
- APN_DISALLOWED_ON_ROAMING,
- APN_PARAMETERS_CHANGED,
- NULL_APN_DISALLOWED,
- THERMAL_MITIGATION,
- DATA_SETTINGS_DISABLED,
- DATA_ROAMING_SETTINGS_DISABLED,
- DDS_SWITCHED,
- FORBIDDEN_APN_NAME,
- DDS_SWITCH_IN_PROGRESS,
- CALL_DISALLOWED_IN_ROAMING,
- NON_IP_NOT_SUPPORTED,
- PDN_NON_IP_CALL_THROTTLED,
- PDN_NON_IP_CALL_DISALLOWED,
- CDMA_LOCK,
- CDMA_INTERCEPT,
- CDMA_REORDER,
- CDMA_RELEASE_DUE_TO_SO_REJECTION,
- CDMA_INCOMING_CALL,
- CDMA_ALERT_STOP,
- CHANNEL_ACQUISITION_FAILURE,
- MAX_ACCESS_PROBE,
- CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION,
- NO_RESPONSE_FROM_BASE_STATION,
- REJECTED_BY_BASE_STATION,
- CONCURRENT_SERVICES_INCOMPATIBLE,
- NO_CDMA_SERVICE,
- RUIM_NOT_PRESENT,
- CDMA_RETRY_ORDER,
- ACCESS_BLOCK,
- ACCESS_BLOCK_ALL,
- IS707B_MAX_ACCESS_PROBES,
- THERMAL_EMERGENCY,
- CONCURRENT_SERVICES_NOT_ALLOWED,
- INCOMING_CALL_REJECTED,
- NO_SERVICE_ON_GATEWAY,
- NO_GPRS_CONTEXT,
- ILLEGAL_MS,
- ILLEGAL_ME,
- GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED,
- GPRS_SERVICES_NOT_ALLOWED,
- MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK,
- IMPLICITLY_DETACHED,
- PLMN_NOT_ALLOWED,
- LOCATION_AREA_NOT_ALLOWED,
- GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
- PDP_DUPLICATE,
- UE_RAT_CHANGE,
- CONGESTION,
- NO_PDP_CONTEXT_ACTIVATED,
- ACCESS_CLASS_DSAC_REJECTION,
- PDP_ACTIVATE_MAX_RETRY_FAILED,
- RADIO_ACCESS_BEARER_FAILURE,
- ESM_UNKNOWN_EPS_BEARER_CONTEXT,
- DRB_RELEASED_BY_RRC,
- CONNECTION_RELEASED,
- EMM_DETACHED,
- EMM_ATTACH_FAILED,
- EMM_ATTACH_STARTED,
- LTE_NAS_SERVICE_REQUEST_FAILED,
- DUPLICATE_BEARER_ID,
- ESM_COLLISION_SCENARIOS,
- ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK,
- ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER,
- ESM_BAD_OTA_MESSAGE,
- ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL,
- ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT,
- DS_EXPLICIT_DEACTIVATION,
- ESM_LOCAL_CAUSE_NONE,
- LTE_THROTTLING_NOT_REQUIRED,
- ACCESS_CONTROL_LIST_CHECK_FAILURE,
- SERVICE_NOT_ALLOWED_ON_PLMN,
- EMM_T3417_EXPIRED,
- EMM_T3417_EXT_EXPIRED,
- RRC_UPLINK_DATA_TRANSMISSION_FAILURE,
- RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER,
- RRC_UPLINK_CONNECTION_RELEASE,
- RRC_UPLINK_RADIO_LINK_FAILURE,
- RRC_UPLINK_ERROR_REQUEST_FROM_NAS,
- RRC_CONNECTION_ACCESS_STRATUM_FAILURE,
- RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS,
- RRC_CONNECTION_ACCESS_BARRED,
- RRC_CONNECTION_CELL_RESELECTION,
- RRC_CONNECTION_CONFIG_FAILURE,
- RRC_CONNECTION_TIMER_EXPIRED,
- RRC_CONNECTION_LINK_FAILURE,
- RRC_CONNECTION_CELL_NOT_CAMPED,
- RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE,
- RRC_CONNECTION_REJECT_BY_NETWORK,
- RRC_CONNECTION_NORMAL_RELEASE,
- RRC_CONNECTION_RADIO_LINK_FAILURE,
- RRC_CONNECTION_REESTABLISHMENT_FAILURE,
- RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER,
- RRC_CONNECTION_ABORT_REQUEST,
- RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR,
- NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH,
- NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH,
- ESM_PROCEDURE_TIME_OUT,
- INVALID_CONNECTION_ID,
- MAXIMIUM_NSAPIS_EXCEEDED,
- INVALID_PRIMARY_NSAPI,
- CANNOT_ENCODE_OTA_MESSAGE,
- RADIO_ACCESS_BEARER_SETUP_FAILURE,
- PDP_ESTABLISH_TIMEOUT_EXPIRED,
- PDP_MODIFY_TIMEOUT_EXPIRED,
- PDP_INACTIVE_TIMEOUT_EXPIRED,
- PDP_LOWERLAYER_ERROR,
- PDP_MODIFY_COLLISION,
- MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED,
- NAS_REQUEST_REJECTED_BY_NETWORK,
- RRC_CONNECTION_INVALID_REQUEST,
- RRC_CONNECTION_TRACKING_AREA_ID_CHANGED,
- RRC_CONNECTION_RF_UNAVAILABLE,
- RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE,
- RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE,
- RRC_CONNECTION_ABORTED_AFTER_HANDOVER,
- RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE,
- RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE,
- IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER,
- IMEI_NOT_ACCEPTED,
- EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED,
- EPS_SERVICES_NOT_ALLOWED_IN_PLMN,
- MSC_TEMPORARILY_NOT_REACHABLE,
- CS_DOMAIN_NOT_AVAILABLE,
- ESM_FAILURE,
- MAC_FAILURE,
- SYNCHRONIZATION_FAILURE,
- UE_SECURITY_CAPABILITIES_MISMATCH,
- SECURITY_MODE_REJECTED,
- UNACCEPTABLE_NON_EPS_AUTHENTICATION,
- CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED,
- NO_EPS_BEARER_CONTEXT_ACTIVATED,
- INVALID_EMM_STATE,
- NAS_LAYER_FAILURE,
- MULTIPLE_PDP_CALL_NOT_ALLOWED,
- EMBMS_NOT_ENABLED,
- IRAT_HANDOVER_FAILED,
- EMBMS_REGULAR_DEACTIVATION,
- TEST_LOOPBACK_REGULAR_DEACTIVATION,
- LOWER_LAYER_REGISTRATION_FAILURE,
- DATA_PLAN_EXPIRED,
- UMTS_HANDOVER_TO_IWLAN,
- EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY,
- EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE,
- EVDO_HDR_CHANGED,
- EVDO_HDR_EXITED,
- EVDO_HDR_NO_SESSION,
- EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL,
- EVDO_HDR_CONNECTION_SETUP_TIMEOUT,
- FAILED_TO_ACQUIRE_COLOCATED_HDR,
- OTASP_COMMIT_IN_PROGRESS,
- NO_HYBRID_HDR_SERVICE,
- HDR_NO_LOCK_GRANTED,
- DBM_OR_SMS_IN_PROGRESS,
- HDR_FADE,
- HDR_ACCESS_FAILURE,
- UNSUPPORTED_1X_PREV,
- LOCAL_END,
- NO_SERVICE,
- FADE,
- NORMAL_RELEASE,
- ACCESS_ATTEMPT_ALREADY_IN_PROGRESS,
- REDIRECTION_OR_HANDOFF_IN_PROGRESS,
- EMERGENCY_MODE,
- PHONE_IN_USE,
- INVALID_MODE,
- INVALID_SIM_STATE,
- NO_COLLOCATED_HDR,
- UE_IS_ENTERING_POWERSAVE_MODE,
- DUAL_SWITCH,
- PPP_TIMEOUT,
- PPP_AUTH_FAILURE,
- PPP_OPTION_MISMATCH,
- PPP_PAP_FAILURE,
- PPP_CHAP_FAILURE,
- PPP_CLOSE_IN_PROGRESS,
- LIMITED_TO_IPV4,
- LIMITED_TO_IPV6,
- VSNCP_TIMEOUT,
- VSNCP_GEN_ERROR,
- VSNCP_APN_UNATHORIZED,
- VSNCP_PDN_LIMIT_EXCEEDED,
- VSNCP_NO_PDN_GATEWAY_ADDRESS,
- VSNCP_PDN_GATEWAY_UNREACHABLE,
- VSNCP_PDN_GATEWAY_REJECT,
- VSNCP_INSUFFICIENT_PARAMETERS,
- VSNCP_RESOURCE_UNAVAILABLE,
- VSNCP_ADMINISTRATIVELY_PROHIBITED,
- VSNCP_PDN_ID_IN_USE,
- VSNCP_SUBSCRIBER_LIMITATION,
- VSNCP_PDN_EXISTS_FOR_THIS_APN,
- VSNCP_RECONNECT_NOT_ALLOWED,
- IPV6_PREFIX_UNAVAILABLE,
- HANDOFF_PREFERENCE_CHANGED,
- OEM_DCFAILCAUSE_1,
- OEM_DCFAILCAUSE_2,
- OEM_DCFAILCAUSE_3,
- OEM_DCFAILCAUSE_4,
- OEM_DCFAILCAUSE_5,
- OEM_DCFAILCAUSE_6,
- OEM_DCFAILCAUSE_7,
- OEM_DCFAILCAUSE_8,
- OEM_DCFAILCAUSE_9,
- OEM_DCFAILCAUSE_10,
- OEM_DCFAILCAUSE_11,
- OEM_DCFAILCAUSE_12,
- OEM_DCFAILCAUSE_13,
- OEM_DCFAILCAUSE_14,
- OEM_DCFAILCAUSE_15,
- REGISTRATION_FAIL,
- GPRS_REGISTRATION_FAIL,
- SIGNAL_LOST,
- PREF_RADIO_TECH_CHANGED,
- RADIO_POWER_OFF,
- TETHERED_CALL_ACTIVE,
- ERROR_UNSPECIFIED,
- UNKNOWN,
- RADIO_NOT_AVAILABLE,
- UNACCEPTABLE_NETWORK_PARAMETER,
- CONNECTION_TO_DATACONNECTIONAC_BROKEN,
- LOST_CONNECTION,
- RESET_BY_FRAMEWORK
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface FailCause{}
-
private static final Map<Integer, String> sFailCauseMap;
static {
sFailCauseMap = new HashMap<>();
@@ -1737,7 +1389,8 @@ public final class DataFailCause {
*
* @hide
*/
- public static boolean isRadioRestartFailure(@NonNull Context context, @FailCause int cause,
+ public static boolean isRadioRestartFailure(@NonNull Context context,
+ @DataFailureCause int cause,
int subId) {
CarrierConfigManager configManager = (CarrierConfigManager)
context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
@@ -1765,7 +1418,8 @@ public final class DataFailCause {
}
/** @hide */
- public static boolean isPermanentFailure(@NonNull Context context, @FailCause int failCause,
+ public static boolean isPermanentFailure(@NonNull Context context,
+ @DataFailureCause int failCause,
int subId) {
synchronized (sPermanentFailureCache) {
@@ -1825,7 +1479,7 @@ public final class DataFailCause {
}
/** @hide */
- public static boolean isEventLoggable(@FailCause int dataFailCause) {
+ public static boolean isEventLoggable(@DataFailureCause int dataFailCause) {
return (dataFailCause == OPERATOR_BARRED) || (dataFailCause == INSUFFICIENT_RESOURCES)
|| (dataFailCause == UNKNOWN_PDP_ADDRESS_TYPE)
|| (dataFailCause == USER_AUTHENTICATION)
@@ -1845,13 +1499,13 @@ public final class DataFailCause {
}
/** @hide */
- public static String toString(@FailCause int dataFailCause) {
+ public static String toString(@DataFailureCause int dataFailCause) {
int cause = getFailCause(dataFailCause);
return (cause == UNKNOWN) ? "UNKNOWN(" + dataFailCause + ")" : sFailCauseMap.get(cause);
}
/** @hide */
- public static int getFailCause(@FailCause int failCause) {
+ public static int getFailCause(@DataFailureCause int failCause) {
if (sFailCauseMap.containsKey(failCause)) {
return failCause;
} else {
diff --git a/telephony/java/android/telephony/DisconnectCause.java b/telephony/java/android/telephony/DisconnectCause.java
index aa7e21a82500..85110c22aa18 100644
--- a/telephony/java/android/telephony/DisconnectCause.java
+++ b/telephony/java/android/telephony/DisconnectCause.java
@@ -16,6 +16,7 @@
package android.telephony;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.UnsupportedAppUsage;
@@ -369,7 +370,7 @@ public final class DisconnectCause {
* @hide
*/
@UnsupportedAppUsage
- public static String toString(int cause) {
+ public static @NonNull String toString(int cause) {
switch (cause) {
case NOT_DISCONNECTED:
return "NOT_DISCONNECTED";
diff --git a/telephony/java/android/telephony/ICellBroadcastService.aidl b/telephony/java/android/telephony/ICellBroadcastService.aidl
index eff64a2e35ba..11263d99cb8f 100644
--- a/telephony/java/android/telephony/ICellBroadcastService.aidl
+++ b/telephony/java/android/telephony/ICellBroadcastService.aidl
@@ -16,6 +16,9 @@
package android.telephony;
+import android.os.RemoteCallback;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+
/**
* Service bound to by the system to allow custom handling of cell broadcast messages.
* <p>
@@ -28,5 +31,9 @@ interface ICellBroadcastService {
oneway void handleGsmCellBroadcastSms(int slotId, in byte[] message);
/** @see android.telephony.CellBroadcastService#onCdmaCellBroadcastSms */
- oneway void handleCdmaCellBroadcastSms(int slotId, in byte[] message);
+ oneway void handleCdmaCellBroadcastSms(int slotId, in byte[] bearerData, int serviceCategory);
+
+ /** @see android.telephony.CellBroadcastService#onCdmaScpMessage */
+ oneway void handleCdmaScpMessage(int slotId, in List<CdmaSmsCbProgramData> programData,
+ String originatingAddress, in RemoteCallback callback);
}
diff --git a/telephony/java/android/telephony/ICellInfoCallback.aidl b/telephony/java/android/telephony/ICellInfoCallback.aidl
index ee3c1b1be6d9..60732a3db59a 100644
--- a/telephony/java/android/telephony/ICellInfoCallback.aidl
+++ b/telephony/java/android/telephony/ICellInfoCallback.aidl
@@ -16,7 +16,6 @@
package android.telephony;
-import android.os.ParcelableException;
import android.telephony.CellInfo;
import java.util.List;
@@ -28,5 +27,5 @@ import java.util.List;
oneway interface ICellInfoCallback
{
void onCellInfo(in List<CellInfo> state);
- void onError(in int errorCode, in ParcelableException detail);
+ void onError(in int errorCode, in String exceptionName, in String message);
}
diff --git a/telephony/java/android/telephony/ImsManager.java b/telephony/java/android/telephony/ImsManager.java
new file mode 100644
index 000000000000..02d8be3ccfd5
--- /dev/null
+++ b/telephony/java/android/telephony/ImsManager.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims;
+
+import android.annotation.SystemService;
+import android.content.Context;
+import android.telephony.SubscriptionManager;
+
+/**
+ * Provides access to information about Telephony IMS services on the device.
+ *
+ * @hide
+ */
+@SystemService(Context.TELEPHONY_IMS_SERVICE)
+public class ImsManager {
+
+ private Context mContext;
+
+ public ImsManager(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * Create an instance of ImsRcsManager for the subscription id specified.
+ *
+ * @param subscriptionId The ID of the subscription that this ImsRcsManager will use.
+ * @throws IllegalArgumentException if the subscription is invalid.
+ * @return a ImsRcsManager instance with the specific subscription ID.
+ */
+ public ImsRcsManager getImsRcsManager(int subscriptionId) {
+ if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
+ throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId);
+ }
+
+ return new ImsRcsManager(mContext, subscriptionId);
+ }
+
+ /**
+ * Create an instance of ImsMmTelManager for the subscription id specified.
+ *
+ * @param subscriptionId The ID of the subscription that this ImsMmTelManager will use.
+ * @throws IllegalArgumentException if the subscription is invalid.
+ * @return a ImsMmTelManager instance with the specific subscription ID.
+ */
+ public ImsMmTelManager getImsMmTelManager(int subscriptionId) {
+ if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
+ throw new IllegalArgumentException("Invalid subscription ID: " + subscriptionId);
+ }
+
+ return new ImsMmTelManager(subscriptionId);
+ }
+}
diff --git a/telephony/java/android/telephony/NetworkRegistrationInfo.java b/telephony/java/android/telephony/NetworkRegistrationInfo.java
index a76b8da09064..3e028715fd6d 100644
--- a/telephony/java/android/telephony/NetworkRegistrationInfo.java
+++ b/telephony/java/android/telephony/NetworkRegistrationInfo.java
@@ -24,8 +24,8 @@ import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.AccessNetworkConstants.TransportType;
-import android.telephony.TelephonyManager.NetworkType;
+import android.telephony.Annotation.NetworkType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index af3ba5e44158..4a1bc1f6343f 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -16,12 +16,12 @@
package android.telephony;
-import com.android.i18n.phonenumbers.NumberParseException;
-import com.android.i18n.phonenumbers.PhoneNumberUtil;
-import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
-import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
+import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING;
import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -42,7 +42,10 @@ import android.text.TextUtils;
import android.text.style.TtsSpan;
import android.util.SparseIntArray;
-import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING;
+import com.android.i18n.phonenumbers.NumberParseException;
+import com.android.i18n.phonenumbers.PhoneNumberUtil;
+import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
+import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -2247,8 +2250,10 @@ public class PhoneNumberUtils {
* to read the VM number.
* @hide
*/
- @UnsupportedAppUsage
- public static boolean isVoiceMailNumber(Context context, int subId, String number) {
+ @SystemApi
+ @TestApi
+ public static boolean isVoiceMailNumber(@NonNull Context context, int subId,
+ @Nullable String number) {
String vmNumber, mdn;
try {
final TelephonyManager tm;
@@ -2734,8 +2739,9 @@ public class PhoneNumberUtils {
* @param number
* @return true if number contains @
*/
- @UnsupportedAppUsage
- public static boolean isUriNumber(String number) {
+ @SystemApi
+ @TestApi
+ public static boolean isUriNumber(@Nullable String number) {
// Note we allow either "@" or "%40" to indicate a URI, in case
// the passed-in string is URI-escaped. (Neither "@" nor "%40"
// will ever be found in a legal PSTN number.)
@@ -2752,8 +2758,9 @@ public class PhoneNumberUtils {
*
* @hide
*/
- @UnsupportedAppUsage
- public static String getUsernameFromUriNumber(String number) {
+ @SystemApi
+ @TestApi
+ public static @NonNull String getUsernameFromUriNumber(@NonNull String number) {
// The delimiter between username and domain name can be
// either "@" or "%40" (the URI-escaped equivalent.)
int delimiterIndex = number.indexOf('@');
diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index 0ce552ae330a..e5bfb4dfb7b4 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -28,6 +28,10 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Looper;
+import android.telephony.Annotation.CallState;
+import android.telephony.Annotation.RadioPowerState;
+import android.telephony.Annotation.SimActivationState;
+import android.telephony.Annotation.SrvccState;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;
@@ -567,7 +571,7 @@ public class PhoneStateListener {
* privileges (see {@link TelephonyManager#hasCarrierPrivileges}), an empty string will be
* passed as an argument.
*/
- public void onCallStateChanged(@TelephonyManager.CallState int state, String phoneNumber) {
+ public void onCallStateChanged(@CallState int state, String phoneNumber) {
// default implementation empty
}
@@ -773,7 +777,7 @@ public class PhoneStateListener {
* @hide
*/
@SystemApi
- public void onSrvccStateChanged(@TelephonyManager.SrvccState int srvccState) {
+ public void onSrvccStateChanged(@SrvccState int srvccState) {
}
@@ -791,7 +795,7 @@ public class PhoneStateListener {
* @hide
*/
@SystemApi
- public void onVoiceActivationStateChanged(@TelephonyManager.SimActivationState int state) {
+ public void onVoiceActivationStateChanged(@SimActivationState int state) {
}
/**
@@ -807,7 +811,7 @@ public class PhoneStateListener {
* @param state is the current SIM data activation state
* @hide
*/
- public void onDataActivationStateChanged(@TelephonyManager.SimActivationState int state) {
+ public void onDataActivationStateChanged(@SimActivationState int state) {
}
/**
@@ -966,7 +970,7 @@ public class PhoneStateListener {
* @hide
*/
@SystemApi
- public void onRadioPowerStateChanged(@TelephonyManager.RadioPowerState int state) {
+ public void onRadioPowerStateChanged(@RadioPowerState int state) {
// default implementation empty
}
@@ -1233,7 +1237,7 @@ public class PhoneStateListener {
() -> mExecutor.execute(() -> psl.onPhoneCapabilityChanged(capability)));
}
- public void onRadioPowerStateChanged(@TelephonyManager.RadioPowerState int state) {
+ public void onRadioPowerStateChanged(@RadioPowerState int state) {
PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
if (psl == null) return;
diff --git a/telephony/java/android/telephony/PhysicalChannelConfig.java b/telephony/java/android/telephony/PhysicalChannelConfig.java
index e1763ab44fba..4273f5a4a16e 100644
--- a/telephony/java/android/telephony/PhysicalChannelConfig.java
+++ b/telephony/java/android/telephony/PhysicalChannelConfig.java
@@ -19,8 +19,8 @@ package android.telephony;
import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcelable;
-import android.telephony.TelephonyManager.NetworkType;
+import android.telephony.Annotation.NetworkType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Arrays;
diff --git a/telephony/java/android/telephony/PreciseCallState.java b/telephony/java/android/telephony/PreciseCallState.java
index 701a375a3039..f929649453b9 100644
--- a/telephony/java/android/telephony/PreciseCallState.java
+++ b/telephony/java/android/telephony/PreciseCallState.java
@@ -41,7 +41,7 @@ import java.util.Objects;
* <li>Precise background call state.
* </ul>
*
- * @see android.telephony.TelephonyManager.CallState which contains generic call states.
+ * @see android.telephony.Annotation.CallState which contains generic call states.
*
* @hide
*/
diff --git a/telephony/java/android/telephony/PreciseDataConnectionState.java b/telephony/java/android/telephony/PreciseDataConnectionState.java
index 90d443a6d8ee..257d634f1577 100644
--- a/telephony/java/android/telephony/PreciseDataConnectionState.java
+++ b/telephony/java/android/telephony/PreciseDataConnectionState.java
@@ -23,6 +23,10 @@ import android.annotation.UnsupportedAppUsage;
import android.net.LinkProperties;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.Annotation.ApnType;
+import android.telephony.Annotation.DataFailureCause;
+import android.telephony.Annotation.DataState;
+import android.telephony.Annotation.NetworkType;
import android.telephony.data.ApnSetting;
import java.util.Objects;
@@ -47,10 +51,10 @@ import java.util.Objects;
@SystemApi
public final class PreciseDataConnectionState implements Parcelable {
- private @TelephonyManager.DataState int mState = TelephonyManager.DATA_UNKNOWN;
- private @TelephonyManager.NetworkType int mNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
- private @DataFailCause.FailCause int mFailCause = DataFailCause.NONE;
- private @ApnSetting.ApnType int mAPNTypes = ApnSetting.TYPE_NONE;
+ private @DataState int mState = TelephonyManager.DATA_UNKNOWN;
+ private @NetworkType int mNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ private @DataFailureCause int mFailCause = DataFailCause.NONE;
+ private @ApnType int mAPNTypes = ApnSetting.TYPE_NONE;
private String mAPN = "";
private LinkProperties mLinkProperties = null;
@@ -60,11 +64,11 @@ public final class PreciseDataConnectionState implements Parcelable {
* @hide
*/
@UnsupportedAppUsage
- public PreciseDataConnectionState(@TelephonyManager.DataState int state,
- @TelephonyManager.NetworkType int networkType,
- @ApnSetting.ApnType int apnTypes, String apn,
+ public PreciseDataConnectionState(@DataState int state,
+ @NetworkType int networkType,
+ @ApnType int apnTypes, String apn,
LinkProperties linkProperties,
- @DataFailCause.FailCause int failCause) {
+ @DataFailureCause int failCause) {
mState = state;
mNetworkType = networkType;
mAPNTypes = apnTypes;
@@ -99,7 +103,7 @@ public final class PreciseDataConnectionState implements Parcelable {
* Returns the state of data connection that supported the apn types returned by
* {@link #getDataConnectionApnTypeBitMask()}
*/
- public @TelephonyManager.DataState int getDataConnectionState() {
+ public @DataState int getDataConnectionState() {
return mState;
}
@@ -107,7 +111,7 @@ public final class PreciseDataConnectionState implements Parcelable {
* Returns the network type associated with this data connection.
* @hide
*/
- public @TelephonyManager.NetworkType int getDataConnectionNetworkType() {
+ public @NetworkType int getDataConnectionNetworkType() {
return mNetworkType;
}
@@ -115,7 +119,7 @@ public final class PreciseDataConnectionState implements Parcelable {
* Returns the data connection APN types supported by this connection and triggers
* {@link PreciseDataConnectionState} change.
*/
- public @ApnSetting.ApnType int getDataConnectionApnTypeBitMask() {
+ public @ApnType int getDataConnectionApnTypeBitMask() {
return mAPNTypes;
}
@@ -139,7 +143,7 @@ public final class PreciseDataConnectionState implements Parcelable {
/**
* Returns data connection fail cause, in case there was a failure.
*/
- public @DataFailCause.FailCause int getDataConnectionFailCause() {
+ public @Annotation.DataFailureCause int getDataConnectionFailCause() {
return mFailCause;
}
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 51048c039160..a6dfd24c419b 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -29,6 +29,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
import android.telephony.AccessNetworkConstants.TransportType;
+import android.telephony.Annotation.NetworkType;
import android.telephony.NetworkRegistrationInfo.Domain;
import android.telephony.NetworkRegistrationInfo.NRState;
import android.text.TextUtils;
@@ -1623,7 +1624,7 @@ public class ServiceState implements Parcelable {
* @hide
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
- public @TelephonyManager.NetworkType int getDataNetworkType() {
+ public @NetworkType int getDataNetworkType() {
final NetworkRegistrationInfo iwlanRegInfo = getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
final NetworkRegistrationInfo wwanRegInfo = getNetworkRegistrationInfo(
@@ -1650,7 +1651,7 @@ public class ServiceState implements Parcelable {
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
- public @TelephonyManager.NetworkType int getVoiceNetworkType() {
+ public @NetworkType int getVoiceNetworkType() {
final NetworkRegistrationInfo regState = getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_CS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
if (regState != null) {
diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java
index c078764cfa24..dc991b9a3ea7 100644
--- a/telephony/java/android/telephony/SmsCbMessage.java
+++ b/telephony/java/android/telephony/SmsCbMessage.java
@@ -207,17 +207,19 @@ public final class SmsCbMessage implements Parcelable {
/** CMAS warning area coordinates. */
private final List<Geometry> mGeometries;
+ private int mSlotIndex = 0;
+
/**
* Create a new SmsCbMessage with the specified data.
*/
public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
@NonNull SmsCbLocation location, int serviceCategory, @Nullable String language,
@Nullable String body, int priority, @Nullable SmsCbEtwsInfo etwsWarningInfo,
- @Nullable SmsCbCmasInfo cmasWarningInfo) {
+ @Nullable SmsCbCmasInfo cmasWarningInfo, int slotIndex) {
this(messageFormat, geographicalScope, serialNumber, location, serviceCategory, language,
body, priority, etwsWarningInfo, cmasWarningInfo, 0 /* maximumWaitingTime */,
- null /* geometries */, System.currentTimeMillis());
+ null /* geometries */, System.currentTimeMillis(), slotIndex);
}
/**
@@ -227,7 +229,8 @@ public final class SmsCbMessage implements Parcelable {
public SmsCbMessage(int messageFormat, int geographicalScope, int serialNumber,
SmsCbLocation location, int serviceCategory, String language, String body,
int priority, SmsCbEtwsInfo etwsWarningInfo, SmsCbCmasInfo cmasWarningInfo,
- int maximumWaitTimeSec, List<Geometry> geometries, long receivedTimeMillis) {
+ int maximumWaitTimeSec, List<Geometry> geometries, long receivedTimeMillis,
+ int slotIndex) {
mMessageFormat = messageFormat;
mGeographicalScope = geographicalScope;
mSerialNumber = serialNumber;
@@ -241,6 +244,7 @@ public final class SmsCbMessage implements Parcelable {
mReceivedTimeMillis = receivedTimeMillis;
mGeometries = geometries;
mMaximumWaitTimeSec = maximumWaitTimeSec;
+ mSlotIndex = slotIndex;
}
/**
@@ -278,6 +282,7 @@ public final class SmsCbMessage implements Parcelable {
String geoStr = in.readString();
mGeometries = geoStr != null ? CbGeoUtils.parseGeometriesFromString(geoStr) : null;
mMaximumWaitTimeSec = in.readInt();
+ mSlotIndex = in.readInt();
}
/**
@@ -312,6 +317,7 @@ public final class SmsCbMessage implements Parcelable {
dest.writeString(
mGeometries != null ? CbGeoUtils.encodeGeometriesToString(mGeometries) : null);
dest.writeInt(mMaximumWaitTimeSec);
+ dest.writeInt(mSlotIndex);
}
@NonNull
@@ -423,6 +429,14 @@ public final class SmsCbMessage implements Parcelable {
}
/**
+ * Get the slotIndex associated with this message.
+ * @return the slotIndex associated with this message
+ */
+ public int getSlotIndex() {
+ return mSlotIndex;
+ }
+
+ /**
* Get the message format ({@link #MESSAGE_FORMAT_3GPP} or {@link #MESSAGE_FORMAT_3GPP2}).
* @return an integer representing 3GPP or 3GPP2 message format
*/
@@ -502,6 +516,7 @@ public final class SmsCbMessage implements Parcelable {
+ (mEtwsWarningInfo != null ? (", " + mEtwsWarningInfo.toString()) : "")
+ (mCmasWarningInfo != null ? (", " + mCmasWarningInfo.toString()) : "")
+ ", maximumWaitingTime = " + mMaximumWaitTimeSec
+ + ", slotIndex = " + mSlotIndex
+ ", geo=" + (mGeometries != null
? CbGeoUtils.encodeGeometriesToString(mGeometries) : "null")
+ '}';
@@ -522,6 +537,7 @@ public final class SmsCbMessage implements Parcelable {
@NonNull
public ContentValues getContentValues() {
ContentValues cv = new ContentValues(16);
+ cv.put(CellBroadcasts.SLOT_INDEX, mSlotIndex);
cv.put(CellBroadcasts.GEOGRAPHICAL_SCOPE, mGeographicalScope);
if (mLocation.getPlmn() != null) {
cv.put(CellBroadcasts.PLMN, mLocation.getPlmn());
@@ -563,6 +579,7 @@ public final class SmsCbMessage implements Parcelable {
}
cv.put(CellBroadcasts.MAXIMUM_WAIT_TIME, mMaximumWaitTimeSec);
+ cv.put(CellBroadcasts.SLOT_INDEX, mSlotIndex);
return cv;
}
@@ -584,6 +601,7 @@ public final class SmsCbMessage implements Parcelable {
String body = cursor.getString(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_BODY));
int format = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_FORMAT));
int priority = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_PRIORITY));
+ int slotIndex = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.SLOT_INDEX));
String plmn;
int plmnColumn = cursor.getColumnIndex(CellBroadcasts.PLMN);
@@ -681,7 +699,7 @@ public final class SmsCbMessage implements Parcelable {
return new SmsCbMessage(format, geoScope, serialNum, location, category,
language, body, priority, etwsInfo, cmasInfo, maximumWaitTimeSec, geometries,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
}
/**
diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java
index 209d46253a07..54e87afb2da9 100644
--- a/telephony/java/android/telephony/SmsManager.java
+++ b/telephony/java/android/telephony/SmsManager.java
@@ -27,25 +27,20 @@ import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.app.ActivityThread;
import android.app.PendingIntent;
-import android.content.ContentValues;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.CursorWindow;
import android.net.Uri;
-import android.os.BaseBundle;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.provider.Telephony;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
import com.android.internal.telephony.IIntegerConsumer;
-import com.android.internal.telephony.IMms;
import com.android.internal.telephony.ISms;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.SmsRawData;
@@ -292,12 +287,6 @@ public final class SmsManager {
*/
public static final int SMS_MESSAGE_PERIOD_NOT_SPECIFIED = -1;
- /**
- * Extra key passed into a PendingIntent when the SMS operation failed due to there being no
- * default set.
- */
- private static final String NO_DEFAULT_EXTRA = "noDefault";
-
// result of asking the user for a subscription to perform an operation.
private interface SubscriptionResolverResult {
void onSuccess(int subId);
@@ -338,9 +327,59 @@ public final class SmsManager {
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
* <code>RESULT_ERROR_NO_SERVICE</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -357,6 +396,119 @@ public final class SmsManager {
true /* persistMessage*/, ActivityThread.currentPackageName());
}
+ /**
+ * Send a text based SMS with messaging options.
+ *
+ * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
+ * manager on a multi-SIM device, this operation may fail sending the SMS message because no
+ * suitable default subscription could be found. In this case, if {@code sentIntent} is
+ * non-null, then the {@link PendingIntent} will be sent with an error code
+ * {@code RESULT_ERROR_GENERIC_FAILURE} and an extra string {@code "noDefault"} containing the
+ * boolean value {@code true}. See {@link #getDefault()} for more information on the conditions
+ * where this operation may fail.
+ * </p>
+ *
+ * @param destinationAddress the address to send the message to
+ * @param scAddress is the service center address or null to use
+ * the current default SMSC
+ * @param text the body of the message to send
+ * @param sentIntent if not NULL this <code>PendingIntent</code> is
+ * broadcast when the message is successfully sent, or failed.
+ * The result code will be <code>Activity.RESULT_OK</code> for success,
+ * or one of these errors:<br>
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
+ * <code>RESULT_ERROR_RADIO_OFF</code><br>
+ * <code>RESULT_ERROR_NULL_PDU</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
+ * The per-application based SMS control checks sentIntent. If sentIntent
+ * is NULL the caller will be checked against all unknown applications,
+ * which cause smaller number of SMS to be sent in checking period.
+ * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
+ * broadcast when the message is delivered to the recipient. The
+ * raw pdu of the status report is in the extended data ("pdu").
+ * @param priority Priority level of the message
+ * Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
+ * ---------------------------------
+ * PRIORITY | Level of Priority
+ * ---------------------------------
+ * '00' | Normal
+ * '01' | Interactive
+ * '10' | Urgent
+ * '11' | Emergency
+ * ----------------------------------
+ * Any Other values included Negative considered as Invalid Priority Indicator of the message.
+ * @param expectMore is a boolean to indicate the sending messages through same link or not.
+ * @param validityPeriod Validity Period of the message in mins.
+ * Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
+ * Validity Period(Minimum) -> 5 mins
+ * Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
+ * Any Other values included Negative considered as Invalid Validity Period of the message.
+ *
+ * @throws IllegalArgumentException if destinationAddress or text are empty
+ * {@hide}
+ */
+ @UnsupportedAppUsage
+ public void sendTextMessage(
+ String destinationAddress, String scAddress, String text,
+ PendingIntent sentIntent, PendingIntent deliveryIntent,
+ int priority, boolean expectMore, int validityPeriod) {
+ sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent,
+ true /* persistMessage*/, priority, expectMore, validityPeriod);
+ }
+
private void sendTextMessageInternal(String destinationAddress, String scAddress,
String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
boolean persistMessage, String packageName) {
@@ -391,13 +543,13 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal: Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -411,7 +563,7 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal (no persist): Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
}
@@ -455,109 +607,6 @@ public final class SmsManager {
false /* persistMessage */, ActivityThread.currentPackageName());
}
- /**
- * A variant of {@link SmsManager#sendTextMessage} that allows self to be the caller. This is
- * for internal use only.
- *
- * <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
- * applications or the Telephony framework and will never trigger an SMS disambiguation
- * dialog. If this method is called on a device that has multiple active subscriptions, this
- * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
- * default subscription is defined, the subscription ID associated with this message will be
- * INVALID, which will result in the SMS being sent on the subscription associated with logical
- * slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the SMS is sent on the
- * correct subscription.
- * </p>
- *
- * @param persistMessage whether to persist the sent message in the SMS app. the caller must be
- * the Phone process if set to false.
- *
- * @hide
- */
- public void sendTextMessageWithSelfPermissions(
- String destinationAddress, String scAddress, String text,
- PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage) {
- if (TextUtils.isEmpty(destinationAddress)) {
- throw new IllegalArgumentException("Invalid destinationAddress");
- }
-
- if (TextUtils.isEmpty(text)) {
- throw new IllegalArgumentException("Invalid message body");
- }
-
- try {
- ISms iSms = getISmsServiceOrThrow();
- iSms.sendTextForSubscriberWithSelfPermissions(getSubscriptionId(),
- ActivityThread.currentPackageName(),
- destinationAddress,
- scAddress, text, sentIntent, deliveryIntent, persistMessage);
- } catch (RemoteException ex) {
- notifySmsGenericError(sentIntent);
- }
- }
-
- /**
- * Send a text based SMS with messaging options.
- *
- * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
- * manager on a multi-SIM device, this operation may fail sending the SMS message because no
- * suitable default subscription could be found. In this case, if {@code sentIntent} is
- * non-null, then the {@link PendingIntent} will be sent with an error code
- * {@code RESULT_ERROR_GENERIC_FAILURE} and an extra string {@code "noDefault"} containing the
- * boolean value {@code true}. See {@link #getDefault()} for more information on the conditions
- * where this operation may fail.
- * </p>
- *
- * @param destinationAddress the address to send the message to
- * @param scAddress is the service center address or null to use
- * the current default SMSC
- * @param text the body of the message to send
- * @param sentIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is successfully sent, or failed.
- * The result code will be <code>Activity.RESULT_OK</code> for success,
- * or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
- * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is delivered to the recipient. The
- * raw pdu of the status report is in the extended data ("pdu").
- * @param priority Priority level of the message
- * Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
- * ---------------------------------
- * PRIORITY | Level of Priority
- * ---------------------------------
- * '00' | Normal
- * '01' | Interactive
- * '10' | Urgent
- * '11' | Emergency
- * ----------------------------------
- * Any Other values included Negative considered as Invalid Priority Indicator of the message.
- * @param expectMore is a boolean to indicate the sending messages through same link or not.
- * @param validityPeriod Validity Period of the message in mins.
- * Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
- * Validity Period(Minimum) -> 5 mins
- * Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
- * Any Other values included Negative considered as Invalid Validity Period of the message.
- *
- * @throws IllegalArgumentException if destinationAddress or text are empty
- * {@hide}
- */
- @UnsupportedAppUsage
- public void sendTextMessage(
- String destinationAddress, String scAddress, String text,
- PendingIntent sentIntent, PendingIntent deliveryIntent,
- int priority, boolean expectMore, int validityPeriod) {
- sendTextMessageInternal(destinationAddress, scAddress, text, sentIntent, deliveryIntent,
- true /* persistMessage*/, priority, expectMore, validityPeriod);
- }
-
private void sendTextMessageInternal(
String destinationAddress, String scAddress, String text,
PendingIntent sentIntent, PendingIntent deliveryIntent, boolean persistMessage,
@@ -607,13 +656,13 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal: Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -629,7 +678,7 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendTextMessageInternal(no persist): Couldn't send SMS, exception - "
+ e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
}
@@ -711,7 +760,7 @@ public final class SmsManager {
} catch (RemoteException ex) {
try {
if (receivedIntent != null) {
- receivedIntent.send(Telephony.Sms.Intents.RESULT_SMS_GENERIC_ERROR);
+ receivedIntent.send(RESULT_REMOTE_EXCEPTION);
}
} catch (PendingIntent.CanceledException cx) {
// Don't worry about it, we do not need to notify the caller if this is the case.
@@ -767,12 +816,63 @@ public final class SmsManager {
* broadcast when the corresponding message part has been sent.
* The result code will be <code>Activity.RESULT_OK</code> for success,
* or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
+ * <code>RESULT_ERROR_RADIO_OFF</code><br>
+ * <code>RESULT_ERROR_NULL_PDU</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -809,10 +909,12 @@ public final class SmsManager {
* {@link ActivityThread#currentPackageName()} is null.
* @hide
*/
- public void sendMultipartTextMessageExternal(
- String destinationAddress, String scAddress, ArrayList<String> parts,
- ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents,
- String packageName) {
+ @SystemApi
+ @TestApi
+ public void sendMultipartTextMessage(
+ @NonNull String destinationAddress, @NonNull String scAddress,
+ @NonNull List<String> parts, @Nullable List<PendingIntent> sentIntents,
+ @Nullable List<PendingIntent> deliveryIntents, @NonNull String packageName) {
sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
deliveryIntents, true /* persistMessage*/,
ActivityThread.currentPackageName() == null
@@ -854,13 +956,13 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntents);
+ notifySmsError(sentIntents, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -875,7 +977,7 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
} else {
@@ -954,12 +1056,63 @@ public final class SmsManager {
* broadcast when the corresponding message part has been sent.
* The result code will be <code>Activity.RESULT_OK</code> for success,
* or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
+ * <code>RESULT_ERROR_RADIO_OFF</code><br>
+ * <code>RESULT_ERROR_NULL_PDU</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -1037,13 +1190,13 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal: Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntents);
+ notifySmsError(sentIntents, RESULT_NO_DEFAULT_SMS_APP);
}
});
} else {
@@ -1059,7 +1212,7 @@ public final class SmsManager {
} catch (RemoteException e) {
Log.e(TAG, "sendMultipartTextMessageInternal (no persist): Couldn't send SMS - "
+ e.getMessage());
- notifySmsGenericError(sentIntents);
+ notifySmsError(sentIntents, RESULT_REMOTE_EXCEPTION);
}
}
} else {
@@ -1078,37 +1231,6 @@ public final class SmsManager {
}
/**
- * Send a multi-part text based SMS without writing it into the SMS Provider.
- *
- * <p>Requires Permission:
- * {@link android.Manifest.permission#MODIFY_PHONE_STATE} or the calling app has carrier
- * privileges.
- * </p>
- *
- * <p class="note"><strong>Note:</strong> This method is intended for internal use the Telephony
- * framework and will never trigger an SMS disambiguation dialog. If this method is called on a
- * device that has multiple active subscriptions, this {@link SmsManager} instance has been
- * created with {@link #getDefault()}, and no user-defined default subscription is defined, the
- * subscription ID associated with this message will be INVALID, which will result in the SMS
- * being sent on the subscription associated with logical slot 0. Use
- * {@link #getSmsManagerForSubscriptionId(int)} to ensure the SMS is sent on the correct
- * subscription.
- * </p>
- *
- * @see #sendMultipartTextMessage(String, String, ArrayList, ArrayList,
- * ArrayList, int, boolean, int)
- * @hide
- **/
- public void sendMultipartTextMessageWithoutPersisting(
- String destinationAddress, String scAddress, List<String> parts,
- List<PendingIntent> sentIntents, List<PendingIntent> deliveryIntents,
- int priority, boolean expectMore, int validityPeriod) {
- sendMultipartTextMessageInternal(destinationAddress, scAddress, parts, sentIntents,
- deliveryIntents, false /* persistMessage*/, priority, expectMore,
- validityPeriod);
- }
-
- /**
* Send a data based SMS to a specific application port.
*
* <p class="note"><strong>Note:</strong> Using this method requires that your app has the
@@ -1135,9 +1257,60 @@ public final class SmsManager {
* <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
* <code>RESULT_ERROR_RADIO_OFF</code><br>
* <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_NO_SERVICE</code><br>
+ * <code>RESULT_ERROR_LIMIT_EXCEEDED</code><br>
+ * <code>RESULT_ERROR_FDN_CHECK_FAILURE</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NOT_ALLOWED</code><br>
+ * <code>RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED</code><br>
+ * <code>RESULT_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_NETWORK_REJECT</code><br>
+ * <code>RESULT_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_INVALID_STATE</code><br>
+ * <code>RESULT_NO_MEMORY</code><br>
+ * <code>RESULT_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_SYSTEM_ERROR</code><br>
+ * <code>RESULT_MODEM_ERROR</code><br>
+ * <code>RESULT_NETWORK_ERROR</code><br>
+ * <code>RESULT_ENCODING_ERROR</code><br>
+ * <code>RESULT_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_INTERNAL_ERROR</code><br>
+ * <code>RESULT_NO_RESOURCES</code><br>
+ * <code>RESULT_CANCELLED</code><br>
+ * <code>RESULT_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_NO_BLUETOOTH_SERVICE</code><br>
+ * <code>RESULT_INVALID_BLUETOOTH_ADDRESS</code><br>
+ * <code>RESULT_BLUETOOTH_DISCONNECTED</code><br>
+ * <code>RESULT_UNEXPECTED_EVENT_STOP_SENDING</code><br>
+ * <code>RESULT_SMS_BLOCKED_DURING_EMERGENCY</code><br>
+ * <code>RESULT_SMS_SEND_RETRY_FAILED</code><br>
+ * <code>RESULT_REMOTE_EXCEPTION</code><br>
+ * <code>RESULT_NO_DEFAULT_SMS_APP</code><br>
+ * <code>RESULT_RIL_RADIO_NOT_AVAILABLE</code><br>
+ * <code>RESULT_RIL_SMS_SEND_FAIL_RETRY</code><br>
+ * <code>RESULT_RIL_NETWORK_REJECT</code><br>
+ * <code>RESULT_RIL_INVALID_STATE</code><br>
+ * <code>RESULT_RIL_INVALID_ARGUMENTS</code><br>
+ * <code>RESULT_RIL_NO_MEMORY</code><br>
+ * <code>RESULT_RIL_REQUEST_RATE_LIMITED</code><br>
+ * <code>RESULT_RIL_INVALID_SMS_FORMAT</code><br>
+ * <code>RESULT_RIL_SYSTEM_ERR</code><br>
+ * <code>RESULT_RIL_ENCODING_ERR</code><br>
+ * <code>RESULT_RIL_INVALID_SMSC_ADDRESS</code><br>
+ * <code>RESULT_RIL_MODEM_ERR</code><br>
+ * <code>RESULT_RIL_NETWORK_ERR</code><br>
+ * <code>RESULT_RIL_INTERNAL_ERR</code><br>
+ * <code>RESULT_RIL_REQUEST_NOT_SUPPORTED</code><br>
+ * <code>RESULT_RIL_INVALID_MODEM_STATE</code><br>
+ * <code>RESULT_RIL_NETWORK_NOT_READY</code><br>
+ * <code>RESULT_RIL_OPERATION_NOT_ALLOWED</code><br>
+ * <code>RESULT_RIL_NO_RESOURCES</code><br>
+ * <code>RESULT_RIL_CANCELLED</code><br>
+ * <code>RESULT_RIL_SIM_ABSENT</code><br>
+ * For <code>RESULT_ERROR_GENERIC_FAILURE</code> or any of the RESULT_RIL errors,
+ * the sentIntent may include the extra "errorCode" containing a radio technology specific
+ * value, generally only useful for troubleshooting.<br>
* The per-application based SMS control checks sentIntent. If sentIntent
* is NULL the caller will be checked against all unknown applications,
* which cause smaller number of SMS to be sent in checking period.
@@ -1169,56 +1342,17 @@ public final class SmsManager {
sentIntent, deliveryIntent);
} catch (RemoteException e) {
Log.e(TAG, "sendDataMessage: Couldn't send SMS - Exception: " + e.getMessage());
- notifySmsGenericError(sentIntent);
+ notifySmsError(sentIntent, RESULT_REMOTE_EXCEPTION);
}
}
@Override
public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
+ notifySmsError(sentIntent, RESULT_NO_DEFAULT_SMS_APP);
}
});
}
/**
- * A variant of {@link SmsManager#sendDataMessage} that allows self to be the caller. This is
- * for internal use only.
- *
- * <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
- * applications or the Telephony framework and will never trigger an SMS disambiguation
- * dialog. If this method is called on a device that has multiple active subscriptions, this
- * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
- * default subscription is defined, the subscription ID associated with this message will be
- * INVALID, which will result in the SMS being sent on the subscription associated with logical
- * slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the SMS is sent on the
- * correct subscription.
- * </p>
- *
- * @hide
- */
- public void sendDataMessageWithSelfPermissions(
- String destinationAddress, String scAddress, short destinationPort,
- byte[] data, PendingIntent sentIntent, PendingIntent deliveryIntent) {
- if (TextUtils.isEmpty(destinationAddress)) {
- throw new IllegalArgumentException("Invalid destinationAddress");
- }
-
- if (data == null || data.length == 0) {
- throw new IllegalArgumentException("Invalid message data");
- }
-
- try {
- ISms iSms = getISmsServiceOrThrow();
- iSms.sendDataForSubscriberWithSelfPermissions(getSubscriptionId(),
- ActivityThread.currentPackageName(), destinationAddress, scAddress,
- destinationPort & 0xFFFF, data, sentIntent, deliveryIntent);
- } catch (RemoteException e) {
- Log.e(TAG, "sendDataMessageWithSelfPermissions: Couldn't send SMS - Exception: "
- + e.getMessage());
- notifySmsGenericError(sentIntent);
- }
- }
-
- /**
* Get the SmsManager associated with the default subscription id. The instance will always be
* associated with the default subscription id, even if the default subscription id changes.
*
@@ -1418,53 +1552,20 @@ public final class SmsManager {
return binder;
}
- private static void notifySmsErrorNoDefaultSet(Context context, PendingIntent pendingIntent) {
- if (pendingIntent != null) {
- Intent errorMessage = new Intent();
- errorMessage.putExtra(NO_DEFAULT_EXTRA, true);
- try {
- pendingIntent.send(context, RESULT_ERROR_GENERIC_FAILURE, errorMessage);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the case.
- }
- }
- }
-
- private static void notifySmsErrorNoDefaultSet(Context context,
- List<PendingIntent> pendingIntents) {
- if (pendingIntents != null) {
- for (PendingIntent pendingIntent : pendingIntents) {
- Intent errorMessage = new Intent();
- errorMessage.putExtra(NO_DEFAULT_EXTRA, true);
- try {
- pendingIntent.send(context, RESULT_ERROR_GENERIC_FAILURE, errorMessage);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the
- // case.
- }
- }
- }
- }
-
- private static void notifySmsGenericError(PendingIntent pendingIntent) {
+ private static void notifySmsError(PendingIntent pendingIntent, int error) {
if (pendingIntent != null) {
try {
- pendingIntent.send(RESULT_ERROR_GENERIC_FAILURE);
+ pendingIntent.send(error);
} catch (PendingIntent.CanceledException e) {
// Don't worry about it, we do not need to notify the caller if this is the case.
}
}
}
- private static void notifySmsGenericError(List<PendingIntent> pendingIntents) {
+ private static void notifySmsError(List<PendingIntent> pendingIntents, int error) {
if (pendingIntents != null) {
for (PendingIntent pendingIntent : pendingIntents) {
- try {
- pendingIntent.send(RESULT_ERROR_GENERIC_FAILURE);
- } catch (PendingIntent.CanceledException e) {
- // Don't worry about it, we do not need to notify the caller if this is the
- // case.
- }
+ notifySmsError(pendingIntent, error);
}
}
}
@@ -1650,100 +1751,6 @@ public final class SmsManager {
/**
* Enable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier and RAN type. The RAN type specify this message ID
- * belong to 3GPP (GSM) or 3GPP2(CDMA).Note that if two different clients
- * enable the same message identifier, they must both disable it for the device to stop
- * receiving those messages. All received messages will be broadcast in an
- * intent with the action "android.provider.Telephony.SMS_CB_RECEIVED".
- * Note: This call is blocking, callers may want to avoid calling it from
- * the main thread of an application.
- *
- * <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
- * applications or the Telephony framework and will never trigger an SMS disambiguation
- * dialog. If this method is called on a device that has multiple active subscriptions, this
- * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
- * default subscription is defined, the subscription ID associated with this message will be
- * INVALID, which will result in the operation being completed on the subscription associated
- * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the
- * operation is performed on the correct subscription.
- * </p>
- *
- * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP)
- * or C.R1001-G (3GPP2)
- * @param ranType the message format as defined in {@link SmsCbMessage]
- * @return true if successful, false otherwise
- * @see #disableCellBroadcast(int, int)
- *
- * {@hide}
- */
- public boolean enableCellBroadcast(int messageIdentifier,
- @android.telephony.SmsCbMessage.MessageFormat int ranType) {
- boolean success = false;
-
- try {
- ISms iSms = getISmsService();
- if (iSms != null) {
- // If getSubscriptionId() returns INVALID or an inactive subscription, we will use
- // the default phone internally.
- success = iSms.enableCellBroadcastForSubscriber(getSubscriptionId(),
- messageIdentifier, ranType);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
-
- return success;
- }
-
- /**
- * Disable reception of cell broadcast (SMS-CB) messages with the given
- * message identifier and RAN type. The RAN type specify this message ID
- * belong to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients
- * enable the same message identifier, they must both disable it for the
- * device to stop receiving those messages.
- * Note: This call is blocking, callers may want to avoid calling it from
- * the main thread of an application.
- *
- * <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
- * applications or the Telephony framework and will never trigger an SMS disambiguation
- * dialog. If this method is called on a device that has multiple active subscriptions, this
- * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
- * default subscription is defined, the subscription ID associated with this message will be
- * INVALID, which will result in the operation being completed on the subscription associated
- * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the
- * operation is performed on the correct subscription.
- * </p>
- *
- * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP)
- * or C.R1001-G (3GPP2)
- * @param ranType the message format as defined in {@link SmsCbMessage}
- * @return true if successful, false otherwise
- *
- * @see #enableCellBroadcast(int, int)
- *
- * {@hide}
- */
- public boolean disableCellBroadcast(int messageIdentifier,
- @android.telephony.SmsCbMessage.MessageFormat int ranType) {
- boolean success = false;
-
- try {
- ISms iSms = getISmsService();
- if (iSms != null) {
- // If getSubscriptionId() returns INVALID or an inactive subscription, we will use
- // the default phone internally.
- success = iSms.disableCellBroadcastForSubscriber(getSubscriptionId(),
- messageIdentifier, ranType);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
-
- return success;
- }
-
- /**
- * Enable reception of cell broadcast (SMS-CB) messages with the given
* message identifier range and RAN type. The RAN type specifies if this message ID
* belongs to 3GPP (GSM) or 3GPP2(CDMA). Note that if two different clients enable
* the same message identifier, they must both disable it for the device to stop
@@ -2005,19 +2012,19 @@ public final class SmsManager {
// see SmsMessage.getStatusOnIcc
/** Free space (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_FREE = 0;
+ public static final int STATUS_ON_ICC_FREE = 0;
/** Received and read (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_READ = 1;
+ public static final int STATUS_ON_ICC_READ = 1;
/** Received and unread (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_UNREAD = 3;
+ public static final int STATUS_ON_ICC_UNREAD = 3;
/** Stored and sent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_SENT = 5;
+ public static final int STATUS_ON_ICC_SENT = 5;
/** Stored and unsent (TS 51.011 10.5.3 / 3GPP2 C.S0023 3.4.27). */
- static public final int STATUS_ON_ICC_UNSENT = 7;
+ public static final int STATUS_ON_ICC_UNSENT = 7;
// SMS send failure result codes
@@ -2053,129 +2060,263 @@ public final class SmsManager {
/**
* No error.
- * @hide
*/
- @SystemApi
- static public final int RESULT_ERROR_NONE = 0;
+ public static final int RESULT_ERROR_NONE = 0;
+
/** Generic failure cause */
- static public final int RESULT_ERROR_GENERIC_FAILURE = 1;
+ public static final int RESULT_ERROR_GENERIC_FAILURE = 1;
+
/** Failed because radio was explicitly turned off */
- static public final int RESULT_ERROR_RADIO_OFF = 2;
+ public static final int RESULT_ERROR_RADIO_OFF = 2;
+
/** Failed because no pdu provided */
- static public final int RESULT_ERROR_NULL_PDU = 3;
+ public static final int RESULT_ERROR_NULL_PDU = 3;
+
/** Failed because service is currently unavailable */
- static public final int RESULT_ERROR_NO_SERVICE = 4;
+ public static final int RESULT_ERROR_NO_SERVICE = 4;
+
/** Failed because we reached the sending queue limit. */
- static public final int RESULT_ERROR_LIMIT_EXCEEDED = 5;
+ public static final int RESULT_ERROR_LIMIT_EXCEEDED = 5;
+
/**
* Failed because FDN is enabled.
- * @hide
*/
- @SystemApi
- static public final int RESULT_ERROR_FDN_CHECK_FAILURE = 6;
+ public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6;
+
/** Failed because user denied the sending of this short code. */
- static public final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7;
+ public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7;
+
/** Failed because the user has denied this app ever send premium short codes. */
- static public final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8;
+ public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8;
+
/**
* Failed because the radio was not available
- * @hide
*/
- @SystemApi
- static public final int RESULT_RADIO_NOT_AVAILABLE = 9;
+ public static final int RESULT_RADIO_NOT_AVAILABLE = 9;
+
/**
* Failed because of network rejection
- * @hide
*/
- @SystemApi
- static public final int RESULT_NETWORK_REJECT = 10;
+ public static final int RESULT_NETWORK_REJECT = 10;
+
/**
* Failed because of invalid arguments
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_ARGUMENTS = 11;
+ public static final int RESULT_INVALID_ARGUMENTS = 11;
+
/**
* Failed because of an invalid state
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_STATE = 12;
+ public static final int RESULT_INVALID_STATE = 12;
+
/**
* Failed because there is no memory
- * @hide
*/
- @SystemApi
- static public final int RESULT_NO_MEMORY = 13;
+ public static final int RESULT_NO_MEMORY = 13;
+
/**
* Failed because the sms format is not valid
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_SMS_FORMAT = 14;
+ public static final int RESULT_INVALID_SMS_FORMAT = 14;
+
/**
* Failed because of a system error
- * @hide
*/
- @SystemApi
- static public final int RESULT_SYSTEM_ERROR = 15;
+ public static final int RESULT_SYSTEM_ERROR = 15;
+
/**
* Failed because of a modem error
- * @hide
*/
- @SystemApi
- static public final int RESULT_MODEM_ERROR = 16;
+ public static final int RESULT_MODEM_ERROR = 16;
+
/**
* Failed because of a network error
- * @hide
*/
- @SystemApi
- static public final int RESULT_NETWORK_ERROR = 17;
+ public static final int RESULT_NETWORK_ERROR = 17;
+
/**
* Failed because of an encoding error
- * @hide
*/
- @SystemApi
- static public final int RESULT_ENCODING_ERROR = 18;
+ public static final int RESULT_ENCODING_ERROR = 18;
+
/**
* Failed because of an invalid smsc address
- * @hide
*/
- @SystemApi
- static public final int RESULT_INVALID_SMSC_ADDRESS = 19;
+ public static final int RESULT_INVALID_SMSC_ADDRESS = 19;
+
/**
* Failed because the operation is not allowed
- * @hide
*/
- @SystemApi
- static public final int RESULT_OPERATION_NOT_ALLOWED = 20;
+ public static final int RESULT_OPERATION_NOT_ALLOWED = 20;
+
/**
* Failed because of an internal error
- * @hide
*/
- @SystemApi
- static public final int RESULT_INTERNAL_ERROR = 21;
+ public static final int RESULT_INTERNAL_ERROR = 21;
+
/**
* Failed because there are no resources
- * @hide
*/
- @SystemApi
- static public final int RESULT_NO_RESOURCES = 22;
+ public static final int RESULT_NO_RESOURCES = 22;
+
/**
* Failed because the operation was cancelled
- * @hide
*/
- @SystemApi
- static public final int RESULT_CANCELLED = 23;
+ public static final int RESULT_CANCELLED = 23;
+
/**
* Failed because the request is not supported
- * @hide
*/
- @SystemApi
- static public final int RESULT_REQUEST_NOT_SUPPORTED = 24;
+ public static final int RESULT_REQUEST_NOT_SUPPORTED = 24;
+
+ /**
+ * Failed sending via bluetooth because the bluetooth service is not available
+ */
+ public static final int RESULT_NO_BLUETOOTH_SERVICE = 25;
+
+ /**
+ * Failed sending via bluetooth because the bluetooth device address is invalid
+ */
+ public static final int RESULT_INVALID_BLUETOOTH_ADDRESS = 26;
+
+ /**
+ * Failed sending via bluetooth because bluetooth disconnected
+ */
+ public static final int RESULT_BLUETOOTH_DISCONNECTED = 27;
+
+ /**
+ * Failed sending because the user denied or canceled the dialog displayed for a premium
+ * shortcode sms or rate-limited sms.
+ */
+ public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING = 28;
+
+ /**
+ * Failed sending during an emergency call
+ */
+ public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY = 29;
+
+ /**
+ * Failed to send an sms retry
+ */
+ public static final int RESULT_SMS_SEND_RETRY_FAILED = 30;
+
+ /**
+ * Set by BroadcastReceiver to indicate a remote exception while handling a message.
+ */
+ public static final int RESULT_REMOTE_EXCEPTION = 31;
+
+ /**
+ * Set by BroadcastReceiver to indicate there's no default sms app.
+ */
+ public static final int RESULT_NO_DEFAULT_SMS_APP = 32;
+
+ // Radio Error results
+
+ /**
+ * The radio did not start or is resetting.
+ */
+ public static final int RESULT_RIL_RADIO_NOT_AVAILABLE = 100;
+
+ /**
+ * The radio failed to send the sms and needs to retry.
+ */
+ public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY = 101;
+
+ /**
+ * The sms request was rejected by the network.
+ */
+ public static final int RESULT_RIL_NETWORK_REJECT = 102;
+
+ /**
+ * The radio returned an unexpected request for the current state.
+ */
+ public static final int RESULT_RIL_INVALID_STATE = 103;
+
+ /**
+ * The radio received invalid arguments in the request.
+ */
+ public static final int RESULT_RIL_INVALID_ARGUMENTS = 104;
+
+ /**
+ * The radio didn't have sufficient memory to process the request.
+ */
+ public static final int RESULT_RIL_NO_MEMORY = 105;
+
+ /**
+ * The radio denied the operation due to overly-frequent requests.
+ */
+ public static final int RESULT_RIL_REQUEST_RATE_LIMITED = 106;
+
+ /**
+ * The radio returned an error indicating invalid sms format.
+ */
+ public static final int RESULT_RIL_INVALID_SMS_FORMAT = 107;
+
+ /**
+ * The radio encountered a platform or system error.
+ */
+ public static final int RESULT_RIL_SYSTEM_ERR = 108;
+
+ /**
+ * The SMS message was not encoded properly.
+ */
+ public static final int RESULT_RIL_ENCODING_ERR = 109;
+
+ /**
+ * The specified SMSC address was invalid.
+ */
+ public static final int RESULT_RIL_INVALID_SMSC_ADDRESS = 110;
+
+ /**
+ * The vendor RIL received an unexpected or incorrect response.
+ */
+ public static final int RESULT_RIL_MODEM_ERR = 111;
+ /**
+ * The radio received an error from the network.
+ */
+ public static final int RESULT_RIL_NETWORK_ERR = 112;
- static private final String PHONE_PACKAGE_NAME = "com.android.phone";
+ /**
+ * The modem encountered an unexpected error scenario while handling the request.
+ */
+ public static final int RESULT_RIL_INTERNAL_ERR = 113;
+
+ /**
+ * The request was not supported by the radio.
+ */
+ public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED = 114;
+
+ /**
+ * The radio cannot process the request in the current modem state.
+ */
+ public static final int RESULT_RIL_INVALID_MODEM_STATE = 115;
+
+ /**
+ * The network is not ready to perform the request.
+ */
+ public static final int RESULT_RIL_NETWORK_NOT_READY = 116;
+
+ /**
+ * The radio reports the request is not allowed.
+ */
+ public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117;
+
+ /**
+ * There are not sufficient resources to process the request.
+ */
+ public static final int RESULT_RIL_NO_RESOURCES = 118;
+
+ /**
+ * The request has been cancelled.
+ */
+ public static final int RESULT_RIL_CANCELLED = 119;
+
+ /**
+ * The radio failed to set the location where the CDMA subscription
+ * can be retrieved because the SIM or RUIM is absent.
+ */
+ public static final int RESULT_RIL_SIM_ABSENT = 120;
/**
* Send an MMS message
@@ -2203,17 +2344,8 @@ public final class SmsManager {
if (contentUri == null) {
throw new IllegalArgumentException("Uri contentUri null");
}
- try {
- final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms == null) {
- return;
- }
-
- iMms.sendMessage(getSubscriptionId(), ActivityThread.currentPackageName(), contentUri,
+ MmsManager.getInstance().sendMultimediaMessage(getSubscriptionId(), contentUri,
locationUrl, configOverrides, sentIntent);
- } catch (RemoteException e) {
- // Ignore it
- }
}
/**
@@ -2246,16 +2378,8 @@ public final class SmsManager {
if (contentUri == null) {
throw new IllegalArgumentException("Uri contentUri null");
}
- try {
- final IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms == null) {
- return;
- }
- iMms.downloadMessage(getSubscriptionId(), ActivityThread.currentPackageName(),
- locationUrl, contentUri, configOverrides, downloadedIntent);
- } catch (RemoteException e) {
- // Ignore it
- }
+ MmsManager.getInstance().downloadMultimediaMessage(getSubscriptionId(), locationUrl,
+ contentUri, configOverrides, downloadedIntent);
}
// MMS send/download failure result codes
@@ -2273,434 +2397,17 @@ public final class SmsManager {
/** Intent extra name for HTTP status code for MMS HTTP failure in integer type */
public static final String EXTRA_MMS_HTTP_STATUS = "android.telephony.extra.MMS_HTTP_STATUS";
- /**
- * Import a text message into system's SMS store
- *
- * Only default SMS apps can import SMS
- *
- * @param address the destination(source) address of the sent(received) message
- * @param type the type of the message
- * @param text the message text
- * @param timestampMillis the message timestamp in milliseconds
- * @param seen if the message is seen
- * @param read if the message is read
- * @return the message URI, null if failed
- * @hide
- */
- public Uri importTextMessage(String address, int type, String text, long timestampMillis,
- boolean seen, boolean read) {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.importTextMessage(ActivityThread.currentPackageName(),
- address, type, text, timestampMillis, seen, read);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return null;
- }
-
/** Represents the received SMS message for importing {@hide} */
public static final int SMS_TYPE_INCOMING = 0;
/** Represents the sent SMS message for importing {@hide} */
public static final int SMS_TYPE_OUTGOING = 1;
- /**
- * Import a multimedia message into system's MMS store. Only the following PDU type is
- * supported: Retrieve.conf, Send.req, Notification.ind, Delivery.ind, Read-Orig.ind
- *
- * Only default SMS apps can import MMS
- *
- * @param contentUri the content uri from which to read the PDU of the message to import
- * @param messageId the optional message id. Use null if not specifying
- * @param timestampSecs the optional message timestamp. Use -1 if not specifying
- * @param seen if the message is seen
- * @param read if the message is read
- * @return the message URI, null if failed
- * @throws IllegalArgumentException if pdu is empty
- * {@hide}
- */
- public Uri importMultimediaMessage(Uri contentUri, String messageId, long timestampSecs,
- boolean seen, boolean read) {
- if (contentUri == null) {
- throw new IllegalArgumentException("Uri contentUri null");
- }
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.importMultimediaMessage(ActivityThread.currentPackageName(),
- contentUri, messageId, timestampSecs, seen, read);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return null;
- }
-
- /**
- * Delete a system stored SMS or MMS message
- *
- * Only default SMS apps can delete system stored SMS and MMS messages
- *
- * @param messageUri the URI of the stored message
- * @return true if deletion is successful, false otherwise
- * @throws IllegalArgumentException if messageUri is empty
- * {@hide}
- */
- public boolean deleteStoredMessage(Uri messageUri) {
- if (messageUri == null) {
- throw new IllegalArgumentException("Empty message URI");
- }
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.deleteStoredMessage(ActivityThread.currentPackageName(), messageUri);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return false;
- }
-
- /**
- * Delete a system stored SMS or MMS thread
- *
- * Only default SMS apps can delete system stored SMS and MMS conversations
- *
- * @param conversationId the ID of the message conversation
- * @return true if deletion is successful, false otherwise
- * {@hide}
- */
- public boolean deleteStoredConversation(long conversationId) {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.deleteStoredConversation(
- ActivityThread.currentPackageName(), conversationId);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return false;
- }
-
- /**
- * Update the status properties of a system stored SMS or MMS message, e.g.
- * the read status of a message, etc.
- *
- * @param messageUri the URI of the stored message
- * @param statusValues a list of status properties in key-value pairs to update
- * @return true if update is successful, false otherwise
- * @throws IllegalArgumentException if messageUri is empty
- * {@hide}
- */
- public boolean updateStoredMessageStatus(Uri messageUri, ContentValues statusValues) {
- if (messageUri == null) {
- throw new IllegalArgumentException("Empty message URI");
- }
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.updateStoredMessageStatus(ActivityThread.currentPackageName(),
- messageUri, statusValues);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return false;
- }
-
/** Message status property: whether the message has been seen. 1 means seen, 0 not {@hide} */
public static final String MESSAGE_STATUS_SEEN = "seen";
/** Message status property: whether the message has been read. 1 means read, 0 not {@hide} */
public static final String MESSAGE_STATUS_READ = "read";
/**
- * Archive or unarchive a stored conversation
- *
- * @param conversationId the ID of the message conversation
- * @param archived true to archive the conversation, false to unarchive
- * @return true if update is successful, false otherwise
- * {@hide}
- */
- public boolean archiveStoredConversation(long conversationId, boolean archived) {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.archiveStoredConversation(ActivityThread.currentPackageName(),
- conversationId, archived);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return false;
- }
-
- /**
- * Add a text message draft to system SMS store
- *
- * Only default SMS apps can add SMS draft
- *
- * @param address the destination address of message
- * @param text the body of the message to send
- * @return the URI of the stored draft message
- * {@hide}
- */
- public Uri addTextMessageDraft(String address, String text) {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.addTextMessageDraft(ActivityThread.currentPackageName(), address, text);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return null;
- }
-
- /**
- * Add a multimedia message draft to system MMS store
- *
- * Only default SMS apps can add MMS draft
- *
- * @param contentUri the content uri from which to read the PDU data of the draft MMS
- * @return the URI of the stored draft message
- * @throws IllegalArgumentException if pdu is empty
- * {@hide}
- */
- public Uri addMultimediaMessageDraft(Uri contentUri) {
- if (contentUri == null) {
- throw new IllegalArgumentException("Uri contentUri null");
- }
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.addMultimediaMessageDraft(ActivityThread.currentPackageName(),
- contentUri);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return null;
- }
-
- /**
- * Send a system stored text message.
- *
- * You can only send a failed text message or a draft text message.
- *
- * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
- * manager on a multi-SIM device, this operation may fail sending the SMS message because no
- * suitable default subscription could be found. In this case, if {@code sentIntent} is
- * non-null, then the {@link PendingIntent} will be sent with an error code
- * {@code RESULT_ERROR_GENERIC_FAILURE} and an extra string {@code "noDefault"} containing the
- * boolean value {@code true}. See {@link #getDefault()} for more information on the conditions
- * where this operation may fail.
- * </p>
- *
- * @param messageUri the URI of the stored message
- * @param scAddress is the service center address or null to use the current default SMSC
- * @param sentIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is successfully sent, or failed.
- * The result code will be <code>Activity.RESULT_OK</code> for success,
- * or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
- * @param deliveryIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is delivered to the recipient. The
- * raw pdu of the status report is in the extended data ("pdu").
- *
- * @throws IllegalArgumentException if messageUri is empty
- * {@hide}
- */
- public void sendStoredTextMessage(Uri messageUri, String scAddress, PendingIntent sentIntent,
- PendingIntent deliveryIntent) {
- if (messageUri == null) {
- throw new IllegalArgumentException("Empty message URI");
- }
- final Context context = ActivityThread.currentApplication().getApplicationContext();
- resolveSubscriptionForOperation(new SubscriptionResolverResult() {
- @Override
- public void onSuccess(int subId) {
- try {
- ISms iSms = getISmsServiceOrThrow();
- iSms.sendStoredText(subId, ActivityThread.currentPackageName(), messageUri,
- scAddress, sentIntent, deliveryIntent);
- } catch (RemoteException e) {
- Log.e(TAG, "sendStoredTextMessage: Couldn't send SMS - Exception: "
- + e.getMessage());
- notifySmsGenericError(sentIntent);
- }
- }
- @Override
- public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntent);
- }
- });
- }
-
- /**
- * Send a system stored multi-part text message.
- *
- * You can only send a failed text message or a draft text message.
- * The provided <code>PendingIntent</code> lists should match the part number of the
- * divided text of the stored message by using <code>divideMessage</code>
- *
- * <p class="note"><strong>Note:</strong> If {@link #getDefault()} is used to instantiate this
- * manager on a multi-SIM device, this operation may fail sending the SMS message because no
- * suitable default subscription could be found. In this case, if {@code sentIntent} is
- * non-null, then the {@link PendingIntent} will be sent with an error code
- * {@code RESULT_ERROR_GENERIC_FAILURE} and an extra string {@code "noDefault"} containing the
- * boolean value {@code true}. See {@link #getDefault()} for more information on the conditions
- * where this operation may fail.
- * </p>
- *
- * @param messageUri the URI of the stored message
- * @param scAddress is the service center address or null to use
- * the current default SMSC
- * @param sentIntents if not null, an <code>ArrayList</code> of
- * <code>PendingIntent</code>s (one for each message part) that is
- * broadcast when the corresponding message part has been sent.
- * The result code will be <code>Activity.RESULT_OK</code> for success,
- * or one of these errors:<br>
- * <code>RESULT_ERROR_GENERIC_FAILURE</code><br>
- * <code>RESULT_ERROR_RADIO_OFF</code><br>
- * <code>RESULT_ERROR_NULL_PDU</code><br>
- * For <code>RESULT_ERROR_GENERIC_FAILURE</code> each sentIntent may include
- * the extra "errorCode" containing a radio technology specific value,
- * generally only useful for troubleshooting.<br>
- * The per-application based SMS control checks sentIntent. If sentIntent
- * is NULL the caller will be checked against all unknown applications,
- * which cause smaller number of SMS to be sent in checking period.
- * @param deliveryIntents if not null, an <code>ArrayList</code> of
- * <code>PendingIntent</code>s (one for each message part) that is
- * broadcast when the corresponding message part has been delivered
- * to the recipient. The raw pdu of the status report is in the
- * extended data ("pdu").
- *
- * @throws IllegalArgumentException if messageUri is empty
- * {@hide}
- */
- public void sendStoredMultipartTextMessage(Uri messageUri, String scAddress,
- ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
- if (messageUri == null) {
- throw new IllegalArgumentException("Empty message URI");
- }
- final Context context = ActivityThread.currentApplication().getApplicationContext();
- resolveSubscriptionForOperation(new SubscriptionResolverResult() {
- @Override
- public void onSuccess(int subId) {
- try {
- ISms iSms = getISmsServiceOrThrow();
- iSms.sendStoredMultipartText(subId, ActivityThread.currentPackageName(),
- messageUri, scAddress, sentIntents, deliveryIntents);
- } catch (RemoteException e) {
- Log.e(TAG, "sendStoredTextMessage: Couldn't send SMS - Exception: "
- + e.getMessage());
- notifySmsGenericError(sentIntents);
- }
- }
- @Override
- public void onFailure() {
- notifySmsErrorNoDefaultSet(context, sentIntents);
- }
- });
- }
-
- /**
- * Send a system stored MMS message
- *
- * This is used for sending a previously sent, but failed-to-send, message or
- * for sending a text message that has been stored as a draft.
- *
- * <p class="note"><strong>Note:</strong> This method will never trigger an SMS disambiguation
- * dialog. If this method is called on a device that has multiple active subscriptions, this
- * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
- * default subscription is defined, the subscription ID associated with this message will be
- * INVALID, which will result in the operation being completed on the subscription associated
- * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the
- * operation is performed on the correct subscription.
- * </p>
- *
- * @param messageUri the URI of the stored message
- * @param configOverrides the carrier-specific messaging configuration values to override for
- * sending the message.
- * @param sentIntent if not NULL this <code>PendingIntent</code> is
- * broadcast when the message is successfully sent, or failed
- * @throws IllegalArgumentException if messageUri is empty
- * {@hide}
- */
- public void sendStoredMultimediaMessage(Uri messageUri, Bundle configOverrides,
- PendingIntent sentIntent) {
- if (messageUri == null) {
- throw new IllegalArgumentException("Empty message URI");
- }
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- iMms.sendStoredMessage(
- getSubscriptionId(), ActivityThread.currentPackageName(), messageUri,
- configOverrides, sentIntent);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- }
-
- /**
- * Turns on/off the flag to automatically write sent/received SMS/MMS messages into system
- *
- * When this flag is on, all SMS/MMS sent/received are stored by system automatically
- * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system
- * automatically
- *
- * This flag can only be changed by default SMS apps
- *
- * @param enabled Whether to enable message auto persisting
- * {@hide}
- */
- public void setAutoPersisting(boolean enabled) {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- iMms.setAutoPersisting(ActivityThread.currentPackageName(), enabled);
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- }
-
- /**
- * Get the value of the flag to automatically write sent/received SMS/MMS messages into system
- *
- * When this flag is on, all SMS/MMS sent/received are stored by system automatically
- * When this flag is off, only SMS/MMS sent by non-default SMS apps are stored by system
- * automatically
- *
- * @return the current value of the auto persist flag
- * {@hide}
- */
- public boolean getAutoPersisting() {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.getAutoPersisting();
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return false;
- }
-
- /**
* Get carrier-dependent configuration values.
*
* <p class="note"><strong>Note:</strong> This method is intended for internal use by carrier
@@ -2716,15 +2423,7 @@ public final class SmsManager {
* @return bundle key/values pairs of configuration values
*/
public Bundle getCarrierConfigValues() {
- try {
- IMms iMms = IMms.Stub.asInterface(ServiceManager.getService("imms"));
- if (iMms != null) {
- return iMms.getCarrierConfigValues(getSubscriptionId());
- }
- } catch (RemoteException ex) {
- // ignore it
- }
- return null;
+ return MmsManager.getInstance().getCarrierConfigValues(getSubscriptionId());
}
/**
@@ -2810,38 +2509,38 @@ public final class SmsManager {
}
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* The prefixes is a list of prefix {@code String} separated by this delimiter.
* @hide
*/
public static final String REGEX_PREFIX_DELIMITER = ",";
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* The success status to be added into the intent to be sent to the calling package.
* @hide
*/
public static final int RESULT_STATUS_SUCCESS = 0;
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* The timeout status to be added into the intent to be sent to the calling package.
* @hide
*/
public static final int RESULT_STATUS_TIMEOUT = 1;
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* Intent extra key of the retrieved SMS message as a {@code String}.
* @hide
*/
public static final String EXTRA_SMS_MESSAGE = "android.telephony.extra.SMS_MESSAGE";
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* Intent extra key of SMS retriever status, which indicates whether the request for the
* coming SMS message is SUCCESS or TIMEOUT
* @hide
*/
public static final String EXTRA_STATUS = "android.telephony.extra.STATUS";
/**
- * @see #createAppSpecificSmsTokenWithPackageInfo().
+ * @see #createAppSpecificSmsTokenWithPackageInfo(String, PendingIntent).
* [Optional] Intent extra key of the retrieved Sim card subscription Id if any. {@code int}
* @hide
*/
@@ -2891,74 +2590,6 @@ public final class SmsManager {
}
}
- /**
- * Filters a bundle to only contain MMS config variables.
- *
- * This is for use with bundles returned by {@link CarrierConfigManager} which contain MMS
- * config and unrelated config. It is assumed that all MMS_CONFIG_* keys are present in the
- * supplied bundle.
- *
- * @param config a Bundle that contains MMS config variables and possibly more.
- * @return a new Bundle that only contains the MMS_CONFIG_* keys defined above.
- * @hide
- */
- public static Bundle getMmsConfig(BaseBundle config) {
- Bundle filtered = new Bundle();
- filtered.putBoolean(MMS_CONFIG_APPEND_TRANSACTION_ID,
- config.getBoolean(MMS_CONFIG_APPEND_TRANSACTION_ID));
- filtered.putBoolean(MMS_CONFIG_MMS_ENABLED, config.getBoolean(MMS_CONFIG_MMS_ENABLED));
- filtered.putBoolean(MMS_CONFIG_GROUP_MMS_ENABLED,
- config.getBoolean(MMS_CONFIG_GROUP_MMS_ENABLED));
- filtered.putBoolean(MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED,
- config.getBoolean(MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED));
- filtered.putBoolean(MMS_CONFIG_ALIAS_ENABLED, config.getBoolean(MMS_CONFIG_ALIAS_ENABLED));
- filtered.putBoolean(MMS_CONFIG_ALLOW_ATTACH_AUDIO,
- config.getBoolean(MMS_CONFIG_ALLOW_ATTACH_AUDIO));
- filtered.putBoolean(MMS_CONFIG_MULTIPART_SMS_ENABLED,
- config.getBoolean(MMS_CONFIG_MULTIPART_SMS_ENABLED));
- filtered.putBoolean(MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED,
- config.getBoolean(MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED));
- filtered.putBoolean(MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION,
- config.getBoolean(MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION));
- filtered.putBoolean(MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES,
- config.getBoolean(MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES));
- filtered.putBoolean(MMS_CONFIG_MMS_READ_REPORT_ENABLED,
- config.getBoolean(MMS_CONFIG_MMS_READ_REPORT_ENABLED));
- filtered.putBoolean(MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED,
- config.getBoolean(MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED));
- filtered.putBoolean(MMS_CONFIG_CLOSE_CONNECTION,
- config.getBoolean(MMS_CONFIG_CLOSE_CONNECTION));
- filtered.putInt(MMS_CONFIG_MAX_MESSAGE_SIZE, config.getInt(MMS_CONFIG_MAX_MESSAGE_SIZE));
- filtered.putInt(MMS_CONFIG_MAX_IMAGE_WIDTH, config.getInt(MMS_CONFIG_MAX_IMAGE_WIDTH));
- filtered.putInt(MMS_CONFIG_MAX_IMAGE_HEIGHT, config.getInt(MMS_CONFIG_MAX_IMAGE_HEIGHT));
- filtered.putInt(MMS_CONFIG_RECIPIENT_LIMIT, config.getInt(MMS_CONFIG_RECIPIENT_LIMIT));
- filtered.putInt(MMS_CONFIG_ALIAS_MIN_CHARS, config.getInt(MMS_CONFIG_ALIAS_MIN_CHARS));
- filtered.putInt(MMS_CONFIG_ALIAS_MAX_CHARS, config.getInt(MMS_CONFIG_ALIAS_MAX_CHARS));
- filtered.putInt(MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD,
- config.getInt(MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD));
- filtered.putInt(MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD,
- config.getInt(MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD));
- filtered.putInt(MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE,
- config.getInt(MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE));
- filtered.putInt(MMS_CONFIG_SUBJECT_MAX_LENGTH,
- config.getInt(MMS_CONFIG_SUBJECT_MAX_LENGTH));
- filtered.putInt(MMS_CONFIG_HTTP_SOCKET_TIMEOUT,
- config.getInt(MMS_CONFIG_HTTP_SOCKET_TIMEOUT));
- filtered.putString(MMS_CONFIG_UA_PROF_TAG_NAME,
- config.getString(MMS_CONFIG_UA_PROF_TAG_NAME));
- filtered.putString(MMS_CONFIG_USER_AGENT, config.getString(MMS_CONFIG_USER_AGENT));
- filtered.putString(MMS_CONFIG_UA_PROF_URL, config.getString(MMS_CONFIG_UA_PROF_URL));
- filtered.putString(MMS_CONFIG_HTTP_PARAMS, config.getString(MMS_CONFIG_HTTP_PARAMS));
- filtered.putString(MMS_CONFIG_EMAIL_GATEWAY_NUMBER,
- config.getString(MMS_CONFIG_EMAIL_GATEWAY_NUMBER));
- filtered.putString(MMS_CONFIG_NAI_SUFFIX, config.getString(MMS_CONFIG_NAI_SUFFIX));
- filtered.putBoolean(MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS,
- config.getBoolean(MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS));
- filtered.putBoolean(MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER,
- config.getBoolean(MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER));
- return filtered;
- }
-
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(prefix = {"SMS_CATEGORY_"},
@@ -3049,4 +2680,74 @@ public final class SmsManager {
}
return SmsManager.SMS_CATEGORY_NOT_SHORT_CODE;
}
+
+ /**
+ * Gets the SMSC address from (U)SIM.
+ *
+ * <p class="note"><strong>Note:</strong> Using this method requires that your app is the
+ * default SMS application, or READ_PRIVILEGED_PHONE_STATE permission, or has the carrier
+ * privileges.</p>
+ *
+ * <p class="note"><strong>Note:</strong> This method will never trigger an SMS disambiguation
+ * dialog. If this method is called on a device that has multiple active subscriptions, this
+ * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
+ * default subscription is defined, the subscription ID associated with this method will be
+ * INVALID, which will result in the operation being completed on the subscription associated
+ * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the operation
+ * is performed on the correct subscription.
+ * </p>
+ *
+ * @return the SMSC address string, null if failed.
+ */
+ @SuppressAutoDoc // for carrier privileges and default SMS application.
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ @Nullable
+ public String getSmscAddress() {
+ String smsc = null;
+
+ try {
+ ISms iSms = getISmsService();
+ if (iSms != null) {
+ smsc = iSms.getSmscAddressFromIccEfForSubscriber(
+ getSubscriptionId(), ActivityThread.currentPackageName());
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ return smsc;
+ }
+
+ /**
+ * Sets the SMSC address on (U)SIM.
+ *
+ * <p class="note"><strong>Note:</strong> Using this method requires that your app is the
+ * default SMS application, or has {@link android.Manifest.permission#MODIFY_PHONE_STATE}
+ * permission, or has the carrier privileges.</p>
+ *
+ * <p class="note"><strong>Note:</strong> This method will never trigger an SMS disambiguation
+ * dialog. If this method is called on a device that has multiple active subscriptions, this
+ * {@link SmsManager} instance has been created with {@link #getDefault()}, and no user-defined
+ * default subscription is defined, the subscription ID associated with this method will be
+ * INVALID, which will result in the operation being completed on the subscription associated
+ * with logical slot 0. Use {@link #getSmsManagerForSubscriptionId(int)} to ensure the operation
+ * is performed on the correct subscription.
+ * </p>
+ *
+ * @param smsc the SMSC address string.
+ * @return true for success, false otherwise.
+ */
+ @SuppressAutoDoc // for carrier privileges and default SMS application.
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
+ public boolean setSmscAddress(@NonNull String smsc) {
+ try {
+ ISms iSms = getISmsService();
+ if (iSms != null) {
+ return iSms.setSmscAddressOnIccEfForSubscriber(
+ smsc, getSubscriptionId(), ActivityThread.currentPackageName());
+ }
+ } catch (RemoteException ex) {
+ // ignore it
+ }
+ return false;
+ }
}
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 0ca22460cdc6..21a89f49fa62 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -31,6 +31,7 @@ import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressAutoDoc;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.app.BroadcastOptions;
import android.app.PendingIntent;
@@ -54,6 +55,7 @@ import android.os.ParcelUuid;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.telephony.Annotation.NetworkType;
import android.telephony.euicc.EuiccManager;
import android.telephony.ims.ImsMmTelManager;
import android.util.DisplayMetrics;
@@ -895,6 +897,11 @@ public class SubscriptionManager {
*/
public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+ /**
+ * Integer extra to specify SIM slot index.
+ */
+ public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
+
private final Context mContext;
private volatile INetworkPolicyManager mNetworkPolicy;
@@ -1862,13 +1869,27 @@ public class SubscriptionManager {
return subId;
}
- /** @hide */
- public void setDefaultVoiceSubId(int subId) {
- if (VDBG) logd("setDefaultVoiceSubId sub id = " + subId);
+ /**
+ * Sets the system's default voice subscription id.
+ *
+ * On a data-only device, this is a no-op.
+ *
+ * May throw a {@link RuntimeException} if the provided subscription id is equal to
+ * {@link SubscriptionManager#DEFAULT_SUBSCRIPTION_ID}
+ *
+ * @param subscriptionId A valid subscription ID to set as the system default, or
+ * {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
+ public void setDefaultVoiceSubscriptionId(int subscriptionId) {
+ if (VDBG) logd("setDefaultVoiceSubId sub id = " + subscriptionId);
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- iSub.setDefaultVoiceSubId(subId);
+ iSub.setDefaultVoiceSubId(subscriptionId);
}
} catch (RemoteException ex) {
// ignore it
@@ -1876,6 +1897,15 @@ public class SubscriptionManager {
}
/**
+ * Same as {@link #setDefaultVoiceSubscriptionId(int)}, but preserved for backwards
+ * compatibility.
+ * @hide
+ */
+ public void setDefaultVoiceSubId(int subId) {
+ setDefaultVoiceSubscriptionId(subId);
+ }
+
+ /**
* Return the SubscriptionInfo for default voice subscription.
*
* Will return null on data only devices, or on error.
@@ -2095,13 +2125,13 @@ public class SubscriptionManager {
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
public static boolean isValidSlotIndex(int slotIndex) {
- return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getMaxPhoneCount();
+ return slotIndex >= 0 && slotIndex < TelephonyManager.getDefault().getActiveModemCount();
}
/** @hide */
@UnsupportedAppUsage
public static boolean isValidPhoneId(int phoneId) {
- return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getMaxPhoneCount();
+ return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getActiveModemCount();
}
/** @hide */
@@ -2122,6 +2152,7 @@ public class SubscriptionManager {
if (VDBG) logd("putPhoneIdAndSubIdExtra: phoneId=" + phoneId + " subId=" + subId);
intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, subId);
intent.putExtra(EXTRA_SUBSCRIPTION_INDEX, subId);
+ intent.putExtra(EXTRA_SLOT_INDEX, phoneId);
intent.putExtra(PhoneConstants.PHONE_KEY, phoneId);
}
@@ -2957,6 +2988,7 @@ public class SubscriptionManager {
* permission or had carrier privilege permission on the subscription.
* {@link TelephonyManager#hasCarrierPrivileges()}
*
+ * @throws IllegalStateException if Telephony service is in bad state.
* @throws SecurityException if the caller doesn't meet the requirements
* outlined above.
*
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8e0fa32caef6..6708b1da35eb 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -38,6 +38,7 @@ import android.annotation.UnsupportedAppUsage;
import android.annotation.WorkerThread;
import android.app.ActivityThread;
import android.app.PendingIntent;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
@@ -63,8 +64,13 @@ import android.telecom.InCallService;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import android.telephony.Annotation.ApnType;
+import android.telephony.Annotation.CallState;
+import android.telephony.Annotation.DataState;
+import android.telephony.Annotation.NetworkType;
+import android.telephony.Annotation.RadioPowerState;
+import android.telephony.Annotation.SimActivationState;
import android.telephony.VisualVoicemailService.VisualVoicemailTask;
-import android.telephony.data.ApnSetting;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories;
import android.telephony.ims.ImsMmTelManager;
@@ -92,6 +98,7 @@ import com.android.internal.telephony.IUpdateAvailableNetworksCallback;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RILConstants;
+import com.android.internal.telephony.SmsApplication;
import com.android.internal.telephony.TelephonyProperties;
import dalvik.system.VMRuntime;
@@ -254,17 +261,6 @@ public class TelephonyManager {
*/
public static final int UNINITIALIZED_CARD_ID = -2;
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = {"SRVCC_STATE_"},
- value = {
- SRVCC_STATE_HANDOVER_NONE,
- SRVCC_STATE_HANDOVER_STARTED,
- SRVCC_STATE_HANDOVER_COMPLETED,
- SRVCC_STATE_HANDOVER_FAILED,
- SRVCC_STATE_HANDOVER_CANCELED})
- public @interface SrvccState {}
-
private final Context mContext;
private final int mSubId;
@UnsupportedAppUsage
@@ -277,6 +273,8 @@ public class TelephonyManager {
* TSTS - Triple SIM Triple Standby
**/
/** @hide */
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Landroid/telephony/TelephonyManager$MultiSimVariants;")
public enum MultiSimVariants {
@UnsupportedAppUsage
DSDS,
@@ -289,6 +287,21 @@ public class TelephonyManager {
};
/** @hide */
+ @IntDef(prefix = {"MODEM_COUNT_"},
+ value = {
+ MODEM_COUNT_NO_MODEM,
+ MODEM_COUNT_SINGLE_MODEM,
+ MODEM_COUNT_DUAL_MODEM,
+ MODEM_COUNT_TRI_MODEM
+ })
+ public @interface ModemCount {}
+
+ public static final int MODEM_COUNT_NO_MODEM = 0;
+ public static final int MODEM_COUNT_SINGLE_MODEM = 1;
+ public static final int MODEM_COUNT_DUAL_MODEM = 2;
+ public static final int MODEM_COUNT_TRI_MODEM = 3;
+
+ /** @hide */
@UnsupportedAppUsage
public TelephonyManager(Context context) {
this(context, SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
@@ -365,12 +378,26 @@ public class TelephonyManager {
/**
* Returns the number of phones available.
* Returns 0 if none of voice, sms, data is not supported
- * Returns 1 for Single standby mode (Single SIM functionality)
- * Returns 2 for Dual standby mode.(Dual SIM functionality)
- * Returns 3 for Tri standby mode.(Tri SIM functionality)
+ * Returns 1 for Single standby mode (Single SIM functionality).
+ * Returns 2 for Dual standby mode (Dual SIM functionality).
+ * Returns 3 for Tri standby mode (Tri SIM functionality).
+ * @deprecated Use {@link #getActiveModemCount} instead.
*/
+ @Deprecated
public int getPhoneCount() {
- int phoneCount = 1;
+ return getActiveModemCount();
+ }
+
+ /**
+ * Returns the number of logical modems currently configured to be activated.
+ *
+ * Returns 0 if none of voice, sms, data is not supported
+ * Returns 1 for Single standby mode (Single SIM functionality).
+ * Returns 2 for Dual standby mode (Dual SIM functionality).
+ * Returns 3 for Tri standby mode (Tri SIM functionality).
+ */
+ public @ModemCount int getActiveModemCount() {
+ int modemCount = 1;
switch (getMultiSimConfiguration()) {
case UNKNOWN:
ConnectivityManager cm = mContext == null ? null : (ConnectivityManager) mContext
@@ -378,45 +405,51 @@ public class TelephonyManager {
// check for voice and data support, 0 if not supported
if (!isVoiceCapable() && !isSmsCapable() && cm != null
&& !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
- phoneCount = 0;
+ modemCount = MODEM_COUNT_NO_MODEM;
} else {
- phoneCount = 1;
+ modemCount = MODEM_COUNT_SINGLE_MODEM;
}
break;
case DSDS:
case DSDA:
- phoneCount = PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM;
+ modemCount = MODEM_COUNT_DUAL_MODEM;
break;
case TSTS:
- phoneCount = PhoneConstants.MAX_PHONE_COUNT_TRI_SIM;
+ modemCount = MODEM_COUNT_TRI_MODEM;
break;
}
- return phoneCount;
+ return modemCount;
}
/**
- *
- * Return how many phone / logical modem can be active simultaneously, in terms of device
+ * Return how many logical modem can be potentially active simultaneously, in terms of hardware
* capability.
- * For example, for a dual-SIM capable device, it always returns 2, even if only one logical
- * modem / SIM is active (aka in single SIM mode).
- *
- * TODO: b/139642279 publicize and rename.
- * @hide
- */
- public int getMaxPhoneCount() {
- // TODO: b/139642279 when turning on this feature, remove dependency of
- // PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE and always return result based on
- // PROPERTY_MAX_ACTIVE_MODEMS.
- String rebootRequired = SystemProperties.get(
- TelephonyProperties.PROPERTY_REBOOT_REQUIRED_ON_MODEM_CHANGE);
- if (rebootRequired.equals("false")) {
- // If no reboot is required, return max possible active modems.
- return SystemProperties.getInt(
- TelephonyProperties.PROPERTY_MAX_ACTIVE_MODEMS, getPhoneCount());
- } else {
- return getPhoneCount();
+ * It might return different value from {@link #getActiveModemCount}. For example, for a
+ * dual-SIM capable device operating in single SIM mode (only one logical modem is turned on),
+ * {@link #getActiveModemCount} returns 1 while this API returns 2.
+ */
+ public @ModemCount int getSupportedModemCount() {
+ return SystemProperties.getInt(TelephonyProperties.PROPERTY_MAX_ACTIVE_MODEMS,
+ getActiveModemCount());
+ }
+
+ /**
+ * Gets the maximum number of SIMs that can be active, based on the device's multisim
+ * configuration.
+ * @return 1 for single-SIM, DSDS, and TSTS devices. 2 for DSDA devices.
+ * @hide
+ */
+ @SystemApi
+ public int getMaxNumberOfSimultaneouslyActiveSims() {
+ switch (getMultiSimConfiguration()) {
+ case UNKNOWN:
+ case DSDS:
+ case TSTS:
+ return 1;
+ case DSDA:
+ return 2;
}
+ return 1;
}
/** {@hide} */
@@ -1177,6 +1210,35 @@ public class TelephonyManager {
"android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
/**
+ * Broadcast intent that indicates multi-SIM configuration is changed. For example, it changed
+ * from single SIM capable to dual-SIM capable (DSDS or DSDA) or triple-SIM mode.
+ *
+ * It doesn't indicate how many subscriptions are actually active, or which states SIMs are,
+ * or that all steps during multi-SIM change are done. To know those information you still need
+ * to listen to SIM_STATE changes or active subscription changes.
+ *
+ * See extra of {@link #EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED} for updated value.
+ */
+ public static final String ACTION_MULTI_SIM_CONFIG_CHANGED =
+ "android.telephony.action.MULTI_SIM_CONFIG_CHANGED";
+
+
+ /**
+ * The number of active SIM supported by current multi-SIM config. It's not related to how many
+ * SIM/subscriptions are currently active.
+ *
+ * For single SIM mode, it's 1.
+ * For DSDS or DSDA mode, it's 2.
+ * For triple-SIM mode, it's 3.
+ *
+ * Extra of {@link #ACTION_MULTI_SIM_CONFIG_CHANGED}.
+ *
+ * type: integer
+ */
+ public static final String EXTRA_NUM_OF_ACTIVE_SIM_SUPPORTED =
+ "android.telephony.extra.NUM_OF_ACTIVE_SIM_SUPPORTED";
+
+ /**
* @hide
*/
public static final String USSD_RESPONSE = "USSD_RESPONSE";
@@ -1610,8 +1672,8 @@ public class TelephonyManager {
*
* <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or
* profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier
- * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a
- * managed profile on the device; for more details see <a
+ * privileges (see {@link #hasCarrierPrivileges}) on any active subscription. The profile owner
+ * is an app that owns a managed profile on the device; for more details see <a
* href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner
* access is deprecated and will be removed in a future release.
*
@@ -1651,8 +1713,8 @@ public class TelephonyManager {
*
* <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or
* profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier
- * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a
- * managed profile on the device; for more details see <a
+ * privileges (see {@link #hasCarrierPrivileges}) on any active subscription. The profile owner
+ * is an app that owns a managed profile on the device; for more details see <a
* href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner
* access is deprecated and will be removed in a future release.
*
@@ -1711,7 +1773,8 @@ public class TelephonyManager {
* <li>The caller holds the READ_PRIVILEGED_PHONE_STATE permission.</li>
* <li>If the caller is the device or profile owner, the caller holds the
* {@link Manifest.permission#READ_PHONE_STATE} permission.</li>
- * <li>The caller has carrier privileges (see {@link #hasCarrierPrivileges()}.</li>
+ * <li>The caller has carrier privileges (see {@link #hasCarrierPrivileges()} on any
+ * active subscription.</li>
* <li>The caller is the default SMS app for the device.</li>
* </ul>
* <p>The profile owner is an app that owns a managed profile on the device; for more details
@@ -1780,8 +1843,8 @@ public class TelephonyManager {
*
* <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or
* profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier
- * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a
- * managed profile on the device; for more details see <a
+ * privileges (see {@link #hasCarrierPrivileges}) on any active subscription. The profile owner
+ * is an app that owns a managed profile on the device; for more details see <a
* href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner
* access is deprecated and will be removed in a future release.
*
@@ -1807,8 +1870,8 @@ public class TelephonyManager {
*
* <p>Requires Permission: READ_PRIVILEGED_PHONE_STATE, for the calling app to be the device or
* profile owner and have the READ_PHONE_STATE permission, or that the calling app has carrier
- * privileges (see {@link #hasCarrierPrivileges}). The profile owner is an app that owns a
- * managed profile on the device; for more details see <a
+ * privileges (see {@link #hasCarrierPrivileges}) on any active subscription. The profile owner
+ * is an app that owns a managed profile on the device; for more details see <a
* href="https://developer.android.com/work/managed-profiles">Work profiles</a>. Profile owner
* access is deprecated and will be removed in a future release.
*
@@ -1832,7 +1895,12 @@ public class TelephonyManager {
if (telephony == null) return null;
try {
- return telephony.getMeidForSlot(slotIndex, getOpPackageName());
+ String meid = telephony.getMeidForSlot(slotIndex, getOpPackageName());
+ if (TextUtils.isEmpty(meid)) {
+ Log.d(TAG, "getMeid: return null because MEID is not available");
+ return null;
+ }
+ return meid;
} catch (RemoteException ex) {
return null;
} catch (NullPointerException ex) {
@@ -2449,41 +2517,37 @@ public class TelephonyManager {
* @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
*/
public String getNetworkCountryIso() {
- return getNetworkCountryIsoForPhone(getPhoneId());
+ return getNetworkCountryIso(getPhoneId());
}
/**
- * Returns the ISO country code equivalent of the MCC (Mobile Country Code) of the current
+ * Returns the ISO-3166 country code equivalent of the MCC (Mobile Country Code) of the current
* registered operator or the cell nearby, if available.
* <p>
+ * The ISO-3166 country code is provided in lowercase 2 character format.
+ * <p>
+ * Note: In multi-sim, this returns a shared emergency network country iso from other
+ * subscription if the subscription used to create the TelephonyManager doesn't camp on
+ * a network due to some reason (e.g. pin/puk locked), or sim is absent in the corresponding
+ * slot.
* Note: Result may be unreliable on CDMA networks (use {@link #getPhoneType()} to determine
* if on a CDMA network).
- *
- * @param subId for which Network CountryIso is returned
- * @hide
- */
- @UnsupportedAppUsage
- public String getNetworkCountryIso(int subId) {
- return getNetworkCountryIsoForPhone(getPhoneId(subId));
- }
-
- /**
- * Returns the ISO country code equivalent of the current registered
- * operator's MCC (Mobile Country Code) of a subscription.
* <p>
- * Availability: Only when user is registered to a network. Result may be
- * unreliable on CDMA networks (use {@link #getPhoneType()} to determine if
- * on a CDMA network).
*
- * @param phoneId for which Network CountryIso is returned
+ * @param slotIndex the SIM slot index to get network country ISO.
+ *
+ * @return the lowercase 2 character ISO-3166 country code, or empty string if not available.
+ *
+ * {@hide}
*/
- /** {@hide} */
- @UnsupportedAppUsage
- public String getNetworkCountryIsoForPhone(int phoneId) {
+ @SystemApi
+ @TestApi
+ @NonNull
+ public String getNetworkCountryIso(int slotIndex) {
try {
ITelephony telephony = getITelephony();
if (telephony == null) return "";
- return telephony.getNetworkCountryIsoForPhone(phoneId);
+ return telephony.getNetworkCountryIsoForPhone(slotIndex);
} catch (RemoteException ex) {
return "";
}
@@ -2542,33 +2606,6 @@ public class TelephonyManager {
/** Max network type number. Update as new types are added. Don't add negative types. {@hide} */
public static final int MAX_NETWORK_TYPE = NETWORK_TYPE_NR;
- /** @hide */
- @IntDef({
- NETWORK_TYPE_UNKNOWN,
- NETWORK_TYPE_GPRS,
- NETWORK_TYPE_EDGE,
- NETWORK_TYPE_UMTS,
- NETWORK_TYPE_CDMA,
- NETWORK_TYPE_EVDO_0,
- NETWORK_TYPE_EVDO_A,
- NETWORK_TYPE_1xRTT,
- NETWORK_TYPE_HSDPA,
- NETWORK_TYPE_HSUPA,
- NETWORK_TYPE_HSPA,
- NETWORK_TYPE_IDEN,
- NETWORK_TYPE_EVDO_B,
- NETWORK_TYPE_LTE,
- NETWORK_TYPE_EHRPD,
- NETWORK_TYPE_HSPAP,
- NETWORK_TYPE_GSM,
- NETWORK_TYPE_TD_SCDMA,
- NETWORK_TYPE_IWLAN,
- NETWORK_TYPE_LTE_CA,
- NETWORK_TYPE_NR,
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface NetworkType{}
-
/**
* Return the current data network type.
*
@@ -4517,6 +4554,17 @@ public class TelephonyManager {
}
/**
+ * Sim activation type: voice
+ * @hide
+ */
+ public static final int SIM_ACTIVATION_TYPE_VOICE = 0;
+ /**
+ * Sim activation type: data
+ * @hide
+ */
+ public static final int SIM_ACTIVATION_TYPE_DATA = 1;
+
+ /**
* Initial SIM activation state, unknown. Not set by any carrier apps.
* @hide
*/
@@ -4559,17 +4607,6 @@ public class TelephonyManager {
@SystemApi
public static final int SIM_ACTIVATION_STATE_RESTRICTED = 4;
- /** @hide */
- @IntDef({
- SIM_ACTIVATION_STATE_UNKNOWN,
- SIM_ACTIVATION_STATE_ACTIVATING,
- SIM_ACTIVATION_STATE_ACTIVATED,
- SIM_ACTIVATION_STATE_DEACTIVATED,
- SIM_ACTIVATION_STATE_RESTRICTED
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface SimActivationState{}
-
/**
* Sets the voice activation state
*
@@ -4954,15 +4991,6 @@ public class TelephonyManager {
*/
public static final int CALL_STATE_OFFHOOK = 2;
- /** @hide */
- @IntDef(prefix = { "CALL_STATE_" }, value = {
- CALL_STATE_IDLE,
- CALL_STATE_RINGING,
- CALL_STATE_OFFHOOK
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface CallState{}
-
/**
* Returns the state of all calls on the device.
* <p>
@@ -5043,6 +5071,17 @@ public class TelephonyManager {
*/
public static final int DATA_ACTIVITY_DORMANT = 0x00000004;
+ /** @hide */
+ @IntDef(prefix = {"DATA_"}, value = {
+ DATA_ACTIVITY_NONE,
+ DATA_ACTIVITY_IN,
+ DATA_ACTIVITY_OUT,
+ DATA_ACTIVITY_INOUT,
+ DATA_ACTIVITY_DORMANT,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataActivityType{}
+
/**
* Returns a constant indicating the type of activity on a data connection
* (cellular).
@@ -5478,19 +5517,20 @@ public class TelephonyManager {
telephony.requestCellInfoUpdate(
getSubId(),
new ICellInfoCallback.Stub() {
+ @Override
public void onCellInfo(List<CellInfo> cellInfo) {
Binder.withCleanCallingIdentity(() ->
executor.execute(() -> callback.onCellInfo(cellInfo)));
}
- public void onError(int errorCode, android.os.ParcelableException detail) {
+ @Override
+ public void onError(int errorCode, String exceptionName, String message) {
Binder.withCleanCallingIdentity(() ->
executor.execute(() -> callback.onError(
errorCode,
- detail == null ? null : detail.getCause())));
+ createThrowableByClassName(exceptionName, message))));
}
}, getOpPackageName());
-
} catch (RemoteException ex) {
}
}
@@ -5519,22 +5559,36 @@ public class TelephonyManager {
telephony.requestCellInfoUpdateWithWorkSource(
getSubId(),
new ICellInfoCallback.Stub() {
+ @Override
public void onCellInfo(List<CellInfo> cellInfo) {
Binder.withCleanCallingIdentity(() ->
executor.execute(() -> callback.onCellInfo(cellInfo)));
}
- public void onError(int errorCode, android.os.ParcelableException detail) {
+ @Override
+ public void onError(int errorCode, String exceptionName, String message) {
Binder.withCleanCallingIdentity(() ->
executor.execute(() -> callback.onError(
errorCode,
- detail == null ? null : detail.getCause())));
+ createThrowableByClassName(exceptionName, message))));
}
}, getOpPackageName(), workSource);
} catch (RemoteException ex) {
}
}
+ private static Throwable createThrowableByClassName(String className, String message) {
+ if (className == null) {
+ return null;
+ }
+ try {
+ Class<?> c = Class.forName(className);
+ return (Throwable) c.getConstructor(String.class).newInstance(message);
+ } catch (ReflectiveOperationException | ClassCastException e) {
+ }
+ return new RuntimeException(className + ": " + message);
+ }
+
/**
* Sets the minimum time in milli-seconds between {@link PhoneStateListener#onCellInfoChanged
* PhoneStateListener.onCellInfoChanged} will be invoked.
@@ -8294,15 +8348,6 @@ public class TelephonyManager {
return false;
}
- /** @hide */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef(prefix = {"RADIO_POWER_"},
- value = {RADIO_POWER_OFF,
- RADIO_POWER_ON,
- RADIO_POWER_UNAVAILABLE,
- })
- public @interface RadioPowerState {}
-
/**
* Radio explicitly powered off (e.g, airplane mode).
* @hide
@@ -9267,6 +9312,21 @@ public class TelephonyManager {
}
/**
+ * Gets the default Respond Via Message application
+ * @param context context from the calling app
+ * @param updateIfNeeded update the default app if there is no valid default app configured.
+ * @return component name of the app and class to direct Respond Via Message intent to, or
+ * {@code null} if the functionality is not supported.
+ * @hide
+ */
+ @SystemApi
+ @TestApi
+ public static @Nullable ComponentName getDefaultRespondViaMessageApplication(
+ @NonNull Context context, boolean updateIfNeeded) {
+ return SmsApplication.getDefaultRespondViaMessageApplication(context, updateIfNeeded);
+ }
+
+ /**
* Set the alphabetic name of current registered operator.
* @param name the alphabetic name of current registered operator.
* @hide
@@ -9368,7 +9428,7 @@ public class TelephonyManager {
* @hide
*/
@UnsupportedAppUsage
- public int getSubIdForPhoneAccount(PhoneAccount phoneAccount) {
+ public int getSubIdForPhoneAccount(@Nullable PhoneAccount phoneAccount) {
int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
try {
ITelephony service = getITelephony();
@@ -9402,16 +9462,28 @@ public class TelephonyManager {
return returnValue;
}
- private int getSubIdForPhoneAccountHandle(PhoneAccountHandle phoneAccountHandle) {
+ /**
+ * Returns the subscription ID for the given phone account handle.
+ *
+ * @param phoneAccountHandle the phone account handle for outgoing calls
+ * @return subscription ID for the given phone account handle; or
+ * {@link SubscriptionManager#INVALID_SUBSCRIPTION_ID}
+ * if not available; or throw a SecurityException if the caller doesn't have the
+ * permission.
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
+ public int getSubIdForPhoneAccountHandle(@NonNull PhoneAccountHandle phoneAccountHandle) {
int retval = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
try {
- ITelecomService service = getTelecomService();
+ ITelephony service = getITelephony();
if (service != null) {
- retval = getSubIdForPhoneAccount(service.getPhoneAccount(phoneAccountHandle));
+ retval = service.getSubIdForPhoneAccountHandle(
+ phoneAccountHandle, mContext.getOpPackageName());
}
- } catch (RemoteException e) {
+ } catch (RemoteException ex) {
+ Log.e(TAG, "getSubIdForPhoneAccountHandle RemoteException", ex);
+ ex.rethrowAsRuntimeException();
}
-
return retval;
}
@@ -9424,8 +9496,29 @@ public class TelephonyManager {
try {
Log.d(TAG, "factoryReset: subId=" + subId);
ITelephony telephony = getITelephony();
- if (telephony != null)
+ if (telephony != null) {
telephony.factoryReset(subId);
+ }
+ } catch (RemoteException e) {
+ }
+ }
+
+
+ /**
+ * Resets Telephony and IMS settings back to factory defaults only for the subscription
+ * associated with this instance.
+ * @see #createForSubscriptionId(int)
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.CONNECTIVITY_INTERNAL)
+ public void resetSettings() {
+ try {
+ Log.d(TAG, "resetSettings: subId=" + getSubId());
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ telephony.factoryReset(getSubId());
+ }
} catch (RemoteException e) {
}
}
@@ -10136,11 +10229,13 @@ public class TelephonyManager {
/**
* Action set from carrier signalling broadcast receivers to enable/disable radio
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @param enabled control enable or disable radio.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionSetRadioEnabled(int subId, boolean enabled) {
try {
ITelephony service = getITelephony();
@@ -10155,11 +10250,13 @@ public class TelephonyManager {
/**
* Action set from carrier signalling broadcast receivers to start/stop reporting default
* network available events
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @param report control start/stop reporting network status.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionReportDefaultNetworkStatus(int subId, boolean report) {
try {
ITelephony service = getITelephony();
@@ -10173,10 +10270,12 @@ public class TelephonyManager {
/**
* Action set from carrier signalling broadcast receivers to reset all carrier actions
- * Permissions android.Manifest.permission.MODIFY_PHONE_STATE is required
+ * Permissions {@link android.Manifest.permission.MODIFY_PHONE_STATE} is required.
* @param subId the subscription ID that this action applies to.
* @hide
*/
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public void carrierActionResetAll(int subId) {
try {
ITelephony service = getITelephony();
@@ -10772,6 +10871,16 @@ public class TelephonyManager {
}
/**
+ * Broadcast intent action for Ota emergency number database installation complete.
+ *
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ @SystemApi
+ public static final String ACTION_OTA_EMERGENCY_NUMBER_DB_INSTALLED =
+ "android.telephony.action.OTA_EMERGENCY_NUMBER_DB_INSTALLED";
+
+ /**
* Returns whether {@link TelephonyManager#ACTION_EMERGENCY_ASSISTANCE emergency assistance} is
* available on the device.
* <p>
@@ -11412,11 +11521,14 @@ public class TelephonyManager {
* 3) APN type is whitelisted. E.g. MMS is whitelisted if
* {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on.
*
+ * @param apnType Value indicating the apn type. Apn types are defined in {@link ApnSetting}.
* @return whether data is enabled for a apn type.
*
* @hide
*/
- public boolean isDataEnabledForApn(@ApnSetting.ApnType int apnType) {
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public boolean isDataEnabledForApn(@ApnType int apnType) {
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
try {
ITelephony service = getITelephony();
@@ -11437,7 +11549,7 @@ public class TelephonyManager {
*
* @hide
*/
- public boolean isApnMetered(@ApnSetting.ApnType int apnType) {
+ public boolean isApnMetered(@ApnType int apnType) {
try {
ITelephony service = getITelephony();
if (service != null) {
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl
new file mode 100644
index 000000000000..a648a0e81073
--- /dev/null
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/** @hide */
+package android.telephony.cdma;
+
+parcelable CdmaSmsCbProgramData;
+
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 116c05129a96..60774e7f1e7f 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -26,6 +26,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.provider.Telephony;
import android.provider.Telephony.Carriers;
+import android.telephony.Annotation.ApnType;
+import android.telephony.Annotation.NetworkType;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
@@ -109,23 +111,6 @@ public class ApnSetting implements Parcelable {
/** APN type for MCX (Mission Critical Service) where X can be PTT/Video/Data */
public static final int TYPE_MCX = ApnTypes.MCX;
- /** @hide */
- @IntDef(flag = true, prefix = { "TYPE_" }, value = {
- TYPE_DEFAULT,
- TYPE_MMS,
- TYPE_SUPL,
- TYPE_DUN,
- TYPE_HIPRI,
- TYPE_FOTA,
- TYPE_IMS,
- TYPE_CBS,
- TYPE_IA,
- TYPE_EMERGENCY,
- TYPE_MCX
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface ApnType {}
-
// Possible values for authentication types.
/** No authentication type. */
public static final int AUTH_TYPE_NONE = 0;
@@ -1206,7 +1191,7 @@ public class ApnSetting implements Parcelable {
&& !other.canHandleType(TYPE_DUN)
&& Objects.equals(this.mApnName, other.mApnName)
&& !typeSameAny(this, other)
- && xorEquals(this.mProxyAddress, other.mProxyAddress)
+ && xorEqualsString(this.mProxyAddress, other.mProxyAddress)
&& xorEqualsInt(this.mProxyPort, other.mProxyPort)
&& xorEquals(this.mProtocol, other.mProtocol)
&& xorEquals(this.mRoamingProtocol, other.mRoamingProtocol)
@@ -1215,7 +1200,7 @@ public class ApnSetting implements Parcelable {
&& Objects.equals(this.mMvnoType, other.mMvnoType)
&& Objects.equals(this.mMvnoMatchData, other.mMvnoMatchData)
&& xorEquals(this.mMmsc, other.mMmsc)
- && xorEquals(this.mMmsProxyAddress, other.mMmsProxyAddress)
+ && xorEqualsString(this.mMmsProxyAddress, other.mMmsProxyAddress)
&& xorEqualsInt(this.mMmsProxyPort, other.mMmsProxyPort))
&& Objects.equals(this.mNetworkTypeBitmask, other.mNetworkTypeBitmask)
&& Objects.equals(mApnSetId, other.mApnSetId)
@@ -1228,6 +1213,11 @@ public class ApnSetting implements Parcelable {
return first == null || second == null || first.equals(second);
}
+ // Equal or one is null.
+ private boolean xorEqualsString(String first, String second) {
+ return TextUtils.isEmpty(first) || TextUtils.isEmpty(second) || first.equals(second);
+ }
+
// Equal or one is not specified.
private boolean xorEqualsInt(int first, int second) {
return first == UNSPECIFIED_INT || second == UNSPECIFIED_INT
@@ -1425,7 +1415,7 @@ public class ApnSetting implements Parcelable {
*
* @hide
*/
- public boolean canSupportNetworkType(@TelephonyManager.NetworkType int networkType) {
+ public boolean canSupportNetworkType(@NetworkType int networkType) {
// Do a special checking for GSM. In reality, GSM is a voice only network type and can never
// be used for data. We allow it here because in some DSDS corner cases, on the non-DDS
// sub, modem reports data rat unknown. In that case if voice is GSM and this APN supports
@@ -1954,8 +1944,9 @@ public class ApnSetting implements Parcelable {
* {@link ApnSetting} built from this builder otherwise.
*/
public ApnSetting build() {
- if ((mApnTypeBitmask & TYPE_ALL) == 0 || TextUtils.isEmpty(mApnName)
- || TextUtils.isEmpty(mEntryName)) {
+ if ((mApnTypeBitmask & (TYPE_DEFAULT | TYPE_MMS | TYPE_SUPL | TYPE_DUN | TYPE_HIPRI |
+ TYPE_FOTA | TYPE_IMS | TYPE_CBS | TYPE_IA | TYPE_EMERGENCY | TYPE_MCX)) == 0
+ || TextUtils.isEmpty(mApnName) || TextUtils.isEmpty(mEntryName)) {
return null;
}
return new ApnSetting(this);
diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java
index 9170e88ce832..49625bbecf4f 100644
--- a/telephony/java/android/telephony/data/DataCallResponse.java
+++ b/telephony/java/android/telephony/data/DataCallResponse.java
@@ -24,8 +24,8 @@ import android.annotation.SystemApi;
import android.net.LinkAddress;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.Annotation.DataFailureCause;
import android.telephony.DataFailCause;
-import android.telephony.DataFailCause.FailCause;
import android.telephony.data.ApnSetting.ProtocolType;
import com.android.internal.annotations.VisibleForTesting;
@@ -67,7 +67,7 @@ public final class DataCallResponse implements Parcelable {
/** Indicates the data connection is active with physical link up. */
public static final int LINK_STATUS_ACTIVE = 2;
- private final @FailCause int mCause;
+ private final @DataFailureCause int mCause;
private final int mSuggestedRetryTime;
private final int mId;
private final @LinkStatus int mLinkStatus;
@@ -103,7 +103,7 @@ public final class DataCallResponse implements Parcelable {
*
* @removed Use the {@link Builder()} instead.
*/
- public DataCallResponse(@FailCause int cause, int suggestedRetryTime, int id,
+ public DataCallResponse(@DataFailureCause int cause, int suggestedRetryTime, int id,
@LinkStatus int linkStatus,
@ProtocolType int protocolType, @Nullable String interfaceName,
@Nullable List<LinkAddress> addresses,
@@ -150,7 +150,7 @@ public final class DataCallResponse implements Parcelable {
/**
* @return Data call fail cause. {@link DataFailCause#NONE} indicates no error.
*/
- @FailCause
+ @DataFailureCause
public int getCause() { return mCause; }
/**
@@ -314,7 +314,7 @@ public final class DataCallResponse implements Parcelable {
* </code></pre>
*/
public static final class Builder {
- private @FailCause int mCause;
+ private @DataFailureCause int mCause;
private int mSuggestedRetryTime;
@@ -348,7 +348,7 @@ public final class DataCallResponse implements Parcelable {
* @param cause Data call fail cause. {@link DataFailCause#NONE} indicates no error.
* @return The same instance of the builder.
*/
- public @NonNull Builder setCause(@FailCause int cause) {
+ public @NonNull Builder setCause(@DataFailureCause int cause) {
mCause = cause;
return this;
}
diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java
index 0d79ec98fcbb..30c209b28a4d 100644
--- a/telephony/java/android/telephony/data/DataProfile.java
+++ b/telephony/java/android/telephony/data/DataProfile.java
@@ -25,8 +25,8 @@ import android.annotation.SystemApi;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telephony.Annotation.ApnType;
import android.telephony.TelephonyManager.NetworkTypeBitMask;
-import android.telephony.data.ApnSetting.ApnType;
import android.telephony.data.ApnSetting.AuthType;
import android.text.TextUtils;
diff --git a/telephony/java/android/telephony/data/QualifiedNetworksService.java b/telephony/java/android/telephony/data/QualifiedNetworksService.java
index 0e1751d50949..e793979a61c9 100644
--- a/telephony/java/android/telephony/data/QualifiedNetworksService.java
+++ b/telephony/java/android/telephony/data/QualifiedNetworksService.java
@@ -27,8 +27,8 @@ import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.AccessNetworkConstants.AccessNetworkType;
+import android.telephony.Annotation.ApnType;
import android.telephony.Rlog;
-import android.telephony.data.ApnSetting.ApnType;
import android.util.SparseArray;
import com.android.internal.annotations.VisibleForTesting;
@@ -133,7 +133,7 @@ public abstract class QualifiedNetworksService extends Service {
* service.
*
* @param apnTypes APN types of the qualified networks. This must be a bitmask combination
- * of {@link ApnSetting.ApnType}.
+ * of {@link ApnType}.
* @param qualifiedNetworkTypes List of network types which are qualified for data
* connection setup for {@link @apnType} in the preferred order. Each element in the list
* is a {@link AccessNetworkType}. An empty list indicates no networks are qualified
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index cabd4dfd91f1..0025c7acb18c 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -32,6 +32,7 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.telephony.TelephonyManager;
+import android.telephony.euicc.EuiccCardManager.ResetOption;
import com.android.internal.telephony.euicc.IEuiccController;
@@ -821,17 +822,22 @@ public class EuiccManager {
}
/**
- * Erase all subscriptions and reset the eUICC.
+ * Erase all operational subscriptions and reset the eUICC.
*
* <p>Requires that the calling app has the
* {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
*
* @param callbackIntent a PendingIntent to launch when the operation completes.
+ *
+ * @deprecated From R, callers should specify a flag for specific set of subscriptions to erase
+ * and use {@link #eraseSubscriptionsWithOptions(int, PendingIntent)} instead
+ *
* @hide
*/
@SystemApi
@RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
- public void eraseSubscriptions(PendingIntent callbackIntent) {
+ @Deprecated
+ public void eraseSubscriptions(@NonNull PendingIntent callbackIntent) {
if (!isEnabled()) {
sendUnavailableError(callbackIntent);
return;
@@ -844,6 +850,32 @@ public class EuiccManager {
}
/**
+ * Erase all specific subscriptions and reset the eUICC.
+ *
+ * <p>Requires that the calling app has the
+ * {@code android.Manifest.permission#WRITE_EMBEDDED_SUBSCRIPTIONS} permission.
+ *
+ * @param options flag indicating specific set of subscriptions to erase
+ * @param callbackIntent a PendingIntent to launch when the operation completes.
+ *
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(Manifest.permission.WRITE_EMBEDDED_SUBSCRIPTIONS)
+ public void eraseSubscriptionsWithOptions(
+ @ResetOption int options, @NonNull PendingIntent callbackIntent) {
+ if (!isEnabled()) {
+ sendUnavailableError(callbackIntent);
+ return;
+ }
+ try {
+ getIEuiccController().eraseSubscriptionsWithOptions(mCardId, options, callbackIntent);
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Ensure that subscriptions will be retained on the next factory reset.
*
* <p>By default, all subscriptions on the eUICC are erased the first time a device boots (ever
diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java
index 77ee20512d11..4ddeb908a200 100644
--- a/telephony/java/android/telephony/ims/ImsCallProfile.java
+++ b/telephony/java/android/telephony/ims/ImsCallProfile.java
@@ -309,6 +309,37 @@ public final class ImsCallProfile implements Parcelable {
public @CallRestrictCause int mRestrictCause = CALL_RESTRICT_CAUSE_NONE;
/**
+ * The VERSTAT for an incoming call's phone number.
+ */
+ private @VerificationStatus int mCallerNumberVerificationStatus;
+
+ /**
+ * Indicates that the network could not perform verification.
+ */
+ public static final int VERIFICATION_STATUS_NOT_VERIFIED = 0;
+
+ /**
+ * Indicates that verification by the network passed. This indicates there is a high likelihood
+ * that the call originated from a valid source.
+ */
+ public static final int VERIFICATION_STATUS_PASSED = 1;
+
+ /**
+ * Indicates that verification by the network failed. This indicates there is a high likelihood
+ * that the call did not originate from a valid source.
+ */
+ public static final int VERIFICATION_STATUS_FAILED = 2;
+
+ /**@hide*/
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = "VERIFICATION_STATUS_", value = {
+ VERIFICATION_STATUS_NOT_VERIFIED,
+ VERIFICATION_STATUS_PASSED,
+ VERIFICATION_STATUS_FAILED
+ })
+ public @interface VerificationStatus {}
+
+ /**
* The emergency service categories, only valid if {@link #getServiceType} returns
* {@link #SERVICE_TYPE_EMERGENCY}
*
@@ -539,6 +570,29 @@ public final class ImsCallProfile implements Parcelable {
mMediaProfile = profile.mMediaProfile;
}
+ /**
+ * Sets the verification status for the phone number of an incoming call as identified in
+ * ATIS-1000082.
+ * <p>
+ * The ImsService should parse the verstat information from the SIP INVITE headers for the call
+ * to determine this information. It is typically found in the P-Asserted-Identity OR From
+ * header fields.
+ * @param callerNumberVerificationStatus the new verification status.
+ */
+ public void setCallerNumberVerificationStatus(
+ @VerificationStatus int callerNumberVerificationStatus) {
+ mCallerNumberVerificationStatus = callerNumberVerificationStatus;
+ }
+
+ /**
+ * Gets the verification status for the phone number of an incoming call as identified in
+ * ATIS-1000082.
+ * @return the verification status.
+ */
+ public @VerificationStatus int getCallerNumberVerificationStatus() {
+ return mCallerNumberVerificationStatus;
+ }
+
@NonNull
@Override
public String toString() {
@@ -551,7 +605,8 @@ public final class ImsCallProfile implements Parcelable {
+ ", emergencyCallRouting=" + mEmergencyCallRouting
+ ", emergencyCallTesting=" + mEmergencyCallTesting
+ ", hasKnownUserIntentEmergency=" + mHasKnownUserIntentEmergency
- + ", mRestrictCause=" + mRestrictCause + " }";
+ + ", mRestrictCause=" + mRestrictCause
+ + ", mCallerNumberVerstat= " + mCallerNumberVerificationStatus + " }";
}
@Override
@@ -572,6 +627,7 @@ public final class ImsCallProfile implements Parcelable {
out.writeBoolean(mEmergencyCallTesting);
out.writeBoolean(mHasKnownUserIntentEmergency);
out.writeInt(mRestrictCause);
+ out.writeInt(mCallerNumberVerificationStatus);
}
private void readFromParcel(Parcel in) {
@@ -585,6 +641,7 @@ public final class ImsCallProfile implements Parcelable {
mEmergencyCallTesting = in.readBoolean();
mHasKnownUserIntentEmergency = in.readBoolean();
mRestrictCause = in.readInt();
+ mCallerNumberVerificationStatus = in.readInt();
}
public static final @android.annotation.NonNull Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() {
diff --git a/telephony/java/android/telephony/ims/ImsMmTelManager.java b/telephony/java/android/telephony/ims/ImsMmTelManager.java
index 2fad8479178e..9fc8e7563a81 100644
--- a/telephony/java/android/telephony/ims/ImsMmTelManager.java
+++ b/telephony/java/android/telephony/ims/ImsMmTelManager.java
@@ -25,30 +25,26 @@ import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.content.Context;
-import android.content.pm.IPackageManager;
-import android.content.pm.PackageManager;
-import android.net.Uri;
import android.os.Binder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.telephony.AccessNetworkConstants;
+import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.ims.aidl.IImsCapabilityCallback;
-import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
-import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.ITelephony;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import java.util.HashMap;
-import java.util.Map;
import java.util.concurrent.Executor;
+import java.util.function.Consumer;
/**
* A manager for the MmTel (Multimedia Telephony) feature of an IMS network, given an associated
@@ -62,9 +58,7 @@ import java.util.concurrent.Executor;
* @hide
*/
@SystemApi
-public class ImsMmTelManager {
-
- private static final String TAG = "ImsMmTelManager";
+public class ImsMmTelManager implements RegistrationManager {
/**
* @hide
@@ -97,94 +91,18 @@ public class ImsMmTelManager {
* Callback class for receiving IMS network Registration callback events.
* @see #registerImsRegistrationCallback(Executor, RegistrationCallback) (RegistrationCallback)
* @see #unregisterImsRegistrationCallback(RegistrationCallback)
+ * @deprecated Use {@link RegistrationManager.RegistrationCallback} instead.
*/
- public static class RegistrationCallback {
-
- private static class RegistrationBinder extends IImsRegistrationCallback.Stub {
-
- // Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
- // and WWAN are more accurate constants.
- private static final Map<Integer, Integer> IMS_REG_TO_ACCESS_TYPE_MAP =
- new HashMap<Integer, Integer>() {{
- // Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE
- // case, since it is defined.
- put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, -1);
- put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
- AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
- put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
- AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
- }};
-
- private final RegistrationCallback mLocalCallback;
- private Executor mExecutor;
-
- RegistrationBinder(RegistrationCallback localCallback) {
- mLocalCallback = localCallback;
- }
-
- @Override
- public void onRegistered(int imsRadioTech) {
- if (mLocalCallback == null) return;
-
- Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
- mLocalCallback.onRegistered(getAccessType(imsRadioTech))));
- }
-
- @Override
- public void onRegistering(int imsRadioTech) {
- if (mLocalCallback == null) return;
-
- Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
- mLocalCallback.onRegistering(getAccessType(imsRadioTech))));
- }
-
- @Override
- public void onDeregistered(ImsReasonInfo info) {
- if (mLocalCallback == null) return;
-
- Binder.withCleanCallingIdentity(() ->
- mExecutor.execute(() -> mLocalCallback.onUnregistered(info)));
- }
-
- @Override
- public void onTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) {
- if (mLocalCallback == null) return;
-
- Binder.withCleanCallingIdentity(() ->
- mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed(
- getAccessType(imsRadioTech), info)));
- }
-
- @Override
- public void onSubscriberAssociatedUriChanged(Uri[] uris) {
- if (mLocalCallback == null) return;
-
- Binder.withCleanCallingIdentity(() ->
- mExecutor.execute(() ->
- mLocalCallback.onSubscriberAssociatedUriChanged(uris)));
- }
-
- private void setExecutor(Executor executor) {
- mExecutor = executor;
- }
-
- private static int getAccessType(int regType) {
- if (!IMS_REG_TO_ACCESS_TYPE_MAP.containsKey(regType)) {
- Log.w("ImsMmTelManager", "RegistrationBinder - invalid regType returned: "
- + regType);
- return -1;
- }
- return IMS_REG_TO_ACCESS_TYPE_MAP.get(regType);
- }
- }
-
- private final RegistrationBinder mBinder = new RegistrationBinder(this);
+ // Do not add to this class, add to RegistrationManager.RegistrationCallback instead.
+ @Deprecated
+ public static class RegistrationCallback extends RegistrationManager.RegistrationCallback {
/**
* Notifies the framework when the IMS Provider is registered to the IMS network.
*
* @param imsTransportType the radio access technology.
*/
+ @Override
public void onRegistered(@AccessNetworkConstants.TransportType int imsTransportType) {
}
@@ -193,6 +111,7 @@ public class ImsMmTelManager {
*
* @param imsTransportType the radio access technology.
*/
+ @Override
public void onRegistering(@AccessNetworkConstants.TransportType int imsTransportType) {
}
@@ -201,6 +120,7 @@ public class ImsMmTelManager {
*
* @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
*/
+ @Override
public void onUnregistered(@Nullable ImsReasonInfo info) {
}
@@ -210,33 +130,11 @@ public class ImsMmTelManager {
* @param imsTransportType The transport type that has failed to handover registration to.
* @param info A {@link ImsReasonInfo} that identifies the reason for failure.
*/
+ @Override
public void onTechnologyChangeFailed(
@AccessNetworkConstants.TransportType int imsTransportType,
@Nullable ImsReasonInfo info) {
}
-
- /**
- * Returns a list of subscriber {@link Uri}s associated with this IMS subscription when
- * it changes. Per RFC3455, an associated URI is a URI that the service provider has
- * allocated to a user for their own usage. A user's phone number is typically one of the
- * associated URIs.
- * @param uris new array of subscriber {@link Uri}s that are associated with this IMS
- * subscription.
- * @hide
- */
- public void onSubscriberAssociatedUriChanged(@Nullable Uri[] uris) {
- }
-
- /**@hide*/
- public final IImsRegistrationCallback getBinder() {
- return mBinder;
- }
-
- /**@hide*/
- //Only exposed as public for compatibility with deprecated ImsManager APIs.
- public void setExecutor(Executor executor) {
- mBinder.setExecutor(executor);
- }
}
/**
@@ -311,7 +209,7 @@ public class ImsMmTelManager {
}
}
- private int mSubId;
+ private final int mSubId;
/**
* Create an instance of {@link ImsMmTelManager} for the subscription id specified.
@@ -356,7 +254,10 @@ public class ImsMmTelManager {
* the {@link ImsService} associated with the subscription is not available. This can happen if
* the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
* reason.
+ * @deprecated Use {@link RegistrationManager#registerImsRegistrationCallback(Executor,
+ * RegistrationManager.RegistrationCallback)} instead.
*/
+ @Deprecated
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void registerImsRegistrationCallback(@NonNull @CallbackExecutor Executor executor,
@NonNull RegistrationCallback c) throws ImsException {
@@ -366,10 +267,6 @@ public class ImsMmTelManager {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
- if (!isImsAvailableOnDevice()) {
- throw new ImsException("IMS not available on device.",
- ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
- }
c.setExecutor(executor);
try {
getITelephony().registerImsRegistrationCallback(mSubId, c.getBinder());
@@ -378,13 +275,34 @@ public class ImsMmTelManager {
// Rethrow as runtime error to keep API compatible.
throw new IllegalArgumentException(e.getMessage());
} else {
- throw new RuntimeException(e.getMessage());
+ throw new ImsException(e.getMessage(), e.errorCode);
}
} catch (RemoteException | IllegalStateException e) {
throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
}
}
+ /**{@inheritDoc}*/
+ @Override
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void registerImsRegistrationCallback(@NonNull @CallbackExecutor Executor executor,
+ @NonNull RegistrationManager.RegistrationCallback c) throws ImsException {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ c.setExecutor(executor);
+ try {
+ getITelephony().registerImsRegistrationCallback(mSubId, c.getBinder());
+ } catch (ServiceSpecificException e) {
+ throw new ImsException(e.getMessage(), e.errorCode);
+ } catch (RemoteException | IllegalStateException e) {
+ throw new ImsException(e.getMessage(), ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+ }
+
/**
* Removes an existing {@link RegistrationCallback}.
*
@@ -395,7 +313,10 @@ public class ImsMmTelManager {
* @param c The {@link RegistrationCallback} to be removed.
* @see SubscriptionManager.OnSubscriptionsChangedListener
* @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
+ * @deprecated Use {@link #unregisterImsRegistrationCallback(
+ * RegistrationManager.RegistrationCallback)}.
*/
+ @Deprecated
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public void unregisterImsRegistrationCallback(@NonNull RegistrationCallback c) {
if (c == null) {
@@ -408,6 +329,69 @@ public class ImsMmTelManager {
}
}
+ /**{@inheritDoc}*/
+ @Override
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void unregisterImsRegistrationCallback(
+ @NonNull RegistrationManager.RegistrationCallback c) {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
+ }
+ try {
+ getITelephony().unregisterImsRegistrationCallback(mSubId, c.getBinder());
+ } catch (RemoteException e) {
+ throw e.rethrowAsRuntimeException();
+ }
+ }
+
+ /**{@inheritDoc}*/
+ @Override
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void getRegistrationState(@NonNull @CallbackExecutor Executor executor,
+ @NonNull @ImsRegistrationState Consumer<Integer> stateCallback) {
+ if (stateCallback == null) {
+ throw new IllegalArgumentException("Must include a non-null callback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ try {
+ getITelephony().getImsMmTelRegistrationState(mSubId, new IIntegerConsumer.Stub() {
+ @Override
+ public void accept(int result) {
+ executor.execute(() -> stateCallback.accept(result));
+ }
+ });
+ } catch (RemoteException e) {
+ throw e.rethrowAsRuntimeException();
+ }
+ }
+
+ /**{@inheritDoc}*/
+ @Override
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void getRegistrationTransportType(@NonNull @CallbackExecutor Executor executor,
+ @NonNull @AccessNetworkConstants.TransportType
+ Consumer<Integer> transportTypeCallback) {
+ if (transportTypeCallback == null) {
+ throw new IllegalArgumentException("Must include a non-null callback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ try {
+ getITelephony().getImsMmTelRegistrationTransportType(mSubId,
+ new IIntegerConsumer.Stub() {
+ @Override
+ public void accept(int result) {
+ executor.execute(() -> transportTypeCallback.accept(result));
+ }
+ });
+ } catch (RemoteException e) {
+ throw e.rethrowAsRuntimeException();
+ }
+ }
+
/**
* Registers a {@link CapabilityCallback} with the system, which will provide MmTel service
* availability updates for the subscription specified in
@@ -416,7 +400,7 @@ public class ImsMmTelManager {
*
* Use {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to
* subscription changed events and call
- * {@link #unregisterImsRegistrationCallback(RegistrationCallback)} to clean up.
+ * {@link #unregisterMmTelCapabilityCallback(CapabilityCallback)} to clean up.
*
* When the callback is registered, it will initiate the callback c to be called with the
* current capabilities.
@@ -441,10 +425,6 @@ public class ImsMmTelManager {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
- if (!isImsAvailableOnDevice()) {
- throw new ImsException("IMS not available on device.",
- ImsException.CODE_ERROR_UNSUPPORTED_OPERATION);
- }
c.setExecutor(executor);
try {
getITelephony().registerMmTelCapabilityCallback(mSubId, c.getBinder());
@@ -453,7 +433,7 @@ public class ImsMmTelManager {
// Rethrow as runtime error to keep API compatible.
throw new IllegalArgumentException(e.getMessage());
} else {
- throw new RuntimeException(e.getMessage());
+ throw new ImsException(e.getMessage(), e.errorCode);
}
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
@@ -618,6 +598,46 @@ public class ImsMmTelManager {
}
/**
+ * Query whether or not the requested MmTel capability is supported by the carrier on the
+ * specified network transport.
+ * <p>
+ * This is a configuration option and does not change. The only time this may change is if a
+ * new IMS configuration is loaded when there is a
+ * {@link CarrierConfigManager#ACTION_CARRIER_CONFIG_CHANGED} broadcast for this subscription.
+ * @param capability The capability that is being queried for support on the carrier network.
+ * @param transportType The transport type of the capability to check support for.
+ * @param executor The executor that the callback will be called with.
+ * @param callback A consumer containing a Boolean result specifying whether or not the
+ * capability is supported on this carrier network for the transport specified.
+ * @throws ImsException if the subscription is no longer valid or the IMS service is not
+ * available.
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void isSupported(@MmTelFeature.MmTelCapabilities.MmTelCapability int capability,
+ @AccessNetworkConstants.TransportType int transportType,
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull Consumer<Boolean> callback) throws ImsException {
+ if (callback == null) {
+ throw new IllegalArgumentException("Must include a non-null Consumer.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ try {
+ getITelephony().isMmTelCapabilitySupported(mSubId, new IIntegerConsumer.Stub() {
+ @Override
+ public void accept(int result) {
+ executor.execute(() -> callback.accept(result == 1));
+ }
+ }, capability, transportType);
+ } catch (ServiceSpecificException sse) {
+ throw new ImsException(sse.getMessage(), sse.errorCode);
+ } catch (RemoteException e) {
+ e.rethrowAsRuntimeException();
+ }
+ }
+
+ /**
* The user's setting for whether or not they have enabled the "Video Calling" setting.
*
* @throws IllegalArgumentException if the subscription associated with this operation is not
@@ -940,7 +960,7 @@ public class ImsMmTelManager {
* @see android.telephony.CarrierConfigManager#KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- boolean isTtyOverVolteEnabled() {
+ public boolean isTtyOverVolteEnabled() {
try {
return getITelephony().isTtyOverVolteEnabled(mSubId);
} catch (ServiceSpecificException e) {
@@ -955,20 +975,39 @@ public class ImsMmTelManager {
}
}
- private static boolean isImsAvailableOnDevice() {
- IPackageManager pm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
- if (pm == null) {
- // For some reason package manger is not available.. This will fail internally anyways,
- // so do not throw error and allow.
- return true;
+ /**
+ * Get the status of the MmTel Feature registered on this subscription.
+ * @param callback A callback containing an Integer describing the current state of the
+ * MmTel feature, Which will be one of the following:
+ * {@link ImsFeature#STATE_UNAVAILABLE},
+ * {@link ImsFeature#STATE_INITIALIZING},
+ * {@link ImsFeature#STATE_READY}. Will be called using the executor
+ * specified when the service state has been retrieved from the IMS service.
+ * @param executor The executor that will be used to call the callback.
+ * @throws ImsException if the IMS service associated with this subscription is not available or
+ * the IMS service is not available.
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public void getFeatureState(@NonNull @ImsFeature.ImsState Consumer<Integer> callback,
+ @NonNull @CallbackExecutor Executor executor) throws ImsException {
+ if (callback == null) {
+ throw new IllegalArgumentException("Must include a non-null Consumer.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
}
try {
- return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS, 0);
+ getITelephony().getImsMmTelFeatureState(mSubId, new IIntegerConsumer.Stub() {
+ @Override
+ public void accept(int result) {
+ executor.execute(() -> callback.accept(result));
+ }
+ });
+ } catch (ServiceSpecificException sse) {
+ throw new ImsException(sse.getMessage(), sse.errorCode);
} catch (RemoteException e) {
- // For some reason package manger is not available.. This will fail internally anyways,
- // so do not throw error and allow.
+ e.rethrowAsRuntimeException();
}
- return true;
}
private static ITelephony getITelephony() {
diff --git a/telephony/java/android/telephony/ims/ImsRcsManager.java b/telephony/java/android/telephony/ims/ImsRcsManager.java
index 3c343dd19a86..21707b0d7cfd 100644
--- a/telephony/java/android/telephony/ims/ImsRcsManager.java
+++ b/telephony/java/android/telephony/ims/ImsRcsManager.java
@@ -22,21 +22,28 @@ import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.content.Context;
import android.os.Binder;
-import android.telephony.SubscriptionManager;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telephony.AccessNetworkConstants;
import android.telephony.ims.aidl.IImsCapabilityCallback;
+import android.telephony.ims.aidl.IImsRcsController;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.RcsFeature;
+import android.util.Log;
import java.util.concurrent.Executor;
+import java.util.function.Consumer;
/**
* Manager for interfacing with the framework RCS services, including the User Capability Exchange
* (UCE) service, as well as managing user settings.
*
- * Use {@link #createForSubscriptionId(Context, int)} to create an instance of this manager.
+ * Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this manager.
* @hide
*/
-public class ImsRcsManager {
+public class ImsRcsManager implements RegistrationManager {
+ private static final String TAG = "ImsRcsManager";
/**
* Receives RCS availability status updates from the ImsService.
@@ -110,32 +117,83 @@ public class ImsRcsManager {
private final int mSubId;
private final Context mContext;
+ /**
+ * Use {@link ImsManager#getImsRcsManager(int)} to create an instance of this class.
+ * @hide
+ */
+ public ImsRcsManager(Context context, int subId) {
+ mSubId = subId;
+ mContext = context;
+ }
/**
- * Create an instance of ImsRcsManager for the subscription id specified.
- *
- * @param context The context to create this ImsRcsManager instance within.
- * @param subscriptionId The ID of the subscription that this ImsRcsManager will use.
- * @see android.telephony.SubscriptionManager#getActiveSubscriptionInfoList()
- * @throws IllegalArgumentException if the subscription is invalid.
+ * @return A {@link RcsUceAdapter} used for User Capability Exchange (UCE) operations for
+ * this subscription.
* @hide
*/
- public static ImsRcsManager createForSubscriptionId(Context context, int subscriptionId) {
- if (!SubscriptionManager.isValidSubscriptionId(subscriptionId)) {
- throw new IllegalArgumentException("Invalid subscription ID");
+ @NonNull
+ public RcsUceAdapter getUceAdapter() {
+ return new RcsUceAdapter(mSubId);
+ }
+
+ /**{@inheritDoc}*/
+ @Override
+ public void registerImsRegistrationCallback(
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull RegistrationCallback c)
+ throws ImsException {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
}
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ c.setExecutor(executor);
+ throw new UnsupportedOperationException("registerImsRegistrationCallback is not"
+ + "supported.");
+ }
- return new ImsRcsManager(context, subscriptionId);
+ /**{@inheritDoc}*/
+ @Override
+ public void unregisterImsRegistrationCallback(
+ @NonNull RegistrationManager.RegistrationCallback c) {
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null RegistrationCallback.");
+ }
+ throw new UnsupportedOperationException("unregisterImsRegistrationCallback is not"
+ + "supported.");
}
- /**
- * Use {@link #createForSubscriptionId(Context, int)} to create an instance of this class.
- */
- private ImsRcsManager(Context context, int subId) {
- mContext = context;
- mSubId = subId;
+ /**{@inheritDoc}*/
+ @Override
+ public void getRegistrationState(@NonNull @CallbackExecutor Executor executor,
+ @NonNull @ImsRegistrationState Consumer<Integer> stateCallback) {
+ if (stateCallback == null) {
+ throw new IllegalArgumentException("Must include a non-null stateCallback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ throw new UnsupportedOperationException("getRegistrationState is not"
+ + "supported.");
+ }
+
+ /**{@inheritDoc}*/
+ @Override
+ public void getRegistrationTransportType(@NonNull @CallbackExecutor Executor executor,
+ @NonNull @AccessNetworkConstants.TransportType
+ Consumer<Integer> transportTypeCallback) {
+ if (transportTypeCallback == null) {
+ throw new IllegalArgumentException("Must include a non-null transportTypeCallback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ throw new UnsupportedOperationException("getRegistrationTransportType is not"
+ + "supported.");
}
+
/**
* Registers an {@link AvailabilityCallback} with the system, which will provide RCS
* availability updates for the subscription specified.
@@ -165,9 +223,22 @@ public class ImsRcsManager {
if (executor == null) {
throw new IllegalArgumentException("Must include a non-null Executor.");
}
+
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "Register availability callback: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
c.setExecutor(executor);
- throw new UnsupportedOperationException("registerRcsAvailabilityCallback is not"
- + "supported.");
+ try {
+ imsRcsController.registerRcsAvailabilityCallback(c.getBinder());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#registerRcsAvailabilityCallback", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
/**
@@ -178,14 +249,31 @@ public class ImsRcsManager {
* inactive subscription, it will result in a no-op.
* @param c The RCS {@link AvailabilityCallback} to be removed.
* @see #registerRcsAvailabilityCallback(Executor, AvailabilityCallback)
+ * @throws ImsException if the IMS service is not available when calling this method
+ * {@link ImsRcsController#unregisterRcsAvailabilityCallback()}.
+ * See {@link ImsException#getCode()} for more information on the error codes.
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- public void unregisterRcsAvailabilityCallback(@NonNull AvailabilityCallback c) {
+ public void unregisterRcsAvailabilityCallback(@NonNull AvailabilityCallback c)
+ throws ImsException {
if (c == null) {
throw new IllegalArgumentException("Must include a non-null AvailabilityCallback.");
}
- throw new UnsupportedOperationException("unregisterRcsAvailabilityCallback is not"
- + "supported.");
+
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "Unregister availability callback: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ imsRcsController.unregisterRcsAvailabilityCallback(c.getBinder());
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#unregisterRcsAvailabilityCallback", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
/**
@@ -200,10 +288,27 @@ public class ImsRcsManager {
* rather the subscription is capable of this service over IMS.
* @see #isAvailable(int)
* @see android.telephony.CarrierConfigManager#KEY_USE_RCS_PRESENCE_BOOL
+ * @throws ImsException if the IMS service is not available when calling this method
+ * {@link ImsRcsController#isCapable(int, int)}.
+ * See {@link ImsException#getCode()} for more information on the error codes.
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- public boolean isCapable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
- throw new UnsupportedOperationException("isCapable is not supported.");
+ public boolean isCapable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability)
+ throws ImsException {
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "isCapable: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ return imsRcsController.isCapable(mSubId, capability);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#isCapable", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
/**
@@ -217,18 +322,31 @@ public class ImsRcsManager {
* false otherwise. If the capability is available, IMS is registered and the service is
* currently available over IMS.
* @see #isCapable(int)
+ * @throws ImsException if the IMS service is not available when calling this method
+ * {@link ImsRcsController#isAvailable(int, int)}.
+ * See {@link ImsException#getCode()} for more information on the error codes.
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
- public boolean isAvailable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
- throw new UnsupportedOperationException("isAvailable is not supported.");
+ public boolean isAvailable(@RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability)
+ throws ImsException {
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "isAvailable: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ return imsRcsController.isAvailable(mSubId, capability);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#isAvailable", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
- /**
- * @return A new {@link RcsUceAdapter} used for User Capability Exchange (UCE) operations for
- * this subscription.
- */
- @NonNull
- public RcsUceAdapter getUceAdapter() {
- return new RcsUceAdapter(mSubId);
+ private IImsRcsController getIImsRcsController() {
+ IBinder binder = ServiceManager.getService(Context.TELEPHONY_IMS_SERVICE);
+ return IImsRcsController.Stub.asInterface(binder);
}
}
diff --git a/telephony/java/android/telephony/ims/ImsSsInfo.java b/telephony/java/android/telephony/ims/ImsSsInfo.java
index be34f9db3e54..0510a0012426 100644
--- a/telephony/java/android/telephony/ims/ImsSsInfo.java
+++ b/telephony/java/android/telephony/ims/ImsSsInfo.java
@@ -336,4 +336,31 @@ public final class ImsSsInfo implements Parcelable {
public @ClirInterrogationStatus int getClirInterrogationStatus() {
return mClirInterrogationStatus;
}
+
+ /**
+ * Parts of telephony still use the old {m,n} 3GPP definition, so convert to that format.
+ * @hide
+ */
+ public int[] getCompatArray(@ImsSsData.ServiceType int type) {
+ int[] result = new int[2];
+ // Convert ImsSsInfo into a form that telephony can read (as per 3GPP 27.007)
+ // CLIR (section 7.7)
+ if (type == ImsSsData.SS_CLIR) {
+ // Assume there will only be one ImsSsInfo.
+ // contains {"n","m"} parameters
+ result[0] = getClirOutgoingState();
+ result[1] = getClirInterrogationStatus();
+ return result;
+ }
+ // COLR 7.31
+ if (type == ImsSsData.SS_COLR) {
+ result[0] = getProvisionStatus();
+ }
+ // Facility Lock CLCK 7.4 (for call barring), CLIP 7.6, COLP 7.8, as well as any
+ // other result, just return the status for the "n" parameter and provisioning status for
+ // "m" as the default.
+ result[0] = getStatus();
+ result[1] = getProvisionStatus();
+ return result;
+ }
}
diff --git a/telephony/java/android/telephony/ims/ImsUtListener.java b/telephony/java/android/telephony/ims/ImsUtListener.java
index d50a0f738b25..1a21d0aa0c76 100644
--- a/telephony/java/android/telephony/ims/ImsUtListener.java
+++ b/telephony/java/android/telephony/ims/ImsUtListener.java
@@ -16,22 +16,53 @@
package android.telephony.ims;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.RemoteException;
+import android.telephony.ims.stub.ImsUtImplBase;
import android.util.Log;
import com.android.ims.internal.IImsUtListener;
/**
- * Base implementation of the IMS UT listener interface, which implements stubs.
- * Override these methods to implement functionality.
+ * Listener interface used to receive network responses back from UT supplementary service queries
+ * made by the framework.
* @hide
*/
// DO NOT remove or change the existing APIs, only add new ones to this Base implementation or you
// will break other implementations of ImsUt maintained by other ImsServices.
@SystemApi
public class ImsUtListener {
+
+ /**
+ * The {@link Bundle} key for a Calling Line Identification Restriction (CLIR) response. The
+ * value will be an int[] with two values:
+ * int[0] contains the 'n' parameter from TS 27.007 7.7, which is the
+ * outgoing CLIR state. See {@link ImsSsInfo#CLIR_OUTGOING_DEFAULT},
+ * {@link ImsSsInfo#CLIR_OUTGOING_INVOCATION}, and {@link ImsSsInfo#CLIR_OUTGOING_SUPPRESSION};
+ * int[1] contains the 'm' parameter from TS 27.007 7.7, which is the CLIR interrogation status.
+ * See {@link ImsSsInfo#CLIR_STATUS_NOT_PROVISIONED},
+ * {@link ImsSsInfo#CLIR_STATUS_PROVISIONED_PERMANENT}, {@link ImsSsInfo#CLIR_STATUS_UNKNOWN},
+ * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_RESTRICTED}, and
+ * {@link ImsSsInfo#CLIR_STATUS_TEMPORARILY_ALLOWED}.
+ * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)}
+ * instead.
+ */
+ @Deprecated
+ public static final String BUNDLE_KEY_CLIR = "queryClir";
+
+ /**
+ * The {@link Bundle} key for a Calling Line Identification Presentation (CLIP), Connected Line
+ * Identification Presentation (COLP), or Connected Line Identification Restriction (COLR)
+ * response. The value will be an instance of {@link ImsSsInfo}, which contains the response to
+ * the query.
+ * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)}
+ * instead.
+ */
+ @Deprecated
+ public static final String BUNDLE_KEY_SSINFO = "imsSsInfo";
+
private IImsUtListener mServiceInterface;
private static final String LOG_TAG = "ImsUtListener";
@@ -51,14 +82,54 @@ public class ImsUtListener {
}
}
- public void onUtConfigurationQueried(int id, Bundle ssInfo) {
+ /**
+ * Notify the framework of a UT configuration response to a {@link ImsUtImplBase#queryClir()},
+ * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or
+ * {@link ImsUtImplBase#queryColr()} query for the transaction ID specified. If the query fails,
+ * {@link #onUtConfigurationQueryFailed(int, ImsReasonInfo)} should be called.
+ * @param id The ID associated with this UT configuration transaction from the framework.
+ * @param configuration A {@link Bundle} containing the result of querying the UT configuration.
+ * Must contain {@link #BUNDLE_KEY_CLIR} if it is a response to
+ * {@link ImsUtImplBase#queryClir()} or
+ * {@link #BUNDLE_KEY_SSINFO} if it is a response to
+ * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or
+ * {@link ImsUtImplBase#queryColr()}.
+ * @deprecated Use {@link #onLineIdentificationSupplementaryServiceResponse(int, ImsSsInfo)}
+ * instead.
+ */
+ @Deprecated
+ public void onUtConfigurationQueried(int id, Bundle configuration) {
try {
- mServiceInterface.utConfigurationQueried(null, id, ssInfo);
+ mServiceInterface.utConfigurationQueried(null, id, configuration);
} catch (RemoteException e) {
Log.w(LOG_TAG, "utConfigurationQueried: remote exception");
}
}
+ /**
+ * Notify the framework of a UT configuration response to a {@link ImsUtImplBase#queryClir()},
+ * {@link ImsUtImplBase#queryClip()}, {@link ImsUtImplBase#queryColp()}, or
+ * {@link ImsUtImplBase#queryColr()} query for the transaction ID specified. If the query fails,
+ * the framework should be notified via
+ * {@link #onUtConfigurationQueryFailed(int, ImsReasonInfo)}.
+ * @param id The ID associated with this UT configuration transaction from the framework.
+ * @param configuration An {@link ImsSsInfo} instance containing the configuration for the
+ * line identification supplementary service queried.
+ */
+ public void onLineIdentificationSupplementaryServiceResponse(int id,
+ @NonNull ImsSsInfo configuration) {
+ try {
+ mServiceInterface.lineIdentificationSupplementaryServiceResponse(id, configuration);
+ } catch (RemoteException e) {
+ Log.w(LOG_TAG, "onLineIdentificationSupplementaryServicesResponse: remote exception");
+ }
+ }
+
+ /**
+ * Notify the Framework of the line identification query failure.
+ * @param id The ID associated with the UT query transaction.
+ * @param error The query failure reason.
+ */
public void onUtConfigurationQueryFailed(int id, ImsReasonInfo error) {
try {
mServiceInterface.utConfigurationQueryFailed(null, id, error);
diff --git a/telephony/java/android/telephony/ims/RcsUceAdapter.java b/telephony/java/android/telephony/ims/RcsUceAdapter.java
index a6a7a84c2c65..b47bcb9b119b 100644
--- a/telephony/java/android/telephony/ims/RcsUceAdapter.java
+++ b/telephony/java/android/telephony/ims/RcsUceAdapter.java
@@ -23,6 +23,13 @@ import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.content.Context;
import android.net.Uri;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.telephony.ims.aidl.IImsRcsController;
+import android.telephony.ims.aidl.IRcsUceControllerCallback;
+import android.util.Log;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -36,6 +43,7 @@ import java.util.concurrent.Executor;
* @hide
*/
public class RcsUceAdapter {
+ private static final String TAG = "RcsUceAdapter";
/**
* An unknown error has caused the request to fail.
@@ -188,7 +196,6 @@ public class RcsUceAdapter {
/**
* Not to be instantiated directly, use
- * {@link ImsRcsManager#createForSubscriptionId(Context, int)} and
* {@link ImsRcsManager#getUceAdapter()} to instantiate this manager class.
*/
RcsUceAdapter(int subId) {
@@ -218,7 +225,45 @@ public class RcsUceAdapter {
public void requestCapabilities(@CallbackExecutor Executor executor,
@NonNull List<Uri> contactNumbers,
@NonNull CapabilitiesCallback c) throws ImsException {
- throw new UnsupportedOperationException("isUceSettingEnabled is not supported.");
+ if (c == null) {
+ throw new IllegalArgumentException("Must include a non-null AvailabilityCallback.");
+ }
+ if (executor == null) {
+ throw new IllegalArgumentException("Must include a non-null Executor.");
+ }
+ if (contactNumbers == null) {
+ throw new IllegalArgumentException("Must include non-null contact number list.");
+ }
+
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "requestCapabilities: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ IRcsUceControllerCallback internalCallback = new IRcsUceControllerCallback.Stub() {
+ @Override
+ public void onCapabilitiesReceived(List<RcsContactUceCapability> contactCapabilities) {
+ Binder.withCleanCallingIdentity(() ->
+ executor.execute(() ->
+ c.onCapabilitiesReceived(contactCapabilities)));
+ }
+ @Override
+ public void onError(int errorCode) {
+ Binder.withCleanCallingIdentity(() ->
+ executor.execute(() ->
+ c.onError(errorCode)));
+ }
+ };
+
+ try {
+ imsRcsController.requestCapabilities(mSubId, contactNumbers, internalCallback);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#requestCapabilities", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
/**
@@ -233,7 +278,20 @@ public class RcsUceAdapter {
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public @PublishState int getUcePublishState() throws ImsException {
- throw new UnsupportedOperationException("getPublishState is not supported.");
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "getUcePublishState: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ return imsRcsController.getUcePublishState(mSubId);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#getUcePublishState", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
/**
@@ -252,9 +310,22 @@ public class RcsUceAdapter {
*/
@RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public boolean isUceSettingEnabled() throws ImsException {
- // TODO: add SubscriptionController column for this property.
- throw new UnsupportedOperationException("isUceSettingEnabled is not supported.");
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "isUceSettingEnabled: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ return imsRcsController.isUceSettingEnabled(mSubId);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#isUceSettingEnabled", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
}
+
/**
* Change the user’s setting for whether or not UCE is enabled for the associated subscription.
* @param isEnabled the user's setting for whether or not they wish for Presence and User
@@ -270,7 +341,24 @@ public class RcsUceAdapter {
*/
@RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
public void setUceSettingEnabled(boolean isEnabled) throws ImsException {
- // TODO: add SubscriptionController column for this property.
- throw new UnsupportedOperationException("setUceSettingEnabled is not supported.");
+ IImsRcsController imsRcsController = getIImsRcsController();
+ if (imsRcsController == null) {
+ Log.e(TAG, "setUceSettingEnabled: IImsRcsController is null");
+ throw new ImsException("Can not find remote IMS service",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+
+ try {
+ imsRcsController.setUceSettingEnabled(mSubId, isEnabled);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling IImsRcsController#setUceSettingEnabled", e);
+ throw new ImsException("Remote IMS Service is not available",
+ ImsException.CODE_ERROR_SERVICE_UNAVAILABLE);
+ }
+ }
+
+ private IImsRcsController getIImsRcsController() {
+ IBinder binder = ServiceManager.getService(Context.TELEPHONY_IMS_SERVICE);
+ return IImsRcsController.Stub.asInterface(binder);
}
}
diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java
new file mode 100644
index 000000000000..23402b88f3b1
--- /dev/null
+++ b/telephony/java/android/telephony/ims/RegistrationManager.java
@@ -0,0 +1,285 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims;
+
+import android.Manifest;
+import android.annotation.CallbackExecutor;
+import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.RequiresPermission;
+import android.annotation.SystemApi;
+import android.net.Uri;
+import android.os.Binder;
+import android.telephony.AccessNetworkConstants;
+import android.telephony.ims.aidl.IImsRegistrationCallback;
+import android.telephony.ims.feature.ImsFeature;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.Log;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.function.Consumer;
+
+/**
+ * Manages IMS Service registration state for associated {@link ImsFeature}s.
+ * @hide
+ */
+@SystemApi
+public interface RegistrationManager {
+
+ /**
+ * @hide
+ */
+ // Defines the underlying radio technology type that we have registered for IMS over.
+ @IntDef(prefix = "REGISTRATION_STATE_",
+ value = {
+ REGISTRATION_STATE_NOT_REGISTERED,
+ REGISTRATION_STATE_REGISTERING,
+ REGISTRATION_STATE_REGISTERED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ImsRegistrationState {}
+
+ /**
+ * The IMS service is currently not registered to the carrier network.
+ */
+ int REGISTRATION_STATE_NOT_REGISTERED = 0;
+
+ /**
+ * The IMS service is currently in the process of registering to the carrier network.
+ */
+ int REGISTRATION_STATE_REGISTERING = 1;
+
+ /**
+ * The IMS service is currently registered to the carrier network.
+ */
+ int REGISTRATION_STATE_REGISTERED = 2;
+
+
+ /**@hide*/
+ // Translate ImsRegistrationImplBase API to new AccessNetworkConstant because WLAN
+ // and WWAN are more accurate constants.
+ Map<Integer, Integer> IMS_REG_TO_ACCESS_TYPE_MAP =
+ new HashMap<Integer, Integer>() {{
+ // Map NONE to -1 to make sure that we handle the REGISTRATION_TECH_NONE
+ // case, since it is defined.
+ put(ImsRegistrationImplBase.REGISTRATION_TECH_NONE, -1);
+ put(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
+ AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ put(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
+ AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
+ }};
+
+ /**
+ * Callback class for receiving IMS network Registration callback events.
+ * @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
+ * @see #unregisterImsRegistrationCallback(RegistrationCallback)
+ */
+ class RegistrationCallback {
+
+ private static class RegistrationBinder extends IImsRegistrationCallback.Stub {
+
+ private final RegistrationCallback mLocalCallback;
+ private Executor mExecutor;
+
+ RegistrationBinder(RegistrationCallback localCallback) {
+ mLocalCallback = localCallback;
+ }
+
+ @Override
+ public void onRegistered(int imsRadioTech) {
+ if (mLocalCallback == null) return;
+
+ Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
+ mLocalCallback.onRegistered(getAccessType(imsRadioTech))));
+ }
+
+ @Override
+ public void onRegistering(int imsRadioTech) {
+ if (mLocalCallback == null) return;
+
+ Binder.withCleanCallingIdentity(() -> mExecutor.execute(() ->
+ mLocalCallback.onRegistering(getAccessType(imsRadioTech))));
+ }
+
+ @Override
+ public void onDeregistered(ImsReasonInfo info) {
+ if (mLocalCallback == null) return;
+
+ Binder.withCleanCallingIdentity(() ->
+ mExecutor.execute(() -> mLocalCallback.onUnregistered(info)));
+ }
+
+ @Override
+ public void onTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) {
+ if (mLocalCallback == null) return;
+
+ Binder.withCleanCallingIdentity(() ->
+ mExecutor.execute(() -> mLocalCallback.onTechnologyChangeFailed(
+ getAccessType(imsRadioTech), info)));
+ }
+
+ @Override
+ public void onSubscriberAssociatedUriChanged(Uri[] uris) {
+ if (mLocalCallback == null) return;
+
+ Binder.withCleanCallingIdentity(() ->
+ mExecutor.execute(() ->
+ mLocalCallback.onSubscriberAssociatedUriChanged(uris)));
+ }
+
+ private void setExecutor(Executor executor) {
+ mExecutor = executor;
+ }
+
+ private static int getAccessType(int regType) {
+ if (!RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.containsKey(regType)) {
+ Log.w("RegistrationManager", "RegistrationBinder - invalid regType returned: "
+ + regType);
+ return -1;
+ }
+ return RegistrationManager.IMS_REG_TO_ACCESS_TYPE_MAP.get(regType);
+ }
+ }
+
+ private final RegistrationBinder mBinder = new RegistrationBinder(this);
+
+ /**
+ * Notifies the framework when the IMS Provider is registered to the IMS network.
+ *
+ * @param imsTransportType the radio access technology.
+ */
+ public void onRegistered(@AccessNetworkConstants.TransportType int imsTransportType) {
+ }
+
+ /**
+ * Notifies the framework when the IMS Provider is trying to register the IMS network.
+ *
+ * @param imsTransportType the radio access technology.
+ */
+ public void onRegistering(@AccessNetworkConstants.TransportType int imsTransportType) {
+ }
+
+ /**
+ * Notifies the framework when the IMS Provider is deregistered from the IMS network.
+ *
+ * @param info the {@link ImsReasonInfo} associated with why registration was disconnected.
+ */
+ public void onUnregistered(@Nullable ImsReasonInfo info) {
+ }
+
+ /**
+ * A failure has occurred when trying to handover registration to another technology type.
+ *
+ * @param imsTransportType The transport type that has failed to handover registration to.
+ * @param info A {@link ImsReasonInfo} that identifies the reason for failure.
+ */
+ public void onTechnologyChangeFailed(
+ @AccessNetworkConstants.TransportType int imsTransportType,
+ @Nullable ImsReasonInfo info) {
+ }
+
+ /**
+ * Returns a list of subscriber {@link Uri}s associated with this IMS subscription when
+ * it changes. Per RFC3455, an associated URI is a URI that the service provider has
+ * allocated to a user for their own usage. A user's phone number is typically one of the
+ * associated URIs.
+ * @param uris new array of subscriber {@link Uri}s that are associated with this IMS
+ * subscription.
+ * @hide
+ */
+ public void onSubscriberAssociatedUriChanged(@Nullable Uri[] uris) {
+ }
+
+ /**@hide*/
+ public final IImsRegistrationCallback getBinder() {
+ return mBinder;
+ }
+
+ /**@hide*/
+ //Only exposed as public for compatibility with deprecated ImsManager APIs.
+ public void setExecutor(Executor executor) {
+ mBinder.setExecutor(executor);
+ }
+ }
+
+ /**
+ * Registers a {@link RegistrationCallback} with the system. Use
+ * {@link SubscriptionManager.OnSubscriptionsChangedListener} to listen to Subscription changed
+ * events and call {@link #unregisterImsRegistrationCallback(RegistrationCallback)} to clean up.
+ *
+ * When the callback is registered, it will initiate the callback c to be called with the
+ * current registration state.
+ *
+ * @param executor The executor the callback events should be run on.
+ * @param c The {@link RegistrationCallback} to be added.
+ * @see #unregisterImsRegistrationCallback(RegistrationCallback)
+ * @throws ImsException if the subscription associated with this callback is valid, but
+ * the {@link ImsService} associated with the subscription is not available. This can happen if
+ * the service crashed, for example. See {@link ImsException#getCode()} for a more detailed
+ * reason.
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ void registerImsRegistrationCallback(@NonNull @CallbackExecutor Executor executor,
+ @NonNull RegistrationCallback c) throws ImsException;
+
+ /**
+ * Removes an existing {@link RegistrationCallback}.
+ *
+ * When the subscription associated with this callback is removed (SIM removed, ESIM swap,
+ * etc...), this callback will automatically be removed. If this method is called for an
+ * inactive subscription, it will result in a no-op.
+ *
+ * @param c The {@link RegistrationCallback} to be removed.
+ * @see SubscriptionManager.OnSubscriptionsChangedListener
+ * @see #registerImsRegistrationCallback(Executor, RegistrationCallback)
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ void unregisterImsRegistrationCallback(@NonNull RegistrationCallback c);
+
+ /**
+ * Gets the registration state of the IMS service.
+ * @param executor The {@link Executor} that will be used to call the IMS registration state
+ * callback.
+ * @param stateCallback A callback called on the supplied {@link Executor} that will contain the
+ * registration state of the IMS service, which will be one of the
+ * following: {@link #REGISTRATION_STATE_NOT_REGISTERED},
+ * {@link #REGISTRATION_STATE_REGISTERING}, or
+ * {@link #REGISTRATION_STATE_REGISTERED}.
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ void getRegistrationState(@NonNull @CallbackExecutor Executor executor,
+ @NonNull @ImsRegistrationState Consumer<Integer> stateCallback);
+
+ /**
+ * Gets the Transport Type associated with the current IMS registration.
+ * @param executor The {@link Executor} that will be used to call the transportTypeCallback.
+ * @param transportTypeCallback The transport type associated with the current IMS registration,
+ * which will be one of following:
+ * {@link AccessNetworkConstants#TRANSPORT_TYPE_WWAN},
+ * {@link AccessNetworkConstants#TRANSPORT_TYPE_WLAN}, or
+ * {@link AccessNetworkConstants#TRANSPORT_TYPE_INVALID}.
+ */
+ @RequiresPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ void getRegistrationTransportType(
+ @NonNull @CallbackExecutor Executor executor,
+ @NonNull @AccessNetworkConstants.TransportType Consumer<Integer> transportTypeCallback);
+}
diff --git a/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
new file mode 100644
index 000000000000..b379bd0cd748
--- /dev/null
+++ b/telephony/java/android/telephony/ims/aidl/IImsRcsController.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims.aidl;
+
+import android.net.Uri;
+import android.telephony.ims.aidl.IImsCapabilityCallback;
+import android.telephony.ims.aidl.IRcsUceControllerCallback;
+
+/**
+ * Interface used to interact with the Telephony IMS.
+ *
+ * {@hide}
+ */
+interface IImsRcsController {
+ void registerRcsAvailabilityCallback(IImsCapabilityCallback c);
+ void unregisterRcsAvailabilityCallback(IImsCapabilityCallback c);
+ boolean isCapable(int subId, int capability);
+ boolean isAvailable(int subId, int capability);
+
+ // ImsUceAdapter specific
+ void requestCapabilities(int subId, in List<Uri> contactNumbers, IRcsUceControllerCallback c);
+ int getUcePublishState(int subId);
+ boolean isUceSettingEnabled(int subId);
+ void setUceSettingEnabled(int subId, boolean isEnabled);
+}
diff --git a/telephony/java/android/telephony/ims/aidl/IRcsUceControllerCallback.aidl b/telephony/java/android/telephony/ims/aidl/IRcsUceControllerCallback.aidl
new file mode 100644
index 000000000000..5975930d5cfa
--- /dev/null
+++ b/telephony/java/android/telephony/ims/aidl/IRcsUceControllerCallback.aidl
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims.aidl;
+
+import android.telephony.ims.RcsContactUceCapability;
+
+/**
+ * Provides interface for RCS UCE when receive a change.
+ *
+ * {@hide}
+ */
+oneway interface IRcsUceControllerCallback {
+ void onCapabilitiesReceived(in List<RcsContactUceCapability> contactCapabilities);
+ void onError(int errorCode);
+}
diff --git a/telephony/java/android/telephony/ims/compat/ImsService.java b/telephony/java/android/telephony/ims/compat/ImsService.java
index 2750e51fc3d4..97a8517afea9 100644
--- a/telephony/java/android/telephony/ims/compat/ImsService.java
+++ b/telephony/java/android/telephony/ims/compat/ImsService.java
@@ -113,6 +113,10 @@ public class ImsService extends Service {
}
};
+ @UnsupportedAppUsage
+ public ImsService() {
+ }
+
/**
* @hide
*/
diff --git a/telephony/java/android/telephony/ims/compat/feature/MMTelFeature.java b/telephony/java/android/telephony/ims/compat/feature/MMTelFeature.java
index 40ea208e4578..3fd356a510e6 100644
--- a/telephony/java/android/telephony/ims/compat/feature/MMTelFeature.java
+++ b/telephony/java/android/telephony/ims/compat/feature/MMTelFeature.java
@@ -16,12 +16,16 @@
package android.telephony.ims.compat.feature;
+import android.annotation.UnsupportedAppUsage;
import android.app.PendingIntent;
import android.os.Message;
import android.os.RemoteException;
-
-import android.annotation.UnsupportedAppUsage;
import android.telephony.ims.ImsCallProfile;
+import android.telephony.ims.ImsCallSession;
+import android.telephony.ims.stub.ImsEcbmImplBase;
+import android.telephony.ims.stub.ImsMultiEndpointImplBase;
+import android.telephony.ims.stub.ImsUtImplBase;
+
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsCallSessionListener;
import com.android.ims.internal.IImsConfig;
@@ -30,11 +34,6 @@ import com.android.ims.internal.IImsMMTelFeature;
import com.android.ims.internal.IImsMultiEndpoint;
import com.android.ims.internal.IImsRegistrationListener;
import com.android.ims.internal.IImsUt;
-import android.telephony.ims.ImsCallSession;
-import android.telephony.ims.compat.stub.ImsCallSessionImplBase;
-import android.telephony.ims.stub.ImsEcbmImplBase;
-import android.telephony.ims.stub.ImsMultiEndpointImplBase;
-import android.telephony.ims.stub.ImsUtImplBase;
/**
* Base implementation for MMTel.
@@ -49,6 +48,10 @@ public class MMTelFeature extends ImsFeature {
// Lock for feature synchronization
private final Object mLock = new Object();
+ @UnsupportedAppUsage
+ public MMTelFeature() {
+ }
+
private final IImsMMTelFeature mImsMMTelBinder = new IImsMMTelFeature.Stub() {
@Override
diff --git a/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java b/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java
index 38566fe6d811..d77f78ea9e88 100644
--- a/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java
+++ b/telephony/java/android/telephony/ims/compat/stub/ImsCallSessionImplBase.java
@@ -16,6 +16,7 @@
package android.telephony.ims.compat.stub;
+import android.annotation.UnsupportedAppUsage;
import android.os.Message;
import android.os.RemoteException;
import android.telephony.CallQuality;
@@ -41,6 +42,10 @@ import com.android.ims.internal.IImsVideoCallProvider;
public class ImsCallSessionImplBase extends IImsCallSession.Stub {
+ @UnsupportedAppUsage
+ public ImsCallSessionImplBase() {
+ }
+
@Override
// convert to old implementation of listener
public final void setListener(IImsCallSessionListener listener)
diff --git a/telephony/java/android/telephony/ims/compat/stub/ImsUtListenerImplBase.java b/telephony/java/android/telephony/ims/compat/stub/ImsUtListenerImplBase.java
index 976c2be1a3fe..e2024742c058 100644
--- a/telephony/java/android/telephony/ims/compat/stub/ImsUtListenerImplBase.java
+++ b/telephony/java/android/telephony/ims/compat/stub/ImsUtListenerImplBase.java
@@ -16,14 +16,14 @@
package android.telephony.ims.compat.stub;
+import android.annotation.UnsupportedAppUsage;
import android.os.Bundle;
import android.os.RemoteException;
-
-import android.annotation.UnsupportedAppUsage;
import android.telephony.ims.ImsCallForwardInfo;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsSsData;
import android.telephony.ims.ImsSsInfo;
+
import com.android.ims.internal.IImsUt;
import com.android.ims.internal.IImsUtListener;
@@ -40,6 +40,10 @@ import com.android.ims.internal.IImsUtListener;
public class ImsUtListenerImplBase extends IImsUtListener.Stub {
+ @UnsupportedAppUsage
+ public ImsUtListenerImplBase() {
+ }
+
/**
* Notifies the result of the supplementary service configuration udpate.
*/
@@ -65,6 +69,13 @@ public class ImsUtListenerImplBase extends IImsUtListener.Stub {
}
/**
+ * Notifies the result of a line identification supplementary service query.
+ */
+ @Override
+ public void lineIdentificationSupplementaryServiceResponse(int id, ImsSsInfo config) {
+ }
+
+ /**
* Notifies the status of the call barring supplementary service.
*/
@Override
diff --git a/telephony/java/android/telephony/ims/feature/MmTelFeature.java b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
index ceb470491dc5..8b27b6fc4bfd 100644
--- a/telephony/java/android/telephony/ims/feature/MmTelFeature.java
+++ b/telephony/java/android/telephony/ims/feature/MmTelFeature.java
@@ -362,6 +362,25 @@ public class MmTelFeature extends ImsFeature {
@Retention(RetentionPolicy.SOURCE)
public @interface ProcessCallResult {}
+ /**
+ * If the flag is present and true, it indicates that the incoming call is for USSD.
+ * <p>
+ * This is an optional boolean flag.
+ */
+ public static final String EXTRA_IS_USSD = "android.telephony.ims.feature.extra.IS_USSD";
+
+ /**
+ * If this flag is present and true, this call is marked as an unknown dialing call instead
+ * of an incoming call. An example of such a call is a call that is originated by sending
+ * commands (like AT commands) directly to the modem without Android involvement or dialing
+ * calls appearing over IMS when the modem does a silent redial from circuit-switched to IMS in
+ * certain situations.
+ * <p>
+ * This is an optional boolean flag.
+ */
+ public static final String EXTRA_IS_UNKNOWN_CALL =
+ "android.telephony.ims.feature.extra.IS_UNKNOWN_CALL";
+
private IImsMmTelListener mListener;
/**
@@ -410,6 +429,8 @@ public class MmTelFeature extends ImsFeature {
/**
* Notify the framework of an incoming call.
* @param c The {@link ImsCallSessionImplBase} of the new incoming call.
+ * @param extras A bundle containing extra parameters related to the call. See
+ * {@link #EXTRA_IS_UNKNOWN_CALL} and {@link #EXTRA_IS_USSD} above.
*/
public final void notifyIncomingCall(@NonNull ImsCallSessionImplBase c,
@NonNull Bundle extras) {
diff --git a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
index a08e0313bb5b..b455c2eff803 100644
--- a/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsRegistrationImplBase.java
@@ -22,6 +22,7 @@ import android.net.Uri;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.telephony.ims.ImsReasonInfo;
+import android.telephony.ims.RegistrationManager;
import android.telephony.ims.aidl.IImsRegistration;
import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.util.Log;
@@ -72,9 +73,6 @@ public class ImsRegistrationImplBase {
// with NOT_REGISTERED in the case where the ImsService has not updated the registration state
// yet.
private static final int REGISTRATION_STATE_UNKNOWN = -1;
- private static final int REGISTRATION_STATE_NOT_REGISTERED = 0;
- private static final int REGISTRATION_STATE_REGISTERING = 1;
- private static final int REGISTRATION_STATE_REGISTERED = 2;
private final IImsRegistration mBinder = new IImsRegistration.Stub() {
@@ -128,7 +126,7 @@ public class ImsRegistrationImplBase {
* {@link #REGISTRATION_TECH_LTE} and {@link #REGISTRATION_TECH_IWLAN}.
*/
public final void onRegistered(@ImsRegistrationTech int imsRadioTech) {
- updateToState(imsRadioTech, REGISTRATION_STATE_REGISTERED);
+ updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERED);
mCallbacks.broadcast((c) -> {
try {
c.onRegistered(imsRadioTech);
@@ -146,7 +144,7 @@ public class ImsRegistrationImplBase {
* {@link #REGISTRATION_TECH_LTE} and {@link #REGISTRATION_TECH_IWLAN}.
*/
public final void onRegistering(@ImsRegistrationTech int imsRadioTech) {
- updateToState(imsRadioTech, REGISTRATION_STATE_REGISTERING);
+ updateToState(imsRadioTech, RegistrationManager.REGISTRATION_STATE_REGISTERING);
mCallbacks.broadcast((c) -> {
try {
c.onRegistering(imsRadioTech);
@@ -230,7 +228,8 @@ public class ImsRegistrationImplBase {
private void updateToDisconnectedState(ImsReasonInfo info) {
synchronized (mLock) {
- updateToState(REGISTRATION_TECH_NONE, REGISTRATION_STATE_NOT_REGISTERED);
+ updateToState(REGISTRATION_TECH_NONE,
+ RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
if (info != null) {
mLastDisconnectCause = info;
} else {
@@ -264,15 +263,15 @@ public class ImsRegistrationImplBase {
disconnectInfo = mLastDisconnectCause;
}
switch (state) {
- case REGISTRATION_STATE_NOT_REGISTERED: {
+ case RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED: {
c.onDeregistered(disconnectInfo);
break;
}
- case REGISTRATION_STATE_REGISTERING: {
+ case RegistrationManager.REGISTRATION_STATE_REGISTERING: {
c.onRegistering(getConnectionType());
break;
}
- case REGISTRATION_STATE_REGISTERED: {
+ case RegistrationManager.REGISTRATION_STATE_REGISTERED: {
c.onRegistered(getConnectionType());
break;
}
diff --git a/telephony/java/com/android/ims/ImsUtInterface.java b/telephony/java/com/android/ims/ImsUtInterface.java
index c9d440551631..e80087d8924e 100644
--- a/telephony/java/com/android/ims/ImsUtInterface.java
+++ b/telephony/java/com/android/ims/ImsUtInterface.java
@@ -21,6 +21,8 @@ import android.os.Message;
import android.telephony.ims.ImsCallForwardInfo;
import android.telephony.ims.ImsSsInfo;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* Provides APIs for the supplementary service settings using IMS (Ut interface).
* It is created from 3GPP TS 24.623 (XCAP(XML Configuration Access Protocol)
@@ -121,6 +123,7 @@ public interface ImsUtInterface {
* Retrieves the configuration of the call forward.
* The return value of ((AsyncResult)result.obj) is an array of {@link ImsCallForwardInfo}.
*/
+ @UnsupportedAppUsage
public void queryCallForward(int condition, String number, Message result);
/**
diff --git a/telephony/java/com/android/ims/internal/IImsUtListener.aidl b/telephony/java/com/android/ims/internal/IImsUtListener.aidl
index fcb9fb1f8773..9a12ceee5212 100644
--- a/telephony/java/com/android/ims/internal/IImsUtListener.aidl
+++ b/telephony/java/com/android/ims/internal/IImsUtListener.aidl
@@ -44,6 +44,7 @@ oneway interface IImsUtListener {
@UnsupportedAppUsage
void utConfigurationQueryFailed(in IImsUt ut, int id, in ImsReasonInfo error);
+ void lineIdentificationSupplementaryServiceResponse(int id, in ImsSsInfo config);
/**
* Notifies the status of the call barring supplementary service.
*/
diff --git a/telephony/java/com/android/internal/telephony/DctConstants.java b/telephony/java/com/android/internal/telephony/DctConstants.java
index cde6db4888fa..e1113eba006f 100644
--- a/telephony/java/com/android/internal/telephony/DctConstants.java
+++ b/telephony/java/com/android/internal/telephony/DctConstants.java
@@ -17,6 +17,8 @@ package com.android.internal.telephony;
import com.android.internal.util.Protocol;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* @hide
*/
@@ -37,20 +39,34 @@ public class DctConstants {
* RETRYING or CONNECTING: CONNECTING
* CONNECTED : CONNECTED or DISCONNECTING
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/telephony/DctConstants$State;")
public enum State {
+ @UnsupportedAppUsage
IDLE,
+ @UnsupportedAppUsage
CONNECTING,
+ @UnsupportedAppUsage
RETRYING,
+ @UnsupportedAppUsage
CONNECTED,
+ @UnsupportedAppUsage
DISCONNECTING,
+ @UnsupportedAppUsage
FAILED,
}
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/telephony/DctConstants$Activity;")
public enum Activity {
NONE,
+ @UnsupportedAppUsage
DATAIN,
+ @UnsupportedAppUsage
DATAOUT,
+ @UnsupportedAppUsage
DATAINANDOUT,
+ @UnsupportedAppUsage
DORMANT
}
diff --git a/telephony/java/com/android/internal/telephony/GsmAlphabet.java b/telephony/java/com/android/internal/telephony/GsmAlphabet.java
index a75096f2c082..79d366037f08 100644
--- a/telephony/java/com/android/internal/telephony/GsmAlphabet.java
+++ b/telephony/java/com/android/internal/telephony/GsmAlphabet.java
@@ -16,19 +16,17 @@
package com.android.internal.telephony;
+import android.annotation.UnsupportedAppUsage;
import android.content.res.Resources;
+import android.os.Build;
+import android.telephony.Rlog;
import android.text.TextUtils;
import android.util.SparseIntArray;
-import android.annotation.UnsupportedAppUsage;
-import android.os.Build;
-import android.telephony.Rlog;
+import com.android.internal.R;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
-import com.android.internal.telephony.SmsConstants;
-import com.android.internal.R;
-
import java.util.ArrayList;
import java.util.List;
@@ -42,8 +40,6 @@ import java.util.List;
public class GsmAlphabet {
private static final String TAG = "GSM";
- private GsmAlphabet() { }
-
/**
* This escapes extended characters, and when present indicates that the
* following character should be looked up in the "extended" table.
@@ -83,6 +79,11 @@ public class GsmAlphabet {
* data.
*/
public static class TextEncodingDetails {
+
+ @UnsupportedAppUsage
+ public TextEncodingDetails() {
+ }
+
/**
*The number of SMS's required to encode the text.
*/
diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl
index 7441c26a8061..c1d700a2d190 100644
--- a/telephony/java/com/android/internal/telephony/ISms.aidl
+++ b/telephony/java/com/android/internal/telephony/ISms.aidl
@@ -586,4 +586,23 @@ interface ISms {
* @param destAddress the destination address to test for possible short code
*/
int checkSmsShortCodeDestination(int subId, String callingApk, String destAddress, String countryIso);
+
+ /**
+ * Gets the SMSC address from (U)SIM.
+ *
+ * @param subId the subscription Id.
+ * @param callingPackage the package name of the calling app.
+ * @return the SMSC address string, null if failed.
+ */
+ String getSmscAddressFromIccEfForSubscriber(int subId, String callingPackage);
+
+ /**
+ * Sets the SMSC address on (U)SIM.
+ *
+ * @param smsc the SMSC address string.
+ * @param subId the subscription Id.
+ * @param callingPackage the package name of the calling app.
+ * @return true for success, false otherwise.
+ */
+ boolean setSmscAddressOnIccEfForSubscriber(String smsc, int subId, String callingPackage);
}
diff --git a/telephony/java/com/android/internal/telephony/ISmsImplBase.java b/telephony/java/com/android/internal/telephony/ISmsImplBase.java
index aa1f94f2355a..ff816f24667e 100644
--- a/telephony/java/com/android/internal/telephony/ISmsImplBase.java
+++ b/telephony/java/com/android/internal/telephony/ISmsImplBase.java
@@ -208,4 +208,15 @@ public class ISmsImplBase extends ISms.Stub {
int subid, String callingApk, String destAddress, String countryIso) {
throw new UnsupportedOperationException();
}
+
+ @Override
+ public String getSmscAddressFromIccEfForSubscriber(int subId, String callingPackage) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean setSmscAddressOnIccEfForSubscriber(
+ String smsc, int subId, String callingPackage) {
+ throw new UnsupportedOperationException();
+ }
}
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index d899a596c222..39a216d468b9 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -319,6 +319,7 @@ interface ITelephony {
/**
* Replaced by getDataActivityForSubId.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
int getDataActivity();
/**
@@ -336,6 +337,7 @@ interface ITelephony {
/**
* Replaced by getDataStateForSubId.
*/
+ @UnsupportedAppUsage(maxTargetSdk = 28)
int getDataState();
/**
@@ -864,6 +866,11 @@ interface ITelephony {
String getImsService(int slotId, boolean isCarrierImsService);
/**
+ * Get the MmTelFeature state attached to this subscription id.
+ */
+ void getImsMmTelFeatureState(int subId, IIntegerConsumer callback);
+
+ /**
* Set the network selection mode to automatic.
*
* @param subId the id of the subscription to update.
@@ -1304,6 +1311,12 @@ interface ITelephony {
int getSubIdForPhoneAccount(in PhoneAccount phoneAccount);
/**
+ * Returns the subscription ID associated with the specified PhoneAccountHandle.
+ */
+ int getSubIdForPhoneAccountHandle(in PhoneAccountHandle phoneAccountHandle,
+ String callingPackage);
+
+ /**
* Returns the PhoneAccountHandle associated with a subscription ID.
*/
PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId);
@@ -1774,21 +1787,6 @@ interface ITelephony {
boolean isInEmergencySmsMode();
/**
- * Get a list of SMS apps on a user.
- */
- String[] getSmsApps(int userId);
-
- /**
- * Get the default SMS app on a given user.
- */
- String getDefaultSmsApp(int userId);
-
- /**
- * Set the default SMS app to a given package on a given user.
- */
- void setDefaultSmsApp(int userId, String packageName);
-
- /**
* Return the modem radio power state for slot index.
*
*/
@@ -1806,6 +1804,16 @@ interface ITelephony {
void unregisterImsRegistrationCallback(int subId, IImsRegistrationCallback c);
/**
+ * Get the IMS service registration state for the MmTelFeature associated with this sub id.
+ */
+ void getImsMmTelRegistrationState(int subId, IIntegerConsumer consumer);
+
+ /**
+ * Get the transport type for the IMS service registration state.
+ */
+ void getImsMmTelRegistrationTransportType(int subId, IIntegerConsumer consumer);
+
+ /**
* Adds an IMS MmTel capabilities callback for the subscription specified.
*/
void registerMmTelCapabilityCallback(int subId, IImsCapabilityCallback c);
@@ -1826,6 +1834,12 @@ interface ITelephony {
boolean isAvailable(int subId, int capability, int regTech);
/**
+ * Return whether or not the MmTel capability is supported for the requested transport type.
+ */
+ void isMmTelCapabilitySupported(int subId, IIntegerConsumer callback, int capability,
+ int transportType);
+
+ /**
* Returns true if the user's setting for 4G LTE is enabled, for the subscription specified.
*/
boolean isAdvancedCallingSettingEnabled(int subId);
diff --git a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
index a20c49455888..d7a7af1d530f 100644
--- a/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephonyRegistry.aidl
@@ -43,14 +43,16 @@ interface ITelephonyRegistry {
void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events,
boolean notifyNow);
@UnsupportedAppUsage
- void notifyCallState(int state, String incomingNumber);
- void notifyCallStateForPhoneId(in int phoneId, in int subId, int state, String incomingNumber);
+ void notifyCallStateForAllSubs(int state, String incomingNumber);
+ void notifyCallState(in int phoneId, in int subId, int state, String incomingNumber);
void notifyServiceStateForPhoneId(in int phoneId, in int subId, in ServiceState state);
void notifySignalStrengthForPhoneId(in int phoneId, in int subId,
in SignalStrength signalStrength);
void notifyMessageWaitingChangedForPhoneId(in int phoneId, in int subId, in boolean mwi);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyCallForwardingChanged(boolean cfi);
void notifyCallForwardingChangedForSubscriber(in int subId, boolean cfi);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyDataActivity(int state);
void notifyDataActivityForSubscriber(in int subId, int state);
void notifyDataConnection(int state, boolean isDataConnectivityPossible,
@@ -63,8 +65,10 @@ interface ITelephonyRegistry {
@UnsupportedAppUsage
void notifyDataConnectionFailed(String apnType);
void notifyDataConnectionFailedForSubscriber(int phoneId, int subId, String apnType);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyCellLocation(in Bundle cellLocation);
void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
+ @UnsupportedAppUsage(maxTargetSdk = 28)
void notifyOtaspChanged(in int subId, in int otaspMode);
@UnsupportedAppUsage
void notifyCellInfo(in List<CellInfo> cellInfo);
diff --git a/telephony/java/com/android/internal/telephony/IccCardConstants.java b/telephony/java/com/android/internal/telephony/IccCardConstants.java
index d57f9afa01e9..6ff27b1152c8 100644
--- a/telephony/java/com/android/internal/telephony/IccCardConstants.java
+++ b/telephony/java/com/android/internal/telephony/IccCardConstants.java
@@ -17,6 +17,8 @@ package com.android.internal.telephony;
import android.telephony.TelephonyManager;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* {@hide}
*/
@@ -65,15 +67,26 @@ public class IccCardConstants {
*
* The ordinal values much match {@link TelephonyManager#SIM_STATE_UNKNOWN} ...
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/telephony/IccCardConstants$State;")
public enum State {
+ @UnsupportedAppUsage
UNKNOWN, /** ordinal(0) == {@See TelephonyManager#SIM_STATE_UNKNOWN} */
+ @UnsupportedAppUsage
ABSENT, /** ordinal(1) == {@See TelephonyManager#SIM_STATE_ABSENT} */
+ @UnsupportedAppUsage
PIN_REQUIRED, /** ordinal(2) == {@See TelephonyManager#SIM_STATE_PIN_REQUIRED} */
+ @UnsupportedAppUsage
PUK_REQUIRED, /** ordinal(3) == {@See TelephonyManager#SIM_STATE_PUK_REQUIRED} */
+ @UnsupportedAppUsage
NETWORK_LOCKED, /** ordinal(4) == {@See TelephonyManager#SIM_STATE_NETWORK_LOCKED} */
+ @UnsupportedAppUsage
READY, /** ordinal(5) == {@See TelephonyManager#SIM_STATE_READY} */
+ @UnsupportedAppUsage
NOT_READY, /** ordinal(6) == {@See TelephonyManager#SIM_STATE_NOT_READY} */
+ @UnsupportedAppUsage
PERM_DISABLED, /** ordinal(7) == {@See TelephonyManager#SIM_STATE_PERM_DISABLED} */
+ @UnsupportedAppUsage
CARD_IO_ERROR, /** ordinal(8) == {@See TelephonyManager#SIM_STATE_CARD_IO_ERROR} */
CARD_RESTRICTED,/** ordinal(9) == {@See TelephonyManager#SIM_STATE_CARD_RESTRICTED} */
LOADED; /** ordinal(9) == {@See TelephonyManager#SIM_STATE_LOADED} */
diff --git a/telephony/java/com/android/internal/telephony/PhoneConstants.java b/telephony/java/com/android/internal/telephony/PhoneConstants.java
index f8621c95d0b0..e4397cdf1254 100644
--- a/telephony/java/com/android/internal/telephony/PhoneConstants.java
+++ b/telephony/java/com/android/internal/telephony/PhoneConstants.java
@@ -15,6 +15,8 @@
*/
package com.android.internal.telephony;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* @hide
*/
@@ -31,8 +33,15 @@ public class PhoneConstants {
* ringing or waiting.</li>
* </ul>
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/telephony/PhoneConstants$State;")
public enum State {
- IDLE, RINGING, OFFHOOK;
+ @UnsupportedAppUsage
+ IDLE,
+ @UnsupportedAppUsage
+ RINGING,
+ @UnsupportedAppUsage
+ OFFHOOK;
};
/**
@@ -46,8 +55,17 @@ public class PhoneConstants {
* in 2G network</li>
* </ul>
*/
+ @UnsupportedAppUsage(implicitMember =
+ "values()[Lcom/android/internal/telephony/PhoneConstants$DataState;")
public enum DataState {
- CONNECTED, CONNECTING, DISCONNECTED, SUSPENDED;
+ @UnsupportedAppUsage
+ CONNECTED,
+ @UnsupportedAppUsage
+ CONNECTING,
+ @UnsupportedAppUsage
+ DISCONNECTED,
+ @UnsupportedAppUsage
+ SUSPENDED;
};
public static final String STATE_KEY = "state";
@@ -69,15 +87,15 @@ public class PhoneConstants {
public static final int LTE_ON_CDMA_TRUE = RILConstants.LTE_ON_CDMA_TRUE;
// Number presentation type for caller id display (From internal/Connection.java)
+ @UnsupportedAppUsage
public static final int PRESENTATION_ALLOWED = 1; // normal
+ @UnsupportedAppUsage
public static final int PRESENTATION_RESTRICTED = 2; // block by user
+ @UnsupportedAppUsage
public static final int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network
+ @UnsupportedAppUsage
public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info
- // Sim activation type
- public static final int SIM_ACTIVATION_TYPE_VOICE = 0;
- public static final int SIM_ACTIVATION_TYPE_DATA = 1;
-
public static final String PHONE_NAME_KEY = "phoneName";
public static final String DATA_NETWORK_TYPE_KEY = "networkType";
public static final String DATA_FAILURE_CAUSE_KEY = "failCause";
diff --git a/telephony/java/com/android/internal/telephony/RILConstants.java b/telephony/java/com/android/internal/telephony/RILConstants.java
index 5205973669ac..03ea9208d064 100644
--- a/telephony/java/com/android/internal/telephony/RILConstants.java
+++ b/telephony/java/com/android/internal/telephony/RILConstants.java
@@ -18,6 +18,8 @@ package com.android.internal.telephony;
import android.telephony.TelephonyManager;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* {@hide}
*/
@@ -230,6 +232,7 @@ public interface RILConstants {
/** NR 5G, LTE, TD-SCDMA, CDMA, EVDO, GSM and WCDMA */
int NETWORK_MODE_NR_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 33;
+ @UnsupportedAppUsage
int PREFERRED_NETWORK_MODE = Integer.parseInt(TelephonyManager.getTelephonyProperty(0,
"ro.telephony.default_network", Integer.toString(NETWORK_MODE_WCDMA_PREF)));
diff --git a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
index 49c737fc3440..2cdf2f63e02f 100644
--- a/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
+++ b/telephony/java/com/android/internal/telephony/Sms7BitEncodingTranslator.java
@@ -16,27 +16,28 @@
package com.android.internal.telephony;
-import android.telephony.Rlog;
-import android.os.Build;
-import android.util.SparseIntArray;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
-import android.telephony.SmsManager;
-import android.telephony.TelephonyManager;
+import android.os.Build;
+import android.telephony.Rlog;
+import android.util.SparseIntArray;
-import com.android.internal.util.XmlUtils;
import com.android.internal.telephony.cdma.sms.UserData;
+import com.android.internal.util.XmlUtils;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
+import dalvik.annotation.compat.UnsupportedAppUsage;
public class Sms7BitEncodingTranslator {
private static final String TAG = "Sms7BitEncodingTranslator";
+ @UnsupportedAppUsage
private static final boolean DBG = Build.IS_DEBUGGABLE ;
private static boolean mIs7BitTranslationTableLoaded = false;
private static SparseIntArray mTranslationTable = null;
+ @UnsupportedAppUsage
private static SparseIntArray mTranslationTableCommon = null;
+ @UnsupportedAppUsage
private static SparseIntArray mTranslationTableGSM = null;
+ @UnsupportedAppUsage
private static SparseIntArray mTranslationTableCDMA = null;
// Parser variables
diff --git a/telephony/java/com/android/internal/telephony/SmsHeader.java b/telephony/java/com/android/internal/telephony/SmsHeader.java
index 9fe1718df6b6..dd77b0179487 100644
--- a/telephony/java/com/android/internal/telephony/SmsHeader.java
+++ b/telephony/java/com/android/internal/telephony/SmsHeader.java
@@ -16,13 +16,12 @@
package com.android.internal.telephony;
-import com.android.internal.telephony.SmsConstants;
+import android.annotation.UnsupportedAppUsage;
+
import com.android.internal.util.HexDump;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-
-import android.annotation.UnsupportedAppUsage;
import java.util.ArrayList;
/**
@@ -74,6 +73,10 @@ public class SmsHeader {
public static class PortAddrs {
@UnsupportedAppUsage
+ public PortAddrs() {
+ }
+
+ @UnsupportedAppUsage
public int destPort;
@UnsupportedAppUsage
public int origPort;
@@ -82,6 +85,10 @@ public class SmsHeader {
public static class ConcatRef {
@UnsupportedAppUsage
+ public ConcatRef() {
+ }
+
+ @UnsupportedAppUsage
public int refNumber;
@UnsupportedAppUsage
public int seqNumber;
diff --git a/telephony/java/com/android/internal/telephony/SmsMessageBase.java b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
index ffdc4b676f90..d29ef3560883 100644
--- a/telephony/java/com/android/internal/telephony/SmsMessageBase.java
+++ b/telephony/java/com/android/internal/telephony/SmsMessageBase.java
@@ -16,23 +16,27 @@
package com.android.internal.telephony;
-import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
-import com.android.internal.telephony.SmsConstants;
-import com.android.internal.telephony.SmsHeader;
-import java.text.BreakIterator;
-import java.util.Arrays;
-
import android.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.provider.Telephony;
import android.telephony.SmsMessage;
import android.text.Emoji;
+import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
+
+import java.text.BreakIterator;
+import java.util.Arrays;
+
/**
* Base class declaring the specific methods and members for SmsMessage.
* {@hide}
*/
public abstract class SmsMessageBase {
+
+ @UnsupportedAppUsage
+ public SmsMessageBase() {
+ }
+
/** {@hide} The address of the SMSC. May be null */
@UnsupportedAppUsage
protected String mScAddress;
diff --git a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
index 67103bfddce1..8a852eea5610 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
@@ -237,9 +237,10 @@ public final class TelephonyPermissions {
* <ul>
* <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
* package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
- * access check, or the calling package has carrier privileges.
- * <li>throw SecurityException: if the caller does not meet any of the requirements and is
- * targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission.
+ * access check, or the calling package has carrier privileges on any active subscription.
+ * <li>throw SecurityException: if the caller does not meet any of the requirements and is
+ * targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission
+ * or carrier privileges of any active subscription.
* <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE
* permission. In this case the caller would expect to have access to the device
* identifiers so false is returned instead of throwing a SecurityException to indicate
@@ -259,10 +260,10 @@ public final class TelephonyPermissions {
* <ul>
* <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
* package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
- * access check, or the calling package has carrier privileges.
+ * access check, or the calling package has carrier privileges on any active subscription.
* <li>throw SecurityException: if the caller does not meet any of the requirements and is
* targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission
- * or carrier privileges.
+ * or carrier privileges of any active subscription.
* <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE
* permission or carrier privileges. In this case the caller would expect to have access
* to the device identifiers so false is returned instead of throwing a SecurityException
@@ -271,8 +272,8 @@ public final class TelephonyPermissions {
*/
public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, int subId,
String callingPackage, String message) {
- return checkReadDeviceIdentifiers(context, TELEPHONY_SUPPLIER, subId,
- Binder.getCallingPid(), Binder.getCallingUid(), callingPackage, message);
+ return checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
+ context, subId, callingPackage, message, true);
}
/**
@@ -282,7 +283,7 @@ public final class TelephonyPermissions {
* <ul>
* <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
* package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
- * access check, or the calling package has carrier privileges.
+ * access check, or the calling package has carrier privileges on specified subscription.
* <li>throw SecurityException: if the caller does not meet any of the requirements and is
* targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission.
* <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE
@@ -293,21 +294,33 @@ public final class TelephonyPermissions {
*/
public static boolean checkCallingOrSelfReadSubscriberIdentifiers(Context context, int subId,
String callingPackage, String message) {
- return checkReadDeviceIdentifiers(context, TELEPHONY_SUPPLIER, subId,
- Binder.getCallingPid(), Binder.getCallingUid(), callingPackage, message);
+ return checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
+ context, subId, callingPackage, message, false);
}
/**
* Checks whether the app with the given pid/uid can read device identifiers.
*
- * @returns true if the caller has the READ_PRIVILEGED_PHONE_STATE permission or the calling
- * package passes a DevicePolicyManager Device Owner / Profile Owner device identifier access
- * check.
+ * <p>This method behaves in one of the following ways:
+ * <ul>
+ * <li>return true: if the caller has the READ_PRIVILEGED_PHONE_STATE permission, the calling
+ * package passes a DevicePolicyManager Device Owner / Profile Owner device identifier
+ * access check; or the calling package has carrier privileges on the specified
+ * subscription; or allowCarrierPrivilegeOnAnySub is true and has carrier privilege on
+ * any active subscription.
+ * <li>throw SecurityException: if the caller does not meet any of the requirements and is
+ * targeting Q or is targeting pre-Q and does not have the READ_PHONE_STATE permission.
+ * <li>return false: if the caller is targeting pre-Q and does have the READ_PHONE_STATE
+ * permission. In this case the caller would expect to have access to the device
+ * identifiers so false is returned instead of throwing a SecurityException to indicate
+ * the calling function should return dummy data.
+ * </ul>
*/
- @VisibleForTesting
- public static boolean checkReadDeviceIdentifiers(Context context,
- Supplier<ITelephony> telephonySupplier, int subId, int pid, int uid,
- String callingPackage, String message) {
+ private static boolean checkPrivilegedReadPermissionOrCarrierPrivilegePermission(
+ Context context, int subId, String callingPackage, String message,
+ boolean allowCarrierPrivilegeOnAnySub) {
+ int uid = Binder.getCallingUid();
+ int pid = Binder.getCallingPid();
// Allow system and root access to the device identifiers.
final int appId = UserHandle.getAppId(uid);
if (appId == Process.SYSTEM_UID || appId == Process.ROOT_UID) {
@@ -318,10 +331,17 @@ public final class TelephonyPermissions {
uid) == PackageManager.PERMISSION_GRANTED) {
return true;
}
- // If the calling package has carrier privileges for any subscription then allow access.
- if (checkCarrierPrivilegeForAnySubId(context, telephonySupplier, uid)) {
+
+ // If the calling package has carrier privileges for specified sub, then allow access.
+ if (checkCarrierPrivilegeForSubId(subId)) return true;
+
+ // If the calling package has carrier privileges for any subscription
+ // and allowCarrierPrivilegeOnAnySub is set true, then allow access.
+ if (allowCarrierPrivilegeOnAnySub && checkCarrierPrivilegeForAnySubId(
+ context, TELEPHONY_SUPPLIER, uid)) {
return true;
}
+
// if the calling package is not null then perform the DevicePolicyManager device /
// profile owner and Appop checks.
if (callingPackage != null) {
@@ -347,7 +367,7 @@ public final class TelephonyPermissions {
}
}
return reportAccessDeniedToReadIdentifiers(context, subId, pid, uid, callingPackage,
- message);
+ message);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/TelephonyProperties.java b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
index bf5c0a18cc96..4e42c20d28db 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyProperties.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyProperties.java
@@ -16,6 +16,8 @@
package com.android.internal.telephony;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
/**
* Contains a list of string constants used to get or set telephone properties
* in the system. You can use {@link android.os.SystemProperties os.SystemProperties}
@@ -101,6 +103,7 @@ public interface TelephonyProperties
* provider of the SIM. 5 or 6 decimal digits.
* Availability: SIM state must be "READY"
*/
+ @UnsupportedAppUsage
static String PROPERTY_ICC_OPERATOR_NUMERIC = "gsm.sim.operator.numeric";
/** PROPERTY_ICC_OPERATOR_ALPHA is also known as the SPN, or Service Provider Name.
diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
index ebc98d61547e..b357fa43008f 100644
--- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java
@@ -19,17 +19,17 @@ package com.android.internal.telephony.cdma;
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_OPERATOR_IDP_STRING;
import android.content.res.Resources;
-import android.os.Parcel;
import android.os.SystemProperties;
import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.telephony.SmsCbLocation;
import android.telephony.SmsCbMessage;
import android.telephony.cdma.CdmaSmsCbProgramData;
-import android.telephony.Rlog;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
+import com.android.internal.telephony.Sms7BitEncodingTranslator;
import com.android.internal.telephony.SmsAddress;
import com.android.internal.telephony.SmsConstants;
import com.android.internal.telephony.SmsHeader;
@@ -43,7 +43,8 @@ import com.android.internal.telephony.cdma.sms.UserData;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.util.BitwiseInputStream;
import com.android.internal.util.HexDump;
-import com.android.internal.telephony.Sms7BitEncodingTranslator;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -109,7 +110,9 @@ public class SmsMessage extends SmsMessageBase {
private static final int PRIORITY_URGENT = 0x2;
private static final int PRIORITY_EMERGENCY = 0x3;
+ @UnsupportedAppUsage
private SmsEnvelope mEnvelope;
+ @UnsupportedAppUsage
private BearerData mBearerData;
/** @hide */
@@ -119,15 +122,20 @@ public class SmsMessage extends SmsMessageBase {
createPdu();
}
+ @UnsupportedAppUsage
public SmsMessage() {}
public static class SubmitPdu extends SubmitPduBase {
+ @UnsupportedAppUsage
+ public SubmitPdu() {
+ }
}
/**
* Create an SmsMessage from a raw PDU.
* Note: In CDMA the PDU is just a byte representation of the received Sms.
*/
+ @UnsupportedAppUsage
public static SmsMessage createFromPdu(byte[] pdu) {
SmsMessage msg = new SmsMessage();
@@ -153,6 +161,7 @@ public class SmsMessage extends SmsMessageBase {
*
* @hide
*/
+ @UnsupportedAppUsage
public static SmsMessage createFromEfRecord(int index, byte[] data) {
try {
SmsMessage msg = new SmsMessage();
@@ -219,6 +228,7 @@ public class SmsMessage extends SmsMessageBase {
* Returns null on encode error.
* @hide
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddr, String destAddr, String message,
boolean statusReportRequested, SmsHeader smsHeader) {
return getSubmitPdu(scAddr, destAddr, message, statusReportRequested, smsHeader, -1);
@@ -239,6 +249,7 @@ public class SmsMessage extends SmsMessageBase {
* Returns null on encode error.
* @hide
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddr, String destAddr, String message,
boolean statusReportRequested, SmsHeader smsHeader, int priority) {
@@ -269,6 +280,7 @@ public class SmsMessage extends SmsMessageBase {
* address, if applicable, and the encoded message.
* Returns null on encode error.
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddr, String destAddr, int destPort,
byte[] data, boolean statusReportRequested) {
@@ -306,6 +318,7 @@ public class SmsMessage extends SmsMessageBase {
* address, if applicable, and the encoded message.
* Returns null on encode error.
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String destAddr, UserData userData,
boolean statusReportRequested) {
return privateGetSubmitPdu(destAddr, statusReportRequested, userData);
@@ -322,6 +335,7 @@ public class SmsMessage extends SmsMessageBase {
* address, if applicable, and the encoded message.
* Returns null on encode error.
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String destAddr, UserData userData,
boolean statusReportRequested, int priority) {
return privateGetSubmitPdu(destAddr, statusReportRequested, userData, priority);
@@ -393,6 +407,7 @@ public class SmsMessage extends SmsMessageBase {
}
/** Return true iff the bearer data message type is DELIVERY_ACK. */
+ @UnsupportedAppUsage
@Override
public boolean isStatusReportMessage() {
return (mBearerData.messageType == BearerData.MESSAGE_TYPE_DELIVERY_ACK);
@@ -415,6 +430,7 @@ public class SmsMessage extends SmsMessageBase {
* @param isEntireMsg indicates if this is entire msg or a segment in multipart msg
* @return TextEncodingDetails
*/
+ @UnsupportedAppUsage
public static TextEncodingDetails calculateLength(CharSequence messageBody,
boolean use7bitOnly, boolean isEntireMsg) {
CharSequence newMsgBody = null;
@@ -437,6 +453,7 @@ public class SmsMessage extends SmsMessageBase {
* {@link com.android.internal.telephony.cdma.sms.SmsEnvelope#TELESERVICE_VMN},
* {@link com.android.internal.telephony.cdma.sms.SmsEnvelope#TELESERVICE_WAP}
*/
+ @UnsupportedAppUsage
public int getTeleService() {
return mEnvelope.teleService;
}
@@ -448,6 +465,7 @@ public class SmsMessage extends SmsMessageBase {
* {@link com.android.internal.telephony.cdma.sms.SmsEnvelope#MESSAGE_TYPE_BROADCAST},
* {@link com.android.internal.telephony.cdma.sms.SmsEnvelope#MESSAGE_TYPE_ACKNOWLEDGE},
*/
+ @UnsupportedAppUsage
public int getMessageType() {
// NOTE: mEnvelope.messageType is not set correctly for cell broadcasts with some RILs.
// Use the service category parameter to detect CMAS and other cell broadcast messages.
@@ -763,6 +781,7 @@ public class SmsMessage extends SmsMessageBase {
/**
* Parses a SMS message from its BearerData stream.
*/
+ @UnsupportedAppUsage
public void parseSms() {
// Message Waiting Info Record defined in 3GPP2 C.S-0005, 3.7.5.6
// It contains only an 8-bit number with the number of messages waiting
@@ -859,8 +878,9 @@ public class SmsMessage extends SmsMessageBase {
* Parses a broadcast SMS, possibly containing a CMAS alert.
*
* @param plmn the PLMN for a broadcast SMS
+ * @param subId
*/
- public SmsCbMessage parseBroadcastSms(String plmn) {
+ public SmsCbMessage parseBroadcastSms(String plmn, int subId) {
BearerData bData = BearerData.decode(mEnvelope.bearerData, mEnvelope.serviceCategory);
if (bData == null) {
Rlog.w(LOG_TAG, "BearerData.decode() returned null");
@@ -876,7 +896,21 @@ public class SmsMessage extends SmsMessageBase {
return new SmsCbMessage(SmsCbMessage.MESSAGE_FORMAT_3GPP2,
SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE, bData.messageId, location,
mEnvelope.serviceCategory, bData.getLanguage(), bData.userData.payloadStr,
- bData.priority, null, bData.cmasWarningInfo);
+ bData.priority, null, bData.cmasWarningInfo, subId);
+ }
+
+ /**
+ * @return the bearer data byte array
+ */
+ public byte[] getEnvelopeBearerData() {
+ return mEnvelope.bearerData;
+ }
+
+ /**
+ * @return the 16-bit CDMA SCPT service category
+ */
+ public @CdmaSmsCbProgramData.Category int getEnvelopeServiceCategory() {
+ return mEnvelope.serviceCategory;
}
/**
@@ -899,6 +933,7 @@ public class SmsMessage extends SmsMessageBase {
* binder-call, and hence should be thread-safe, it has been
* synchronized.
*/
+ @UnsupportedAppUsage
public synchronized static int getNextMessageId() {
// Testing and dialog with partners has indicated that
// msgId==0 is (sometimes?) treated specially by lower levels.
@@ -923,6 +958,7 @@ public class SmsMessage extends SmsMessageBase {
* Creates BearerData and Envelope from parameters for a Submit SMS.
* @return byte stream for SubmitPdu.
*/
+ @UnsupportedAppUsage
private static SubmitPdu privateGetSubmitPdu(String destAddrStr, boolean statusReportRequested,
UserData userData) {
return privateGetSubmitPdu(destAddrStr, statusReportRequested, userData, -1);
@@ -1108,6 +1144,7 @@ public class SmsMessage extends SmsMessageBase {
/** This function shall be called to get the number of voicemails.
* @hide
*/
+ @UnsupportedAppUsage
public int getNumOfVoicemails() {
return mBearerData.numberOfMessages;
}
@@ -1119,6 +1156,7 @@ public class SmsMessage extends SmsMessageBase {
* @return byte array uniquely identifying the message.
* @hide
*/
+ @UnsupportedAppUsage
public byte[] getIncomingSmsFingerprint() {
ByteArrayOutputStream output = new ByteArrayOutputStream();
diff --git a/telephony/java/com/android/internal/telephony/cdma/UserData.java b/telephony/java/com/android/internal/telephony/cdma/UserData.java
index f87956098e5c..d960f05f3114 100644
--- a/telephony/java/com/android/internal/telephony/cdma/UserData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/UserData.java
@@ -21,8 +21,14 @@ import android.util.SparseIntArray;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.util.HexDump;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
public class UserData {
+ @UnsupportedAppUsage
+ public UserData() {
+ }
+
/**
* User data encoding types.
* (See 3GPP2 C.R1001-F, v1.0, table 9.1-1)
@@ -92,6 +98,7 @@ public class UserData {
public static final int PRINTABLE_ASCII_MIN_INDEX = 0x20;
public static final int ASCII_NL_INDEX = 0x0A;
public static final int ASCII_CR_INDEX = 0x0D;
+ @UnsupportedAppUsage
public static final SparseIntArray charToAscii = new SparseIntArray();
static {
for (int i = 0; i < ASCII_MAP.length; i++) {
@@ -131,12 +138,15 @@ public class UserData {
/**
* Contains the data header of the user data
*/
+ @UnsupportedAppUsage
public SmsHeader userDataHeader;
/**
* Contains the data encoding type for the SMS message
*/
+ @UnsupportedAppUsage
public int msgEncoding;
+ @UnsupportedAppUsage
public boolean msgEncodingSet = false;
public int msgType;
@@ -146,13 +156,16 @@ public class UserData {
*/
public int paddingBits;
+ @UnsupportedAppUsage
public int numFields;
/**
* Contains the user data of a SMS message
* (See 3GPP2 C.S0015-B, v2, 4.5.2)
*/
+ @UnsupportedAppUsage
public byte[] payload;
+ @UnsupportedAppUsage
public String payloadStr;
@Override
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
index dab14369d79c..e9378e7ba690 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/BearerData.java
@@ -17,10 +17,10 @@
package com.android.internal.telephony.cdma.sms;
import android.content.res.Resources;
+import android.telephony.Rlog;
import android.telephony.SmsCbCmasInfo;
import android.telephony.cdma.CdmaSmsCbProgramData;
import android.telephony.cdma.CdmaSmsCbProgramResults;
-import android.telephony.Rlog;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
@@ -31,6 +31,8 @@ import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.util.BitwiseInputStream;
import com.android.internal.util.BitwiseOutputStream;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
@@ -42,6 +44,10 @@ import java.util.ArrayList;
public final class BearerData {
private final static String LOG_TAG = "BearerData";
+ @UnsupportedAppUsage
+ public BearerData() {
+ }
+
/**
* Bearer Data Subparameter Identifiers
* (See 3GPP2 C.S0015-B, v2.0, table 4.5-1)
@@ -95,6 +101,7 @@ public final class BearerData {
* (Special rules apply for WAP-messages.)
* (See 3GPP2 C.S0015-B, v2, 4.5.1)
*/
+ @UnsupportedAppUsage
public int messageId;
/**
@@ -106,7 +113,9 @@ public final class BearerData {
public static final int PRIORITY_URGENT = 0x2;
public static final int PRIORITY_EMERGENCY = 0x3;
+ @UnsupportedAppUsage
public boolean priorityIndicatorSet = false;
+ @UnsupportedAppUsage
public int priority = PRIORITY_NORMAL;
/**
@@ -144,6 +153,7 @@ public final class BearerData {
public static final int DISPLAY_MODE_USER = 0x2;
public boolean displayModeSet = false;
+ @UnsupportedAppUsage
public int displayMode = DISPLAY_MODE_DEFAULT;
/**
@@ -207,6 +217,7 @@ public final class BearerData {
* presence of a UDH in the structured data, any existing setting
* will be overwritten.
*/
+ @UnsupportedAppUsage
public boolean hasUserDataHeader;
/**
@@ -214,6 +225,7 @@ public final class BearerData {
* (e.g. padding bits, user data, user data header, etc)
* (See 3GPP2 C.S.0015-B, v2, 4.5.2)
*/
+ @UnsupportedAppUsage
public UserData userData;
/**
@@ -244,6 +256,7 @@ public final class BearerData {
private ZoneId mZoneId;
+ @UnsupportedAppUsage
public TimeStamp() {
mZoneId = ZoneId.systemDefault(); // 3GPP2 timestamps use the local timezone
}
@@ -295,6 +308,7 @@ public final class BearerData {
}
}
+ @UnsupportedAppUsage
public TimeStamp msgCenterTimeStamp;
public TimeStamp validityPeriodAbsolute;
public TimeStamp deferredDeliveryTimeAbsolute;
@@ -383,6 +397,7 @@ public final class BearerData {
private static class CodingException extends Exception {
+ @UnsupportedAppUsage
public CodingException(String s) {
super(s);
}
@@ -476,6 +491,7 @@ public final class BearerData {
outStream.skip(3);
}
+ @UnsupportedAppUsage
private static int countAsciiSeptets(CharSequence msg, boolean force) {
int msgLen = msg.length();
if (force) return msgLen;
@@ -518,6 +534,7 @@ public final class BearerData {
return ted;
}
+ @UnsupportedAppUsage
private static byte[] encode7bitAscii(String msg, boolean force)
throws CodingException
{
@@ -949,6 +966,7 @@ public final class BearerData {
*
* @return byte array of raw encoded SMS bearer data.
*/
+ @UnsupportedAppUsage
public static byte[] encode(BearerData bData) {
bData.hasUserDataHeader = ((bData.userData != null) &&
(bData.userData.userDataHeader != null));
@@ -1200,6 +1218,7 @@ public final class BearerData {
}
}
+ @UnsupportedAppUsage
private static void decodeUserDataPayload(UserData userData, boolean hasUserDataHeader)
throws CodingException
{
@@ -1845,6 +1864,7 @@ public final class BearerData {
* @return the number of bits to read from the stream
* @throws CodingException if the specified encoding is not supported
*/
+ @UnsupportedAppUsage
private static int getBitsForNumFields(int msgEncoding, int numFields)
throws CodingException {
switch (msgEncoding) {
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java b/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
index d27a75815980..b268ee82529b 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/CdmaSmsAddress.java
@@ -20,9 +20,10 @@ import android.util.SparseBooleanArray;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.SmsAddress;
-import com.android.internal.telephony.cdma.sms.UserData;
import com.android.internal.util.HexDump;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
public class CdmaSmsAddress extends SmsAddress {
/**
@@ -33,6 +34,7 @@ public class CdmaSmsAddress extends SmsAddress {
static public final int DIGIT_MODE_4BIT_DTMF = 0x00;
static public final int DIGIT_MODE_8BIT_CHAR = 0x01;
+ @UnsupportedAppUsage
public int digitMode;
/**
@@ -43,6 +45,7 @@ public class CdmaSmsAddress extends SmsAddress {
static public final int NUMBER_MODE_NOT_DATA_NETWORK = 0x00;
static public final int NUMBER_MODE_DATA_NETWORK = 0x01;
+ @UnsupportedAppUsage
public int numberMode;
/**
@@ -70,6 +73,7 @@ public class CdmaSmsAddress extends SmsAddress {
* This field shall be set to the number of address digits
* (See 3GPP2 C.S0015-B, v2, 3.4.3.3)
*/
+ @UnsupportedAppUsage
public int numberOfDigits;
/**
@@ -83,6 +87,7 @@ public class CdmaSmsAddress extends SmsAddress {
//static protected final int NUMBERING_PLAN_TELEX = 0x4;
//static protected final int NUMBERING_PLAN_PRIVATE = 0x9;
+ @UnsupportedAppUsage
public int numberPlan;
/**
@@ -90,7 +95,7 @@ public class CdmaSmsAddress extends SmsAddress {
* are stored in the parent class address and origBytes fields,
* respectively.
*/
-
+ @UnsupportedAppUsage
public CdmaSmsAddress(){
}
@@ -194,6 +199,7 @@ public class CdmaSmsAddress extends SmsAddress {
* common punctuation. For alpha addresses, the string is cleaned
* up by removing whitespace.
*/
+ @UnsupportedAppUsage
public static CdmaSmsAddress parse(String address) {
CdmaSmsAddress addr = new CdmaSmsAddress();
addr.address = address;
diff --git a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
index 4a49fbf93af9..be1eab1d4523 100644
--- a/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
+++ b/telephony/java/com/android/internal/telephony/cdma/sms/SmsEnvelope.java
@@ -19,7 +19,7 @@ package com.android.internal.telephony.cdma.sms;
import android.telephony.cdma.CdmaSmsCbProgramData;
-import com.android.internal.telephony.cdma.sms.CdmaSmsSubaddress;
+import dalvik.annotation.compat.UnsupportedAppUsage;
public final class SmsEnvelope {
/**
@@ -58,17 +58,17 @@ public final class SmsEnvelope {
// CMAS alert service category assignments, see 3GPP2 C.R1001 table 9.3.3-1
public static final int SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT =
- CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT; // = 4096
public static final int SERVICE_CATEGORY_CMAS_EXTREME_THREAT =
- CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT; // = 4097
public static final int SERVICE_CATEGORY_CMAS_SEVERE_THREAT =
- CdmaSmsCbProgramData.CATEGORY_CMAS_SEVERE_THREAT;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_SEVERE_THREAT; // = 4098
public static final int SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY =
- CdmaSmsCbProgramData.CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY; // = 4099
public static final int SERVICE_CATEGORY_CMAS_TEST_MESSAGE =
- CdmaSmsCbProgramData.CATEGORY_CMAS_TEST_MESSAGE;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_TEST_MESSAGE; // = 4100
public static final int SERVICE_CATEGORY_CMAS_LAST_RESERVED_VALUE =
- CdmaSmsCbProgramData.CATEGORY_CMAS_LAST_RESERVED_VALUE;
+ CdmaSmsCbProgramData.CATEGORY_CMAS_LAST_RESERVED_VALUE; // = 4351
/**
* Provides the type of a SMS message like point to point, broadcast or acknowledge
@@ -80,6 +80,7 @@ public final class SmsEnvelope {
* or receiving the message.
* (See 3GPP2 C.S0015-B, v2, 3.4.3.1)
*/
+ @UnsupportedAppUsage
public int teleService = TELESERVICE_NOT_SET;
/**
@@ -87,6 +88,7 @@ public final class SmsEnvelope {
* by the SMS message.
* (See 3GPP2 C.S0015-B, v2, 3.4.3.2)
*/
+ @UnsupportedAppUsage
public int serviceCategory;
/**
@@ -137,8 +139,10 @@ public final class SmsEnvelope {
* encoded bearer data
* (See 3GPP2 C.S0015-B, v2, 3.4.3.7)
*/
+ @UnsupportedAppUsage
public byte[] bearerData;
+ @UnsupportedAppUsage
public SmsEnvelope() {
// nothing to see here
}
diff --git a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
index 20169152539e..7422863d862c 100644
--- a/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
+++ b/telephony/java/com/android/internal/telephony/euicc/IEuiccController.aidl
@@ -44,5 +44,7 @@ interface IEuiccController {
oneway void updateSubscriptionNickname(int cardId, int subscriptionId, String nickname,
String callingPackage, in PendingIntent callbackIntent);
oneway void eraseSubscriptions(int cardId, in PendingIntent callbackIntent);
+ oneway void eraseSubscriptionsWithOptions(
+ int cardId, int options, in PendingIntent callbackIntent);
oneway void retainSubscriptionsForFactoryReset(int cardId, in PendingIntent callbackIntent);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSmsAddress.java b/telephony/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
index bd8c83e63055..19e0b2d1ba35 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSmsAddress.java
@@ -18,10 +18,13 @@ package com.android.internal.telephony.gsm;
import android.telephony.PhoneNumberUtils;
-import java.text.ParseException;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.SmsAddress;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
+import java.text.ParseException;
+
public class GsmSmsAddress extends SmsAddress {
static final int OFFSET_ADDRESS_LENGTH = 0;
@@ -39,6 +42,7 @@ public class GsmSmsAddress extends SmsAddress {
* @throws ParseException
*/
+ @UnsupportedAppUsage
public GsmSmsAddress(byte[] data, int offset, int length) throws ParseException {
origBytes = new byte[length];
System.arraycopy(data, offset, origBytes, 0, length);
@@ -136,6 +140,7 @@ public class GsmSmsAddress extends SmsAddress {
* address indicating a "set" of "indicator 1" of type "voice message
* waiting"
*/
+ @UnsupportedAppUsage
public boolean isCphsVoiceMessageSet() {
// 0x11 means "set" "voice message waiting" "indicator 1"
return isCphsVoiceMessageIndicatorAddress()
@@ -148,6 +153,7 @@ public class GsmSmsAddress extends SmsAddress {
* address indicating a "clear" of "indicator 1" of type "voice message
* waiting"
*/
+ @UnsupportedAppUsage
public boolean isCphsVoiceMessageClear() {
// 0x10 means "clear" "voice message waiting" "indicator 1"
return isCphsVoiceMessageIndicatorAddress()
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
index c65c45fa015b..c15a8004b18c 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmSmsCbMessage.java
@@ -90,9 +90,10 @@ public class GsmSmsCbMessage {
* Create a new SmsCbMessage object from a header object plus one or more received PDUs.
*
* @param pdus PDU bytes
+ * @slotIndex slotIndex for which received sms cb message
*/
public static SmsCbMessage createSmsCbMessage(Context context, SmsCbHeader header,
- SmsCbLocation location, byte[][] pdus)
+ SmsCbLocation location, byte[][] pdus, int slotIndex)
throws IllegalArgumentException {
long receivedTimeMillis = System.currentTimeMillis();
if (header.isEtwsPrimaryNotification()) {
@@ -104,7 +105,7 @@ public class GsmSmsCbMessage {
header.getSerialNumber(), location, header.getServiceCategory(), null,
getEtwsPrimaryMessage(context, header.getEtwsInfo().getWarningType()),
SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY, header.getEtwsInfo(),
- header.getCmasInfo(), 0, null /* geometries */, receivedTimeMillis);
+ header.getCmasInfo(), 0, null /* geometries */, receivedTimeMillis, slotIndex);
} else if (header.isUmtsFormat()) {
// UMTS format has only 1 PDU
byte[] pdu = pdus[0];
@@ -138,7 +139,7 @@ public class GsmSmsCbMessage {
header.getGeographicalScope(), header.getSerialNumber(), location,
header.getServiceCategory(), language, body, priority,
header.getEtwsInfo(), header.getCmasInfo(), maximumWaitingTimeSec, geometries,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
} else {
String language = null;
StringBuilder sb = new StringBuilder();
@@ -154,7 +155,7 @@ public class GsmSmsCbMessage {
header.getGeographicalScope(), header.getSerialNumber(), location,
header.getServiceCategory(), language, sb.toString(), priority,
header.getEtwsInfo(), header.getCmasInfo(), 0, null /* geometries */,
- receivedTimeMillis);
+ receivedTimeMillis, slotIndex);
}
}
@@ -214,7 +215,7 @@ public class GsmSmsCbMessage {
private static Pair<Integer, List<Geometry>> parseWarningAreaCoordinates(
byte[] pdu, int wacOffset) {
// little-endian
- int wacDataLength = (pdu[wacOffset + 1] << 8) | pdu[wacOffset];
+ int wacDataLength = ((pdu[wacOffset + 1] & 0xff) << 8) | (pdu[wacOffset] & 0xff);
int offset = wacOffset + 2;
if (offset + wacDataLength > pdu.length) {
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java b/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
index 465840f3bc7f..d85cf151b9eb 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsCbHeader.java
@@ -21,6 +21,8 @@ import android.telephony.SmsCbEtwsInfo;
import com.android.internal.telephony.SmsConstants;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.util.Arrays;
import java.util.Locale;
@@ -110,6 +112,7 @@ public class SmsCbHeader {
private final int mSerialNumber;
/** The Message Identifier in 3GPP is the same as the Service Category in CDMA. */
+ @UnsupportedAppUsage
private final int mMessageIdentifier;
private final int mDataCodingScheme;
@@ -128,6 +131,7 @@ public class SmsCbHeader {
/** CMAS warning notification info. */
private final SmsCbCmasInfo mCmasInfo;
+ @UnsupportedAppUsage
public SmsCbHeader(byte[] pdu) throws IllegalArgumentException {
if (pdu == null || pdu.length < PDU_HEADER_LENGTH) {
throw new IllegalArgumentException("Illegal PDU");
@@ -225,14 +229,17 @@ public class SmsCbHeader {
}
}
+ @UnsupportedAppUsage
int getGeographicalScope() {
return mGeographicalScope;
}
+ @UnsupportedAppUsage
int getSerialNumber() {
return mSerialNumber;
}
+ @UnsupportedAppUsage
int getServiceCategory() {
return mMessageIdentifier;
}
@@ -245,10 +252,12 @@ public class SmsCbHeader {
return mDataCodingSchemeStructedData;
}
+ @UnsupportedAppUsage
int getPageIndex() {
return mPageIndex;
}
+ @UnsupportedAppUsage
int getNumberOfPages() {
return mNrOfPages;
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
index 17e3bacb21d3..e7b385c5444b 100644
--- a/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
+++ b/telephony/java/com/android/internal/telephony/gsm/SmsMessage.java
@@ -16,18 +16,29 @@
package com.android.internal.telephony.gsm;
+import static com.android.internal.telephony.SmsConstants.ENCODING_16BIT;
+import static com.android.internal.telephony.SmsConstants.ENCODING_7BIT;
+import static com.android.internal.telephony.SmsConstants.ENCODING_8BIT;
+import static com.android.internal.telephony.SmsConstants.ENCODING_KSC5601;
+import static com.android.internal.telephony.SmsConstants.ENCODING_UNKNOWN;
+import static com.android.internal.telephony.SmsConstants.MAX_USER_DATA_BYTES;
+import static com.android.internal.telephony.SmsConstants.MAX_USER_DATA_SEPTETS;
+import static com.android.internal.telephony.SmsConstants.MessageClass;
+
+import android.content.res.Resources;
import android.telephony.PhoneNumberUtils;
import android.telephony.Rlog;
-import android.content.res.Resources;
import android.text.TextUtils;
import com.android.internal.telephony.EncodeException;
import com.android.internal.telephony.GsmAlphabet;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
-import com.android.internal.telephony.uicc.IccUtils;
+import com.android.internal.telephony.Sms7BitEncodingTranslator;
import com.android.internal.telephony.SmsHeader;
import com.android.internal.telephony.SmsMessageBase;
-import com.android.internal.telephony.Sms7BitEncodingTranslator;
+import com.android.internal.telephony.uicc.IccUtils;
+
+import dalvik.annotation.compat.UnsupportedAppUsage;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
@@ -35,16 +46,6 @@ import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
-import static com.android.internal.telephony.SmsConstants.MessageClass;
-import static com.android.internal.telephony.SmsConstants.ENCODING_UNKNOWN;
-import static com.android.internal.telephony.SmsConstants.ENCODING_7BIT;
-import static com.android.internal.telephony.SmsConstants.ENCODING_8BIT;
-import static com.android.internal.telephony.SmsConstants.ENCODING_16BIT;
-import static com.android.internal.telephony.SmsConstants.ENCODING_KSC5601;
-import static com.android.internal.telephony.SmsConstants.MAX_USER_DATA_SEPTETS;
-import static com.android.internal.telephony.SmsConstants.MAX_USER_DATA_BYTES;
-import static com.android.internal.telephony.SmsConstants.MAX_USER_DATA_BYTES_WITH_HEADER;
-
/**
* A Short Message Service message.
*
@@ -99,12 +100,20 @@ public class SmsMessage extends SmsMessageBase {
private static final int INVALID_VALIDITY_PERIOD = -1;
+ @UnsupportedAppUsage
+ public SmsMessage() {
+ }
+
public static class SubmitPdu extends SubmitPduBase {
+ @UnsupportedAppUsage
+ public SubmitPdu() {
+ }
}
/**
* Create an SmsMessage from a raw PDU.
*/
+ @UnsupportedAppUsage
public static SmsMessage createFromPdu(byte[] pdu) {
try {
SmsMessage msg = new SmsMessage();
@@ -169,6 +178,7 @@ public class SmsMessage extends SmsMessageBase {
*
* @hide
*/
+ @UnsupportedAppUsage
public static SmsMessage createFromEfRecord(int index, byte[] data) {
try {
SmsMessage msg = new SmsMessage();
@@ -259,6 +269,7 @@ public class SmsMessage extends SmsMessageBase {
* Returns null on encode error.
* @hide
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddress,
String destinationAddress, String message,
boolean statusReportRequested, byte[] header) {
@@ -281,6 +292,7 @@ public class SmsMessage extends SmsMessageBase {
* Returns null on encode error.
* @hide
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddress,
String destinationAddress, String message,
boolean statusReportRequested, byte[] header, int encoding,
@@ -304,6 +316,7 @@ public class SmsMessage extends SmsMessageBase {
* Returns null on encode error.
* @hide
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddress,
String destinationAddress, String message,
boolean statusReportRequested, byte[] header, int encoding,
@@ -444,6 +457,7 @@ public class SmsMessage extends SmsMessageBase {
* @throws UnsupportedEncodingException
* @throws EncodeException if String is too large to encode
*/
+ @UnsupportedAppUsage
private static byte[] encodeUCS2(String message, byte[] header)
throws UnsupportedEncodingException, EncodeException {
byte[] userData, textPart;
@@ -478,6 +492,7 @@ public class SmsMessage extends SmsMessageBase {
* address, if applicable, and the encoded message.
* Returns null on encode error.
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddress,
String destinationAddress, String message,
boolean statusReportRequested) {
@@ -496,6 +511,7 @@ public class SmsMessage extends SmsMessageBase {
* address, if applicable, and the encoded message.
* Returns null on encode error.
*/
+ @UnsupportedAppUsage
public static SubmitPdu getSubmitPdu(String scAddress,
String destinationAddress, String message,
boolean statusReportRequested, int validityPeriod) {
@@ -576,6 +592,7 @@ public class SmsMessage extends SmsMessageBase {
* @param ret <code>SubmitPdu</code> containing the encoded SC
* address, if applicable, and the encoded message. Returns null on encode error.
*/
+ @UnsupportedAppUsage
private static ByteArrayOutputStream getSubmitPduHead(
String scAddress, String destinationAddress, byte mtiByte,
boolean statusReportRequested, SubmitPdu ret) {
@@ -622,12 +639,16 @@ public class SmsMessage extends SmsMessageBase {
}
private static class PduParser {
+ @UnsupportedAppUsage
byte mPdu[];
+ @UnsupportedAppUsage
int mCur;
SmsHeader mUserDataHeader;
byte[] mUserData;
+ @UnsupportedAppUsage
int mUserDataSeptetPadding;
+ @UnsupportedAppUsage
PduParser(byte[] pdu) {
mPdu = pdu;
mCur = 0;
@@ -667,6 +688,7 @@ public class SmsMessage extends SmsMessageBase {
/**
* returns non-sign-extended byte value
*/
+ @UnsupportedAppUsage
int getByte() {
return mPdu[mCur++] & 0xff;
}
@@ -808,6 +830,7 @@ public class SmsMessage extends SmsMessageBase {
*
* @return the user data payload, not including the headers
*/
+ @UnsupportedAppUsage
byte[] getUserData() {
return mUserData;
}
@@ -864,6 +887,7 @@ public class SmsMessage extends SmsMessageBase {
* @param byteCount the number of bytes in the user data payload
* @return a String with the decoded characters
*/
+ @UnsupportedAppUsage
String getUserDataUCS2(int byteCount) {
String ret;
@@ -912,6 +936,7 @@ public class SmsMessage extends SmsMessageBase {
* @param use7bitOnly ignore (but still count) illegal characters if true
* @return TextEncodingDetails
*/
+ @UnsupportedAppUsage
public static TextEncodingDetails calculateLength(CharSequence msgBody,
boolean use7bitOnly) {
CharSequence newMsgBody = null;
@@ -959,6 +984,7 @@ public class SmsMessage extends SmsMessageBase {
}
/** {@inheritDoc} */
+ @UnsupportedAppUsage
@Override
public boolean isMWIClearMessage() {
if (mIsMwi && !mMwiSense) {
@@ -970,6 +996,7 @@ public class SmsMessage extends SmsMessageBase {
}
/** {@inheritDoc} */
+ @UnsupportedAppUsage
@Override
public boolean isMWISetMessage() {
if (mIsMwi && mMwiSense) {
@@ -981,6 +1008,7 @@ public class SmsMessage extends SmsMessageBase {
}
/** {@inheritDoc} */
+ @UnsupportedAppUsage
@Override
public boolean isMwiDontStore() {
if (mIsMwi && mMwiDontStore) {
@@ -1000,12 +1028,14 @@ public class SmsMessage extends SmsMessageBase {
}
/** {@inheritDoc} */
+ @UnsupportedAppUsage
@Override
public int getStatus() {
return mStatus;
}
/** {@inheritDoc} */
+ @UnsupportedAppUsage
@Override
public boolean isStatusReportMessage() {
return mIsStatusReportMessage;
diff --git a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
index 96e215cf6f45..f2d46244d60e 100644
--- a/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
+++ b/telephony/java/com/android/internal/telephony/uicc/IccUtils.java
@@ -25,6 +25,8 @@ import android.telephony.Rlog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.GsmAlphabet;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import java.io.UnsupportedEncodingException;
import java.util.List;
@@ -53,6 +55,7 @@ public class IccUtils {
*
* Stops on invalid BCD value, returning string so far
*/
+ @UnsupportedAppUsage
public static String
bcdToString(byte[] data, int offset, int length) {
StringBuilder ret = new StringBuilder(length*2);
@@ -180,6 +183,7 @@ public class IccUtils {
/**
* Decode cdma byte into String.
*/
+ @UnsupportedAppUsage
public static String
cdmaBcdToString(byte[] data, int offset, int length) {
StringBuilder ret = new StringBuilder(length);
@@ -215,6 +219,7 @@ public class IccUtils {
* assume the digit is set to 0 but shall store the entire field
* exactly as received"
*/
+ @UnsupportedAppUsage
public static int
gsmBcdByteToInt(byte b) {
int ret = 0;
@@ -237,6 +242,7 @@ public class IccUtils {
* is in the least significant nibble and the most significant
* is in the most significant nibble.
*/
+ @UnsupportedAppUsage
public static int
cdmaBcdByteToInt(byte b) {
int ret = 0;
@@ -288,6 +294,7 @@ public class IccUtils {
* contain a 16 bit number which defines the complete 16 bit
* base pointer to a "half page" in the UCS2 code space...
*/
+ @UnsupportedAppUsage
public static String
adnStringFieldToString(byte[] data, int offset, int length) {
if (length == 0) {
@@ -379,6 +386,7 @@ public class IccUtils {
return GsmAlphabet.gsm8BitUnpackedToString(data, offset, length, defaultCharset.trim());
}
+ @UnsupportedAppUsage
public static int
hexCharToInt(char c) {
if (c >= '0' && c <= '9') return (c - '0');
@@ -398,6 +406,7 @@ public class IccUtils {
*
* @throws RuntimeException on invalid format
*/
+ @UnsupportedAppUsage
public static byte[]
hexStringToBytes(String s) {
byte[] ret;
@@ -424,6 +433,7 @@ public class IccUtils {
*
* @return hex string representation of bytes array
*/
+ @UnsupportedAppUsage
public static String
bytesToHexString(byte[] bytes) {
if (bytes == null) return null;
@@ -451,6 +461,7 @@ public class IccUtils {
* "offset" points to "octet 3", the coding scheme byte
* empty string returned on decode error
*/
+ @UnsupportedAppUsage
public static String
networkNameToString(byte[] data, int offset, int length) {
String ret;
@@ -501,6 +512,7 @@ public class IccUtils {
* @param length The length of image body
* @return The bitmap
*/
+ @UnsupportedAppUsage
public static Bitmap parseToBnW(byte[] data, int length){
int valueIndex = 0;
int width = data[valueIndex++] & 0xFF;
@@ -543,6 +555,7 @@ public class IccUtils {
* @param transparency with or without transparency
* @return The color bitmap
*/
+ @UnsupportedAppUsage
public static Bitmap parseToRGB(byte[] data, int length,
boolean transparency) {
int valueIndex = 0;
diff --git a/test-mock/Android.bp b/test-mock/Android.bp
index 81b1e49ffed1..0b5d4460612d 100644
--- a/test-mock/Android.bp
+++ b/test-mock/Android.bp
@@ -19,8 +19,14 @@
java_sdk_library {
name: "android.test.mock",
- srcs: ["src/**/*.java"],
- api_srcs: [":framework-all-sources"],
+ srcs: [
+ "src/**/*.java",
+ // Note: Below are NOT APIs of this library. We only take APIs under
+ // the android.test.mock package. They however provide private APIs that
+ // android.test.mock APIs references to.
+ ":framework-core-sources-for-test-mock",
+ ":framework_native_aidl",
+ ],
libs: ["framework-all"],
api_packages: [
diff --git a/test-mock/src/android/test/mock/MockContext.java b/test-mock/src/android/test/mock/MockContext.java
index a95b6f11e98a..727684eca7ea 100644
--- a/test-mock/src/android/test/mock/MockContext.java
+++ b/test-mock/src/android/test/mock/MockContext.java
@@ -463,6 +463,13 @@ public class MockContext extends Context {
}
@Override
+ public void sendOrderedBroadcast(Intent intent, String receiverPermission,
+ String receiverAppOp, BroadcastReceiver resultReceiver, Handler scheduler,
+ int initialCode, String initialData, Bundle initialExtras) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
public void sendStickyBroadcast(Intent intent) {
throw new UnsupportedOperationException();
}
diff --git a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
index 81937e6b7005..f8e338e93002 100644
--- a/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
+++ b/tests/BootImageProfileTest/src/com/android/bootimageprofile/BootImageProfileTest.java
@@ -106,13 +106,18 @@ public class BootImageProfileTest implements IDeviceTest {
// Test the profile contents contain common methods for core-oj that would normally be AOT
// compiled.
res = mTestDevice.executeShellCommand("profman --dump-classes-and-methods --profile-file="
- + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar");
+ + SYSTEM_SERVER_PROFILE + " --apk=/apex/com.android.art/javalib/core-oj.jar"
+ + " --apk=/system/framework/services.jar");
boolean sawObjectInit = false;
+ boolean sawPmInit = false;
for (String line : res.split("\n")) {
if (line.contains("Ljava/lang/Object;-><init>()V")) {
sawObjectInit = true;
+ } else if (line.contains("Lcom/android/server/pm/PackageManagerService;-><init>")) {
+ sawPmInit = true;
}
}
assertTrue("Did not see Object.<init> in " + res, sawObjectInit);
+ assertTrue("Did not see PackageManagerService.<init> in " + res, sawPmInit);
}
}
diff --git a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
index 4315514cb7a5..98e066f541cc 100644
--- a/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
+++ b/tests/RollbackTest/StagedRollbackTest/src/com/android/tests/rollback/host/StagedRollbackTest.java
@@ -19,6 +19,7 @@ package com.android.tests.rollback.host;
import static org.junit.Assert.assertTrue;
import com.android.ddmlib.Log.LogLevel;
+import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -97,7 +98,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
+ "watchdog_request_timeout_millis 300000");
// Simulate re-installation of new NetworkStack with rollbacks enabled
getDevice().executeShellCommand("pm install -r --staged --enable-rollback "
- + "/system/priv-app/NetworkStack/NetworkStack.apk");
+ + getNetworkStackPath());
// Sleep to allow writes to disk before reboot
Thread.sleep(5000);
@@ -143,7 +144,7 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
+ "watchdog_request_timeout_millis 300000");
// Simulate re-installation of new NetworkStack with rollbacks enabled
getDevice().executeShellCommand("pm install -r --staged --enable-rollback "
- + "/system/priv-app/NetworkStack/NetworkStack.apk");
+ + getNetworkStackPath());
// Sleep to allow writes to disk before reboot
Thread.sleep(5000);
@@ -167,4 +168,9 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
// Verify rollback was not executed after health check deadline
runPhase("assertNoNetworkStackRollbackCommitted");
}
+
+ private String getNetworkStackPath() throws DeviceNotAvailableException {
+ // Find the NetworkStack path (can be NetworkStack.apk or NetworkStackNext.apk)
+ return getDevice().executeShellCommand("ls /system/priv-app/NetworkStack*/*.apk");
+ }
}
diff --git a/tests/net/Android.bp b/tests/net/Android.bp
index b9b2238572ac..10f27e243c8c 100644
--- a/tests/net/Android.bp
+++ b/tests/net/Android.bp
@@ -37,7 +37,7 @@ java_defaults {
"libvndksupport",
"libziparchive",
"libz",
- "netd_aidl_interface-V2-cpp",
+ "netd_aidl_interface-cpp",
],
}
diff --git a/tests/net/common/java/android/net/NetworkScoreTest.kt b/tests/net/common/java/android/net/NetworkScoreTest.kt
new file mode 100644
index 000000000000..30836b7c9be1
--- /dev/null
+++ b/tests/net/common/java/android/net/NetworkScoreTest.kt
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net
+
+import android.os.Parcelable
+import androidx.test.filters.SmallTest
+import androidx.test.runner.AndroidJUnit4
+import com.android.testutils.assertParcelSane
+import org.junit.Assert.assertEquals
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertNotEquals
+import org.junit.Assert.assertTrue
+import org.junit.Test
+import org.junit.runner.RunWith
+
+private const val TEST_SCORE = 80
+private const val KEY_DEFAULT_CAPABILITIES = "DEFAULT_CAPABILITIES"
+
+@RunWith(AndroidJUnit4::class)
+@SmallTest
+class NetworkScoreTest {
+ @Test
+ fun testParcelNetworkScore() {
+ val networkScore = NetworkScore()
+ val defaultCap = NetworkCapabilities()
+ networkScore.putExtension(KEY_DEFAULT_CAPABILITIES, defaultCap)
+ assertEquals(defaultCap, networkScore.getExtension(KEY_DEFAULT_CAPABILITIES))
+ networkScore.putIntExtension(NetworkScore.LEGACY_SCORE, TEST_SCORE)
+ assertEquals(TEST_SCORE, networkScore.getIntExtension(NetworkScore.LEGACY_SCORE))
+ assertParcelSane(networkScore, 1)
+ }
+
+ @Test
+ fun testNullKeyAndValue() {
+ val networkScore = NetworkScore()
+ val defaultCap = NetworkCapabilities()
+ networkScore.putIntExtension(null, TEST_SCORE)
+ assertEquals(TEST_SCORE, networkScore.getIntExtension(null))
+ networkScore.putExtension(null, defaultCap)
+ assertEquals(defaultCap, networkScore.getExtension(null))
+ networkScore.putExtension(null, null)
+ val result: Parcelable? = networkScore.getExtension(null)
+ assertEquals(null, result)
+ }
+
+ @Test
+ fun testRemoveExtension() {
+ val networkScore = NetworkScore()
+ val defaultCap = NetworkCapabilities()
+ networkScore.putExtension(KEY_DEFAULT_CAPABILITIES, defaultCap)
+ networkScore.putIntExtension(NetworkScore.LEGACY_SCORE, TEST_SCORE)
+ assertEquals(defaultCap, networkScore.getExtension(KEY_DEFAULT_CAPABILITIES))
+ assertEquals(TEST_SCORE, networkScore.getIntExtension(NetworkScore.LEGACY_SCORE))
+ networkScore.removeExtension(KEY_DEFAULT_CAPABILITIES)
+ networkScore.removeExtension(NetworkScore.LEGACY_SCORE)
+ val result: Parcelable? = networkScore.getExtension(KEY_DEFAULT_CAPABILITIES)
+ assertEquals(null, result)
+ assertEquals(0, networkScore.getIntExtension(NetworkScore.LEGACY_SCORE))
+ }
+
+ @Test
+ fun testEqualsNetworkScore() {
+ val ns1 = NetworkScore()
+ val ns2 = NetworkScore()
+ assertTrue(ns1.equals(ns2))
+ assertEquals(ns1.hashCode(), ns2.hashCode())
+
+ ns1.putIntExtension(NetworkScore.LEGACY_SCORE, TEST_SCORE)
+ assertFalse(ns1.equals(ns2))
+ assertNotEquals(ns1.hashCode(), ns2.hashCode())
+ ns2.putIntExtension(NetworkScore.LEGACY_SCORE, TEST_SCORE)
+ assertTrue(ns1.equals(ns2))
+ assertEquals(ns1.hashCode(), ns2.hashCode())
+
+ val defaultCap = NetworkCapabilities()
+ ns1.putExtension(KEY_DEFAULT_CAPABILITIES, defaultCap)
+ assertFalse(ns1.equals(ns2))
+ assertNotEquals(ns1.hashCode(), ns2.hashCode())
+ ns2.putExtension(KEY_DEFAULT_CAPABILITIES, defaultCap)
+ assertTrue(ns1.equals(ns2))
+ assertEquals(ns1.hashCode(), ns2.hashCode())
+
+ ns1.putIntExtension(null, 10)
+ assertFalse(ns1.equals(ns2))
+ assertNotEquals(ns1.hashCode(), ns2.hashCode())
+ ns2.putIntExtension(null, 10)
+ assertTrue(ns1.equals(ns2))
+ assertEquals(ns1.hashCode(), ns2.hashCode())
+ }
+}
diff --git a/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java b/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
index 142769f61335..535298f9b09a 100644
--- a/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
+++ b/tests/net/java/com/android/server/connectivity/LingerMonitorTest.java
@@ -39,6 +39,7 @@ import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkInfo;
import android.net.NetworkMisc;
+import android.net.NetworkScore;
import android.os.INetworkManagementService;
import android.text.format.DateUtils;
@@ -354,8 +355,10 @@ public class LingerMonitorTest {
NetworkCapabilities caps = new NetworkCapabilities();
caps.addCapability(0);
caps.addTransportType(transport);
+ NetworkScore ns = new NetworkScore();
+ ns.putIntExtension(NetworkScore.LEGACY_SCORE, 50);
NetworkAgentInfo nai = new NetworkAgentInfo(null, null, new Network(netId), info, null,
- caps, 50, mCtx, null, mMisc, mConnService, mNetd, mDnsResolver, mNMS,
+ caps, ns, mCtx, null, mMisc, mConnService, mNetd, mDnsResolver, mNMS,
NetworkFactory.SerialNumber.NONE);
nai.everValidated = true;
return nai;
diff --git a/tests/testables/src/android/testing/TestableSettingsProvider.java b/tests/testables/src/android/testing/TestableSettingsProvider.java
index b158476bd438..fd92c657cb2e 100644
--- a/tests/testables/src/android/testing/TestableSettingsProvider.java
+++ b/tests/testables/src/android/testing/TestableSettingsProvider.java
@@ -14,6 +14,8 @@
package android.testing;
+import static org.junit.Assert.assertEquals;
+
import android.content.ContentProviderClient;
import android.content.Context;
import android.os.Bundle;
@@ -25,8 +27,6 @@ import android.util.Log;
import java.util.HashMap;
-import static org.junit.Assert.*;
-
/**
* Allows calls to android.provider.Settings to be tested easier.
*
@@ -71,7 +71,7 @@ public class TestableSettingsProvider extends MockContentProvider {
public Bundle call(String method, String arg, Bundle extras) {
// Methods are "GET_system", "GET_global", "PUT_secure", etc.
- final int userId = extras.getInt(Settings.CALL_METHOD_USER_KEY, 0);
+ final int userId = extras.getInt(Settings.CALL_METHOD_USER_KEY, UserHandle.myUserId());
final String[] commands = method.split("_", 2);
final String op = commands[0];
final String table = commands[1];
diff --git a/tools/aapt2/compile/PseudolocaleGenerator.cpp b/tools/aapt2/compile/PseudolocaleGenerator.cpp
index c5de9e058907..5e0300b3071b 100644
--- a/tools/aapt2/compile/PseudolocaleGenerator.cpp
+++ b/tools/aapt2/compile/PseudolocaleGenerator.cpp
@@ -231,7 +231,7 @@ class Visitor : public ValueVisitor {
Visitor sub_visitor(pool_, method_);
if (plural->values[i]) {
plural->values[i]->Accept(&sub_visitor);
- if (sub_visitor.value) {
+ if (sub_visitor.item) {
localized->values[i] = std::move(sub_visitor.item);
} else {
localized->values[i] = std::unique_ptr<Item>(plural->values[i]->Clone(pool_));
diff --git a/tools/aapt2/compile/PseudolocaleGenerator_test.cpp b/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
index 31358020ab60..e816c86e20a8 100644
--- a/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
+++ b/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
@@ -234,6 +234,27 @@ TEST(PseudolocaleGeneratorTest, PseudolocalizeOnlyDefaultConfigs) {
test::ParseConfigOrDie("ar-rXB")));
}
+TEST(PseudolocaleGeneratorTest, PluralsArePseudolocalized) {
+ std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+ std::unique_ptr<ResourceTable> table =
+ test::ResourceTableBuilder().SetPackageId("com.pkg", 0x7F).Build();
+ std::unique_ptr<Plural> plural = util::make_unique<Plural>();
+ plural->values = {util::make_unique<String>(table->string_pool.MakeRef("zero")),
+ util::make_unique<String>(table->string_pool.MakeRef("one"))};
+ ASSERT_TRUE(table->AddResource(test::ParseNameOrDie("com.pkg:plurals/foo"), ConfigDescription{},
+ {}, std::move(plural), context->GetDiagnostics()));
+ std::unique_ptr<Plural> expected = util::make_unique<Plural>();
+ expected->values = {util::make_unique<String>(table->string_pool.MakeRef("[žéŕö one]")),
+ util::make_unique<String>(table->string_pool.MakeRef("[öñé one]"))};
+
+ PseudolocaleGenerator generator;
+ ASSERT_TRUE(generator.Consume(context.get(), table.get()));
+
+ const auto* actual = test::GetValueForConfig<Plural>(table.get(), "com.pkg:plurals/foo",
+ test::ParseConfigOrDie("en-rXA"));
+ EXPECT_TRUE(actual->Equals(expected.get()));
+}
+
TEST(PseudolocaleGeneratorTest, RespectUntranslateableSections) {
std::unique_ptr<IAaptContext> context =
test::ContextBuilder().SetCompilationPackage("android").Build();
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index f1890488276c..9cef7b3d2ce3 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -30,6 +30,7 @@ namespace aapt {
constexpr const static uint32_t kContainerFormatMagic = 0x54504141u;
constexpr const static uint32_t kContainerFormatVersion = 1u;
+constexpr const static size_t kPaddingAlignment = 4u;
ContainerWriter::ContainerWriter(ZeroCopyOutputStream* out, size_t entry_count)
: out_(out), total_entry_count_(entry_count), current_entry_count_(0u) {
@@ -49,11 +50,17 @@ ContainerWriter::ContainerWriter(ZeroCopyOutputStream* out, size_t entry_count)
}
}
-inline static void WritePadding(int padding, CodedOutputStream* out) {
- if (padding < 4) {
- const uint32_t zero = 0u;
- out->WriteRaw(&zero, padding);
- }
+inline static size_t CalculatePaddingForAlignment(size_t size) {
+ size_t overage = size % kPaddingAlignment;
+ return overage == 0 ? 0 : kPaddingAlignment - overage;
+}
+
+inline static void WritePadding(size_t padding, CodedOutputStream* out) {
+ CHECK(padding < kPaddingAlignment);
+ const uint32_t zero = 0u;
+ static_assert(sizeof(zero) >= kPaddingAlignment, "Not enough source bytes for padding");
+
+ out->WriteRaw(&zero, padding);
}
bool ContainerWriter::AddResTableEntry(const pb::ResourceTable& table) {
@@ -70,7 +77,7 @@ bool ContainerWriter::AddResTableEntry(const pb::ResourceTable& table) {
// Write the aligned size.
const ::google::protobuf::uint64 size = table.ByteSize();
- const int padding = 4 - (size % 4);
+ const int padding = CalculatePaddingForAlignment(size);
coded_out.WriteLittleEndian64(size);
// Write the table.
@@ -103,9 +110,9 @@ bool ContainerWriter::AddResFileEntry(const pb::internal::CompiledFile& file,
// Write the aligned size.
const ::google::protobuf::uint32 header_size = file.ByteSize();
- const int header_padding = 4 - (header_size % 4);
+ const int header_padding = CalculatePaddingForAlignment(header_size);
const ::google::protobuf::uint64 data_size = in->TotalSize();
- const int data_padding = 4 - (data_size % 4);
+ const int data_padding = CalculatePaddingForAlignment(data_size);
coded_out.WriteLittleEndian64(kResFileEntryHeaderSize + header_size + header_padding + data_size +
data_padding);
diff --git a/tools/aapt2/formats.md b/tools/aapt2/formats.md
index bb31a005ef42..25a0e798dea2 100644
--- a/tools/aapt2/formats.md
+++ b/tools/aapt2/formats.md
@@ -23,7 +23,7 @@ boundary, so if a previous entry ends unaligned, padding must be inserted.
| Size (in bytes) | Field | Description |
|:----------------|:---------------|:----------------------------------------------------------------------------------------------------------|
| `4` | `entry_type` | The type of the entry. This can be one of two types: `RES_TABLE (0x00000000)` or `RES_FILE (0x00000001)`. |
-| `8` | `entry_length` | The length of the data that follows. |
+| `8` | `entry_length` | The length of the data that follows. Do not use if `entry_type` is `RES_FILE`; this value may be wrong. |
| `entry_length` | `data` | The payload. The contents of this varies based on the `entry_type`. |
If the `entry_type` is equal to `RES_TABLE (0x00000000)`, the `data` field contains a serialized
@@ -32,13 +32,14 @@ If the `entry_type` is equal to `RES_TABLE (0x00000000)`, the `data` field conta
If the `entry_type` is equal to `RES_FILE (0x00000001)`, the `data` field contains the following:
-| Size (in bytes) | Field | Description |
-|:----------------|:---------------|:----------------------------------------------------------------------------------------------------------|
-| `4` | `header_size` | The size of the `header` field. |
-| `8` | `data_size` | The size of the `data` field. |
-| `header_size` | `header` | The serialized Protobuf message [aapt.pb.internal.CompiledFile](ResourcesInternal.proto). |
-| `x` | `padding` | Up to 4 bytes of zeros, if padding is necessary to align the `data` field on a 32-bit boundary. |
-| `data_size` | `data` | The payload, which is determined by the `type` field in the `aapt.pb.internal.CompiledFile`. This can be a PNG file, binary XML, or [aapt.pb.XmlNode](Resources.proto). |
+| Size (in bytes) | Field | Description |
+|:----------------|:-----------------|:----------------------------------------------------------------------------------------------------------|
+| `4` | `header_size` | The size of the `header` field. |
+| `8` | `data_size` | The size of the `data` field. |
+| `header_size` | `header` | The serialized Protobuf message [aapt.pb.internal.CompiledFile](ResourcesInternal.proto). |
+| `x` | `header_padding` | Up to 3 bytes of zeros, if padding is necessary to align the `data` field on a 32-bit boundary. |
+| `data_size` | `data` | The payload, which is determined by the `type` field in the `aapt.pb.internal.CompiledFile`. This can be a PNG file, binary XML, or [aapt.pb.XmlNode](Resources.proto). |
+| `y` | `data_padding` | Up to 3 bytes of zeros, if `data_size` is not a multiple of 4. |
## AAPT2 Static Library Format (extension `.sapk`)
diff --git a/tools/aapt2/java/ProguardRules.h b/tools/aapt2/java/ProguardRules.h
index f9656d112b7b..b15df59f56a6 100644
--- a/tools/aapt2/java/ProguardRules.h
+++ b/tools/aapt2/java/ProguardRules.h
@@ -99,11 +99,13 @@ bool CollectLocations(const UsageLocation& location, const KeepSet& keep_set,
//
inline bool operator==(const UsageLocation& lhs, const UsageLocation& rhs) {
+ // The "source" member is ignored because we only need "name" for outputting
+ // keep rules; "source" is used for comments.
return lhs.name == rhs.name;
}
-inline int operator<(const UsageLocation& lhs, const UsageLocation& rhs) {
- return lhs.name.compare(rhs.name);
+inline bool operator<(const UsageLocation& lhs, const UsageLocation& rhs) {
+ return lhs.name.compare(rhs.name) < 0;
}
//
diff --git a/tools/aapt2/java/ProguardRules_test.cpp b/tools/aapt2/java/ProguardRules_test.cpp
index 559b07af3e80..25b55ab003b0 100644
--- a/tools/aapt2/java/ProguardRules_test.cpp
+++ b/tools/aapt2/java/ProguardRules_test.cpp
@@ -364,4 +364,12 @@ TEST(ProguardRulesTest, TransitionRulesAreEmitted) {
"-keep class com.foo.Bar { <init>(android.content.Context, android.util.AttributeSet); }"));
}
+TEST(ProguardRulesTest, UsageLocationComparator) {
+ proguard::UsageLocation location1 = {{"pkg", ResourceType::kAttr, "x"}};
+ proguard::UsageLocation location2 = {{"pkg", ResourceType::kAttr, "y"}};
+
+ EXPECT_EQ(location1 < location2, true);
+ EXPECT_EQ(location2 < location1, false);
+}
+
} // namespace aapt
diff --git a/tools/apilint/apilint b/tools/apilint/apilint
deleted file mode 100755
index e42857f1a190..000000000000
--- a/tools/apilint/apilint
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-if [ "$1" == "--help" -o "$1" == "-h" ]; then
-echo "Usage: apilint [FILTERS...]"
-echo " Shows lint from currently open files (as diffed from HEAD), i.e. errors"
-echo " you will receive if you upload this CL."
-echo
-echo "Usage: apilint --all [FILTERS...]"
-echo " Shows all lint errors present in the current working directory, regardless"
-echo " of when they were added."
-echo
-echo "Usage: apilint --level API_LEVEL [FILTERS...]"
-echo " Shows lint as it stands in API_LEVEL"
-echo
-echo "Usage: apilint --shal SHA [FILTERS...]"
-echo " Shows lint from locally commited git change SHA."
-echo
-echo "Usage: apilint --unreleased [FILTERS...]"
-echo " Shows all lint errors in the current working directory directory added since"
-echo " the last released SDK version."
-echo
-echo "FILTERS"
-echo " List of class or package names by which to filter the results."
-echo
-exit
-fi
-
-if [ \( -z "$ANDROID_BUILD_TOP" \) \
- -a \( ! -f frameworks/base/api/current.txt \) \
- -a \( ! -f frameworks/base/api/system-current.txt \) \
- ]; then
- echo "apilint must be run either with ANDROID_BUILD_TOP set or from the" 1>&2
- echo "root of the android source tree" 1>&2
- exit 1
-fi
-
-if [ ${ANDROID_BUILD_TOP:0:1} != "/" ]; then
- echo "ANDROID_BUILD_TOP must be an absolute path, not: $ANDROID_BUILD_TOP" 1>&2
- exit 1
-fi
-
-if [ -z "$ANDROID_BUILD_TOP" ]; then
- ANDROID_BUILD_TOP=$(pwd)
-fi
-
-FW_BASE=$ANDROID_BUILD_TOP/frameworks/base
-
-MODE=open
-
-OPTIONS=$(getopt -n apilint -o "" -l "all,sha:,unreleased" -- "$@")
-
-[ $? -eq 0 ] || {
- exit 1
-}
-
-eval set -- "$OPTIONS"
-while true; do
- case "$1" in
- --all)
- MODE=all
- ;;
- --sha)
- shift; # The arg is next in position args
- MODE=sha
- SHA=$1
- ;;
- --unreleased)
- MODE=unreleased
- ;;
- --)
- shift
- break
- ;;
- esac
- shift
-done
-FILTERS=
-for var in "$@"
-do
- FILTERS="$FILTERS --filter $var"
-done
-
-if [ $MODE = "all" ]; then
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SDK" \
- $FILTERS \
- $ANDROID_BUILD_TOP/frameworks/base/api/current.txt
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SystemApi" \
- $FILTERS \
- --base-current $ANDROID_BUILD_TOP/frameworks/base/api/current.txt \
- $ANDROID_BUILD_TOP/frameworks/base/api/system-current.txt
-elif [ $MODE = "open" ]; then
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SDK" \
- $FILTERS \
- $ANDROID_BUILD_TOP/frameworks/base/api/current.txt \
- <(cd $FW_BASE ; git show HEAD:api/current.txt)
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SystemApi" \
- $FILTERS \
- --base-current $ANDROID_BUILD_TOP/frameworks/base/api/current.txt \
- --base-previous <(cd $FW_BASE ; git show HEAD:api/current.txt) \
- $ANDROID_BUILD_TOP/frameworks/base/api/system-current.txt \
- <(cd $FW_BASE ; git show HEAD:api/system-current.txt)
-elif [ $MODE = "sha" ]; then
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SDK" \
- $FILTERS \
- <(cd $FW_BASE ; git show $SHA:api/current.txt) \
- <(cd $FW_BASE ; git show $SHA^:api/current.txt)
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SystemApi" \
- $FILTERS \
- --base-current <(cd $FW_BASE ; git show $SHA:api/current.txt) \
- --base-previous <(cd $FW_BASE ; git show $SHA^:api/current.txt) \
- <(cd $FW_BASE ; git show $SHA:api/system-current.txt) \
- <(cd $FW_BASE ; git show $SHA^:api/system-current.txt)
-elif [ $MODE = "unreleased" ]; then
- LAST_SDK=$(ls $ANDROID_BUILD_TOP/prebuilts/sdk | grep "^[0-9][0-9]*$" | sort -n | tail -n 1)
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SDK" \
- $FILTERS \
- $ANDROID_BUILD_TOP/frameworks/base/api/current.txt \
- $ANDROID_BUILD_TOP/prebuilts/sdk/$LAST_SDK/public/api/android.txt
- python2.7 -B $ANDROID_BUILD_TOP/frameworks/base/tools/apilint/apilint.py \
- --title "SystemApi" \
- $FILTERS \
- --base-current $ANDROID_BUILD_TOP/frameworks/base/api/current.txt \
- --base-previous $ANDROID_BUILD_TOP/prebuilts/sdk/$LAST_SDK/public/api/android.txt \
- $ANDROID_BUILD_TOP/frameworks/base/api/system-current.txt \
- $ANDROID_BUILD_TOP/prebuilts/sdk/$LAST_SDK/system/api/android.txt
-fi
diff --git a/tools/apilint/apilint.py b/tools/apilint/apilint.py
deleted file mode 100644
index 912c1ad377c1..000000000000
--- a/tools/apilint/apilint.py
+++ /dev/null
@@ -1,2353 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2014 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.
-
-"""
-Enforces common Android public API design patterns. It ignores lint messages from
-a previous API level, if provided.
-
-Usage: apilint.py current.txt
-Usage: apilint.py current.txt previous.txt
-
-You can also splice in blame details like this:
-$ git blame api/current.txt -t -e > /tmp/currentblame.txt
-$ apilint.py /tmp/currentblame.txt previous.txt --no-color
-"""
-
-import re, sys, collections, traceback, argparse, itertools
-
-
-BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
-
-ALLOW_GOOGLE = False
-USE_COLOR = True
-
-def format(fg=None, bg=None, bright=False, bold=False, dim=False, reset=False):
- # manually derived from http://en.wikipedia.org/wiki/ANSI_escape_code#Codes
- if not USE_COLOR: return ""
- codes = []
- if reset: codes.append("0")
- else:
- if not fg is None: codes.append("3%d" % (fg))
- if not bg is None:
- if not bright: codes.append("4%d" % (bg))
- else: codes.append("10%d" % (bg))
- if bold: codes.append("1")
- elif dim: codes.append("2")
- else: codes.append("22")
- return "\033[%sm" % (";".join(codes))
-
-
-class Field():
- def __init__(self, clazz, line, raw, blame, sig_format = 1):
- self.clazz = clazz
- self.line = line
- self.raw = raw.strip(" {;")
- self.blame = blame
-
- if sig_format == 2:
- V2LineParser(raw).parse_into_field(self)
- elif sig_format == 1:
- # drop generics for now; may need multiple passes
- raw = re.sub("<[^<]+?>", "", raw)
- raw = re.sub("<[^<]+?>", "", raw)
-
- raw = raw.split()
- self.split = list(raw)
-
- for r in ["field", "volatile", "transient", "public", "protected", "static", "final", "deprecated"]:
- while r in raw: raw.remove(r)
-
- # ignore annotations for now
- raw = [ r for r in raw if not r.startswith("@") ]
-
- self.typ = raw[0]
- self.name = raw[1].strip(";")
- if len(raw) >= 4 and raw[2] == "=":
- self.value = raw[3].strip(';"')
- else:
- self.value = None
- self.annotations = []
-
- self.ident = "-".join((self.typ, self.name, self.value or ""))
-
- def __hash__(self):
- return hash(self.raw)
-
- def __repr__(self):
- return self.raw
-
-
-class Argument(object):
-
- __slots__ = ["type", "annotations", "name", "default"]
-
- def __init__(self, type):
- self.type = type
- self.annotations = []
- self.name = None
- self.default = None
-
-
-class Method():
- def __init__(self, clazz, line, raw, blame, sig_format = 1):
- self.clazz = clazz
- self.line = line
- self.raw = raw.strip(" {;")
- self.blame = blame
-
- if sig_format == 2:
- V2LineParser(raw).parse_into_method(self)
- elif sig_format == 1:
- # drop generics for now; may need multiple passes
- raw = re.sub("<[^<]+?>", "", raw)
- raw = re.sub("<[^<]+?>", "", raw)
-
- # handle each clause differently
- raw_prefix, raw_args, _, raw_throws = re.match(r"(.*?)\((.*?)\)( throws )?(.*?);$", raw).groups()
-
- # parse prefixes
- raw = re.split("[\s]+", raw_prefix)
- for r in ["", ";"]:
- while r in raw: raw.remove(r)
- self.split = list(raw)
-
- for r in ["method", "public", "protected", "static", "final", "deprecated", "abstract", "default", "operator", "synchronized"]:
- while r in raw: raw.remove(r)
-
- self.typ = raw[0]
- self.name = raw[1]
-
- # parse args
- self.detailed_args = []
- for arg in re.split(",\s*", raw_args):
- arg = re.split("\s", arg)
- # ignore annotations for now
- arg = [ a for a in arg if not a.startswith("@") ]
- if len(arg[0]) > 0:
- self.detailed_args.append(Argument(arg[0]))
-
- # parse throws
- self.throws = []
- for throw in re.split(",\s*", raw_throws):
- self.throws.append(throw)
-
- self.annotations = []
- else:
- raise ValueError("Unknown signature format: " + sig_format)
-
- self.args = map(lambda a: a.type, self.detailed_args)
- self.ident = "-".join((self.typ, self.name, "-".join(self.args)))
-
- def sig_matches(self, typ, name, args):
- return typ == self.typ and name == self.name and args == self.args
-
- def __hash__(self):
- return hash(self.raw)
-
- def __repr__(self):
- return self.raw
-
-
-class Class():
- def __init__(self, pkg, line, raw, blame, sig_format = 1):
- self.pkg = pkg
- self.line = line
- self.raw = raw.strip(" {;")
- self.blame = blame
- self.ctors = []
- self.fields = []
- self.methods = []
- self.annotations = []
-
- if sig_format == 2:
- V2LineParser(raw).parse_into_class(self)
- elif sig_format == 1:
- # drop generics for now; may need multiple passes
- raw = re.sub("<[^<]+?>", "", raw)
- raw = re.sub("<[^<]+?>", "", raw)
-
- raw = raw.split()
- self.split = list(raw)
- if "class" in raw:
- self.fullname = raw[raw.index("class")+1]
- elif "interface" in raw:
- self.fullname = raw[raw.index("interface")+1]
- elif "@interface" in raw:
- self.fullname = raw[raw.index("@interface")+1]
- else:
- raise ValueError("Funky class type %s" % (self.raw))
-
- if "extends" in raw:
- self.extends = raw[raw.index("extends")+1]
- else:
- self.extends = None
-
- if "implements" in raw:
- self.implements = raw[raw.index("implements")+1]
- self.implements_all = [self.implements]
- else:
- self.implements = None
- self.implements_all = []
- else:
- raise ValueError("Unknown signature format: " + sig_format)
-
- self.fullname = self.pkg.name + "." + self.fullname
- self.fullname_path = self.fullname.split(".")
-
- if self.extends is not None:
- self.extends_path = self.extends.split(".")
- else:
- self.extends_path = []
-
- self.name = self.fullname[self.fullname.rindex(".")+1:]
-
- def merge_from(self, other):
- self.ctors.extend(other.ctors)
- self.fields.extend(other.fields)
- self.methods.extend(other.methods)
-
- def __hash__(self):
- return hash((self.raw, tuple(self.ctors), tuple(self.fields), tuple(self.methods)))
-
- def __repr__(self):
- return self.raw
-
-
-class Package():
- NAME = re.compile("package(?: .*)? ([A-Za-z0-9.]+)")
-
- def __init__(self, line, raw, blame):
- self.line = line
- self.raw = raw.strip(" {;")
- self.blame = blame
-
- self.name = Package.NAME.match(raw).group(1)
- self.name_path = self.name.split(".")
-
- def __repr__(self):
- return self.raw
-
-class V2Tokenizer(object):
- __slots__ = ["raw"]
-
- SIGNATURE_PREFIX = "// Signature format: "
- DELIMITER = re.compile(r'\s+|[()@<>;,={}/"!?]|\[\]|\.\.\.')
- STRING_SPECIAL = re.compile(r'["\\]')
-
- def __init__(self, raw):
- self.raw = raw
-
- def tokenize(self):
- tokens = []
- current = 0
- raw = self.raw
- length = len(raw)
-
- while current < length:
- while current < length:
- start = current
- match = V2Tokenizer.DELIMITER.search(raw, start)
- if match is not None:
- match_start = match.start()
- if match_start == current:
- end = match.end()
- else:
- end = match_start
- else:
- end = length
-
- token = raw[start:end]
- current = end
-
- if token == "" or token[0] == " ":
- continue
- else:
- break
-
- if token == "@":
- if raw[start:start+11] == "@interface ":
- current = start + 11
- tokens.append("@interface")
- continue
- elif token == '/':
- if raw[start:start+2] == "//":
- current = length
- continue
- elif token == '"':
- current, string_token = self.tokenize_string(raw, length, current)
- tokens.append(token + string_token)
- continue
-
- tokens.append(token)
-
- return tokens
-
- def tokenize_string(self, raw, length, current):
- start = current
- end = length
- while start < end:
- match = V2Tokenizer.STRING_SPECIAL.search(raw, start)
- if match:
- if match.group() == '"':
- end = match.end()
- break
- elif match.group() == '\\':
- # ignore whatever is after the slash
- start += 2
- else:
- raise ValueError("Unexpected match: `%s`" % (match.group()))
- else:
- raise ValueError("Unexpected EOF tokenizing string: `%s`" % (raw[current - 1:],))
-
- token = raw[current:end]
- return end, token
-
-class V2LineParser(object):
- __slots__ = ["tokenized", "current", "len"]
-
- FIELD_KINDS = ("field", "property", "enum_constant")
- MODIFIERS = set("public protected internal private abstract default static final transient volatile synchronized native operator sealed strictfp infix inline suspend vararg".split())
- JAVA_LANG_TYPES = set("AbstractMethodError AbstractStringBuilder Appendable ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException AssertionError AutoCloseable Boolean BootstrapMethodError Byte Character CharSequence Class ClassCastException ClassCircularityError ClassFormatError ClassLoader ClassNotFoundException Cloneable CloneNotSupportedException Comparable Compiler Deprecated Double Enum EnumConstantNotPresentException Error Exception ExceptionInInitializerError Float FunctionalInterface IllegalAccessError IllegalAccessException IllegalArgumentException IllegalMonitorStateException IllegalStateException IllegalThreadStateException IncompatibleClassChangeError IndexOutOfBoundsException InheritableThreadLocal InstantiationError InstantiationException Integer InternalError InterruptedException Iterable LinkageError Long Math NegativeArraySizeException NoClassDefFoundError NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NullPointerException Number NumberFormatException Object OutOfMemoryError Override Package package-info.java Process ProcessBuilder ProcessEnvironment ProcessImpl Readable ReflectiveOperationException Runnable Runtime RuntimeException RuntimePermission SafeVarargs SecurityException SecurityManager Short StackOverflowError StackTraceElement StrictMath String StringBuffer StringBuilder StringIndexOutOfBoundsException SuppressWarnings System Thread ThreadDeath ThreadGroup ThreadLocal Throwable TypeNotPresentException UNIXProcess UnknownError UnsatisfiedLinkError UnsupportedClassVersionError UnsupportedOperationException VerifyError VirtualMachineError Void".split())
-
- def __init__(self, raw):
- self.tokenized = V2Tokenizer(raw).tokenize()
- self.current = 0
- self.len = len(self.tokenized)
-
- def parse_into_method(self, method):
- method.split = []
- kind = self.parse_one_of("ctor", "method")
- method.split.append(kind)
- method.annotations = self.parse_annotations()
- method.split.extend(self.parse_modifiers())
- self.parse_matching_paren("<", ">")
- if "@Deprecated" in method.annotations:
- method.split.append("deprecated")
- if kind == "ctor":
- method.typ = "ctor"
- else:
- method.typ = self.parse_type()
- method.split.append(method.typ)
- method.name = self.parse_name()
- method.split.append(method.name)
- self.parse_token("(")
- method.detailed_args = self.parse_args()
- self.parse_token(")")
- method.throws = self.parse_throws()
- if "@interface" in method.clazz.split:
- self.parse_annotation_default()
- self.parse_token(";")
- self.parse_eof()
-
- def parse_into_class(self, clazz):
- clazz.split = []
- clazz.annotations = self.parse_annotations()
- if "@Deprecated" in clazz.annotations:
- clazz.split.append("deprecated")
- clazz.split.extend(self.parse_modifiers())
- kind = self.parse_one_of("class", "interface", "@interface", "enum")
- if kind == "enum":
- # enums are implicitly final
- clazz.split.append("final")
- clazz.split.append(kind)
- clazz.fullname = self.parse_name()
- self.parse_matching_paren("<", ">")
- extends = self.parse_extends()
- clazz.extends = extends[0] if extends else None
- clazz.implements_all = self.parse_implements()
- # The checks assume that interfaces are always found in implements, which isn't true for
- # subinterfaces.
- if not clazz.implements_all and "interface" in clazz.split:
- clazz.implements_all = [clazz.extends]
- clazz.implements = clazz.implements_all[0] if clazz.implements_all else None
- self.parse_token("{")
- self.parse_eof()
-
- def parse_into_field(self, field):
- kind = self.parse_one_of(*V2LineParser.FIELD_KINDS)
- field.split = [kind]
- field.annotations = self.parse_annotations()
- if "@Deprecated" in field.annotations:
- field.split.append("deprecated")
- field.split.extend(self.parse_modifiers())
- field.typ = self.parse_type()
- field.split.append(field.typ)
- field.name = self.parse_name()
- field.split.append(field.name)
- if self.parse_if("="):
- field.value = self.parse_value_stripped()
- else:
- field.value = None
-
- self.parse_token(";")
- self.parse_eof()
-
- def lookahead(self):
- return self.tokenized[self.current]
-
- def parse_one_of(self, *options):
- found = self.lookahead()
- if found not in options:
- raise ValueError("Parsing failed, expected one of `%s` but found `%s` in %s" % (options, found, repr(self.tokenized)))
- return self.parse_token()
-
- def parse_token(self, tok = None):
- found = self.lookahead()
- if tok is not None and found != tok:
- raise ValueError("Parsing failed, expected `%s` but found `%s` in %s" % (tok, found, repr(self.tokenized)))
- self.current += 1
- return found
-
- def eof(self):
- return self.current == self.len
-
- def parse_eof(self):
- if not self.eof():
- raise ValueError("Parsing failed, expected EOF, but %s has not been parsed in %s" % (self.tokenized[self.current:], self.tokenized))
-
- def parse_if(self, tok):
- if not self.eof() and self.lookahead() == tok:
- self.parse_token()
- return True
- return False
-
- def parse_annotations(self):
- ret = []
- while self.lookahead() == "@":
- ret.append(self.parse_annotation())
- return ret
-
- def parse_annotation(self):
- ret = self.parse_token("@") + self.parse_token()
- self.parse_matching_paren("(", ")")
- return ret
-
- def parse_matching_paren(self, open, close):
- start = self.current
- if not self.parse_if(open):
- return
- length = len(self.tokenized)
- count = 1
- while count > 0:
- if self.current == length:
- raise ValueError("Unexpected EOF looking for closing paren: `%s`" % (self.tokenized[start:],))
- t = self.parse_token()
- if t == open:
- count += 1
- elif t == close:
- count -= 1
- return self.tokenized[start:self.current]
-
- def parse_modifiers(self):
- ret = []
- while self.lookahead() in V2LineParser.MODIFIERS:
- ret.append(self.parse_token())
- return ret
-
- def parse_kotlin_nullability(self):
- t = self.lookahead()
- if t == "?" or t == "!":
- return self.parse_token()
- return None
-
- def parse_type(self):
- self.parse_annotations()
- type = self.parse_token()
- if type[-1] == '.':
- self.parse_annotations()
- type += self.parse_token()
- if type in V2LineParser.JAVA_LANG_TYPES:
- type = "java.lang." + type
- self.parse_matching_paren("<", ">")
- while True:
- t = self.lookahead()
- if t == "@":
- self.parse_annotation()
- elif t == "[]":
- type += self.parse_token()
- elif self.parse_kotlin_nullability() is not None:
- pass # discard nullability for now
- else:
- break
- return type
-
- def parse_arg_type(self):
- type = self.parse_type()
- if self.parse_if("..."):
- type += "..."
- self.parse_kotlin_nullability() # discard nullability for now
- return type
-
- def parse_name(self):
- return self.parse_token()
-
- def parse_args(self):
- args = []
- if self.lookahead() == ")":
- return args
-
- while True:
- args.append(self.parse_arg())
- if self.lookahead() == ")":
- return args
- self.parse_token(",")
-
- def parse_arg(self):
- self.parse_if("vararg") # kotlin vararg
- annotations = self.parse_annotations()
- arg = Argument(self.parse_arg_type())
- arg.annotations = annotations
- l = self.lookahead()
- if l != "," and l != ")":
- if self.lookahead() != '=':
- arg.name = self.parse_token() # kotlin argument name
- if self.parse_if('='): # kotlin default value
- arg.default = self.parse_expression()
- return arg
-
- def parse_expression(self):
- while not self.lookahead() in [')', ',', ';']:
- (self.parse_matching_paren('(', ')') or
- self.parse_matching_paren('{', '}') or
- self.parse_token())
-
- def parse_throws(self):
- ret = []
- if self.parse_if("throws"):
- ret.append(self.parse_type())
- while self.parse_if(","):
- ret.append(self.parse_type())
- return ret
-
- def parse_extends(self):
- if self.parse_if("extends"):
- return self.parse_space_delimited_type_list()
- return []
-
- def parse_implements(self):
- if self.parse_if("implements"):
- return self.parse_space_delimited_type_list()
- return []
-
- def parse_space_delimited_type_list(self, terminals = ["implements", "{"]):
- types = []
- while True:
- types.append(self.parse_type())
- if self.lookahead() in terminals:
- return types
-
- def parse_annotation_default(self):
- if self.parse_if("default"):
- self.parse_expression()
-
- def parse_value(self):
- if self.lookahead() == "{":
- return " ".join(self.parse_matching_paren("{", "}"))
- elif self.lookahead() == "(":
- return " ".join(self.parse_matching_paren("(", ")"))
- else:
- return self.parse_token()
-
- def parse_value_stripped(self):
- value = self.parse_value()
- if value[0] == '"':
- return value[1:-1]
- return value
-
-
-def _parse_stream(f, clazz_cb=None, base_f=None, out_classes_with_base=None,
- in_classes_with_base=[]):
- api = {}
- in_classes_with_base = _retry_iterator(in_classes_with_base)
-
- if base_f:
- base_classes = _retry_iterator(_parse_stream_to_generator(base_f))
- else:
- base_classes = []
-
- def handle_class(clazz):
- if clazz_cb:
- clazz_cb(clazz)
- else: # In callback mode, don't keep track of the full API
- api[clazz.fullname] = clazz
-
- def handle_missed_classes_with_base(clazz):
- for c in _yield_until_matching_class(in_classes_with_base, clazz):
- base_class = _skip_to_matching_class(base_classes, c)
- if base_class:
- handle_class(base_class)
-
- for clazz in _parse_stream_to_generator(f):
- # Before looking at clazz, let's see if there's some classes that were not present, but
- # may have an entry in the base stream.
- handle_missed_classes_with_base(clazz)
-
- base_class = _skip_to_matching_class(base_classes, clazz)
- if base_class:
- clazz.merge_from(base_class)
- if out_classes_with_base is not None:
- out_classes_with_base.append(clazz)
- handle_class(clazz)
-
- handle_missed_classes_with_base(None)
-
- return api
-
-def _parse_stream_to_generator(f):
- line = 0
- pkg = None
- clazz = None
- blame = None
- sig_format = 1
-
- re_blame = re.compile(r"^(\^?[a-z0-9]{7,}) \(<([^>]+)>.+?\) (.+?)$")
-
- field_prefixes = map(lambda kind: " %s" % (kind,), V2LineParser.FIELD_KINDS)
- def startsWithFieldPrefix(raw):
- for prefix in field_prefixes:
- if raw.startswith(prefix):
- return True
- return False
-
- for raw in f:
- line += 1
- raw = raw.rstrip()
- match = re_blame.match(raw)
- if match is not None:
- blame = match.groups()[0:2]
- if blame[0].startswith("^"): # Outside of blame range
- blame = None
- raw = match.groups()[2]
- else:
- blame = None
-
- if line == 1 and V2Tokenizer.SIGNATURE_PREFIX in raw:
- sig_format_string = raw[len(V2Tokenizer.SIGNATURE_PREFIX):]
- if sig_format_string in ["2.0", "3.0"]:
- sig_format = 2
- else:
- raise ValueError("Unknown format: %s" % (sig_format_string,))
- elif raw.startswith("package"):
- pkg = Package(line, raw, blame)
- elif raw.startswith(" ") and raw.endswith("{"):
- clazz = Class(pkg, line, raw, blame, sig_format=sig_format)
- elif raw.startswith(" ctor"):
- clazz.ctors.append(Method(clazz, line, raw, blame, sig_format=sig_format))
- elif raw.startswith(" method"):
- clazz.methods.append(Method(clazz, line, raw, blame, sig_format=sig_format))
- elif startsWithFieldPrefix(raw):
- clazz.fields.append(Field(clazz, line, raw, blame, sig_format=sig_format))
- elif raw.startswith(" }") and clazz:
- yield clazz
-
-def _retry_iterator(it):
- """Wraps an iterator, such that calling send(True) on it will redeliver the same element"""
- for e in it:
- while True:
- retry = yield e
- if not retry:
- break
- # send() was called, asking us to redeliver clazz on next(). Still need to yield
- # a dummy value to the send() first though.
- if (yield "Returning clazz on next()"):
- raise TypeError("send() must be followed by next(), not send()")
-
-def _skip_to_matching_class(classes, needle):
- """Takes a classes iterator and consumes entries until it returns the class we're looking for
-
- This relies on classes being sorted by package and class name."""
-
- for clazz in classes:
- if clazz.pkg.name < needle.pkg.name:
- # We haven't reached the right package yet
- continue
- if clazz.pkg.name == needle.pkg.name and clazz.fullname < needle.fullname:
- # We're in the right package, but not the right class yet
- continue
- if clazz.fullname == needle.fullname:
- return clazz
- # We ran past the right class. Send it back into the generator, then report failure.
- classes.send(clazz)
- return None
-
-def _yield_until_matching_class(classes, needle):
- """Takes a class iterator and yields entries it until it reaches the class we're looking for.
-
- This relies on classes being sorted by package and class name."""
-
- for clazz in classes:
- if needle is None:
- yield clazz
- elif clazz.pkg.name < needle.pkg.name:
- # We haven't reached the right package yet
- yield clazz
- elif clazz.pkg.name == needle.pkg.name and clazz.fullname < needle.fullname:
- # We're in the right package, but not the right class yet
- yield clazz
- elif clazz.fullname == needle.fullname:
- # Class found, abort.
- return
- else:
- # We ran past the right class. Send it back into the iterator, then abort.
- classes.send(clazz)
- return
-
-class Failure():
- def __init__(self, sig, clazz, detail, error, rule, msg):
- self.clazz = clazz
- self.sig = sig
- self.error = error
- self.rule = rule
- self.msg = msg
-
- if error:
- self.head = "Error %s" % (rule) if rule else "Error"
- dump = "%s%s:%s %s" % (format(fg=RED, bg=BLACK, bold=True), self.head, format(reset=True), msg)
- else:
- self.head = "Warning %s" % (rule) if rule else "Warning"
- dump = "%s%s:%s %s" % (format(fg=YELLOW, bg=BLACK, bold=True), self.head, format(reset=True), msg)
-
- self.line = clazz.line
- blame = clazz.blame
- if detail is not None:
- dump += "\n in " + repr(detail)
- self.line = detail.line
- blame = detail.blame
- dump += "\n in " + repr(clazz)
- dump += "\n in " + repr(clazz.pkg)
- dump += "\n at line " + repr(self.line)
- if blame is not None:
- dump += "\n last modified by %s in %s" % (blame[1], blame[0])
-
- self.dump = dump
-
- def __repr__(self):
- return self.dump
-
-
-failures = {}
-
-def _fail(clazz, detail, error, rule, msg):
- """Records an API failure to be processed later."""
- global failures
-
- sig = "%s-%s-%s" % (clazz.fullname, detail.ident if detail else None, msg)
- sig = sig.replace(" deprecated ", " ")
-
- failures[sig] = Failure(sig, clazz, detail, error, rule, msg)
-
-
-def warn(clazz, detail, rule, msg):
- _fail(clazz, detail, False, rule, msg)
-
-def error(clazz, detail, rule, msg):
- _fail(clazz, detail, True, rule, msg)
-
-
-noticed = {}
-
-def notice(clazz):
- global noticed
-
- noticed[clazz.fullname] = hash(clazz)
-
-
-verifiers = {}
-
-def verifier(f):
- verifiers[f.__name__] = f
- return f
-
-
-@verifier
-def verify_constants(clazz):
- """All static final constants must be FOO_NAME style."""
- if re.match("android\.R\.[a-z]+", clazz.fullname): return
- if clazz.fullname.startswith("android.os.Build"): return
- if clazz.fullname == "android.system.OsConstants": return
-
- req = ["java.lang.String","byte","short","int","long","float","double","boolean","char"]
- for f in clazz.fields:
- if "static" in f.split and "final" in f.split:
- if re.match("[A-Z0-9_]+", f.name) is None:
- error(clazz, f, "C2", "Constant field names must be FOO_NAME")
- if f.typ != "java.lang.String":
- if f.name.startswith("MIN_") or f.name.startswith("MAX_"):
- warn(clazz, f, "C8", "If min/max could change in future, make them dynamic methods")
- if f.typ in req and f.value is None:
- error(clazz, f, None, "All constants must be defined at compile time")
-
-@verifier
-def verify_enums(clazz):
- """Enums are bad, mmkay?"""
- if clazz.extends == "java.lang.Enum" or "enum" in clazz.split:
- error(clazz, None, "F5", "Enums are not allowed")
-
-@verifier
-def verify_class_names(clazz):
- """Try catching malformed class names like myMtp or MTPUser."""
- if clazz.fullname.startswith("android.opengl"): return
- if clazz.fullname.startswith("android.renderscript"): return
- if re.match("android\.R\.[a-z]+", clazz.fullname): return
-
- if re.search("[A-Z]{2,}", clazz.name) is not None:
- warn(clazz, None, "S1", "Class names with acronyms should be Mtp not MTP")
- if re.match("[^A-Z]", clazz.name):
- error(clazz, None, "S1", "Class must start with uppercase char")
- if clazz.name.endswith("Impl"):
- error(clazz, None, None, "Don't expose your implementation details")
-
-
-@verifier
-def verify_method_names(clazz):
- """Try catching malformed method names, like Foo() or getMTU()."""
- if clazz.fullname.startswith("android.opengl"): return
- if clazz.fullname.startswith("android.renderscript"): return
- if clazz.fullname == "android.system.OsConstants": return
-
- for m in clazz.methods:
- if re.search("[A-Z]{2,}", m.name) is not None:
- warn(clazz, m, "S1", "Method names with acronyms should be getMtu() instead of getMTU()")
- if re.match("[^a-z]", m.name):
- error(clazz, m, "S1", "Method name must start with lowercase char")
-
-
-@verifier
-def verify_callbacks(clazz):
- """Verify Callback classes.
- All methods must follow onFoo() naming style."""
- if clazz.fullname == "android.speech.tts.SynthesisCallback": return
-
- if clazz.name.endswith("Callbacks"):
- error(clazz, None, "L1", "Callback class names should be singular")
- if clazz.name.endswith("Observer"):
- warn(clazz, None, "L1", "Class should be named FooCallback")
-
- if clazz.name.endswith("Callback"):
- for m in clazz.methods:
- if not re.match("on[A-Z][a-z]*", m.name):
- error(clazz, m, "L1", "Callback method names must be onFoo() style")
-
-
-@verifier
-def verify_listeners(clazz):
- """Verify Listener classes.
- All Listener classes must be interface.
- All methods must follow onFoo() naming style.
- If only a single method, it must match class name:
- interface OnFooListener { void onFoo() }"""
-
- if clazz.name.endswith("Listener"):
- if "abstract" in clazz.split and "class" in clazz.split:
- error(clazz, None, "L1", "Listeners should be an interface, or otherwise renamed Callback")
-
- for m in clazz.methods:
- if not re.match("on[A-Z][a-z]*", m.name):
- error(clazz, m, "L1", "Listener method names must be onFoo() style")
-
- if len(clazz.methods) == 1 and clazz.name.startswith("On"):
- m = clazz.methods[0]
- if (m.name + "Listener").lower() != clazz.name.lower():
- error(clazz, m, "L1", "Single listener method name must match class name")
-
-
-@verifier
-def verify_actions(clazz):
- """Verify intent actions.
- All action names must be named ACTION_FOO.
- All action values must be scoped by package and match name:
- package android.foo {
- String ACTION_BAR = "android.foo.action.BAR";
- }"""
- for f in clazz.fields:
- if f.value is None: continue
- if f.name.startswith("EXTRA_"): continue
- if f.name == "SERVICE_INTERFACE" or f.name == "PROVIDER_INTERFACE": continue
- if "INTERACTION" in f.name: continue
-
- if "static" in f.split and "final" in f.split and f.typ == "java.lang.String":
- if "_ACTION" in f.name or "ACTION_" in f.name or ".action." in f.value.lower():
- if not f.name.startswith("ACTION_"):
- error(clazz, f, "C3", "Intent action constant name must be ACTION_FOO")
- else:
- if clazz.fullname == "android.content.Intent":
- prefix = "android.intent.action"
- elif clazz.fullname == "android.provider.Settings":
- prefix = "android.settings"
- elif clazz.fullname == "android.app.admin.DevicePolicyManager" or clazz.fullname == "android.app.admin.DeviceAdminReceiver":
- prefix = "android.app.action"
- else:
- prefix = clazz.pkg.name + ".action"
- expected = prefix + "." + f.name[7:]
- if f.value != expected:
- error(clazz, f, "C4", "Inconsistent action value; expected '%s'" % (expected))
-
-
-@verifier
-def verify_extras(clazz):
- """Verify intent extras.
- All extra names must be named EXTRA_FOO.
- All extra values must be scoped by package and match name:
- package android.foo {
- String EXTRA_BAR = "android.foo.extra.BAR";
- }"""
- if clazz.fullname == "android.app.Notification": return
- if clazz.fullname == "android.appwidget.AppWidgetManager": return
-
- for f in clazz.fields:
- if f.value is None: continue
- if f.name.startswith("ACTION_"): continue
-
- if "static" in f.split and "final" in f.split and f.typ == "java.lang.String":
- if "_EXTRA" in f.name or "EXTRA_" in f.name or ".extra" in f.value.lower():
- if not f.name.startswith("EXTRA_"):
- error(clazz, f, "C3", "Intent extra must be EXTRA_FOO")
- else:
- if clazz.pkg.name == "android.content" and clazz.name == "Intent":
- prefix = "android.intent.extra"
- elif clazz.pkg.name == "android.app.admin":
- prefix = "android.app.extra"
- else:
- prefix = clazz.pkg.name + ".extra"
- expected = prefix + "." + f.name[6:]
- if f.value != expected:
- error(clazz, f, "C4", "Inconsistent extra value; expected '%s'" % (expected))
-
-
-@verifier
-def verify_equals(clazz):
- """Verify that equals() and hashCode() must be overridden together."""
- eq = False
- hc = False
- for m in clazz.methods:
- if "static" in m.split: continue
- if m.sig_matches("boolean", "equals", ["java.lang.Object"]): eq = True
- if m.sig_matches("int", "hashCode", []): hc = True
- if eq != hc:
- error(clazz, None, "M8", "Must override both equals and hashCode; missing one")
-
-
-@verifier
-def verify_parcelable(clazz):
- """Verify that Parcelable objects aren't hiding required bits."""
- if clazz.implements == "android.os.Parcelable":
- creator = [ i for i in clazz.fields if i.name == "CREATOR" ]
- write = [ i for i in clazz.methods if i.name == "writeToParcel" ]
- describe = [ i for i in clazz.methods if i.name == "describeContents" ]
-
- if len(creator) == 0 or len(write) == 0 or len(describe) == 0:
- error(clazz, None, "FW3", "Parcelable requires CREATOR, writeToParcel, and describeContents; missing one")
-
- if "final" not in clazz.split:
- error(clazz, None, "FW8", "Parcelable classes must be final")
-
- for c in clazz.ctors:
- if c.args == ["android.os.Parcel"]:
- error(clazz, c, "FW3", "Parcelable inflation is exposed through CREATOR, not raw constructors")
-
-
-@verifier
-def verify_protected(clazz):
- """Verify that no protected methods or fields are allowed."""
- for m in clazz.methods:
- if m.name == "finalize": continue
- if "protected" in m.split:
- error(clazz, m, "M7", "Protected methods not allowed; must be public")
- for f in clazz.fields:
- if "protected" in f.split:
- error(clazz, f, "M7", "Protected fields not allowed; must be public")
-
-
-@verifier
-def verify_fields(clazz):
- """Verify that all exposed fields are final.
- Exposed fields must follow myName style.
- Catch internal mFoo objects being exposed."""
-
- IGNORE_BARE_FIELDS = [
- "android.app.ActivityManager.RecentTaskInfo",
- "android.app.Notification",
- "android.content.pm.ActivityInfo",
- "android.content.pm.ApplicationInfo",
- "android.content.pm.ComponentInfo",
- "android.content.pm.ResolveInfo",
- "android.content.pm.FeatureGroupInfo",
- "android.content.pm.InstrumentationInfo",
- "android.content.pm.PackageInfo",
- "android.content.pm.PackageItemInfo",
- "android.content.res.Configuration",
- "android.graphics.BitmapFactory.Options",
- "android.os.Message",
- "android.system.StructPollfd",
- ]
-
- for f in clazz.fields:
- if not "final" in f.split:
- if clazz.fullname in IGNORE_BARE_FIELDS:
- pass
- elif clazz.fullname.endswith("LayoutParams"):
- pass
- elif clazz.fullname.startswith("android.util.Mutable"):
- pass
- else:
- error(clazz, f, "F2", "Bare fields must be marked final, or add accessors if mutable")
-
- if "static" not in f.split and "property" not in f.split:
- if not re.match("[a-z]([a-zA-Z]+)?", f.name):
- error(clazz, f, "S1", "Non-static fields must be named using myField style")
-
- if re.match("[ms][A-Z]", f.name):
- error(clazz, f, "F1", "Internal objects must not be exposed")
-
- if re.match("[A-Z_]+", f.name):
- if "static" not in f.split or "final" not in f.split:
- error(clazz, f, "C2", "Constants must be marked static final")
-
-
-@verifier
-def verify_register(clazz):
- """Verify parity of registration methods.
- Callback objects use register/unregister methods.
- Listener objects use add/remove methods."""
- methods = [ m.name for m in clazz.methods ]
- for m in clazz.methods:
- if "Callback" in m.raw:
- if m.name.startswith("register"):
- other = "unregister" + m.name[8:]
- if other not in methods:
- error(clazz, m, "L2", "Missing unregister method")
- if m.name.startswith("unregister"):
- other = "register" + m.name[10:]
- if other not in methods:
- error(clazz, m, "L2", "Missing register method")
-
- if m.name.startswith("add") or m.name.startswith("remove"):
- error(clazz, m, "L3", "Callback methods should be named register/unregister")
-
- if "Listener" in m.raw:
- if m.name.startswith("add"):
- other = "remove" + m.name[3:]
- if other not in methods:
- error(clazz, m, "L2", "Missing remove method")
- if m.name.startswith("remove") and not m.name.startswith("removeAll"):
- other = "add" + m.name[6:]
- if other not in methods:
- error(clazz, m, "L2", "Missing add method")
-
- if m.name.startswith("register") or m.name.startswith("unregister"):
- error(clazz, m, "L3", "Listener methods should be named add/remove")
-
-
-@verifier
-def verify_sync(clazz):
- """Verify synchronized methods aren't exposed."""
- for m in clazz.methods:
- if "synchronized" in m.split:
- error(clazz, m, "M5", "Internal locks must not be exposed")
-
-
-@verifier
-def verify_intent_builder(clazz):
- """Verify that Intent builders are createFooIntent() style."""
- if clazz.name == "Intent": return
-
- for m in clazz.methods:
- if m.typ == "android.content.Intent":
- if m.name.startswith("create") and m.name.endswith("Intent"):
- pass
- else:
- warn(clazz, m, "FW1", "Methods creating an Intent should be named createFooIntent()")
-
-
-@verifier
-def verify_helper_classes(clazz):
- """Verify that helper classes are named consistently with what they extend.
- All developer extendable methods should be named onFoo()."""
- test_methods = False
- if clazz.extends == "android.app.Service":
- test_methods = True
- if not clazz.name.endswith("Service"):
- error(clazz, None, "CL4", "Inconsistent class name; should be FooService")
-
- found = False
- for f in clazz.fields:
- if f.name == "SERVICE_INTERFACE":
- found = True
- if f.value != clazz.fullname:
- error(clazz, f, "C4", "Inconsistent interface constant; expected '%s'" % (clazz.fullname))
-
- if clazz.extends == "android.content.ContentProvider":
- test_methods = True
- if not clazz.name.endswith("Provider"):
- error(clazz, None, "CL4", "Inconsistent class name; should be FooProvider")
-
- found = False
- for f in clazz.fields:
- if f.name == "PROVIDER_INTERFACE":
- found = True
- if f.value != clazz.fullname:
- error(clazz, f, "C4", "Inconsistent interface constant; expected '%s'" % (clazz.fullname))
-
- if clazz.extends == "android.content.BroadcastReceiver":
- test_methods = True
- if not clazz.name.endswith("Receiver"):
- error(clazz, None, "CL4", "Inconsistent class name; should be FooReceiver")
-
- if clazz.extends == "android.app.Activity":
- test_methods = True
- if not clazz.name.endswith("Activity"):
- error(clazz, None, "CL4", "Inconsistent class name; should be FooActivity")
-
- if test_methods:
- for m in clazz.methods:
- if "final" in m.split: continue
- if not re.match("on[A-Z]", m.name):
- if "abstract" in m.split:
- warn(clazz, m, None, "Methods implemented by developers should be named onFoo()")
- else:
- warn(clazz, m, None, "If implemented by developer, should be named onFoo(); otherwise consider marking final")
-
-
-@verifier
-def verify_builder(clazz):
- """Verify builder classes.
- Methods should return the builder to enable chaining."""
- if clazz.extends: return
- if not clazz.name.endswith("Builder"): return
-
- if clazz.name != "Builder":
- warn(clazz, None, None, "Builder should be defined as inner class")
-
- has_build = False
- for m in clazz.methods:
- if m.name == "build":
- has_build = True
- continue
-
- if m.name.startswith("get"): continue
- if m.name.startswith("clear"): continue
-
- if m.name.startswith("with"):
- warn(clazz, m, None, "Builder methods names should use setFoo() style")
-
- if m.name.startswith("set"):
- if not m.typ.endswith(clazz.fullname):
- warn(clazz, m, "M4", "Methods must return the builder object")
-
- if not has_build:
- warn(clazz, None, None, "Missing build() method")
-
- if "final" not in clazz.split:
- error(clazz, None, None, "Builder should be final")
-
-
-@verifier
-def verify_aidl(clazz):
- """Catch people exposing raw AIDL."""
- if clazz.extends == "android.os.Binder" or clazz.implements == "android.os.IInterface":
- error(clazz, None, None, "Raw AIDL interfaces must not be exposed")
-
-
-@verifier
-def verify_internal(clazz):
- """Catch people exposing internal classes."""
- if clazz.pkg.name.startswith("com.android"):
- error(clazz, None, None, "Internal classes must not be exposed")
-
-def layering_build_ranking(ranking_list):
- r = {}
- for rank, ps in enumerate(ranking_list):
- if not isinstance(ps, list):
- ps = [ps]
- for p in ps:
- rs = r
- for n in p.split('.'):
- if n not in rs:
- rs[n] = {}
- rs = rs[n]
- rs['-rank'] = rank
- return r
-
-LAYERING_PACKAGE_RANKING = layering_build_ranking([
- ["android.service","android.accessibilityservice","android.inputmethodservice","android.printservice","android.appwidget","android.webkit","android.preference","android.gesture","android.print"],
- "android.app",
- "android.widget",
- "android.view",
- "android.animation",
- "android.provider",
- ["android.content","android.graphics.drawable"],
- "android.database",
- "android.text",
- "android.graphics",
- "android.os",
- "android.util"
-])
-
-@verifier
-def verify_layering(clazz):
- """Catch package layering violations.
- For example, something in android.os depending on android.app."""
-
- def rank(p):
- r = None
- l = LAYERING_PACKAGE_RANKING
- for n in p.split('.'):
- if n in l:
- l = l[n]
- if '-rank' in l:
- r = l['-rank']
- else:
- break
- return r
-
- cr = rank(clazz.pkg.name)
- if cr is None: return
-
- for f in clazz.fields:
- ir = rank(f.typ)
- if ir is not None and ir < cr:
- warn(clazz, f, "FW6", "Field type violates package layering")
-
- for m in itertools.chain(clazz.methods, clazz.ctors):
- ir = rank(m.typ)
- if ir is not None and ir < cr:
- warn(clazz, m, "FW6", "Method return type violates package layering")
- for arg in m.args:
- ir = rank(arg)
- if ir is not None and ir < cr:
- warn(clazz, m, "FW6", "Method argument type violates package layering")
-
-
-@verifier
-def verify_boolean(clazz):
- """Verifies that boolean accessors are named correctly.
- For example, hasFoo() and setHasFoo()."""
-
- def is_get(m): return len(m.args) == 0 and m.typ == "boolean"
- def is_set(m): return len(m.args) == 1 and m.args[0] == "boolean"
-
- gets = [ m for m in clazz.methods if is_get(m) ]
- sets = [ m for m in clazz.methods if is_set(m) ]
-
- def error_if_exists(methods, trigger, expected, actual):
- for m in methods:
- if m.name == actual:
- error(clazz, m, "M6", "Symmetric method for %s must be named %s" % (trigger, expected))
-
- for m in clazz.methods:
- if is_get(m):
- if re.match("is[A-Z]", m.name):
- target = m.name[2:]
- expected = "setIs" + target
- error_if_exists(sets, m.name, expected, "setHas" + target)
- elif re.match("has[A-Z]", m.name):
- target = m.name[3:]
- expected = "setHas" + target
- error_if_exists(sets, m.name, expected, "setIs" + target)
- error_if_exists(sets, m.name, expected, "set" + target)
- elif re.match("get[A-Z]", m.name):
- target = m.name[3:]
- expected = "set" + target
- error_if_exists(sets, m.name, expected, "setIs" + target)
- error_if_exists(sets, m.name, expected, "setHas" + target)
-
- if is_set(m):
- if re.match("set[A-Z]", m.name):
- target = m.name[3:]
- expected = "get" + target
- error_if_exists(sets, m.name, expected, "is" + target)
- error_if_exists(sets, m.name, expected, "has" + target)
-
-
-@verifier
-def verify_collections(clazz):
- """Verifies that collection types are interfaces."""
- if clazz.fullname == "android.os.Bundle": return
- if clazz.fullname == "android.os.Parcel": return
-
- bad = ["java.util.Vector", "java.util.LinkedList", "java.util.ArrayList", "java.util.Stack",
- "java.util.HashMap", "java.util.HashSet", "android.util.ArraySet", "android.util.ArrayMap"]
- for m in clazz.methods:
- if m.typ in bad:
- error(clazz, m, "CL2", "Return type is concrete collection; must be higher-level interface")
- for arg in m.args:
- if arg in bad:
- error(clazz, m, "CL2", "Argument is concrete collection; must be higher-level interface")
-
-
-@verifier
-def verify_uris(clazz):
- bad = ["java.net.URL", "java.net.URI", "android.net.URL"]
-
- for f in clazz.fields:
- if f.typ in bad:
- error(clazz, f, None, "Field must be android.net.Uri instead of " + f.typ)
-
- for m in clazz.methods + clazz.ctors:
- if m.typ in bad:
- error(clazz, m, None, "Must return android.net.Uri instead of " + m.typ)
- for arg in m.args:
- if arg in bad:
- error(clazz, m, None, "Argument must take android.net.Uri instead of " + arg)
-
-
-@verifier
-def verify_flags(clazz):
- """Verifies that flags are non-overlapping."""
- known = collections.defaultdict(int)
- for f in clazz.fields:
- if "FLAG_" in f.name:
- try:
- val = int(f.value)
- except:
- continue
-
- scope = f.name[0:f.name.index("FLAG_")]
- if val & known[scope]:
- warn(clazz, f, "C1", "Found overlapping flag constant value")
- known[scope] |= val
-
-
-@verifier
-def verify_exception(clazz):
- """Verifies that methods don't throw generic exceptions."""
- for m in clazz.methods:
- for t in m.throws:
- if t in ["java.lang.Exception", "java.lang.Throwable", "java.lang.Error"]:
- error(clazz, m, "S1", "Methods must not throw generic exceptions")
-
- if t in ["android.os.RemoteException"]:
- if clazz.fullname == "android.content.ContentProviderClient": continue
- if clazz.fullname == "android.os.Binder": continue
- if clazz.fullname == "android.os.IBinder": continue
-
- error(clazz, m, "FW9", "Methods calling into system server should rethrow RemoteException as RuntimeException")
-
- if len(m.args) == 0 and t in ["java.lang.IllegalArgumentException", "java.lang.NullPointerException"]:
- warn(clazz, m, "S1", "Methods taking no arguments should throw IllegalStateException")
-
-
-GOOGLE_IGNORECASE = re.compile("google", re.IGNORECASE)
-
-# Not marked as @verifier, because it is only conditionally applied.
-def verify_google(clazz):
- """Verifies that APIs never reference Google."""
-
- if GOOGLE_IGNORECASE.search(clazz.raw) is not None:
- error(clazz, None, None, "Must never reference Google")
-
- for test in clazz.ctors, clazz.fields, clazz.methods:
- for t in test:
- if GOOGLE_IGNORECASE.search(t.raw) is not None:
- error(clazz, t, None, "Must never reference Google")
-
-
-@verifier
-def verify_bitset(clazz):
- """Verifies that we avoid using heavy BitSet."""
-
- for f in clazz.fields:
- if f.typ == "java.util.BitSet":
- error(clazz, f, None, "Field type must not be heavy BitSet")
-
- for m in clazz.methods:
- if m.typ == "java.util.BitSet":
- error(clazz, m, None, "Return type must not be heavy BitSet")
- for arg in m.args:
- if arg == "java.util.BitSet":
- error(clazz, m, None, "Argument type must not be heavy BitSet")
-
-
-@verifier
-def verify_manager(clazz):
- """Verifies that FooManager is only obtained from Context."""
-
- if not clazz.name.endswith("Manager"): return
-
- for c in clazz.ctors:
- error(clazz, c, None, "Managers must always be obtained from Context; no direct constructors")
-
- for m in clazz.methods:
- if m.typ == clazz.fullname:
- error(clazz, m, None, "Managers must always be obtained from Context")
-
-
-@verifier
-def verify_boxed(clazz):
- """Verifies that methods avoid boxed primitives."""
-
- boxed = ["java.lang.Number","java.lang.Byte","java.lang.Double","java.lang.Float","java.lang.Integer","java.lang.Long","java.lang.Short"]
-
- for c in clazz.ctors:
- for arg in c.args:
- if arg in boxed:
- error(clazz, c, "M11", "Must avoid boxed primitives")
-
- for f in clazz.fields:
- if f.typ in boxed:
- error(clazz, f, "M11", "Must avoid boxed primitives")
-
- for m in clazz.methods:
- if m.typ in boxed:
- error(clazz, m, "M11", "Must avoid boxed primitives")
- for arg in m.args:
- if arg in boxed:
- error(clazz, m, "M11", "Must avoid boxed primitives")
-
-
-@verifier
-def verify_static_utils(clazz):
- """Verifies that helper classes can't be constructed."""
- if clazz.fullname.startswith("android.opengl"): return
- if clazz.fullname.startswith("android.R"): return
-
- # Only care about classes with default constructors
- if len(clazz.ctors) == 1 and len(clazz.ctors[0].args) == 0:
- test = []
- test.extend(clazz.fields)
- test.extend(clazz.methods)
-
- if len(test) == 0: return
- for t in test:
- if "static" not in t.split:
- return
-
- error(clazz, None, None, "Fully-static utility classes must not have constructor")
-
-
-# @verifier # Disabled for now
-def verify_overload_args(clazz):
- """Verifies that method overloads add new arguments at the end."""
- if clazz.fullname.startswith("android.opengl"): return
-
- overloads = collections.defaultdict(list)
- for m in clazz.methods:
- if "deprecated" in m.split: continue
- overloads[m.name].append(m)
-
- for name, methods in overloads.items():
- if len(methods) <= 1: continue
-
- # Look for arguments common across all overloads
- def cluster(args):
- count = collections.defaultdict(int)
- res = set()
- for i in range(len(args)):
- a = args[i]
- res.add("%s#%d" % (a, count[a]))
- count[a] += 1
- return res
-
- common_args = cluster(methods[0].args)
- for m in methods:
- common_args = common_args & cluster(m.args)
-
- if len(common_args) == 0: continue
-
- # Require that all common arguments are present at start of signature
- locked_sig = None
- for m in methods:
- sig = m.args[0:len(common_args)]
- if not common_args.issubset(cluster(sig)):
- warn(clazz, m, "M2", "Expected common arguments [%s] at beginning of overloaded method" % (", ".join(common_args)))
- elif not locked_sig:
- locked_sig = sig
- elif locked_sig != sig:
- error(clazz, m, "M2", "Expected consistent argument ordering between overloads: %s..." % (", ".join(locked_sig)))
-
-
-@verifier
-def verify_callback_handlers(clazz):
- """Verifies that methods adding listener/callback have overload
- for specifying delivery thread."""
-
- # Ignore UI packages which assume main thread
- skip = [
- "animation",
- "view",
- "graphics",
- "transition",
- "widget",
- "webkit",
- ]
- for s in skip:
- if s in clazz.pkg.name_path: return
- if s in clazz.extends_path: return
-
- # Ignore UI classes which assume main thread
- if "app" in clazz.pkg.name_path or "app" in clazz.extends_path:
- for s in ["ActionBar","Dialog","Application","Activity","Fragment","Loader"]:
- if s in clazz.fullname: return
- if "content" in clazz.pkg.name_path or "content" in clazz.extends_path:
- for s in ["Loader"]:
- if s in clazz.fullname: return
-
- found = {}
- by_name = collections.defaultdict(list)
- examine = clazz.ctors + clazz.methods
- for m in examine:
- if m.name.startswith("unregister"): continue
- if m.name.startswith("remove"): continue
- if re.match("on[A-Z]+", m.name): continue
-
- by_name[m.name].append(m)
-
- for a in m.args:
- if a.endswith("Listener") or a.endswith("Callback") or a.endswith("Callbacks"):
- found[m.name] = m
-
- for f in found.values():
- takes_handler = False
- takes_exec = False
- for m in by_name[f.name]:
- if "android.os.Handler" in m.args:
- takes_handler = True
- if "java.util.concurrent.Executor" in m.args:
- takes_exec = True
- if not takes_exec:
- warn(clazz, f, "L1", "Registration methods should have overload that accepts delivery Executor")
-
-
-@verifier
-def verify_context_first(clazz):
- """Verifies that methods accepting a Context keep it the first argument."""
- examine = clazz.ctors + clazz.methods
- for m in examine:
- if len(m.args) > 1 and m.args[0] != "android.content.Context":
- if "android.content.Context" in m.args[1:]:
- error(clazz, m, "M3", "Context is distinct, so it must be the first argument")
- if len(m.args) > 1 and m.args[0] != "android.content.ContentResolver":
- if "android.content.ContentResolver" in m.args[1:]:
- error(clazz, m, "M3", "ContentResolver is distinct, so it must be the first argument")
-
-
-@verifier
-def verify_listener_last(clazz):
- """Verifies that methods accepting a Listener or Callback keep them as last arguments."""
- examine = clazz.ctors + clazz.methods
- for m in examine:
- if "Listener" in m.name or "Callback" in m.name: continue
- found = False
- for a in m.args:
- if a.endswith("Callback") or a.endswith("Callbacks") or a.endswith("Listener"):
- found = True
- elif found:
- warn(clazz, m, "M3", "Listeners should always be at end of argument list")
-
-
-@verifier
-def verify_resource_names(clazz):
- """Verifies that resource names have consistent case."""
- if not re.match("android\.R\.[a-z]+", clazz.fullname): return
-
- # Resources defined by files are foo_bar_baz
- if clazz.name in ["anim","animator","color","dimen","drawable","interpolator","layout","transition","menu","mipmap","string","plurals","raw","xml"]:
- for f in clazz.fields:
- if re.match("config_[a-z][a-zA-Z1-9]*$", f.name): continue
- if f.name.startswith("config_"):
- error(clazz, f, None, "Expected config name to be config_fooBarBaz style")
-
- if re.match("[a-z1-9_]+$", f.name): continue
- error(clazz, f, None, "Expected resource name in this class to be foo_bar_baz style")
-
- # Resources defined inside files are fooBarBaz
- if clazz.name in ["array","attr","id","bool","fraction","integer"]:
- for f in clazz.fields:
- if re.match("config_[a-z][a-zA-Z1-9]*$", f.name): continue
- if re.match("layout_[a-z][a-zA-Z1-9]*$", f.name): continue
- if re.match("state_[a-z_]*$", f.name): continue
-
- if re.match("[a-z][a-zA-Z1-9]*$", f.name): continue
- error(clazz, f, "C7", "Expected resource name in this class to be fooBarBaz style")
-
- # Styles are FooBar_Baz
- if clazz.name in ["style"]:
- for f in clazz.fields:
- if re.match("[A-Z][A-Za-z1-9]+(_[A-Z][A-Za-z1-9]+?)*$", f.name): continue
- error(clazz, f, "C7", "Expected resource name in this class to be FooBar_Baz style")
-
-
-@verifier
-def verify_files(clazz):
- """Verifies that methods accepting File also accept streams."""
-
- has_file = set()
- has_stream = set()
-
- test = []
- test.extend(clazz.ctors)
- test.extend(clazz.methods)
-
- for m in test:
- if "java.io.File" in m.args:
- has_file.add(m)
- if "java.io.FileDescriptor" in m.args or "android.os.ParcelFileDescriptor" in m.args or "java.io.InputStream" in m.args or "java.io.OutputStream" in m.args:
- has_stream.add(m.name)
-
- for m in has_file:
- if m.name not in has_stream:
- warn(clazz, m, "M10", "Methods accepting File should also accept FileDescriptor or streams")
-
-
-@verifier
-def verify_manager_list(clazz):
- """Verifies that managers return List<? extends Parcelable> instead of arrays."""
-
- if not clazz.name.endswith("Manager"): return
-
- for m in clazz.methods:
- if m.typ.startswith("android.") and m.typ.endswith("[]"):
- warn(clazz, m, None, "Methods should return List<? extends Parcelable> instead of Parcelable[] to support ParceledListSlice under the hood")
-
-
-@verifier
-def verify_abstract_inner(clazz):
- """Verifies that abstract inner classes are static."""
-
- if re.match(".+?\.[A-Z][^\.]+\.[A-Z]", clazz.fullname):
- if "abstract" in clazz.split and "static" not in clazz.split:
- warn(clazz, None, None, "Abstract inner classes should be static to improve testability")
-
-
-@verifier
-def verify_runtime_exceptions(clazz):
- """Verifies that runtime exceptions aren't listed in throws."""
-
- banned = [
- "java.lang.NullPointerException",
- "java.lang.ClassCastException",
- "java.lang.IndexOutOfBoundsException",
- "java.lang.reflect.UndeclaredThrowableException",
- "java.lang.reflect.MalformedParametersException",
- "java.lang.reflect.MalformedParameterizedTypeException",
- "java.lang.invoke.WrongMethodTypeException",
- "java.lang.EnumConstantNotPresentException",
- "java.lang.IllegalMonitorStateException",
- "java.lang.SecurityException",
- "java.lang.UnsupportedOperationException",
- "java.lang.annotation.AnnotationTypeMismatchException",
- "java.lang.annotation.IncompleteAnnotationException",
- "java.lang.TypeNotPresentException",
- "java.lang.IllegalStateException",
- "java.lang.ArithmeticException",
- "java.lang.IllegalArgumentException",
- "java.lang.ArrayStoreException",
- "java.lang.NegativeArraySizeException",
- "java.util.MissingResourceException",
- "java.util.EmptyStackException",
- "java.util.concurrent.CompletionException",
- "java.util.concurrent.RejectedExecutionException",
- "java.util.IllformedLocaleException",
- "java.util.ConcurrentModificationException",
- "java.util.NoSuchElementException",
- "java.io.UncheckedIOException",
- "java.time.DateTimeException",
- "java.security.ProviderException",
- "java.nio.BufferUnderflowException",
- "java.nio.BufferOverflowException",
- ]
-
- examine = clazz.ctors + clazz.methods
- for m in examine:
- for t in m.throws:
- if t in banned:
- error(clazz, m, None, "Methods must not mention RuntimeException subclasses in throws clauses")
-
-
-@verifier
-def verify_error(clazz):
- """Verifies that we always use Exception instead of Error."""
- if not clazz.extends: return
- if clazz.extends.endswith("Error"):
- error(clazz, None, None, "Trouble must be reported through an Exception, not Error")
- if clazz.extends.endswith("Exception") and not clazz.name.endswith("Exception"):
- error(clazz, None, None, "Exceptions must be named FooException")
-
-
-@verifier
-def verify_units(clazz):
- """Verifies that we use consistent naming for units."""
-
- # If we find K, recommend replacing with V
- bad = {
- "Ns": "Nanos",
- "Ms": "Millis or Micros",
- "Sec": "Seconds", "Secs": "Seconds",
- "Hr": "Hours", "Hrs": "Hours",
- "Mo": "Months", "Mos": "Months",
- "Yr": "Years", "Yrs": "Years",
- "Byte": "Bytes", "Space": "Bytes",
- }
-
- for m in clazz.methods:
- if m.typ not in ["short","int","long"]: continue
- for k, v in bad.iteritems():
- if m.name.endswith(k):
- error(clazz, m, None, "Expected method name units to be " + v)
- if m.name.endswith("Nanos") or m.name.endswith("Micros"):
- warn(clazz, m, None, "Returned time values are strongly encouraged to be in milliseconds unless you need the extra precision")
- if m.name.endswith("Seconds"):
- error(clazz, m, None, "Returned time values must be in milliseconds")
-
- for m in clazz.methods:
- typ = m.typ
- if typ == "void":
- if len(m.args) != 1: continue
- typ = m.args[0]
-
- if m.name.endswith("Fraction") and typ != "float":
- error(clazz, m, None, "Fractions must use floats")
- if m.name.endswith("Percentage") and typ != "int":
- error(clazz, m, None, "Percentage must use ints")
-
-
-@verifier
-def verify_closable(clazz):
- """Verifies that classes are AutoClosable."""
- if "java.lang.AutoCloseable" in clazz.implements_all: return
- if "java.io.Closeable" in clazz.implements_all: return
-
- for m in clazz.methods:
- if len(m.args) > 0: continue
- if m.name in ["close","release","destroy","finish","finalize","disconnect","shutdown","stop","free","quit"]:
- warn(clazz, m, None, "Classes that release resources should implement AutoClosable and CloseGuard")
- return
-
-
-@verifier
-def verify_member_name_not_kotlin_keyword(clazz):
- """Prevent method names which are keywords in Kotlin."""
-
- # https://kotlinlang.org/docs/reference/keyword-reference.html#hard-keywords
- # This list does not include Java keywords as those are already impossible to use.
- keywords = [
- 'as',
- 'fun',
- 'in',
- 'is',
- 'object',
- 'typealias',
- 'val',
- 'var',
- 'when',
- ]
-
- for m in clazz.methods:
- if m.name in keywords:
- error(clazz, m, None, "Method name must not be a Kotlin keyword")
- for f in clazz.fields:
- if f.name in keywords:
- error(clazz, f, None, "Field name must not be a Kotlin keyword")
-
-
-@verifier
-def verify_method_name_not_kotlin_operator(clazz):
- """Warn about method names which become operators in Kotlin."""
-
- binary = set()
-
- def unique_binary_op(m, op):
- if op in binary:
- error(clazz, m, None, "Only one of '{0}' and '{0}Assign' methods should be present for Kotlin".format(op))
- binary.add(op)
-
- for m in clazz.methods:
- if 'static' in m.split or 'operator' in m.split:
- continue
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#unary-prefix-operators
- if m.name in ['unaryPlus', 'unaryMinus', 'not'] and len(m.args) == 0:
- warn(clazz, m, None, "Method can be invoked as a unary operator from Kotlin")
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#increments-and-decrements
- if m.name in ['inc', 'dec'] and len(m.args) == 0 and m.typ != 'void':
- # This only applies if the return type is the same or a subtype of the enclosing class, but we have no
- # practical way of checking that relationship here.
- warn(clazz, m, None, "Method can be invoked as a pre/postfix inc/decrement operator from Kotlin")
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#arithmetic
- if m.name in ['plus', 'minus', 'times', 'div', 'rem', 'mod', 'rangeTo'] and len(m.args) == 1:
- warn(clazz, m, None, "Method can be invoked as a binary operator from Kotlin")
- unique_binary_op(m, m.name)
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#in
- if m.name == 'contains' and len(m.args) == 1 and m.typ == 'boolean':
- warn(clazz, m, None, "Method can be invoked as a 'in' operator from Kotlin")
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#indexed
- if (m.name == 'get' and len(m.args) > 0) or (m.name == 'set' and len(m.args) > 1):
- warn(clazz, m, None, "Method can be invoked with an indexing operator from Kotlin")
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#invoke
- if m.name == 'invoke':
- warn(clazz, m, None, "Method can be invoked with function call syntax from Kotlin")
-
- # https://kotlinlang.org/docs/reference/operator-overloading.html#assignments
- if m.name in ['plusAssign', 'minusAssign', 'timesAssign', 'divAssign', 'remAssign', 'modAssign'] \
- and len(m.args) == 1 \
- and m.typ == 'void':
- warn(clazz, m, None, "Method can be invoked as a compound assignment operator from Kotlin")
- unique_binary_op(m, m.name[:-6]) # Remove 'Assign' suffix
-
-
-@verifier
-def verify_collections_over_arrays(clazz):
- """Warn that [] should be Collections."""
-
- if "@interface" in clazz.split:
- return
-
- safe = ["java.lang.String[]","byte[]","short[]","int[]","long[]","float[]","double[]","boolean[]","char[]"]
- for m in clazz.methods:
- if m.typ.endswith("[]") and m.typ not in safe:
- warn(clazz, m, None, "Method should return Collection<> (or subclass) instead of raw array")
- for arg in m.args:
- if arg.endswith("[]") and arg not in safe:
- warn(clazz, m, None, "Method argument should be Collection<> (or subclass) instead of raw array")
-
-
-@verifier
-def verify_user_handle(clazz):
- """Methods taking UserHandle should be ForUser or AsUser."""
- if clazz.name.endswith("Listener") or clazz.name.endswith("Callback") or clazz.name.endswith("Callbacks"): return
- if clazz.fullname == "android.app.admin.DeviceAdminReceiver": return
- if clazz.fullname == "android.content.pm.LauncherApps": return
- if clazz.fullname == "android.os.UserHandle": return
- if clazz.fullname == "android.os.UserManager": return
-
- for m in clazz.methods:
- if re.match("on[A-Z]+", m.name): continue
-
- has_arg = "android.os.UserHandle" in m.args
- has_name = m.name.endswith("AsUser") or m.name.endswith("ForUser")
-
- if clazz.fullname.endswith("Manager") and has_arg:
- warn(clazz, m, None, "When a method overload is needed to target a specific "
- "UserHandle, callers should be directed to use "
- "Context.createPackageContextAsUser() and re-obtain the relevant "
- "Manager, and no new API should be added")
- elif has_arg and not has_name:
- warn(clazz, m, None, "Method taking UserHandle should be named 'doFooAsUser' "
- "or 'queryFooForUser'")
-
-
-@verifier
-def verify_params(clazz):
- """Parameter classes should be 'Params'."""
- if clazz.name.endswith("Params"): return
- if clazz.fullname == "android.app.ActivityOptions": return
- if clazz.fullname == "android.app.BroadcastOptions": return
- if clazz.fullname == "android.os.Bundle": return
- if clazz.fullname == "android.os.BaseBundle": return
- if clazz.fullname == "android.os.PersistableBundle": return
-
- bad = ["Param","Parameter","Parameters","Args","Arg","Argument","Arguments","Options","Bundle"]
- for b in bad:
- if clazz.name.endswith(b):
- error(clazz, None, None, "Classes holding a set of parameters should be called 'FooParams'")
-
-
-@verifier
-def verify_services(clazz):
- """Service name should be FOO_BAR_SERVICE = 'foo_bar'."""
- if clazz.fullname != "android.content.Context": return
-
- for f in clazz.fields:
- if f.typ != "java.lang.String": continue
- found = re.match(r"([A-Z_]+)_SERVICE", f.name)
- if found:
- expected = found.group(1).lower()
- if f.value != expected:
- error(clazz, f, "C4", "Inconsistent service value; expected '%s'" % (expected))
-
-
-@verifier
-def verify_tense(clazz):
- """Verify tenses of method names."""
- if clazz.fullname.startswith("android.opengl"): return
-
- for m in clazz.methods:
- if m.name.endswith("Enable"):
- warn(clazz, m, None, "Unexpected tense; probably meant 'enabled'")
-
-
-@verifier
-def verify_icu(clazz):
- """Verifies that richer ICU replacements are used."""
- better = {
- "java.util.TimeZone": "android.icu.util.TimeZone",
- "java.util.Calendar": "android.icu.util.Calendar",
- "java.util.Locale": "android.icu.util.ULocale",
- "java.util.ResourceBundle": "android.icu.util.UResourceBundle",
- "java.util.SimpleTimeZone": "android.icu.util.SimpleTimeZone",
- "java.util.StringTokenizer": "android.icu.util.StringTokenizer",
- "java.util.GregorianCalendar": "android.icu.util.GregorianCalendar",
- "java.lang.Character": "android.icu.lang.UCharacter",
- "java.text.BreakIterator": "android.icu.text.BreakIterator",
- "java.text.Collator": "android.icu.text.Collator",
- "java.text.DecimalFormatSymbols": "android.icu.text.DecimalFormatSymbols",
- "java.text.NumberFormat": "android.icu.text.NumberFormat",
- "java.text.DateFormatSymbols": "android.icu.text.DateFormatSymbols",
- "java.text.DateFormat": "android.icu.text.DateFormat",
- "java.text.SimpleDateFormat": "android.icu.text.SimpleDateFormat",
- "java.text.MessageFormat": "android.icu.text.MessageFormat",
- "java.text.DecimalFormat": "android.icu.text.DecimalFormat",
- }
-
- for m in clazz.ctors + clazz.methods:
- types = []
- types.extend(m.typ)
- types.extend(m.args)
- for arg in types:
- if arg in better:
- warn(clazz, m, None, "Type %s should be replaced with richer ICU type %s" % (arg, better[arg]))
-
-
-@verifier
-def verify_clone(clazz):
- """Verify that clone() isn't implemented; see EJ page 61."""
- for m in clazz.methods:
- if m.name == "clone":
- error(clazz, m, None, "Provide an explicit copy constructor instead of implementing clone()")
-
-
-@verifier
-def verify_pfd(clazz):
- """Verify that android APIs use PFD over FD."""
- if clazz.fullname == "android.os.FileUtils" or clazz.fullname == "android.system.Os":
- return
-
- examine = clazz.ctors + clazz.methods
- for m in examine:
- if m.typ == "java.io.FileDescriptor":
- error(clazz, m, "FW11", "Must use ParcelFileDescriptor")
- if m.typ == "int":
- if "Fd" in m.name or "FD" in m.name or "FileDescriptor" in m.name:
- error(clazz, m, "FW11", "Must use ParcelFileDescriptor")
- for arg in m.args:
- if arg == "java.io.FileDescriptor":
- error(clazz, m, "FW11", "Must use ParcelFileDescriptor")
-
- for f in clazz.fields:
- if f.typ == "java.io.FileDescriptor":
- error(clazz, f, "FW11", "Must use ParcelFileDescriptor")
-
-
-@verifier
-def verify_numbers(clazz):
- """Discourage small numbers types like short and byte."""
-
- discouraged = ["short","byte"]
-
- for c in clazz.ctors:
- for arg in c.args:
- if arg in discouraged:
- warn(clazz, c, "FW12", "Should avoid odd sized primitives; use int instead")
-
- for f in clazz.fields:
- if f.typ in discouraged:
- warn(clazz, f, "FW12", "Should avoid odd sized primitives; use int instead")
-
- for m in clazz.methods:
- if m.typ in discouraged:
- warn(clazz, m, "FW12", "Should avoid odd sized primitives; use int instead")
- for arg in m.args:
- if arg in discouraged:
- warn(clazz, m, "FW12", "Should avoid odd sized primitives; use int instead")
-
-
-PRIMITIVES = {"void", "int", "float", "boolean", "short", "char", "byte", "long", "double"}
-
-@verifier
-def verify_nullability(clazz):
- """Catches missing nullability annotations"""
-
- for f in clazz.fields:
- if "enum_constant" in f.split:
- continue # Enum constants are never null
- if f.value is not None and 'final' in f.split:
- continue # Nullability of constants can be inferred.
- if f.typ not in PRIMITIVES and not has_nullability(f.annotations):
- error(clazz, f, "M12", "Field must be marked either @NonNull or @Nullable")
-
- for c in clazz.ctors:
- verify_nullability_args(clazz, c)
-
- for m in clazz.methods:
- if m.name == "writeToParcel" or m.name == "onReceive" or m.name == "onBind":
- continue # Parcelable.writeToParcel(), BroadcastReceiver.onReceive(), and Service.onBind() are not yet annotated
-
- if (m.name == "equals" and m.args == ["java.lang.Object"] or
- m.name == "toString" and m.args == []):
- continue # Nullability of equals and toString is implicit.
-
- if m.typ not in PRIMITIVES and not has_nullability(m.annotations):
- error(clazz, m, "M12", "Return value must be marked either @NonNull or @Nullable")
- verify_nullability_args(clazz, m)
-
-def verify_nullability_args(clazz, m):
- for i, arg in enumerate(m.detailed_args):
- if arg.type not in PRIMITIVES and not has_nullability(arg.annotations):
- error(clazz, m, "M12", "Argument %d must be marked either @NonNull or @Nullable" % (i+1,))
-
-def has_nullability(annotations):
- return "@NonNull" in annotations or "@Nullable" in annotations
-
-
-@verifier
-def verify_intdef(clazz):
- """intdefs must be @hide, because the constant names cannot be stored in
- the stubs (only the values are, which is not useful)"""
- if "@interface" not in clazz.split:
- return
- if "@IntDef" in clazz.annotations or "@LongDef" in clazz.annotations:
- error(clazz, None, None, "@IntDef and @LongDef annotations must be @hide")
-
-
-@verifier
-def verify_singleton(clazz):
- """Catch singleton objects with constructors."""
-
- singleton = False
- for m in clazz.methods:
- if m.name.startswith("get") and m.name.endswith("Instance") and " static " in m.raw:
- singleton = True
-
- if singleton:
- for c in clazz.ctors:
- error(clazz, c, None, "Singleton classes should use getInstance() methods")
-
-
-
-def is_interesting(clazz):
- """Test if given class is interesting from an Android PoV."""
-
- if clazz.pkg.name.startswith("java"): return False
- if clazz.pkg.name.startswith("junit"): return False
- if clazz.pkg.name.startswith("org.apache"): return False
- if clazz.pkg.name.startswith("org.xml"): return False
- if clazz.pkg.name.startswith("org.json"): return False
- if clazz.pkg.name.startswith("org.w3c"): return False
- if clazz.pkg.name.startswith("android.icu."): return False
- return True
-
-
-def examine_clazz(clazz):
- """Find all style issues in the given class."""
-
- notice(clazz)
-
- if not is_interesting(clazz): return
-
- for v in verifiers.itervalues():
- v(clazz)
-
- if not ALLOW_GOOGLE: verify_google(clazz)
-
-
-def examine_stream(stream, base_stream=None, in_classes_with_base=[], out_classes_with_base=None):
- """Find all style issues in the given API stream."""
- global failures, noticed
- failures = {}
- noticed = {}
- _parse_stream(stream, examine_clazz, base_f=base_stream,
- in_classes_with_base=in_classes_with_base,
- out_classes_with_base=out_classes_with_base)
- return (failures, noticed)
-
-
-def examine_api(api):
- """Find all style issues in the given parsed API."""
- global failures
- failures = {}
- for key in sorted(api.keys()):
- examine_clazz(api[key])
- return failures
-
-
-def verify_compat(cur, prev):
- """Find any incompatible API changes between two levels."""
- global failures
-
- def class_exists(api, test):
- return test.fullname in api
-
- def ctor_exists(api, clazz, test):
- for m in clazz.ctors:
- if m.ident == test.ident: return True
- return False
-
- def all_methods(api, clazz):
- methods = list(clazz.methods)
- if clazz.extends is not None:
- methods.extend(all_methods(api, api[clazz.extends]))
- return methods
-
- def method_exists(api, clazz, test):
- methods = all_methods(api, clazz)
- for m in methods:
- if m.ident == test.ident: return True
- return False
-
- def field_exists(api, clazz, test):
- for f in clazz.fields:
- if f.ident == test.ident: return True
- return False
-
- failures = {}
- for key in sorted(prev.keys()):
- prev_clazz = prev[key]
-
- if not class_exists(cur, prev_clazz):
- error(prev_clazz, None, None, "Class removed or incompatible change")
- continue
-
- cur_clazz = cur[key]
-
- for test in prev_clazz.ctors:
- if not ctor_exists(cur, cur_clazz, test):
- error(prev_clazz, prev_ctor, None, "Constructor removed or incompatible change")
-
- methods = all_methods(prev, prev_clazz)
- for test in methods:
- if not method_exists(cur, cur_clazz, test):
- error(prev_clazz, test, None, "Method removed or incompatible change")
-
- for test in prev_clazz.fields:
- if not field_exists(cur, cur_clazz, test):
- error(prev_clazz, test, None, "Field removed or incompatible change")
-
- return failures
-
-
-def match_filter(filters, fullname):
- for f in filters:
- if fullname == f:
- return True
- if fullname.startswith(f + '.'):
- return True
- return False
-
-
-def show_deprecations_at_birth(cur, prev):
- """Show API deprecations at birth."""
- global failures
-
- # Remove all existing things so we're left with new
- for prev_clazz in prev.values():
- if prev_clazz.fullname not in cur:
- # The class was removed this release; we can safely ignore it.
- continue
-
- cur_clazz = cur[prev_clazz.fullname]
- if not is_interesting(cur_clazz): continue
-
- sigs = { i.ident: i for i in prev_clazz.ctors }
- cur_clazz.ctors = [ i for i in cur_clazz.ctors if i.ident not in sigs ]
- sigs = { i.ident: i for i in prev_clazz.methods }
- cur_clazz.methods = [ i for i in cur_clazz.methods if i.ident not in sigs ]
- sigs = { i.ident: i for i in prev_clazz.fields }
- cur_clazz.fields = [ i for i in cur_clazz.fields if i.ident not in sigs ]
-
- # Forget about class entirely when nothing new
- if len(cur_clazz.ctors) == 0 and len(cur_clazz.methods) == 0 and len(cur_clazz.fields) == 0:
- del cur[prev_clazz.fullname]
-
- for clazz in cur.values():
- if not is_interesting(clazz): continue
-
- if "deprecated" in clazz.split and not clazz.fullname in prev:
- error(clazz, None, None, "Found API deprecation at birth")
-
- for i in clazz.ctors + clazz.methods + clazz.fields:
- if "deprecated" in i.split:
- error(clazz, i, None, "Found API deprecation at birth")
-
- print "%s Deprecated at birth %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True),
- format(reset=True)))
- for f in sorted(failures):
- print failures[f]
- print
-
-
-def show_stats(cur, prev):
- """Show API stats."""
-
- stats = collections.defaultdict(int)
- for cur_clazz in cur.values():
- if not is_interesting(cur_clazz): continue
-
- if cur_clazz.fullname not in prev:
- stats['new_classes'] += 1
- stats['new_ctors'] += len(cur_clazz.ctors)
- stats['new_methods'] += len(cur_clazz.methods)
- stats['new_fields'] += len(cur_clazz.fields)
- else:
- prev_clazz = prev[cur_clazz.fullname]
-
- sigs = { i.ident: i for i in prev_clazz.ctors }
- ctors = len([ i for i in cur_clazz.ctors if i.ident not in sigs ])
- sigs = { i.ident: i for i in prev_clazz.methods }
- methods = len([ i for i in cur_clazz.methods if i.ident not in sigs ])
- sigs = { i.ident: i for i in prev_clazz.fields }
- fields = len([ i for i in cur_clazz.fields if i.ident not in sigs ])
-
- if ctors + methods + fields > 0:
- stats['extend_classes'] += 1
- stats['extend_ctors'] += ctors
- stats['extend_methods'] += methods
- stats['extend_fields'] += fields
-
- print "#", "".join([ k.ljust(20) for k in sorted(stats.keys()) ])
- print " ", "".join([ str(stats[k]).ljust(20) for k in sorted(stats.keys()) ])
-
-
-def main():
- parser = argparse.ArgumentParser(description="Enforces common Android public API design \
- patterns. It ignores lint messages from a previous API level, if provided.")
- parser.add_argument("--base-current", nargs='?', type=argparse.FileType('r'), default=None,
- help="The base current.txt to use when examining system-current.txt or"
- " test-current.txt")
- parser.add_argument("--base-previous", nargs='?', type=argparse.FileType('r'), default=None,
- help="The base previous.txt to use when examining system-previous.txt or"
- " test-previous.txt")
- parser.add_argument("--no-color", action='store_const', const=True,
- help="Disable terminal colors")
- parser.add_argument("--color", action='store_const', const=True,
- help="Use terminal colors")
- parser.add_argument("--allow-google", action='store_const', const=True,
- help="Allow references to Google")
- parser.add_argument("--show-noticed", action='store_const', const=True,
- help="Show API changes noticed")
- parser.add_argument("--show-deprecations-at-birth", action='store_const', const=True,
- help="Show API deprecations at birth")
- parser.add_argument("--show-stats", action='store_const', const=True,
- help="Show API stats")
- parser.add_argument("--title", action='store', default=None,
- help="Title to put in for display purposes")
- parser.add_argument("--filter", action="append",
- help="If provided, only show lint for the given packages or classes.")
- parser.add_argument("current.txt", type=argparse.FileType('r'), help="current.txt")
- parser.add_argument("previous.txt", nargs='?', type=argparse.FileType('r'), default=None,
- help="previous.txt")
- args = vars(parser.parse_args())
-
- if args['no_color']:
- USE_COLOR = False
- elif args['color']:
- USE_COLOR = True
- else:
- USE_COLOR = sys.stdout.isatty()
-
- if args['allow_google']:
- ALLOW_GOOGLE = True
-
- current_file = args['current.txt']
- base_current_file = args['base_current']
- previous_file = args['previous.txt']
- base_previous_file = args['base_previous']
- filters = args['filter']
- if not filters:
- filters = []
- title = args['title']
- if not title:
- title = current_file.name
-
- if args['show_deprecations_at_birth']:
- with current_file as f:
- cur = _parse_stream(f)
- with previous_file as f:
- prev = _parse_stream(f)
- show_deprecations_at_birth(cur, prev)
- sys.exit()
-
- if args['show_stats']:
- with current_file as f:
- cur = _parse_stream(f)
- with previous_file as f:
- prev = _parse_stream(f)
- show_stats(cur, prev)
- sys.exit()
-
- classes_with_base = []
-
- with current_file as f:
- if base_current_file:
- with base_current_file as base_f:
- cur_fail, cur_noticed = examine_stream(f, base_f,
- out_classes_with_base=classes_with_base)
- else:
- cur_fail, cur_noticed = examine_stream(f, out_classes_with_base=classes_with_base)
-
- if not previous_file is None:
- with previous_file as f:
- if base_previous_file:
- with base_previous_file as base_f:
- prev_fail, prev_noticed = examine_stream(f, base_f,
- in_classes_with_base=classes_with_base)
- else:
- prev_fail, prev_noticed = examine_stream(f, in_classes_with_base=classes_with_base)
-
- # ignore errors from previous API level
- for p in prev_fail:
- if p in cur_fail:
- del cur_fail[p]
-
- # ignore classes unchanged from previous API level
- for k, v in prev_noticed.iteritems():
- if k in cur_noticed and v == cur_noticed[k]:
- del cur_noticed[k]
-
- """
- # NOTE: disabled because of memory pressure
- # look for compatibility issues
- compat_fail = verify_compat(cur, prev)
-
- print "%s API compatibility issues %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True), format(reset=True)))
- for f in sorted(compat_fail):
- print compat_fail[f]
- print
- """
-
- # ignore everything but the given filters, if provided
- if filters:
- cur_fail = dict([(key, failure) for key, failure in cur_fail.iteritems()
- if match_filter(filters, failure.clazz.fullname)])
-
- if args['show_noticed'] and len(cur_noticed) != 0:
- print "%s API changes noticed %s\n" % ((format(fg=WHITE, bg=BLUE, bold=True), format(reset=True)))
- for f in sorted(cur_noticed.keys()):
- print f
- print
-
- if len(cur_fail) != 0:
- print "%s API style issues: %s %s" % ((format(fg=WHITE, bg=BLUE, bold=True),
- title, format(reset=True)))
- for f in filters:
- print "%s filter: %s %s" % ((format(fg=WHITE, bg=BLUE, bold=True),
- f, format(reset=True)))
- print
- for f in sorted(cur_fail):
- print cur_fail[f]
- print
- print "%d errors" % len(cur_fail)
- sys.exit(77)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- sys.exit(1)
diff --git a/tools/apilint/apilint_sha.sh b/tools/apilint/apilint_sha.sh
deleted file mode 100755
index 2a45b10392d7..000000000000
--- a/tools/apilint/apilint_sha.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-if git show --name-only --pretty=format: $1 | grep api/ > /dev/null; then
- python tools/apilint/apilint.py <(git show $1:api/current.txt) <(git show $1^:api/current.txt)
-fi
diff --git a/tools/apilint/apilint_sha_system.sh b/tools/apilint/apilint_sha_system.sh
deleted file mode 100755
index 8538a3d904f5..000000000000
--- a/tools/apilint/apilint_sha_system.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-# 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.
-
-if git show --name-only --pretty=format: $1 | grep api/ > /dev/null; then
- python tools/apilint/apilint.py \
- --base-current <(git show $1:api/current.txt) \
- --base-previous <(git show $1^:api/current.txt) \
- <(git show $1:api/system-current.txt) \
- <(git show $1^:api/system-current.txt)
-fi
diff --git a/tools/apilint/apilint_stats.sh b/tools/apilint/apilint_stats.sh
deleted file mode 100755
index 052d9a5265fe..000000000000
--- a/tools/apilint/apilint_stats.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-API=28
-while [ $API -gt 14 ]; do
- echo "# Changes in API $((API))"
- python tools/apilint/apilint.py --show-stats ../../prebuilts/sdk/$((API))/public/api/android.txt ../../prebuilts/sdk/$((API-1))/public/api/android.txt
- let API=API-1
-done
diff --git a/tools/apilint/apilint_test.py b/tools/apilint/apilint_test.py
deleted file mode 100644
index 811cb9aa23d5..000000000000
--- a/tools/apilint/apilint_test.py
+++ /dev/null
@@ -1,414 +0,0 @@
-#!/usr/bin/env python
-
-# 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.
-
-import unittest
-
-import apilint
-
-def cls(pkg, name):
- return apilint.Class(apilint.Package(999, "package %s {" % pkg, None), 999,
- "public final class %s {" % name, None)
-
-_ri = apilint._retry_iterator
-
-c1 = cls("android.app", "ActivityManager")
-c2 = cls("android.app", "Notification")
-c3 = cls("android.app", "Notification.Action")
-c4 = cls("android.graphics", "Bitmap")
-
-class UtilTests(unittest.TestCase):
- def test_retry_iterator(self):
- it = apilint._retry_iterator([1, 2, 3, 4])
- self.assertEqual(it.next(), 1)
- self.assertEqual(it.next(), 2)
- self.assertEqual(it.next(), 3)
- it.send("retry")
- self.assertEqual(it.next(), 3)
- self.assertEqual(it.next(), 4)
- with self.assertRaises(StopIteration):
- it.next()
-
- def test_retry_iterator_one(self):
- it = apilint._retry_iterator([1])
- self.assertEqual(it.next(), 1)
- it.send("retry")
- self.assertEqual(it.next(), 1)
- with self.assertRaises(StopIteration):
- it.next()
-
- def test_retry_iterator_one(self):
- it = apilint._retry_iterator([1])
- self.assertEqual(it.next(), 1)
- it.send("retry")
- self.assertEqual(it.next(), 1)
- with self.assertRaises(StopIteration):
- it.next()
-
- def test_skip_to_matching_class_found(self):
- it = _ri([c1, c2, c3, c4])
- self.assertEquals(apilint._skip_to_matching_class(it, c3),
- c3)
- self.assertEqual(it.next(), c4)
-
- def test_skip_to_matching_class_not_found(self):
- it = _ri([c1, c2, c3, c4])
- self.assertEquals(apilint._skip_to_matching_class(it, cls("android.content", "ContentProvider")),
- None)
- self.assertEqual(it.next(), c4)
-
- def test_yield_until_matching_class_found(self):
- it = _ri([c1, c2, c3, c4])
- self.assertEquals(list(apilint._yield_until_matching_class(it, c3)),
- [c1, c2])
- self.assertEqual(it.next(), c4)
-
- def test_yield_until_matching_class_not_found(self):
- it = _ri([c1, c2, c3, c4])
- self.assertEquals(list(apilint._yield_until_matching_class(it, cls("android.content", "ContentProvider"))),
- [c1, c2, c3])
- self.assertEqual(it.next(), c4)
-
- def test_yield_until_matching_class_None(self):
- it = _ri([c1, c2, c3, c4])
- self.assertEquals(list(apilint._yield_until_matching_class(it, None)),
- [c1, c2, c3, c4])
-
-
-faulty_current_txt = """
-// Signature format: 2.0
-package android.app {
- public final class Activity {
- }
-
- public final class WallpaperColors implements android.os.Parcelable {
- ctor public WallpaperColors(@NonNull android.os.Parcel);
- method public int describeContents();
- method public void writeToParcel(@NonNull android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
- }
-}
-""".strip().split('\n')
-
-ok_current_txt = """
-// Signature format: 2.0
-package android.app {
- public final class Activity {
- }
-
- public final class WallpaperColors implements android.os.Parcelable {
- ctor public WallpaperColors();
- method public int describeContents();
- method public void writeToParcel(@NonNull android.os.Parcel, int);
- field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
- }
-}
-""".strip().split('\n')
-
-system_current_txt = """
-// Signature format: 2.0
-package android.app {
- public final class WallpaperColors implements android.os.Parcelable {
- method public int getSomething();
- }
-}
-""".strip().split('\n')
-
-
-
-class BaseFileTests(unittest.TestCase):
- def test_base_file_avoids_errors(self):
- failures, _ = apilint.examine_stream(system_current_txt, ok_current_txt)
- self.assertEquals(failures, {})
-
- def test_class_with_base_finds_same_errors(self):
- failures_with_classes_with_base, _ = apilint.examine_stream("", faulty_current_txt,
- in_classes_with_base=[cls("android.app", "WallpaperColors")])
- failures_with_system_txt, _ = apilint.examine_stream(system_current_txt, faulty_current_txt)
-
- self.assertEquals(failures_with_classes_with_base.keys(), failures_with_system_txt.keys())
-
- def test_classes_with_base_is_emited(self):
- classes_with_base = []
- _, _ = apilint.examine_stream(system_current_txt, faulty_current_txt,
- out_classes_with_base=classes_with_base)
- self.assertEquals(map(lambda x: x.fullname, classes_with_base), ["android.app.WallpaperColors"])
-
-class ParseV2Stream(unittest.TestCase):
- def test_field_kinds(self):
- api = apilint._parse_stream("""
-// Signature format: 2.0
-package android {
- public enum SomeEnum {
- enum_constant public static final android.SomeEnum ENUM_CONST;
- field public static final int FIELD_CONST;
- property public final int someProperty;
- ctor public SomeEnum();
- method public Object? getObject();
- }
-}
- """.strip().split('\n'))
-
- self.assertEquals(api['android.SomeEnum'].fields[0].split[0], 'enum_constant')
- self.assertEquals(api['android.SomeEnum'].fields[1].split[0], 'field')
- self.assertEquals(api['android.SomeEnum'].fields[2].split[0], 'property')
- self.assertEquals(api['android.SomeEnum'].ctors[0].split[0], 'ctor')
- self.assertEquals(api['android.SomeEnum'].methods[0].split[0], 'method')
-
-class ParseV3Stream(unittest.TestCase):
- def test_field_kinds(self):
- api = apilint._parse_stream("""
-// Signature format: 3.0
-package a {
-
- public final class ContextKt {
- method public static inline <reified T> T! getSystemService(android.content.Context);
- method public static inline void withStyledAttributes(android.content.Context, android.util.AttributeSet? set = null, int[] attrs, @AttrRes int defStyleAttr = 0, @StyleRes int defStyleRes = 0, kotlin.jvm.functions.Function1<? super android.content.res.TypedArray,kotlin.Unit> block);
- }
-}
- """.strip().split('\n'))
- self.assertEquals(api['a.ContextKt'].methods[0].name, 'getSystemService')
- self.assertEquals(api['a.ContextKt'].methods[0].split[:4], ['method', 'public', 'static', 'inline'])
- self.assertEquals(api['a.ContextKt'].methods[1].name, 'withStyledAttributes')
- self.assertEquals(api['a.ContextKt'].methods[1].split[:4], ['method', 'public', 'static', 'inline'])
-
-class V2TokenizerTests(unittest.TestCase):
- def _test(self, raw, expected):
- self.assertEquals(apilint.V2Tokenizer(raw).tokenize(), expected)
-
- def test_simple(self):
- self._test(" method public some.Type someName(some.Argument arg, int arg);",
- ['method', 'public', 'some.Type', 'someName', '(', 'some.Argument',
- 'arg', ',', 'int', 'arg', ')', ';'])
- self._test("class Some.Class extends SomeOther {",
- ['class', 'Some.Class', 'extends', 'SomeOther', '{'])
-
- def test_varargs(self):
- self._test("name(String...)",
- ['name', '(', 'String', '...', ')'])
-
- def test_kotlin(self):
- self._test("String? name(String!...)",
- ['String', '?', 'name', '(', 'String', '!', '...', ')'])
-
- def test_annotation(self):
- self._test("method @Nullable public void name();",
- ['method', '@', 'Nullable', 'public', 'void', 'name', '(', ')', ';'])
-
- def test_annotation_args(self):
- self._test("@Some(val=1, other=2) class Class {",
- ['@', 'Some', '(', 'val', '=', '1', ',', 'other', '=', '2', ')',
- 'class', 'Class', '{'])
- def test_comment(self):
- self._test("some //comment", ['some'])
-
- def test_strings(self):
- self._test(r'"" "foo" "\"" "\\"', ['""', '"foo"', r'"\""', r'"\\"'])
-
- def test_at_interface(self):
- self._test("public @interface Annotation {",
- ['public', '@interface', 'Annotation', '{'])
-
- def test_array_type(self):
- self._test("int[][]", ['int', '[]', '[]'])
-
- def test_generics(self):
- self._test("<>foobar<A extends Object>",
- ['<', '>', 'foobar', '<', 'A', 'extends', 'Object', '>'])
-
-class V2ParserTests(unittest.TestCase):
- def _cls(self, raw):
- pkg = apilint.Package(999, "package pkg {", None)
- return apilint.Class(pkg, 1, raw, '', sig_format=2)
-
- def _method(self, raw, cls=None):
- if not cls:
- cls = self._cls("class Class {")
- return apilint.Method(cls, 1, raw, '', sig_format=2)
-
- def _field(self, raw):
- cls = self._cls("class Class {")
- return apilint.Field(cls, 1, raw, '', sig_format=2)
-
- def test_parse_package(self):
- pkg = apilint.Package(999, "package wifi.p2p {", None)
- self.assertEquals("wifi.p2p", pkg.name)
-
- def test_class(self):
- cls = self._cls("@Deprecated @IntRange(from=1, to=2) public static abstract class Some.Name extends Super<Class> implements Interface<Class> {")
- self.assertTrue('deprecated' in cls.split)
- self.assertTrue('static' in cls.split)
- self.assertTrue('abstract' in cls.split)
- self.assertTrue('class' in cls.split)
- self.assertEquals('Super', cls.extends)
- self.assertEquals('Interface', cls.implements)
- self.assertEquals('pkg.Some.Name', cls.fullname)
-
- def test_enum(self):
- cls = self._cls("public enum Some.Name {")
- self._field("enum_constant public static final android.ValueType COLOR;")
-
- def test_interface(self):
- cls = self._cls("@Deprecated @IntRange(from=1, to=2) public interface Some.Name extends Interface<Class> {")
- self.assertTrue('deprecated' in cls.split)
- self.assertTrue('interface' in cls.split)
- self.assertEquals('Interface', cls.extends)
- self.assertEquals('Interface', cls.implements)
- self.assertEquals('pkg.Some.Name', cls.fullname)
-
- def test_at_interface(self):
- cls = self._cls("@java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) public @interface SuppressLint {")
- self.assertTrue('@interface' in cls.split)
- self.assertEquals('pkg.SuppressLint', cls.fullname)
-
- def test_parse_method(self):
- m = self._method("method @Deprecated public static native <T> Class<T>[][] name("
- + "Class<T[]>[][], Class<T[][][]>[][]...) throws Exception, T;")
- self.assertTrue('static' in m.split)
- self.assertTrue('public' in m.split)
- self.assertTrue('method' in m.split)
- self.assertTrue('native' in m.split)
- self.assertTrue('deprecated' in m.split)
- self.assertEquals('java.lang.Class[][]', m.typ)
- self.assertEquals('name', m.name)
- self.assertEquals(['java.lang.Class[][]', 'java.lang.Class[][]...'], m.args)
- self.assertEquals(['java.lang.Exception', 'T'], m.throws)
-
- def test_ctor(self):
- m = self._method("ctor @Deprecated <T> ClassName();")
- self.assertTrue('ctor' in m.split)
- self.assertTrue('deprecated' in m.split)
- self.assertEquals('ctor', m.typ)
- self.assertEquals('ClassName', m.name)
-
- def test_parse_annotation_method(self):
- cls = self._cls("@interface Annotation {")
- self._method('method abstract String category() default "";', cls=cls)
- self._method('method abstract boolean deepExport() default false;', cls=cls)
- self._method('method abstract ViewDebug.FlagToString[] flagMapping() default {};', cls=cls)
- self._method('method abstract ViewDebug.FlagToString[] flagMapping() default (double)java.lang.Float.NEGATIVE_INFINITY;', cls=cls)
-
- def test_parse_string_field(self):
- f = self._field('field @Deprecated public final String SOME_NAME = "value";')
- self.assertTrue('field' in f.split)
- self.assertTrue('deprecated' in f.split)
- self.assertTrue('final' in f.split)
- self.assertEquals('java.lang.String', f.typ)
- self.assertEquals('SOME_NAME', f.name)
- self.assertEquals('value', f.value)
-
- def test_parse_field(self):
- f = self._field('field public Object SOME_NAME;')
- self.assertTrue('field' in f.split)
- self.assertEquals('java.lang.Object', f.typ)
- self.assertEquals('SOME_NAME', f.name)
- self.assertEquals(None, f.value)
-
- def test_parse_int_field(self):
- f = self._field('field public int NAME = 123;')
- self.assertTrue('field' in f.split)
- self.assertEquals('int', f.typ)
- self.assertEquals('NAME', f.name)
- self.assertEquals('123', f.value)
-
- def test_parse_quotient_field(self):
- f = self._field('field public int NAME = (0.0/0.0);')
- self.assertTrue('field' in f.split)
- self.assertEquals('int', f.typ)
- self.assertEquals('NAME', f.name)
- self.assertEquals('( 0.0 / 0.0 )', f.value)
-
- def test_kotlin_types(self):
- self._field('field public List<Integer[]?[]!>?[]![]? NAME;')
- self._method("method <T?> Class<T!>?[]![][]? name(Type!, Type argname,"
- + "Class<T?>[][]?[]!...!) throws Exception, T;")
- self._method("method <T> T name(T a = 1, T b = A(1), Lambda f = { false }, N? n = null, "
- + """double c = (1/0), float d = 1.0f, String s = "heyo", char c = 'a');""")
-
- def test_kotlin_operator(self):
- self._method('method public operator void unaryPlus(androidx.navigation.NavDestination);')
- self._method('method public static operator androidx.navigation.NavDestination get(androidx.navigation.NavGraph, @IdRes int id);')
- self._method('method public static operator <T> T get(androidx.navigation.NavigatorProvider, kotlin.reflect.KClass<T> clazz);')
-
- def test_kotlin_property(self):
- self._field('property public VM value;')
- self._field('property public final String? action;')
-
- def test_kotlin_varargs(self):
- self._method('method public void error(int p = "42", Integer int2 = "null", int p1 = "42", vararg String args);')
-
- def test_kotlin_default_values(self):
- self._method('method public void foo(String! = null, String! = "Hello World", int = 42);')
- self._method('method void method(String, String firstArg = "hello", int secondArg = "42", String thirdArg = "world");')
- self._method('method void method(String, String firstArg = "hello", int secondArg = "42");')
- self._method('method void method(String, String firstArg = "hello");')
- self._method('method void edit(android.Type, boolean commit = false, Function1<? super Editor,kotlin.Unit> action);')
- self._method('method <K, V> LruCache<K,V> lruCache(int maxSize, Function2<? super K,? super V,java.lang.Integer> sizeOf = { _, _ -> 1 }, Function1<? extends V> create = { (V)null }, Function4<kotlin.Unit> onEntryRemoved = { _, _, _, _ -> });')
- self._method('method android.Bitmap? drawToBitmap(android.View, android.Config config = android.graphics.Bitmap.Config.ARGB_8888);')
- self._method('method void emptyLambda(Function0<kotlin.Unit> sizeOf = {});')
- self._method('method void method1(int p = 42, Integer? int2 = null, int p1 = 42, String str = "hello world", java.lang.String... args);')
- self._method('method void method2(int p, int int2 = (2 * int) * some.other.pkg.Constants.Misc.SIZE);')
- self._method('method void method3(String str, int p, int int2 = double(int) + str.length);')
- self._method('method void print(test.pkg.Foo foo = test.pkg.Foo());')
-
- def test_type_use_annotation(self):
- self._method('method public static int codePointAt(char @NonNull [], int);')
- self._method('method @NonNull public java.util.Set<java.util.Map.@NonNull Entry<K,V>> entrySet();')
-
- m = self._method('method @NonNull public java.lang.annotation.@NonNull Annotation @NonNull [] getAnnotations();')
- self.assertEquals('java.lang.annotation.Annotation[]', m.typ)
-
- m = self._method('method @NonNull public abstract java.lang.annotation.@NonNull Annotation @NonNull [] @NonNull [] getParameterAnnotations();')
- self.assertEquals('java.lang.annotation.Annotation[][]', m.typ)
-
- m = self._method('method @NonNull public @NonNull String @NonNull [] split(@NonNull String, int);')
- self.assertEquals('java.lang.String[]', m.typ)
-
-class PackageTests(unittest.TestCase):
- def _package(self, raw):
- return apilint.Package(123, raw, "blame")
-
- def test_regular_package(self):
- p = self._package("package an.pref.int {")
- self.assertEquals('an.pref.int', p.name)
-
- def test_annotation_package(self):
- p = self._package("package @RestrictTo(a.b.C) an.pref.int {")
- self.assertEquals('an.pref.int', p.name)
-
- def test_multi_annotation_package(self):
- p = self._package("package @Rt(a.b.L_G_P) @RestrictTo(a.b.C) an.pref.int {")
- self.assertEquals('an.pref.int', p.name)
-
-class FilterTests(unittest.TestCase):
- def test_filter_match_prefix(self):
- self.assertTrue(apilint.match_filter(["a"], "a.B"))
- self.assertTrue(apilint.match_filter(["a.B"], "a.B.C"))
-
- def test_filter_dont_match_prefix(self):
- self.assertFalse(apilint.match_filter(["c"], "a.B"))
- self.assertFalse(apilint.match_filter(["a."], "a.B"))
- self.assertFalse(apilint.match_filter(["a.B."], "a.B.C"))
-
- def test_filter_match_exact(self):
- self.assertTrue(apilint.match_filter(["a.B"], "a.B"))
-
- def test_filter_dont_match_exact(self):
- self.assertFalse(apilint.match_filter([""], "a.B"))
- self.assertFalse(apilint.match_filter(["a.C"], "a.B"))
- self.assertFalse(apilint.match_filter(["a.C"], "a.B"))
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index ec27ee59ef0d..e745277db268 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -38,6 +38,7 @@ import android.net.DhcpInfo;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
+import android.net.NetworkStack;
import android.net.wifi.hotspot2.IProvisioningCallback;
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
@@ -532,19 +533,25 @@ public class WifiManager {
@SystemApi
public static final String EXTRA_PREVIOUS_WIFI_AP_STATE = "previous_wifi_state";
/**
- * The interface used for the softap.
+ * The lookup key for a String extra that stores the interface name used for the Soft AP.
+ * This extra is included in the broadcast {@link #WIFI_AP_STATE_CHANGED_ACTION}.
+ * Retrieve its value with {@link android.content.Intent#getStringExtra(String)}.
*
* @hide
*/
- public static final String EXTRA_WIFI_AP_INTERFACE_NAME = "wifi_ap_interface_name";
+ @SystemApi
+ public static final String EXTRA_WIFI_AP_INTERFACE_NAME =
+ "android.net.wifi.extra.WIFI_AP_INTERFACE_NAME";
/**
- * The intended ip mode for this softap.
- * @see #IFACE_IP_MODE_TETHERED
- * @see #IFACE_IP_MODE_LOCAL_ONLY
+ * The lookup key for an int extra that stores the intended IP mode for this Soft AP.
+ * One of {@link #IFACE_IP_MODE_TETHERED} or {@link #IFACE_IP_MODE_LOCAL_ONLY}.
+ * This extra is included in the broadcast {@link #WIFI_AP_STATE_CHANGED_ACTION}.
+ * Retrieve its value with {@link android.content.Intent#getIntExtra(String, int)}.
*
* @hide
*/
- public static final String EXTRA_WIFI_AP_MODE = "wifi_ap_mode";
+ @SystemApi
+ public static final String EXTRA_WIFI_AP_MODE = "android.net.wifi.extra.WIFI_AP_MODE";
/** @hide */
@IntDef(flag = false, prefix = { "WIFI_AP_STATE_" }, value = {
@@ -634,40 +641,53 @@ public class WifiManager {
*/
public static final int SAP_START_FAILURE_NO_CHANNEL = 1;
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(prefix = {"IFACE_IP_MODE_"}, value = {
+ IFACE_IP_MODE_UNSPECIFIED,
+ IFACE_IP_MODE_CONFIGURATION_ERROR,
+ IFACE_IP_MODE_TETHERED,
+ IFACE_IP_MODE_LOCAL_ONLY})
+ public @interface IfaceIpMode {}
+
/**
* Interface IP mode unspecified.
*
- * @see updateInterfaceIpState(String, int)
+ * @see #updateInterfaceIpState(String, int)
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_UNSPECIFIED = -1;
/**
* Interface IP mode for configuration error.
*
- * @see updateInterfaceIpState(String, int)
+ * @see #updateInterfaceIpState(String, int)
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_CONFIGURATION_ERROR = 0;
/**
* Interface IP mode for tethering.
*
- * @see updateInterfaceIpState(String, int)
+ * @see #updateInterfaceIpState(String, int)
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_TETHERED = 1;
/**
* Interface IP mode for Local Only Hotspot.
*
- * @see updateInterfaceIpState(String, int)
+ * @see #updateInterfaceIpState(String, int)
*
* @hide
*/
+ @SystemApi
public static final int IFACE_IP_MODE_LOCAL_ONLY = 2;
/**
@@ -2045,69 +2065,69 @@ public class WifiManager {
}
/** @hide */
- public static final int WIFI_FEATURE_INFRA = 0x0001; // Basic infrastructure mode
+ public static final long WIFI_FEATURE_INFRA = 0x0001L; // Basic infrastructure mode
/** @hide */
- public static final int WIFI_FEATURE_INFRA_5G = 0x0002; // Support for 5 GHz Band
+ public static final long WIFI_FEATURE_INFRA_5G = 0x0002L; // Support for 5 GHz Band
/** @hide */
- public static final int WIFI_FEATURE_PASSPOINT = 0x0004; // Support for GAS/ANQP
+ public static final long WIFI_FEATURE_PASSPOINT = 0x0004L; // Support for GAS/ANQP
/** @hide */
- public static final int WIFI_FEATURE_P2P = 0x0008; // Wifi-Direct
+ public static final long WIFI_FEATURE_P2P = 0x0008L; // Wifi-Direct
/** @hide */
- public static final int WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010; // Soft AP
+ public static final long WIFI_FEATURE_MOBILE_HOTSPOT = 0x0010L; // Soft AP
/** @hide */
- public static final int WIFI_FEATURE_SCANNER = 0x0020; // WifiScanner APIs
+ public static final long WIFI_FEATURE_SCANNER = 0x0020L; // WifiScanner APIs
/** @hide */
- public static final int WIFI_FEATURE_AWARE = 0x0040; // Wi-Fi AWare networking
+ public static final long WIFI_FEATURE_AWARE = 0x0040L; // Wi-Fi AWare networking
/** @hide */
- public static final int WIFI_FEATURE_D2D_RTT = 0x0080; // Device-to-device RTT
+ public static final long WIFI_FEATURE_D2D_RTT = 0x0080L; // Device-to-device RTT
/** @hide */
- public static final int WIFI_FEATURE_D2AP_RTT = 0x0100; // Device-to-AP RTT
+ public static final long WIFI_FEATURE_D2AP_RTT = 0x0100L; // Device-to-AP RTT
/** @hide */
- public static final int WIFI_FEATURE_BATCH_SCAN = 0x0200; // Batched Scan (deprecated)
+ public static final long WIFI_FEATURE_BATCH_SCAN = 0x0200L; // Batched Scan (deprecated)
/** @hide */
- public static final int WIFI_FEATURE_PNO = 0x0400; // Preferred network offload
+ public static final long WIFI_FEATURE_PNO = 0x0400L; // Preferred network offload
/** @hide */
- public static final int WIFI_FEATURE_ADDITIONAL_STA = 0x0800; // Support for two STAs
+ public static final long WIFI_FEATURE_ADDITIONAL_STA = 0x0800L; // Support for two STAs
/** @hide */
- public static final int WIFI_FEATURE_TDLS = 0x1000; // Tunnel directed link setup
+ public static final long WIFI_FEATURE_TDLS = 0x1000L; // Tunnel directed link setup
/** @hide */
- public static final int WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000; // Support for TDLS off channel
+ public static final long WIFI_FEATURE_TDLS_OFFCHANNEL = 0x2000L; // TDLS off channel
/** @hide */
- public static final int WIFI_FEATURE_EPR = 0x4000; // Enhanced power reporting
+ public static final long WIFI_FEATURE_EPR = 0x4000L; // Enhanced power reporting
/** @hide */
- public static final int WIFI_FEATURE_AP_STA = 0x8000; // AP STA Concurrency
+ public static final long WIFI_FEATURE_AP_STA = 0x8000L; // AP STA Concurrency
/** @hide */
- public static final int WIFI_FEATURE_LINK_LAYER_STATS = 0x10000; // Link layer stats collection
+ public static final long WIFI_FEATURE_LINK_LAYER_STATS = 0x10000L; // Link layer stats
/** @hide */
- public static final int WIFI_FEATURE_LOGGER = 0x20000; // WiFi Logger
+ public static final long WIFI_FEATURE_LOGGER = 0x20000L; // WiFi Logger
/** @hide */
- public static final int WIFI_FEATURE_HAL_EPNO = 0x40000; // Enhanced PNO
+ public static final long WIFI_FEATURE_HAL_EPNO = 0x40000L; // Enhanced PNO
/** @hide */
- public static final int WIFI_FEATURE_RSSI_MONITOR = 0x80000; // RSSI Monitor
+ public static final long WIFI_FEATURE_RSSI_MONITOR = 0x80000L; // RSSI Monitor
/** @hide */
- public static final int WIFI_FEATURE_MKEEP_ALIVE = 0x100000; // mkeep_alive
+ public static final long WIFI_FEATURE_MKEEP_ALIVE = 0x100000L; // mkeep_alive
/** @hide */
- public static final int WIFI_FEATURE_CONFIG_NDO = 0x200000; // ND offload
+ public static final long WIFI_FEATURE_CONFIG_NDO = 0x200000L; // ND offload
/** @hide */
- public static final int WIFI_FEATURE_TRANSMIT_POWER = 0x400000; // Capture transmit power
+ public static final long WIFI_FEATURE_TRANSMIT_POWER = 0x400000L; // Capture transmit power
/** @hide */
- public static final int WIFI_FEATURE_CONTROL_ROAMING = 0x800000; // Control firmware roaming
+ public static final long WIFI_FEATURE_CONTROL_ROAMING = 0x800000L; // Control firmware roaming
/** @hide */
- public static final int WIFI_FEATURE_IE_WHITELIST = 0x1000000; // Probe IE white listing
+ public static final long WIFI_FEATURE_IE_WHITELIST = 0x1000000L; // Probe IE white listing
/** @hide */
- public static final int WIFI_FEATURE_SCAN_RAND = 0x2000000; // Random MAC & Probe seq
+ public static final long WIFI_FEATURE_SCAN_RAND = 0x2000000L; // Random MAC & Probe seq
/** @hide */
- public static final int WIFI_FEATURE_TX_POWER_LIMIT = 0x4000000; // Set Tx power limit
+ public static final long WIFI_FEATURE_TX_POWER_LIMIT = 0x4000000L; // Set Tx power limit
/** @hide */
- public static final int WIFI_FEATURE_WPA3_SAE = 0x8000000; // WPA3-Personal SAE
+ public static final long WIFI_FEATURE_WPA3_SAE = 0x8000000L; // WPA3-Personal SAE
/** @hide */
- public static final int WIFI_FEATURE_WPA3_SUITE_B = 0x10000000; // WPA3-Enterprise Suite-B
+ public static final long WIFI_FEATURE_WPA3_SUITE_B = 0x10000000L; // WPA3-Enterprise Suite-B
/** @hide */
- public static final int WIFI_FEATURE_OWE = 0x20000000; // Enhanced Open
+ public static final long WIFI_FEATURE_OWE = 0x20000000L; // Enhanced Open
/** @hide */
- public static final int WIFI_FEATURE_LOW_LATENCY = 0x40000000; // Low Latency modes
+ public static final long WIFI_FEATURE_LOW_LATENCY = 0x40000000L; // Low Latency modes
/** @hide */
- public static final int WIFI_FEATURE_DPP = 0x80000000; // DPP (Easy-Connect)
+ public static final long WIFI_FEATURE_DPP = 0x80000000L; // DPP (Easy-Connect)
/** @hide */
public static final long WIFI_FEATURE_P2P_RAND_MAC = 0x100000000L; // Random P2P MAC
@@ -2539,16 +2559,21 @@ public class WifiManager {
/**
* Call allowing ConnectivityService to update WifiService with interface mode changes.
*
- * The possible modes include: {@link IFACE_IP_MODE_TETHERED},
- * {@link IFACE_IP_MODE_LOCAL_ONLY},
- * {@link IFACE_IP_MODE_CONFIGURATION_ERROR}
- *
- * @param ifaceName String name of the updated interface
- * @param mode int representing the new mode
+ * @param ifaceName String name of the updated interface, or null to represent all interfaces
+ * @param mode int representing the new mode, one of:
+ * {@link #IFACE_IP_MODE_TETHERED},
+ * {@link #IFACE_IP_MODE_LOCAL_ONLY},
+ * {@link #IFACE_IP_MODE_CONFIGURATION_ERROR},
+ * {@link #IFACE_IP_MODE_UNSPECIFIED}
*
* @hide
*/
- public void updateInterfaceIpState(String ifaceName, int mode) {
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
+ public void updateInterfaceIpState(@Nullable String ifaceName, @IfaceIpMode int mode) {
try {
mService.updateInterfaceIpState(ifaceName, mode);
} catch (RemoteException e) {
@@ -2557,15 +2582,21 @@ public class WifiManager {
}
/**
- * Start SoftAp mode with the specified configuration.
- * Note that starting in access point mode disables station
- * mode operation
- * @param wifiConfig SSID, security and channel details as
- * part of WifiConfiguration
- * @return {@code true} if the operation succeeds, {@code false} otherwise
+ * Start Soft AP (hotspot) mode with the specified configuration.
+ * Note that starting Soft AP mode may disable station mode operation if the device does not
+ * support concurrency.
+ * @param wifiConfig SSID, security and channel details as part of WifiConfiguration, or null to
+ * use the persisted Soft AP configuration that was previously set using
+ * {@link #setWifiApConfiguration(WifiConfiguration)}.
+ * @return {@code true} if the operation succeeded, {@code false} otherwise
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
public boolean startSoftAp(@Nullable WifiConfiguration wifiConfig) {
try {
return mService.startSoftAp(wifiConfig);
@@ -2581,6 +2612,11 @@ public class WifiManager {
*
* @hide
*/
+ @SystemApi
+ @RequiresPermission(anyOf = {
+ android.Manifest.permission.NETWORK_STACK,
+ NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
+ })
public boolean stopSoftAp() {
try {
return mService.stopSoftAp();
diff --git a/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java b/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
index e59516485112..8f3635fd2f04 100644
--- a/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
+++ b/wifi/java/android/net/wifi/WifiUsabilityStatsEntry.java
@@ -20,8 +20,8 @@ import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
-import android.telephony.TelephonyManager.NetworkType;
+import android.telephony.Annotation.NetworkType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;