summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk6
-rw-r--r--CleanSpec.mk3
-rw-r--r--api/current.txt651
-rw-r--r--cmds/settings/src/com/android/commands/settings/SettingsCmd.java34
-rw-r--r--core/java/android/app/Activity.java31
-rw-r--r--core/java/android/app/ActivityOptions.java14
-rw-r--r--core/java/android/app/ActivityTransitionCoordinator.java16
-rw-r--r--core/java/android/app/ActivityTransitionState.java38
-rw-r--r--core/java/android/app/ActivityView.java17
-rw-r--r--core/java/android/app/ContextImpl.java8
-rw-r--r--core/java/android/app/EnterTransitionCoordinator.java71
-rw-r--r--core/java/android/app/JobSchedulerImpl.java (renamed from core/java/android/app/TaskManagerImpl.java)28
-rw-r--r--core/java/android/app/Notification.java19
-rw-r--r--core/java/android/app/VoiceInteractor.java2
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java2
-rw-r--r--core/java/android/app/job/IJobCallback.aidl (renamed from core/java/android/app/task/ITaskCallback.aidl)31
-rw-r--r--core/java/android/app/job/IJobScheduler.aidl (renamed from core/java/android/app/task/ITaskManager.aidl)14
-rw-r--r--core/java/android/app/job/IJobService.aidl (renamed from core/java/android/app/task/ITaskService.aidl)19
-rw-r--r--core/java/android/app/job/JobInfo.aidl (renamed from core/java/android/app/task/Task.aidl)5
-rw-r--r--core/java/android/app/job/JobInfo.java (renamed from core/java/android/app/task/Task.java)150
-rw-r--r--core/java/android/app/job/JobParameters.aidl (renamed from core/java/android/app/task/TaskParams.aidl)4
-rw-r--r--core/java/android/app/job/JobParameters.java (renamed from core/java/android/app/task/TaskParams.java)44
-rw-r--r--core/java/android/app/job/JobScheduler.java72
-rw-r--r--core/java/android/app/job/JobService.java (renamed from core/java/android/app/task/TaskService.java)161
-rw-r--r--core/java/android/app/maintenance/package.html5
-rw-r--r--core/java/android/app/task/TaskManager.java72
-rw-r--r--core/java/android/content/Context.java16
-rw-r--r--core/java/android/hardware/camera2/CameraCaptureSession.java20
-rw-r--r--core/java/android/hardware/camera2/CameraCharacteristics.java104
-rw-r--r--core/java/android/hardware/camera2/CameraDevice.java639
-rw-r--r--core/java/android/hardware/camera2/CameraManager.java10
-rw-r--r--core/java/android/hardware/camera2/CameraMetadata.java539
-rw-r--r--core/java/android/hardware/camera2/CaptureRequest.java236
-rw-r--r--core/java/android/hardware/camera2/CaptureResult.java298
-rw-r--r--core/java/android/hardware/camera2/package.html72
-rw-r--r--core/java/android/hardware/camera2/params/StreamConfiguration.java7
-rw-r--r--core/java/android/hardware/camera2/params/StreamConfigurationMap.java26
-rw-r--r--core/java/android/net/RouteInfo.java2
-rw-r--r--core/java/android/provider/Browser.java39
-rw-r--r--core/java/android/provider/Settings.java16
-rw-r--r--core/java/android/service/notification/NotificationListenerService.java220
-rw-r--r--core/java/android/service/voice/DspInfo.java56
-rw-r--r--core/java/android/service/voice/KeyphraseEnrollmentInfo.java246
-rw-r--r--core/java/android/service/voice/KeyphraseInfo.java27
-rw-r--r--core/java/android/service/voice/SoundTriggerManager.java73
-rw-r--r--core/java/android/service/voice/VoiceInteractionService.java59
-rw-r--r--core/java/android/speech/tts/RequestConfig.java15
-rw-r--r--core/java/android/speech/tts/RequestConfigHelper.java15
-rw-r--r--core/java/android/speech/tts/SynthesisRequestV2.java15
-rw-r--r--core/java/android/speech/tts/VoiceInfo.java15
-rw-r--r--core/java/android/text/util/Linkify.java53
-rw-r--r--core/java/android/transition/Transition.java122
-rw-r--r--core/java/android/view/accessibility/AccessibilityInteractionClient.java16
-rw-r--r--core/jni/Android.mk1
-rw-r--r--core/jni/AndroidRuntime.cpp8
-rw-r--r--core/jni/android/graphics/AndroidPicture.cpp112
-rw-r--r--core/jni/android/graphics/AndroidPicture.h63
-rw-r--r--core/jni/android/graphics/Bitmap.cpp40
-rw-r--r--core/jni/android/graphics/Canvas.cpp209
-rw-r--r--core/jni/android/graphics/Graphics.cpp5
-rw-r--r--core/jni/android/graphics/GraphicsJNI.h4
-rw-r--r--core/jni/android/graphics/Picture.cpp38
-rw-r--r--core/jni/android/graphics/pdf/PdfDocument.cpp29
-rw-r--r--core/jni/android_media_AudioSystem.cpp7
-rw-r--r--core/jni/android_view_Surface.cpp1
-rw-r--r--core/res/AndroidManifest.xml27
-rw-r--r--core/res/res/drawable-hdpi/ic_afw_icon.pngbin0 -> 1298 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_afw_icon.pngbin0 -> 906 bytes
-rw-r--r--core/res/res/drawable-xhdpi/ic_afw_icon.pngbin0 -> 1488 bytes
-rw-r--r--core/res/res/drawable-xxhdpi/ic_afw_icon.pngbin0 -> 2137 bytes
-rw-r--r--core/res/res/drawable/btn_borderless_material.xml2
-rw-r--r--core/res/res/drawable/btn_default_material.xml2
-rw-r--r--core/res/res/drawable/btn_toggle_material.xml2
-rw-r--r--core/res/res/drawable/edit_text_material.xml3
-rw-r--r--core/res/res/drawable/item_background_borderless_material.xml3
-rw-r--r--core/res/res/drawable/item_background_material.xml4
-rw-r--r--core/res/res/drawable/notification_bg_dim.xml6
-rw-r--r--core/res/res/drawable/notification_material_bg_dim.xml15
-rw-r--r--core/res/res/layout/notification_template_material_big_base.xml2
-rw-r--r--core/res/res/layout/notification_template_material_big_media.xml3
-rw-r--r--core/res/res/layout/notification_template_material_big_text.xml2
-rw-r--r--core/res/res/layout/preference_widget_checkbox.xml3
-rw-r--r--core/res/res/layout/preference_widget_switch.xml3
-rw-r--r--core/res/res/values-watch/config.xml4
-rw-r--r--core/res/res/values/attrs.xml18
-rw-r--r--core/res/res/values/colors.xml1
-rw-r--r--core/res/res/values/config.xml10
-rw-r--r--core/res/res/values/public.xml8
-rw-r--r--core/res/res/values/strings.xml10
-rw-r--r--core/res/res/values/styles_material.xml11
-rw-r--r--core/res/res/values/symbols.xml4
-rw-r--r--core/res/res/values/themes_material.xml4
-rw-r--r--data/fonts/Android.mk2
-rw-r--r--data/fonts/Roboto-BlackItalic.ttfbin0 -> 134716 bytes
-rw-r--r--data/fonts/fonts.mk1
-rw-r--r--data/fonts/system_fonts.xml1
-rw-r--r--docs/html/distribute/engage/analytics.jd50
-rw-r--r--docs/html/distribute/engage/deep-linking.jd35
-rw-r--r--docs/html/distribute/engage/engage_toc.cs6
-rw-r--r--docs/html/distribute/engage/index.jd4
-rw-r--r--docs/html/distribute/engage/widgets.jd2
-rw-r--r--docs/html/distribute/monetize/ads.jd101
-rw-r--r--docs/html/distribute/users/index.jd4
-rw-r--r--docs/html/distribute/users/promote-with-ads.jd45
-rw-r--r--docs/html/distribute/users/users_toc.cs7
-rw-r--r--docs/html/images/gp-ads-console.jpgbin0 -> 34526 bytes
-rw-r--r--docs/html/images/gp-ads-linking2.jpgbin0 -> 30046 bytes
-rw-r--r--docs/html/images/gp-analytics.jpgbin0 -> 36914 bytes
-rw-r--r--docs/html/jd_collections.js19
-rw-r--r--docs/html/jd_extras.js28
-rw-r--r--docs/html/training/articles/keystore.jd107
-rw-r--r--graphics/java/android/graphics/Bitmap.java11
-rw-r--r--graphics/java/android/graphics/Picture.java25
-rw-r--r--graphics/java/android/graphics/drawable/Ripple.java36
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java134
-rw-r--r--keystore/java/android/security/KeyPairGeneratorSpec.java4
-rw-r--r--keystore/java/android/security/KeyStoreParameter.java4
-rw-r--r--libs/hwui/TessellationCache.cpp29
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp2
-rw-r--r--media/java/android/media/AudioManager.java22
-rw-r--r--media/java/android/media/AudioSystem.java5
-rw-r--r--media/java/android/media/CamcorderProfile.java14
-rw-r--r--media/java/android/media/tv/TvContract.java9
-rw-r--r--media/jni/android_media_MediaMetadataRetriever.cpp13
-rw-r--r--media/jni/android_media_MediaScanner.cpp11
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java7
-rw-r--r--packages/PrintSpooler/res/drawable/print_button.xml3
-rw-r--r--packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.pngbin0 -> 219 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.pngbin1054 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-hdpi/stat_sys_no_sim.pngbin756 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.pngbin0 -> 193 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.pngbin1050 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-mdpi/stat_sys_no_sim.pngbin569 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.pngbin0 -> 242 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.pngbin985 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-xhdpi/stat_sys_no_sim.pngbin932 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.pngbin0 -> 1123 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.pngbin1070 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable-xxhdpi/stat_sys_no_sim.pngbin1683 -> 0 bytes
-rw-r--r--packages/SystemUI/res/drawable/ic_notify_zen.xml (renamed from packages/SystemUI/res/drawable/ic_qs_location_04.xml)10
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_color_inversion.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_inversion_off.xml (renamed from packages/SystemUI/res/drawable/ic_qs_location_02.xml)8
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_inversion_on.xml (renamed from packages/SystemUI/res/drawable/ic_qs_location_01.xml)6
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_03.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_05.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_06.xml31
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_07.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_08.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_09.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_10.xml28
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_off.xml32
-rw-r--r--packages/SystemUI/res/drawable/ic_qs_location_on.xml29
-rw-r--r--packages/SystemUI/res/drawable/notification_row_legacy_bg.xml22
-rw-r--r--packages/SystemUI/res/drawable/ripple_drawable.xml4
-rw-r--r--packages/SystemUI/res/drawable/stat_sys_no_sim.xml (renamed from packages/SystemUI/res/drawable/ic_qs_location_11.xml)8
-rw-r--r--packages/SystemUI/res/drawable/status_bar_item_background.xml25
-rw-r--r--packages/SystemUI/res/drawable/ticker_background.xml27
-rw-r--r--packages/SystemUI/res/layout/recents_nav_bar_scrim.xml2
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml49
-rw-r--r--packages/SystemUI/res/values/colors.xml15
-rw-r--r--packages/SystemUI/res/values/dimens.xml10
-rw-r--r--packages/SystemUI/src/com/android/systemui/power/PowerUI.java47
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java22
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java43
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java26
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java89
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java52
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsAlgorithm.java80
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsLayout.java136
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java128
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java204
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java47
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java169
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java53
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java26
-rw-r--r--services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java22
-rw-r--r--services/core/java/com/android/server/BatteryService.java72
-rw-r--r--services/core/java/com/android/server/MountServiceIdler.java28
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java3
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityStack.java15
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java89
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java12
-rw-r--r--services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java6
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecController.java39
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecKeycodeTranslator.java349
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java80
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java43
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java17
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiConstants.java26
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiControlService.java145
-rw-r--r--services/core/java/com/android/server/hdmi/HdmiUtils.java20
-rw-r--r--services/core/java/com/android/server/hdmi/HotplugDetectionAction.java2
-rw-r--r--services/core/java/com/android/server/hdmi/NewDeviceAction.java35
-rw-r--r--services/core/java/com/android/server/hdmi/SendKeyAction.java153
-rw-r--r--services/core/java/com/android/server/job/JobCompletedListener.java (renamed from services/core/java/com/android/server/task/TaskCompletedListener.java)16
-rw-r--r--services/core/java/com/android/server/job/JobMapReadFinishedListener.java (renamed from services/core/java/com/android/server/task/TaskMapReadFinishedListener.java)12
-rw-r--r--services/core/java/com/android/server/job/JobSchedulerService.java764
-rw-r--r--services/core/java/com/android/server/job/JobServiceContext.java (renamed from services/core/java/com/android/server/task/TaskServiceContext.java)216
-rw-r--r--services/core/java/com/android/server/job/JobStore.java (renamed from services/core/java/com/android/server/task/TaskStore.java)382
-rw-r--r--services/core/java/com/android/server/job/StateChangedListener.java (renamed from services/core/java/com/android/server/task/StateChangedListener.java)16
-rw-r--r--services/core/java/com/android/server/job/controllers/BatteryController.java (renamed from services/core/java/com/android/server/task/controllers/BatteryController.java)57
-rw-r--r--services/core/java/com/android/server/job/controllers/ConnectivityController.java (renamed from services/core/java/com/android/server/task/controllers/ConnectivityController.java)70
-rw-r--r--services/core/java/com/android/server/job/controllers/IdleController.java (renamed from services/core/java/com/android/server/task/controllers/IdleController.java)16
-rw-r--r--services/core/java/com/android/server/job/controllers/JobStatus.java (renamed from services/core/java/com/android/server/task/controllers/TaskStatus.java)115
-rw-r--r--services/core/java/com/android/server/job/controllers/StateController.java (renamed from services/core/java/com/android/server/task/controllers/StateController.java)18
-rw-r--r--services/core/java/com/android/server/job/controllers/TimeController.java (renamed from services/core/java/com/android/server/task/controllers/TimeController.java)146
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java22
-rwxr-xr-xservices/core/java/com/android/server/pm/PackageManagerService.java1
-rw-r--r--services/core/java/com/android/server/power/PowerManagerService.java21
-rw-r--r--services/core/java/com/android/server/task/TaskManagerService.java764
-rw-r--r--services/core/java/com/android/server/trust/TrustManagerService.java4
-rw-r--r--services/core/java/com/android/server/wm/AccessibilityController.java9
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java21
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java8
-rw-r--r--services/core/jni/com_android_server_hdmi_HdmiCecController.cpp43
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java10
-rw-r--r--services/java/com/android/server/SystemServer.java26
-rw-r--r--services/tests/servicestests/src/com/android/server/task/TaskStoreTest.java83
-rw-r--r--services/tests/servicestests/src/com/android/server/task/controllers/BatteryControllerTest.java66
-rw-r--r--tests/Camera2Tests/CameraToo/Android.mk23
-rw-r--r--tests/Camera2Tests/CameraToo/AndroidManifest.xml33
-rw-r--r--tests/Camera2Tests/CameraToo/res/layout/mainactivity.xml23
-rw-r--r--tests/Camera2Tests/CameraToo/src/com/example/android/camera2/cameratoo/CameraTooActivity.java437
-rw-r--r--tests/Camera2Tests/CameraToo/tests/Android.mk25
-rw-r--r--tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml29
-rw-r--r--tests/Camera2Tests/CameraToo/tests/src/com/example/android/camera2/cameratoo/CameraTooTest.java189
-rw-r--r--tests/JobSchedulerTestApp/AndroidManifest.xml1
-rw-r--r--tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java26
-rw-r--r--tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java48
-rw-r--r--tests/VoiceEnrollment/Android.mk12
-rw-r--r--tests/VoiceEnrollment/AndroidManifest.xml16
-rw-r--r--tests/VoiceEnrollment/res/xml/enrollment_application.xml23
-rw-r--r--tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java23
-rw-r--r--tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java5
-rw-r--r--tools/layoutlib/bridge/src/android/view/BridgeInflater.java4
-rw-r--r--tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java2
-rw-r--r--tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java2
-rw-r--r--tools/layoutlib/create/README.txt14
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmAnalyzer.java34
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java36
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java5
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java53
-rwxr-xr-xtools/layoutlib/rename_font/build_font.py5
-rwxr-xr-xtools/layoutlib/rename_font/test.py2
-rw-r--r--wifi/java/android/net/wifi/ScanResult.java15
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java39
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java76
-rw-r--r--wifi/java/android/net/wifi/WifiScanner.java108
-rw-r--r--wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl3
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java5
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java165
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointOsuProvider.java12
275 files changed, 7878 insertions, 5336 deletions
diff --git a/Android.mk b/Android.mk
index 4875cc5..c889fa1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -77,9 +77,9 @@ LOCAL_SRC_FILES += \
core/java/android/app/ISearchManagerCallback.aidl \
core/java/android/app/IServiceConnection.aidl \
core/java/android/app/IStopUserCallback.aidl \
- core/java/android/app/task/ITaskCallback.aidl \
- core/java/android/app/task/ITaskManager.aidl \
- core/java/android/app/task/ITaskService.aidl \
+ core/java/android/app/job/IJobCallback.aidl \
+ core/java/android/app/job/IJobScheduler.aidl \
+ core/java/android/app/job/IJobService.aidl \
core/java/android/app/IThumbnailRetriever.aidl \
core/java/android/app/ITransientNotification.aidl \
core/java/android/app/IUiAutomationConnection.aidl \
diff --git a/CleanSpec.mk b/CleanSpec.mk
index f3bb9b6..5b027b3 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -197,3 +197,6 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framew
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/classes/android/app/task)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/src/core/java/android/app/task)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework-base_intermediates/classes/android/app/TaskManager)
diff --git a/api/current.txt b/api/current.txt
index ddb9397..991186f 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -248,7 +248,7 @@ package android {
field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4
field public static final int actionBarTabStyle = 16843507; // 0x10102f3
field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5
- field public static final int actionBarTheme = 16843828; // 0x1010434
+ field public static final int actionBarTheme = 16843827; // 0x1010433
field public static final int actionBarWidgetTheme = 16843671; // 0x1010397
field public static final int actionButtonStyle = 16843480; // 0x10102d8
field public static final int actionDropDownStyle = 16843479; // 0x10102d7
@@ -265,7 +265,7 @@ package android {
field public static final int actionModeSplitBackground = 16843677; // 0x101039d
field public static final int actionModeStyle = 16843668; // 0x1010394
field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
- field public static final int actionOverflowMenuStyle = 16843847; // 0x1010447
+ field public static final int actionOverflowMenuStyle = 16843846; // 0x1010446
field public static final int actionProviderClass = 16843657; // 0x1010389
field public static final int actionViewClass = 16843516; // 0x10102fc
field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
@@ -311,7 +311,7 @@ package android {
field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b
field public static final int autoLink = 16842928; // 0x10100b0
field public static final int autoMirrored = 16843754; // 0x10103ea
- field public static final int autoRemoveFromRecents = 16843850; // 0x101044a
+ field public static final int autoRemoveFromRecents = 16843849; // 0x1010449
field public static final int autoStart = 16843445; // 0x10102b5
field public static final deprecated int autoText = 16843114; // 0x101016a
field public static final int autoUrlDetect = 16843404; // 0x101028c
@@ -384,22 +384,22 @@ package android {
field public static final int codes = 16843330; // 0x1010242
field public static final int collapseColumns = 16843083; // 0x101014b
field public static final int color = 16843173; // 0x10101a5
- field public static final int colorAccent = 16843832; // 0x1010438
+ field public static final int colorAccent = 16843831; // 0x1010437
field public static final int colorActivatedHighlight = 16843664; // 0x1010390
field public static final int colorBackground = 16842801; // 0x1010031
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
- field public static final int colorButtonNormal = 16843822; // 0x101042e
- field public static final int colorControlActivated = 16843821; // 0x101042d
- field public static final int colorControlHighlight = 16843823; // 0x101042f
- field public static final int colorControlNormal = 16843820; // 0x101042c
+ field public static final int colorButtonNormal = 16843821; // 0x101042d
+ field public static final int colorControlActivated = 16843820; // 0x101042c
+ field public static final int colorControlHighlight = 16843822; // 0x101042e
+ field public static final int colorControlNormal = 16843819; // 0x101042b
field public static final int colorFocusedHighlight = 16843663; // 0x101038f
field public static final int colorForeground = 16842800; // 0x1010030
field public static final int colorForegroundInverse = 16843270; // 0x1010206
field public static final int colorLongPressedHighlight = 16843662; // 0x101038e
field public static final int colorMultiSelectHighlight = 16843665; // 0x1010391
field public static final int colorPressedHighlight = 16843661; // 0x101038d
- field public static final int colorPrimary = 16843830; // 0x1010436
- field public static final int colorPrimaryDark = 16843831; // 0x1010437
+ field public static final int colorPrimary = 16843829; // 0x1010435
+ field public static final int colorPrimaryDark = 16843830; // 0x1010436
field public static final int columnCount = 16843639; // 0x1010377
field public static final int columnDelay = 16843215; // 0x10101cf
field public static final int columnOrderPreserved = 16843640; // 0x1010378
@@ -414,10 +414,10 @@ package android {
field public static final int content = 16843355; // 0x101025b
field public static final int contentAuthority = 16843408; // 0x1010290
field public static final int contentDescription = 16843379; // 0x1010273
- field public static final int contentInsetEnd = 16843863; // 0x1010457
- field public static final int contentInsetLeft = 16843864; // 0x1010458
- field public static final int contentInsetRight = 16843865; // 0x1010459
- field public static final int contentInsetStart = 16843862; // 0x1010456
+ field public static final int contentInsetEnd = 16843862; // 0x1010456
+ field public static final int contentInsetLeft = 16843863; // 0x1010457
+ field public static final int contentInsetRight = 16843864; // 0x1010458
+ field public static final int contentInsetStart = 16843861; // 0x1010455
field public static final int controlX1 = 16843798; // 0x1010416
field public static final int controlX2 = 16843800; // 0x1010418
field public static final int controlY1 = 16843799; // 0x1010417
@@ -462,7 +462,7 @@ package android {
field public static final int dividerHorizontal = 16843564; // 0x101032c
field public static final int dividerPadding = 16843562; // 0x101032a
field public static final int dividerVertical = 16843530; // 0x101030a
- field public static final int documentLaunchMode = 16843848; // 0x1010448
+ field public static final int documentLaunchMode = 16843847; // 0x1010447
field public static final int drawSelectorOnTop = 16843004; // 0x10100fc
field public static final int drawable = 16843161; // 0x1010199
field public static final int drawableBottom = 16843118; // 0x101016e
@@ -491,8 +491,8 @@ package android {
field public static final int editTextStyle = 16842862; // 0x101006e
field public static final deprecated int editable = 16843115; // 0x101016b
field public static final int editorExtras = 16843300; // 0x1010224
- field public static final int elegantTextHeight = 16843872; // 0x1010460
- field public static final int elevation = 16843843; // 0x1010443
+ field public static final int elegantTextHeight = 16843871; // 0x101045f
+ field public static final int elevation = 16843842; // 0x1010442
field public static final int ellipsize = 16842923; // 0x10100ab
field public static final int ems = 16843096; // 0x1010158
field public static final int enabled = 16842766; // 0x101000e
@@ -502,10 +502,10 @@ package android {
field public static final int entries = 16842930; // 0x10100b2
field public static final int entryValues = 16843256; // 0x10101f8
field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d
- field public static final int excludeClass = 16843845; // 0x1010445
+ field public static final int excludeClass = 16843844; // 0x1010444
field public static final int excludeFromRecents = 16842775; // 0x1010017
- field public static final int excludeId = 16843844; // 0x1010444
- field public static final int excludeViewName = 16843857; // 0x1010451
+ field public static final int excludeId = 16843843; // 0x1010443
+ field public static final int excludeViewName = 16843856; // 0x1010450
field public static final int exitFadeDuration = 16843533; // 0x101030d
field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052
field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053
@@ -567,7 +567,7 @@ package android {
field public static final int freezesText = 16843116; // 0x101016c
field public static final int fromAlpha = 16843210; // 0x10101ca
field public static final int fromDegrees = 16843187; // 0x10101b3
- field public static final int fromId = 16843853; // 0x101044d
+ field public static final int fromId = 16843852; // 0x101044c
field public static final int fromScene = 16843741; // 0x10103dd
field public static final int fromXDelta = 16843206; // 0x10101c6
field public static final int fromXScale = 16843202; // 0x10101c2
@@ -600,7 +600,7 @@ package android {
field public static final int headerBackground = 16843055; // 0x101012f
field public static final int headerDividersEnabled = 16843310; // 0x101022e
field public static final int height = 16843093; // 0x1010155
- field public static final int hideOnContentScroll = 16843846; // 0x1010446
+ field public static final int hideOnContentScroll = 16843845; // 0x1010445
field public static final int hint = 16843088; // 0x1010150
field public static final int homeAsUpIndicator = 16843531; // 0x101030b
field public static final int homeLayout = 16843549; // 0x101031d
@@ -746,7 +746,7 @@ package android {
field public static final int layout_centerVertical = 16843153; // 0x1010191
field public static final int layout_column = 16843084; // 0x101014c
field public static final int layout_columnSpan = 16843645; // 0x101037d
- field public static final int layout_columnWeight = 16843868; // 0x101045c
+ field public static final int layout_columnWeight = 16843867; // 0x101045b
field public static final int layout_gravity = 16842931; // 0x10100b3
field public static final int layout_height = 16842997; // 0x10100f5
field public static final int layout_margin = 16842998; // 0x10100f6
@@ -758,7 +758,7 @@ package android {
field public static final int layout_marginTop = 16843000; // 0x10100f8
field public static final int layout_row = 16843643; // 0x101037b
field public static final int layout_rowSpan = 16843644; // 0x101037c
- field public static final int layout_rowWeight = 16843867; // 0x101045b
+ field public static final int layout_rowWeight = 16843866; // 0x101045a
field public static final int layout_scale = 16843155; // 0x1010193
field public static final int layout_span = 16843085; // 0x101014d
field public static final int layout_toEndOf = 16843704; // 0x10103b8
@@ -797,7 +797,7 @@ package android {
field public static final int manageSpaceActivity = 16842756; // 0x1010004
field public static final int mapViewStyle = 16842890; // 0x101008a
field public static final int marqueeRepeatLimit = 16843293; // 0x101021d
- field public static final int matchOrder = 16843858; // 0x1010452
+ field public static final int matchOrder = 16843857; // 0x1010451
field public static final int max = 16843062; // 0x1010136
field public static final int maxDate = 16843584; // 0x1010340
field public static final int maxEms = 16843095; // 0x1010157
@@ -806,7 +806,7 @@ package android {
field public static final int maxLength = 16843104; // 0x1010160
field public static final int maxLevel = 16843186; // 0x10101b2
field public static final int maxLines = 16843091; // 0x1010153
- field public static final int maxRecents = 16843849; // 0x1010449
+ field public static final int maxRecents = 16843848; // 0x1010448
field public static final int maxRows = 16843059; // 0x1010133
field public static final int maxSdkVersion = 16843377; // 0x1010271
field public static final int maxWidth = 16843039; // 0x101011f
@@ -831,10 +831,10 @@ package android {
field public static final int moreIcon = 16843061; // 0x1010135
field public static final int multiprocess = 16842771; // 0x1010013
field public static final int name = 16842755; // 0x1010003
- field public static final int navigationBarColor = 16843861; // 0x1010455
+ field public static final int navigationBarColor = 16843860; // 0x1010454
field public static final int navigationMode = 16843471; // 0x10102cf
field public static final int negativeButtonText = 16843254; // 0x10101f6
- field public static final int nestedScrollingEnabled = 16843833; // 0x1010439
+ field public static final int nestedScrollingEnabled = 16843832; // 0x1010438
field public static final int nextFocusDown = 16842980; // 0x10100e4
field public static final int nextFocusForward = 16843580; // 0x101033c
field public static final int nextFocusLeft = 16842977; // 0x10100e1
@@ -865,7 +865,7 @@ package android {
field public static final int paddingBottom = 16842969; // 0x10100d9
field public static final int paddingEnd = 16843700; // 0x10103b4
field public static final int paddingLeft = 16842966; // 0x10100d6
- field public static final int paddingMode = 16843866; // 0x101045a
+ field public static final int paddingMode = 16843865; // 0x1010459
field public static final int paddingRight = 16842968; // 0x10100d8
field public static final int paddingStart = 16843699; // 0x10103b3
field public static final int paddingTop = 16842967; // 0x10100d7
@@ -884,11 +884,10 @@ package android {
field public static final int permissionFlags = 16843719; // 0x10103c7
field public static final int permissionGroup = 16842762; // 0x101000a
field public static final int permissionGroupFlags = 16843717; // 0x10103c5
- field public static final int persistable = 16843824; // 0x1010430
+ field public static final int persistable = 16843823; // 0x101042f
field public static final int persistent = 16842765; // 0x101000d
field public static final int persistentDrawingCache = 16842990; // 0x10100ee
field public static final deprecated int phoneNumber = 16843111; // 0x1010167
- field public static final int pinned = 16843819; // 0x101042b
field public static final int pivotX = 16843189; // 0x10101b5
field public static final int pivotY = 16843190; // 0x10101b6
field public static final int popupAnimationStyle = 16843465; // 0x10102c9
@@ -961,7 +960,7 @@ package android {
field public static final int restoreAnyVersion = 16843450; // 0x10102ba
field public static final deprecated int restoreNeedsApplication = 16843421; // 0x101029d
field public static final int restrictedAccountType = 16843733; // 0x10103d5
- field public static final int reversible = 16843854; // 0x101044e
+ field public static final int reversible = 16843853; // 0x101044d
field public static final int right = 16843183; // 0x10101af
field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093
field public static final int ringtoneType = 16843257; // 0x10101f9
@@ -1001,6 +1000,9 @@ package android {
field public static final int scrollbars = 16842974; // 0x10100de
field public static final int scrollingCache = 16843006; // 0x10100fe
field public static final deprecated int searchButtonText = 16843269; // 0x1010205
+ field public static final int searchKeyphrase = 16843873; // 0x1010461
+ field public static final int searchKeyphraseId = 16843872; // 0x1010460
+ field public static final int searchKeyphraseSupportedLocales = 16843874; // 0x1010462
field public static final int searchMode = 16843221; // 0x10101d5
field public static final int searchSettingsDescription = 16843402; // 0x101028a
field public static final int searchSuggestAuthority = 16843222; // 0x10101d6
@@ -1015,10 +1017,10 @@ package android {
field public static final int selectAllOnFocus = 16843102; // 0x101015e
field public static final int selectable = 16843238; // 0x10101e6
field public static final int selectableItemBackground = 16843534; // 0x101030e
- field public static final int selectableItemBackgroundBorderless = 16843871; // 0x101045f
+ field public static final int selectableItemBackgroundBorderless = 16843870; // 0x101045e
field public static final int selectedDateVerticalBar = 16843591; // 0x1010347
field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342
- field public static final int sessionService = 16843840; // 0x1010440
+ field public static final int sessionService = 16843839; // 0x101043f
field public static final int settingsActivity = 16843301; // 0x1010225
field public static final int setupActivity = 16843766; // 0x10103f6
field public static final int shadowColor = 16843105; // 0x1010161
@@ -1040,7 +1042,7 @@ package android {
field public static final int shrinkColumns = 16843082; // 0x101014a
field public static final deprecated int singleLine = 16843101; // 0x101015d
field public static final int singleUser = 16843711; // 0x10103bf
- field public static final int slideEdge = 16843827; // 0x1010433
+ field public static final int slideEdge = 16843826; // 0x1010432
field public static final int smallIcon = 16843422; // 0x101029e
field public static final int smallScreens = 16843396; // 0x1010284
field public static final int smoothScrollbar = 16843313; // 0x1010231
@@ -1052,19 +1054,19 @@ package android {
field public static final int spinnerStyle = 16842881; // 0x1010081
field public static final int spinnersShown = 16843595; // 0x101034b
field public static final int splitMotionEvents = 16843503; // 0x10102ef
- field public static final int splitTrack = 16843855; // 0x101044f
+ field public static final int splitTrack = 16843854; // 0x101044e
field public static final int src = 16843033; // 0x1010119
field public static final int ssp = 16843747; // 0x10103e3
field public static final int sspPattern = 16843749; // 0x10103e5
field public static final int sspPrefix = 16843748; // 0x10103e4
field public static final int stackFromBottom = 16843005; // 0x10100fd
- field public static final int stackViewStyle = 16843841; // 0x1010441
+ field public static final int stackViewStyle = 16843840; // 0x1010440
field public static final int starStyle = 16842882; // 0x1010082
field public static final int startColor = 16843165; // 0x101019d
field public static final int startDelay = 16843746; // 0x10103e2
field public static final int startOffset = 16843198; // 0x10101be
field public static final deprecated int startYear = 16843132; // 0x101017c
- field public static final int stateListAnimator = 16843851; // 0x101044b
+ field public static final int stateListAnimator = 16843850; // 0x101044a
field public static final int stateNotNeeded = 16842774; // 0x1010016
field public static final int state_above_anchor = 16842922; // 0x10100aa
field public static final int state_accelerated = 16843547; // 0x101031b
@@ -1089,7 +1091,7 @@ package android {
field public static final int state_single = 16842915; // 0x10100a3
field public static final int state_window_focused = 16842909; // 0x101009d
field public static final int staticWallpaperPreview = 16843569; // 0x1010331
- field public static final int statusBarColor = 16843860; // 0x1010454
+ field public static final int statusBarColor = 16843859; // 0x1010453
field public static final int stepSize = 16843078; // 0x1010146
field public static final int stopWithTask = 16843626; // 0x101036a
field public static final int streamType = 16843273; // 0x1010209
@@ -1101,7 +1103,7 @@ package android {
field public static final int strokeOpacity = 16843810; // 0x1010422
field public static final int strokeWidth = 16843811; // 0x1010423
field public static final int subtitle = 16843473; // 0x10102d1
- field public static final int subtitleTextAppearance = 16843826; // 0x1010432
+ field public static final int subtitleTextAppearance = 16843825; // 0x1010431
field public static final int subtitleTextStyle = 16843513; // 0x10102f9
field public static final int subtypeExtraValue = 16843674; // 0x101039a
field public static final int subtypeId = 16843713; // 0x10103c1
@@ -1118,7 +1120,7 @@ package android {
field public static final int switchMinWidth = 16843632; // 0x1010370
field public static final int switchPadding = 16843633; // 0x1010371
field public static final int switchPreferenceStyle = 16843629; // 0x101036d
- field public static final int switchStyle = 16843842; // 0x1010442
+ field public static final int switchStyle = 16843841; // 0x1010441
field public static final int switchTextAppearance = 16843630; // 0x101036e
field public static final int switchTextOff = 16843628; // 0x101036c
field public static final int switchTextOn = 16843627; // 0x101036b
@@ -1134,7 +1136,7 @@ package android {
field public static final int targetId = 16843740; // 0x10103dc
field public static final int targetPackage = 16842785; // 0x1010021
field public static final int targetSdkVersion = 16843376; // 0x1010270
- field public static final int targetViewName = 16843856; // 0x1010450
+ field public static final int targetViewName = 16843855; // 0x101044f
field public static final int taskAffinity = 16842770; // 0x1010012
field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
field public static final int taskCloseExitAnimation = 16842943; // 0x10100bf
@@ -1156,7 +1158,7 @@ package android {
field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043
field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301
field public static final int textAppearanceListItem = 16843678; // 0x101039e
- field public static final int textAppearanceListItemSecondary = 16843829; // 0x1010435
+ field public static final int textAppearanceListItemSecondary = 16843828; // 0x1010434
field public static final int textAppearanceListItemSmall = 16843679; // 0x101039f
field public static final int textAppearanceMedium = 16842817; // 0x1010041
field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044
@@ -1220,11 +1222,11 @@ package android {
field public static final int tintMode = 16843797; // 0x1010415
field public static final int title = 16843233; // 0x10101e1
field public static final int titleCondensed = 16843234; // 0x10101e2
- field public static final int titleTextAppearance = 16843825; // 0x1010431
+ field public static final int titleTextAppearance = 16843824; // 0x1010430
field public static final int titleTextStyle = 16843512; // 0x10102f8
field public static final int toAlpha = 16843211; // 0x10101cb
field public static final int toDegrees = 16843188; // 0x10101b4
- field public static final int toId = 16843852; // 0x101044c
+ field public static final int toId = 16843851; // 0x101044b
field public static final int toScene = 16843742; // 0x10103de
field public static final int toXDelta = 16843207; // 0x10101c7
field public static final int toXScale = 16843203; // 0x10101c3
@@ -1243,8 +1245,8 @@ package android {
field public static final int transition = 16843743; // 0x10103df
field public static final int transitionGroup = 16843803; // 0x101041b
field public static final int transitionOrdering = 16843744; // 0x10103e0
- field public static final int translateX = 16843869; // 0x101045d
- field public static final int translateY = 16843870; // 0x101045e
+ field public static final int translateX = 16843868; // 0x101045c
+ field public static final int translateY = 16843869; // 0x101045d
field public static final int translationX = 16843554; // 0x1010322
field public static final int translationY = 16843555; // 0x1010323
field public static final int translationZ = 16843796; // 0x1010414
@@ -1307,8 +1309,8 @@ package android {
field public static final int windowActionBar = 16843469; // 0x10102cd
field public static final int windowActionBarOverlay = 16843492; // 0x10102e4
field public static final int windowActionModeOverlay = 16843485; // 0x10102dd
- field public static final int windowAllowEnterTransitionOverlap = 16843839; // 0x101043f
- field public static final int windowAllowExitTransitionOverlap = 16843838; // 0x101043e
+ field public static final int windowAllowEnterTransitionOverlap = 16843838; // 0x101043e
+ field public static final int windowAllowExitTransitionOverlap = 16843837; // 0x101043d
field public static final int windowAnimationStyle = 16842926; // 0x10100ae
field public static final int windowBackground = 16842836; // 0x1010054
field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b
@@ -1316,12 +1318,12 @@ package android {
field public static final int windowContentTransitionManager = 16843795; // 0x1010413
field public static final int windowContentTransitions = 16843794; // 0x1010412
field public static final int windowDisablePreview = 16843298; // 0x1010222
- field public static final int windowDrawsSystemBarBackgrounds = 16843859; // 0x1010453
+ field public static final int windowDrawsSystemBarBackgrounds = 16843858; // 0x1010452
field public static final int windowEnableSplitTouch = 16843543; // 0x1010317
field public static final int windowEnterAnimation = 16842932; // 0x10100b4
- field public static final int windowEnterTransition = 16843834; // 0x101043a
+ field public static final int windowEnterTransition = 16843833; // 0x1010439
field public static final int windowExitAnimation = 16842933; // 0x10100b5
- field public static final int windowExitTransition = 16843835; // 0x101043b
+ field public static final int windowExitTransition = 16843834; // 0x101043a
field public static final int windowFrame = 16842837; // 0x1010055
field public static final int windowFullscreen = 16843277; // 0x101020d
field public static final int windowHideAnimation = 16842935; // 0x10100b7
@@ -1332,8 +1334,8 @@ package android {
field public static final int windowNoDisplay = 16843294; // 0x101021e
field public static final int windowNoTitle = 16842838; // 0x1010056
field public static final int windowOverscan = 16843727; // 0x10103cf
- field public static final int windowSharedElementEnterTransition = 16843836; // 0x101043c
- field public static final int windowSharedElementExitTransition = 16843837; // 0x101043d
+ field public static final int windowSharedElementEnterTransition = 16843835; // 0x101043b
+ field public static final int windowSharedElementExitTransition = 16843836; // 0x101043c
field public static final int windowShowAnimation = 16842934; // 0x10100b6
field public static final int windowShowWallpaper = 16843410; // 0x1010292
field public static final int windowSoftInputMode = 16843307; // 0x101022b
@@ -1865,52 +1867,52 @@ package android {
field public static final int TextAppearance_Inverse = 16973887; // 0x103003f
field public static final int TextAppearance_Large = 16973890; // 0x1030042
field public static final int TextAppearance_Large_Inverse = 16973891; // 0x1030043
- field public static final int TextAppearance_Material = 16974348; // 0x103020c
- field public static final int TextAppearance_Material_Body1 = 16974546; // 0x10302d2
- field public static final int TextAppearance_Material_Body2 = 16974545; // 0x10302d1
- field public static final int TextAppearance_Material_Button = 16974549; // 0x10302d5
- field public static final int TextAppearance_Material_Caption = 16974547; // 0x10302d3
- field public static final int TextAppearance_Material_DialogWindowTitle = 16974349; // 0x103020d
- field public static final int TextAppearance_Material_Display1 = 16974541; // 0x10302cd
- field public static final int TextAppearance_Material_Display2 = 16974540; // 0x10302cc
- field public static final int TextAppearance_Material_Display3 = 16974539; // 0x10302cb
- field public static final int TextAppearance_Material_Display4 = 16974538; // 0x10302ca
- field public static final int TextAppearance_Material_Headline = 16974542; // 0x10302ce
- field public static final int TextAppearance_Material_Inverse = 16974350; // 0x103020e
- field public static final int TextAppearance_Material_Large = 16974351; // 0x103020f
- field public static final int TextAppearance_Material_Large_Inverse = 16974352; // 0x1030210
- field public static final int TextAppearance_Material_Medium = 16974353; // 0x1030211
- field public static final int TextAppearance_Material_Medium_Inverse = 16974354; // 0x1030212
- field public static final int TextAppearance_Material_Menu = 16974548; // 0x10302d4
- field public static final int TextAppearance_Material_SearchResult_Subtitle = 16974355; // 0x1030213
- field public static final int TextAppearance_Material_SearchResult_Title = 16974356; // 0x1030214
- field public static final int TextAppearance_Material_Small = 16974357; // 0x1030215
- field public static final int TextAppearance_Material_Small_Inverse = 16974358; // 0x1030216
- field public static final int TextAppearance_Material_Subhead = 16974544; // 0x10302d0
- field public static final int TextAppearance_Material_Title = 16974543; // 0x10302cf
- field public static final int TextAppearance_Material_Widget = 16974360; // 0x1030218
- field public static final int TextAppearance_Material_Widget_ActionBar_Menu = 16974361; // 0x1030219
- field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle = 16974362; // 0x103021a
- field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle_Inverse = 16974363; // 0x103021b
- field public static final int TextAppearance_Material_Widget_ActionBar_Title = 16974364; // 0x103021c
- field public static final int TextAppearance_Material_Widget_ActionBar_Title_Inverse = 16974365; // 0x103021d
- field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle = 16974366; // 0x103021e
- field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle_Inverse = 16974367; // 0x103021f
- field public static final int TextAppearance_Material_Widget_ActionMode_Title = 16974368; // 0x1030220
- field public static final int TextAppearance_Material_Widget_ActionMode_Title_Inverse = 16974369; // 0x1030221
- field public static final int TextAppearance_Material_Widget_Button = 16974370; // 0x1030222
- field public static final int TextAppearance_Material_Widget_DropDownHint = 16974371; // 0x1030223
- field public static final int TextAppearance_Material_Widget_DropDownItem = 16974372; // 0x1030224
- field public static final int TextAppearance_Material_Widget_EditText = 16974373; // 0x1030225
- field public static final int TextAppearance_Material_Widget_IconMenu_Item = 16974374; // 0x1030226
- field public static final int TextAppearance_Material_Widget_PopupMenu = 16974375; // 0x1030227
- field public static final int TextAppearance_Material_Widget_PopupMenu_Large = 16974376; // 0x1030228
- field public static final int TextAppearance_Material_Widget_PopupMenu_Small = 16974377; // 0x1030229
- field public static final int TextAppearance_Material_Widget_TabWidget = 16974378; // 0x103022a
- field public static final int TextAppearance_Material_Widget_TextView = 16974379; // 0x103022b
- field public static final int TextAppearance_Material_Widget_TextView_PopupMenu = 16974380; // 0x103022c
- field public static final int TextAppearance_Material_Widget_TextView_SpinnerItem = 16974381; // 0x103022d
- field public static final int TextAppearance_Material_WindowTitle = 16974359; // 0x1030217
+ field public static final int TextAppearance_Material = 16974350; // 0x103020e
+ field public static final int TextAppearance_Material_Body1 = 16974550; // 0x10302d6
+ field public static final int TextAppearance_Material_Body2 = 16974549; // 0x10302d5
+ field public static final int TextAppearance_Material_Button = 16974553; // 0x10302d9
+ field public static final int TextAppearance_Material_Caption = 16974551; // 0x10302d7
+ field public static final int TextAppearance_Material_DialogWindowTitle = 16974351; // 0x103020f
+ field public static final int TextAppearance_Material_Display1 = 16974545; // 0x10302d1
+ field public static final int TextAppearance_Material_Display2 = 16974544; // 0x10302d0
+ field public static final int TextAppearance_Material_Display3 = 16974543; // 0x10302cf
+ field public static final int TextAppearance_Material_Display4 = 16974542; // 0x10302ce
+ field public static final int TextAppearance_Material_Headline = 16974546; // 0x10302d2
+ field public static final int TextAppearance_Material_Inverse = 16974352; // 0x1030210
+ field public static final int TextAppearance_Material_Large = 16974353; // 0x1030211
+ field public static final int TextAppearance_Material_Large_Inverse = 16974354; // 0x1030212
+ field public static final int TextAppearance_Material_Medium = 16974355; // 0x1030213
+ field public static final int TextAppearance_Material_Medium_Inverse = 16974356; // 0x1030214
+ field public static final int TextAppearance_Material_Menu = 16974552; // 0x10302d8
+ field public static final int TextAppearance_Material_SearchResult_Subtitle = 16974357; // 0x1030215
+ field public static final int TextAppearance_Material_SearchResult_Title = 16974358; // 0x1030216
+ field public static final int TextAppearance_Material_Small = 16974359; // 0x1030217
+ field public static final int TextAppearance_Material_Small_Inverse = 16974360; // 0x1030218
+ field public static final int TextAppearance_Material_Subhead = 16974548; // 0x10302d4
+ field public static final int TextAppearance_Material_Title = 16974547; // 0x10302d3
+ field public static final int TextAppearance_Material_Widget = 16974362; // 0x103021a
+ field public static final int TextAppearance_Material_Widget_ActionBar_Menu = 16974363; // 0x103021b
+ field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle = 16974364; // 0x103021c
+ field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle_Inverse = 16974365; // 0x103021d
+ field public static final int TextAppearance_Material_Widget_ActionBar_Title = 16974366; // 0x103021e
+ field public static final int TextAppearance_Material_Widget_ActionBar_Title_Inverse = 16974367; // 0x103021f
+ field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle = 16974368; // 0x1030220
+ field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle_Inverse = 16974369; // 0x1030221
+ field public static final int TextAppearance_Material_Widget_ActionMode_Title = 16974370; // 0x1030222
+ field public static final int TextAppearance_Material_Widget_ActionMode_Title_Inverse = 16974371; // 0x1030223
+ field public static final int TextAppearance_Material_Widget_Button = 16974372; // 0x1030224
+ field public static final int TextAppearance_Material_Widget_DropDownHint = 16974373; // 0x1030225
+ field public static final int TextAppearance_Material_Widget_DropDownItem = 16974374; // 0x1030226
+ field public static final int TextAppearance_Material_Widget_EditText = 16974375; // 0x1030227
+ field public static final int TextAppearance_Material_Widget_IconMenu_Item = 16974376; // 0x1030228
+ field public static final int TextAppearance_Material_Widget_PopupMenu = 16974377; // 0x1030229
+ field public static final int TextAppearance_Material_Widget_PopupMenu_Large = 16974378; // 0x103022a
+ field public static final int TextAppearance_Material_Widget_PopupMenu_Small = 16974379; // 0x103022b
+ field public static final int TextAppearance_Material_Widget_TabWidget = 16974380; // 0x103022c
+ field public static final int TextAppearance_Material_Widget_TextView = 16974381; // 0x103022d
+ field public static final int TextAppearance_Material_Widget_TextView_PopupMenu = 16974382; // 0x103022e
+ field public static final int TextAppearance_Material_Widget_TextView_SpinnerItem = 16974383; // 0x103022f
+ field public static final int TextAppearance_Material_WindowTitle = 16974361; // 0x1030219
field public static final int TextAppearance_Medium = 16973892; // 0x1030044
field public static final int TextAppearance_Medium_Inverse = 16973893; // 0x1030045
field public static final int TextAppearance_Small = 16973894; // 0x1030046
@@ -1936,12 +1938,12 @@ package android {
field public static final int TextAppearance_Widget_TextView_SpinnerItem = 16973906; // 0x1030052
field public static final int TextAppearance_WindowTitle = 16973907; // 0x1030053
field public static final int Theme = 16973829; // 0x1030005
- field public static final int ThemeOverlay = 16974412; // 0x103024c
- field public static final int ThemeOverlay_Material = 16974413; // 0x103024d
- field public static final int ThemeOverlay_Material_ActionBar = 16974414; // 0x103024e
- field public static final int ThemeOverlay_Material_Dark = 16974416; // 0x1030250
- field public static final int ThemeOverlay_Material_Dark_ActionBar = 16974417; // 0x1030251
- field public static final int ThemeOverlay_Material_Light = 16974415; // 0x103024f
+ field public static final int ThemeOverlay = 16974414; // 0x103024e
+ field public static final int ThemeOverlay_Material = 16974415; // 0x103024f
+ field public static final int ThemeOverlay_Material_ActionBar = 16974416; // 0x1030250
+ field public static final int ThemeOverlay_Material_Dark = 16974418; // 0x1030252
+ field public static final int ThemeOverlay_Material_Dark_ActionBar = 16974419; // 0x1030253
+ field public static final int ThemeOverlay_Material_Light = 16974417; // 0x1030251
field public static final int Theme_Black = 16973832; // 0x1030008
field public static final int Theme_Black_NoTitleBar = 16973833; // 0x1030009
field public static final int Theme_Black_NoTitleBar_Fullscreen = 16973834; // 0x103000a
@@ -2008,36 +2010,36 @@ package android {
field public static final int Theme_Light_NoTitleBar_Fullscreen = 16973838; // 0x103000e
field public static final int Theme_Light_Panel = 16973914; // 0x103005a
field public static final int Theme_Light_WallpaperSettings = 16973922; // 0x1030062
- field public static final int Theme_Material = 16974382; // 0x103022e
- field public static final int Theme_Material_Dialog = 16974383; // 0x103022f
- field public static final int Theme_Material_DialogWhenLarge = 16974387; // 0x1030233
- field public static final int Theme_Material_DialogWhenLarge_NoActionBar = 16974388; // 0x1030234
- field public static final int Theme_Material_Dialog_MinWidth = 16974384; // 0x1030230
- field public static final int Theme_Material_Dialog_NoActionBar = 16974385; // 0x1030231
- field public static final int Theme_Material_Dialog_NoActionBar_MinWidth = 16974386; // 0x1030232
- field public static final int Theme_Material_InputMethod = 16974389; // 0x1030235
- field public static final int Theme_Material_Light = 16974398; // 0x103023e
- field public static final int Theme_Material_Light_DarkActionBar = 16974399; // 0x103023f
- field public static final int Theme_Material_Light_Dialog = 16974400; // 0x1030240
- field public static final int Theme_Material_Light_DialogWhenLarge = 16974404; // 0x1030244
- field public static final int Theme_Material_Light_DialogWhenLarge_NoActionBar = 16974405; // 0x1030245
- field public static final int Theme_Material_Light_Dialog_MinWidth = 16974401; // 0x1030241
- field public static final int Theme_Material_Light_Dialog_NoActionBar = 16974402; // 0x1030242
- field public static final int Theme_Material_Light_Dialog_NoActionBar_MinWidth = 16974403; // 0x1030243
- field public static final int Theme_Material_Light_NoActionBar = 16974406; // 0x1030246
- field public static final int Theme_Material_Light_NoActionBar_Fullscreen = 16974407; // 0x1030247
- field public static final int Theme_Material_Light_NoActionBar_Overscan = 16974408; // 0x1030248
- field public static final int Theme_Material_Light_NoActionBar_TranslucentDecor = 16974409; // 0x1030249
- field public static final int Theme_Material_Light_Panel = 16974410; // 0x103024a
- field public static final int Theme_Material_Light_Voice = 16974411; // 0x103024b
- field public static final int Theme_Material_NoActionBar = 16974390; // 0x1030236
- field public static final int Theme_Material_NoActionBar_Fullscreen = 16974391; // 0x1030237
- field public static final int Theme_Material_NoActionBar_Overscan = 16974392; // 0x1030238
- field public static final int Theme_Material_NoActionBar_TranslucentDecor = 16974393; // 0x1030239
- field public static final int Theme_Material_Panel = 16974394; // 0x103023a
- field public static final int Theme_Material_Voice = 16974395; // 0x103023b
- field public static final int Theme_Material_Wallpaper = 16974396; // 0x103023c
- field public static final int Theme_Material_Wallpaper_NoTitleBar = 16974397; // 0x103023d
+ field public static final int Theme_Material = 16974384; // 0x1030230
+ field public static final int Theme_Material_Dialog = 16974385; // 0x1030231
+ field public static final int Theme_Material_DialogWhenLarge = 16974389; // 0x1030235
+ field public static final int Theme_Material_DialogWhenLarge_NoActionBar = 16974390; // 0x1030236
+ field public static final int Theme_Material_Dialog_MinWidth = 16974386; // 0x1030232
+ field public static final int Theme_Material_Dialog_NoActionBar = 16974387; // 0x1030233
+ field public static final int Theme_Material_Dialog_NoActionBar_MinWidth = 16974388; // 0x1030234
+ field public static final int Theme_Material_InputMethod = 16974391; // 0x1030237
+ field public static final int Theme_Material_Light = 16974400; // 0x1030240
+ field public static final int Theme_Material_Light_DarkActionBar = 16974401; // 0x1030241
+ field public static final int Theme_Material_Light_Dialog = 16974402; // 0x1030242
+ field public static final int Theme_Material_Light_DialogWhenLarge = 16974406; // 0x1030246
+ field public static final int Theme_Material_Light_DialogWhenLarge_NoActionBar = 16974407; // 0x1030247
+ field public static final int Theme_Material_Light_Dialog_MinWidth = 16974403; // 0x1030243
+ field public static final int Theme_Material_Light_Dialog_NoActionBar = 16974404; // 0x1030244
+ field public static final int Theme_Material_Light_Dialog_NoActionBar_MinWidth = 16974405; // 0x1030245
+ field public static final int Theme_Material_Light_NoActionBar = 16974408; // 0x1030248
+ field public static final int Theme_Material_Light_NoActionBar_Fullscreen = 16974409; // 0x1030249
+ field public static final int Theme_Material_Light_NoActionBar_Overscan = 16974410; // 0x103024a
+ field public static final int Theme_Material_Light_NoActionBar_TranslucentDecor = 16974411; // 0x103024b
+ field public static final int Theme_Material_Light_Panel = 16974412; // 0x103024c
+ field public static final int Theme_Material_Light_Voice = 16974413; // 0x103024d
+ field public static final int Theme_Material_NoActionBar = 16974392; // 0x1030238
+ field public static final int Theme_Material_NoActionBar_Fullscreen = 16974393; // 0x1030239
+ field public static final int Theme_Material_NoActionBar_Overscan = 16974394; // 0x103023a
+ field public static final int Theme_Material_NoActionBar_TranslucentDecor = 16974395; // 0x103023b
+ field public static final int Theme_Material_Panel = 16974396; // 0x103023c
+ field public static final int Theme_Material_Voice = 16974397; // 0x103023d
+ field public static final int Theme_Material_Wallpaper = 16974398; // 0x103023e
+ field public static final int Theme_Material_Wallpaper_NoTitleBar = 16974399; // 0x103023f
field public static final int Theme_NoDisplay = 16973909; // 0x1030055
field public static final int Theme_NoTitleBar = 16973830; // 0x1030006
field public static final int Theme_NoTitleBar_Fullscreen = 16973831; // 0x1030007
@@ -2099,7 +2101,7 @@ package android {
field public static final int Widget_DeviceDefault_DropDownItem_Spinner = 16974178; // 0x1030162
field public static final int Widget_DeviceDefault_EditText = 16974154; // 0x103014a
field public static final int Widget_DeviceDefault_ExpandableListView = 16974155; // 0x103014b
- field public static final int Widget_DeviceDefault_FastScroll = 16974344; // 0x1030208
+ field public static final int Widget_DeviceDefault_FastScroll = 16974346; // 0x103020a
field public static final int Widget_DeviceDefault_GridView = 16974156; // 0x103014c
field public static final int Widget_DeviceDefault_HorizontalScrollView = 16974171; // 0x103015b
field public static final int Widget_DeviceDefault_ImageButton = 16974157; // 0x103014d
@@ -2133,7 +2135,7 @@ package android {
field public static final int Widget_DeviceDefault_Light_DropDownItem_Spinner = 16974233; // 0x1030199
field public static final int Widget_DeviceDefault_Light_EditText = 16974206; // 0x103017e
field public static final int Widget_DeviceDefault_Light_ExpandableListView = 16974207; // 0x103017f
- field public static final int Widget_DeviceDefault_Light_FastScroll = 16974346; // 0x103020a
+ field public static final int Widget_DeviceDefault_Light_FastScroll = 16974348; // 0x103020c
field public static final int Widget_DeviceDefault_Light_GridView = 16974208; // 0x1030180
field public static final int Widget_DeviceDefault_Light_HorizontalScrollView = 16974226; // 0x1030192
field public static final int Widget_DeviceDefault_Light_ImageButton = 16974209; // 0x1030181
@@ -2157,7 +2159,7 @@ package android {
field public static final int Widget_DeviceDefault_Light_ScrollView = 16974225; // 0x1030191
field public static final int Widget_DeviceDefault_Light_SeekBar = 16974220; // 0x103018c
field public static final int Widget_DeviceDefault_Light_Spinner = 16974227; // 0x1030193
- field public static final int Widget_DeviceDefault_Light_StackView = 16974347; // 0x103020b
+ field public static final int Widget_DeviceDefault_Light_StackView = 16974349; // 0x103020d
field public static final int Widget_DeviceDefault_Light_Tab = 16974237; // 0x103019d
field public static final int Widget_DeviceDefault_Light_TabWidget = 16974229; // 0x1030195
field public static final int Widget_DeviceDefault_Light_TextView = 16974202; // 0x103017a
@@ -2181,7 +2183,7 @@ package android {
field public static final int Widget_DeviceDefault_ScrollView = 16974170; // 0x103015a
field public static final int Widget_DeviceDefault_SeekBar = 16974165; // 0x1030155
field public static final int Widget_DeviceDefault_Spinner = 16974172; // 0x103015c
- field public static final int Widget_DeviceDefault_StackView = 16974345; // 0x1030209
+ field public static final int Widget_DeviceDefault_StackView = 16974347; // 0x103020b
field public static final int Widget_DeviceDefault_Tab = 16974189; // 0x103016d
field public static final int Widget_DeviceDefault_TabWidget = 16974174; // 0x103015e
field public static final int Widget_DeviceDefault_TextView = 16974150; // 0x1030146
@@ -2224,7 +2226,7 @@ package android {
field public static final int Widget_Holo_DropDownItem_Spinner = 16973995; // 0x10300ab
field public static final int Widget_Holo_EditText = 16973971; // 0x1030093
field public static final int Widget_Holo_ExpandableListView = 16973972; // 0x1030094
- field public static final int Widget_Holo_FastScroll = 16974339; // 0x1030203
+ field public static final int Widget_Holo_FastScroll = 16974341; // 0x1030205
field public static final int Widget_Holo_GridView = 16973973; // 0x1030095
field public static final int Widget_Holo_HorizontalScrollView = 16973988; // 0x10300a4
field public static final int Widget_Holo_ImageButton = 16973974; // 0x1030096
@@ -2245,7 +2247,7 @@ package android {
field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974119; // 0x1030127
field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb
field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6
- field public static final int Widget_Holo_Light_Button_Borderless = 16974341; // 0x1030205
+ field public static final int Widget_Holo_Light_Button_Borderless = 16974343; // 0x1030207
field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974107; // 0x103011b
field public static final int Widget_Holo_Light_Button_Inset = 16974008; // 0x10300b8
field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7
@@ -2259,7 +2261,7 @@ package android {
field public static final int Widget_Holo_Light_DropDownItem_Spinner = 16974041; // 0x10300d9
field public static final int Widget_Holo_Light_EditText = 16974014; // 0x10300be
field public static final int Widget_Holo_Light_ExpandableListView = 16974015; // 0x10300bf
- field public static final int Widget_Holo_Light_FastScroll = 16974342; // 0x1030206
+ field public static final int Widget_Holo_Light_FastScroll = 16974344; // 0x1030208
field public static final int Widget_Holo_Light_GridView = 16974016; // 0x10300c0
field public static final int Widget_Holo_Light_HorizontalScrollView = 16974034; // 0x10300d2
field public static final int Widget_Holo_Light_ImageButton = 16974017; // 0x10300c1
@@ -2283,7 +2285,7 @@ package android {
field public static final int Widget_Holo_Light_ScrollView = 16974033; // 0x10300d1
field public static final int Widget_Holo_Light_SeekBar = 16974028; // 0x10300cc
field public static final int Widget_Holo_Light_Spinner = 16974035; // 0x10300d3
- field public static final int Widget_Holo_Light_StackView = 16974343; // 0x1030207
+ field public static final int Widget_Holo_Light_StackView = 16974345; // 0x1030209
field public static final int Widget_Holo_Light_Tab = 16974052; // 0x10300e4
field public static final int Widget_Holo_Light_TabWidget = 16974037; // 0x10300d5
field public static final int Widget_Holo_Light_TextView = 16974010; // 0x10300ba
@@ -2307,7 +2309,7 @@ package android {
field public static final int Widget_Holo_ScrollView = 16973987; // 0x10300a3
field public static final int Widget_Holo_SeekBar = 16973982; // 0x103009e
field public static final int Widget_Holo_Spinner = 16973989; // 0x10300a5
- field public static final int Widget_Holo_StackView = 16974340; // 0x1030204
+ field public static final int Widget_Holo_StackView = 16974342; // 0x1030206
field public static final int Widget_Holo_Tab = 16974051; // 0x10300e3
field public static final int Widget_Holo_TabWidget = 16973991; // 0x10300a7
field public static final int Widget_Holo_TextView = 16973967; // 0x103008f
@@ -2322,126 +2324,128 @@ package android {
field public static final int Widget_ListView_DropDown = 16973872; // 0x1030030
field public static final int Widget_ListView_Menu = 16973873; // 0x1030031
field public static final int Widget_ListView_White = 16973871; // 0x103002f
- field public static final int Widget_Material = 16974418; // 0x1030252
- field public static final int Widget_Material_ActionBar = 16974419; // 0x1030253
- field public static final int Widget_Material_ActionBar_Solid = 16974420; // 0x1030254
- field public static final int Widget_Material_ActionBar_TabBar = 16974421; // 0x1030255
- field public static final int Widget_Material_ActionBar_TabText = 16974422; // 0x1030256
- field public static final int Widget_Material_ActionBar_TabView = 16974423; // 0x1030257
- field public static final int Widget_Material_ActionButton = 16974424; // 0x1030258
- field public static final int Widget_Material_ActionButton_CloseMode = 16974425; // 0x1030259
- field public static final int Widget_Material_ActionButton_Overflow = 16974426; // 0x103025a
- field public static final int Widget_Material_ActionMode = 16974427; // 0x103025b
- field public static final int Widget_Material_AutoCompleteTextView = 16974428; // 0x103025c
- field public static final int Widget_Material_Button = 16974429; // 0x103025d
- field public static final int Widget_Material_ButtonBar = 16974435; // 0x1030263
- field public static final int Widget_Material_ButtonBar_AlertDialog = 16974436; // 0x1030264
- field public static final int Widget_Material_Button_Borderless = 16974430; // 0x103025e
- field public static final int Widget_Material_Button_Borderless_Small = 16974431; // 0x103025f
- field public static final int Widget_Material_Button_Inset = 16974432; // 0x1030260
- field public static final int Widget_Material_Button_Small = 16974433; // 0x1030261
- field public static final int Widget_Material_Button_Toggle = 16974434; // 0x1030262
- field public static final int Widget_Material_CalendarView = 16974437; // 0x1030265
- field public static final int Widget_Material_CheckedTextView = 16974438; // 0x1030266
- field public static final int Widget_Material_CompoundButton_CheckBox = 16974439; // 0x1030267
- field public static final int Widget_Material_CompoundButton_RadioButton = 16974440; // 0x1030268
- field public static final int Widget_Material_CompoundButton_Star = 16974441; // 0x1030269
- field public static final int Widget_Material_DatePicker = 16974442; // 0x103026a
- field public static final int Widget_Material_DropDownItem = 16974443; // 0x103026b
- field public static final int Widget_Material_DropDownItem_Spinner = 16974444; // 0x103026c
- field public static final int Widget_Material_EditText = 16974445; // 0x103026d
- field public static final int Widget_Material_ExpandableListView = 16974446; // 0x103026e
- field public static final int Widget_Material_FastScroll = 16974447; // 0x103026f
- field public static final int Widget_Material_GridView = 16974448; // 0x1030270
- field public static final int Widget_Material_HorizontalScrollView = 16974449; // 0x1030271
- field public static final int Widget_Material_ImageButton = 16974450; // 0x1030272
- field public static final int Widget_Material_Light = 16974477; // 0x103028d
- field public static final int Widget_Material_Light_ActionBar = 16974478; // 0x103028e
- field public static final int Widget_Material_Light_ActionBar_Solid = 16974479; // 0x103028f
- field public static final int Widget_Material_Light_ActionBar_TabBar = 16974480; // 0x1030290
- field public static final int Widget_Material_Light_ActionBar_TabText = 16974481; // 0x1030291
- field public static final int Widget_Material_Light_ActionBar_TabView = 16974482; // 0x1030292
- field public static final int Widget_Material_Light_ActionButton = 16974483; // 0x1030293
- field public static final int Widget_Material_Light_ActionButton_CloseMode = 16974484; // 0x1030294
- field public static final int Widget_Material_Light_ActionButton_Overflow = 16974485; // 0x1030295
- field public static final int Widget_Material_Light_ActionMode = 16974486; // 0x1030296
- field public static final int Widget_Material_Light_AutoCompleteTextView = 16974487; // 0x1030297
- field public static final int Widget_Material_Light_Button = 16974488; // 0x1030298
- field public static final int Widget_Material_Light_ButtonBar = 16974494; // 0x103029e
- field public static final int Widget_Material_Light_ButtonBar_AlertDialog = 16974495; // 0x103029f
- field public static final int Widget_Material_Light_Button_Borderless = 16974489; // 0x1030299
- field public static final int Widget_Material_Light_Button_Borderless_Small = 16974490; // 0x103029a
- field public static final int Widget_Material_Light_Button_Inset = 16974491; // 0x103029b
- field public static final int Widget_Material_Light_Button_Small = 16974492; // 0x103029c
- field public static final int Widget_Material_Light_Button_Toggle = 16974493; // 0x103029d
- field public static final int Widget_Material_Light_CalendarView = 16974496; // 0x10302a0
- field public static final int Widget_Material_Light_CheckedTextView = 16974497; // 0x10302a1
- field public static final int Widget_Material_Light_CompoundButton_CheckBox = 16974498; // 0x10302a2
- field public static final int Widget_Material_Light_CompoundButton_RadioButton = 16974499; // 0x10302a3
- field public static final int Widget_Material_Light_CompoundButton_Star = 16974500; // 0x10302a4
- field public static final int Widget_Material_Light_DropDownItem = 16974501; // 0x10302a5
- field public static final int Widget_Material_Light_DropDownItem_Spinner = 16974502; // 0x10302a6
- field public static final int Widget_Material_Light_EditText = 16974503; // 0x10302a7
- field public static final int Widget_Material_Light_ExpandableListView = 16974504; // 0x10302a8
- field public static final int Widget_Material_Light_FastScroll = 16974505; // 0x10302a9
- field public static final int Widget_Material_Light_GridView = 16974506; // 0x10302aa
- field public static final int Widget_Material_Light_HorizontalScrollView = 16974507; // 0x10302ab
- field public static final int Widget_Material_Light_ImageButton = 16974508; // 0x10302ac
- field public static final int Widget_Material_Light_ListPopupWindow = 16974509; // 0x10302ad
- field public static final int Widget_Material_Light_ListView = 16974510; // 0x10302ae
- field public static final int Widget_Material_Light_ListView_DropDown = 16974511; // 0x10302af
- field public static final int Widget_Material_Light_MediaRouteButton = 16974512; // 0x10302b0
- field public static final int Widget_Material_Light_PopupMenu = 16974513; // 0x10302b1
- field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974514; // 0x10302b2
- field public static final int Widget_Material_Light_PopupWindow = 16974515; // 0x10302b3
- field public static final int Widget_Material_Light_ProgressBar = 16974516; // 0x10302b4
- field public static final int Widget_Material_Light_ProgressBar_Horizontal = 16974517; // 0x10302b5
- field public static final int Widget_Material_Light_ProgressBar_Inverse = 16974518; // 0x10302b6
- field public static final int Widget_Material_Light_ProgressBar_Large = 16974519; // 0x10302b7
- field public static final int Widget_Material_Light_ProgressBar_Large_Inverse = 16974520; // 0x10302b8
- field public static final int Widget_Material_Light_ProgressBar_Small = 16974521; // 0x10302b9
- field public static final int Widget_Material_Light_ProgressBar_Small_Inverse = 16974522; // 0x10302ba
- field public static final int Widget_Material_Light_ProgressBar_Small_Title = 16974523; // 0x10302bb
- field public static final int Widget_Material_Light_RatingBar = 16974524; // 0x10302bc
- field public static final int Widget_Material_Light_RatingBar_Indicator = 16974525; // 0x10302bd
- field public static final int Widget_Material_Light_RatingBar_Small = 16974526; // 0x10302be
- field public static final int Widget_Material_Light_ScrollView = 16974527; // 0x10302bf
- field public static final int Widget_Material_Light_SeekBar = 16974528; // 0x10302c0
- field public static final int Widget_Material_Light_SegmentedButton = 16974529; // 0x10302c1
- field public static final int Widget_Material_Light_Spinner = 16974531; // 0x10302c3
- field public static final int Widget_Material_Light_StackView = 16974530; // 0x10302c2
- field public static final int Widget_Material_Light_Tab = 16974532; // 0x10302c4
- field public static final int Widget_Material_Light_TabWidget = 16974533; // 0x10302c5
- field public static final int Widget_Material_Light_TextView = 16974534; // 0x10302c6
- field public static final int Widget_Material_Light_TextView_SpinnerItem = 16974535; // 0x10302c7
- field public static final int Widget_Material_Light_WebTextView = 16974536; // 0x10302c8
- field public static final int Widget_Material_Light_WebView = 16974537; // 0x10302c9
- field public static final int Widget_Material_ListPopupWindow = 16974451; // 0x1030273
- field public static final int Widget_Material_ListView = 16974452; // 0x1030274
- field public static final int Widget_Material_ListView_DropDown = 16974453; // 0x1030275
- field public static final int Widget_Material_MediaRouteButton = 16974454; // 0x1030276
- field public static final int Widget_Material_PopupMenu = 16974455; // 0x1030277
- field public static final int Widget_Material_PopupMenu_Overflow = 16974456; // 0x1030278
- field public static final int Widget_Material_PopupWindow = 16974457; // 0x1030279
- field public static final int Widget_Material_ProgressBar = 16974458; // 0x103027a
- field public static final int Widget_Material_ProgressBar_Horizontal = 16974459; // 0x103027b
- field public static final int Widget_Material_ProgressBar_Large = 16974460; // 0x103027c
- field public static final int Widget_Material_ProgressBar_Small = 16974461; // 0x103027d
- field public static final int Widget_Material_ProgressBar_Small_Title = 16974462; // 0x103027e
- field public static final int Widget_Material_RatingBar = 16974463; // 0x103027f
- field public static final int Widget_Material_RatingBar_Indicator = 16974464; // 0x1030280
- field public static final int Widget_Material_RatingBar_Small = 16974465; // 0x1030281
- field public static final int Widget_Material_ScrollView = 16974466; // 0x1030282
- field public static final int Widget_Material_SeekBar = 16974467; // 0x1030283
- field public static final int Widget_Material_SegmentedButton = 16974468; // 0x1030284
- field public static final int Widget_Material_Spinner = 16974470; // 0x1030286
- field public static final int Widget_Material_StackView = 16974469; // 0x1030285
- field public static final int Widget_Material_Tab = 16974471; // 0x1030287
- field public static final int Widget_Material_TabWidget = 16974472; // 0x1030288
- field public static final int Widget_Material_TextView = 16974473; // 0x1030289
- field public static final int Widget_Material_TextView_SpinnerItem = 16974474; // 0x103028a
- field public static final int Widget_Material_WebTextView = 16974475; // 0x103028b
- field public static final int Widget_Material_WebView = 16974476; // 0x103028c
+ field public static final int Widget_Material = 16974420; // 0x1030254
+ field public static final int Widget_Material_ActionBar = 16974421; // 0x1030255
+ field public static final int Widget_Material_ActionBar_Solid = 16974422; // 0x1030256
+ field public static final int Widget_Material_ActionBar_TabBar = 16974423; // 0x1030257
+ field public static final int Widget_Material_ActionBar_TabText = 16974424; // 0x1030258
+ field public static final int Widget_Material_ActionBar_TabView = 16974425; // 0x1030259
+ field public static final int Widget_Material_ActionButton = 16974426; // 0x103025a
+ field public static final int Widget_Material_ActionButton_CloseMode = 16974427; // 0x103025b
+ field public static final int Widget_Material_ActionButton_Overflow = 16974428; // 0x103025c
+ field public static final int Widget_Material_ActionMode = 16974429; // 0x103025d
+ field public static final int Widget_Material_AutoCompleteTextView = 16974430; // 0x103025e
+ field public static final int Widget_Material_Button = 16974431; // 0x103025f
+ field public static final int Widget_Material_ButtonBar = 16974437; // 0x1030265
+ field public static final int Widget_Material_ButtonBar_AlertDialog = 16974438; // 0x1030266
+ field public static final int Widget_Material_Button_Borderless = 16974432; // 0x1030260
+ field public static final int Widget_Material_Button_Borderless_Small = 16974433; // 0x1030261
+ field public static final int Widget_Material_Button_Inset = 16974434; // 0x1030262
+ field public static final int Widget_Material_Button_Small = 16974435; // 0x1030263
+ field public static final int Widget_Material_Button_Toggle = 16974436; // 0x1030264
+ field public static final int Widget_Material_CalendarView = 16974439; // 0x1030267
+ field public static final int Widget_Material_CheckedTextView = 16974440; // 0x1030268
+ field public static final int Widget_Material_CompoundButton_CheckBox = 16974441; // 0x1030269
+ field public static final int Widget_Material_CompoundButton_RadioButton = 16974442; // 0x103026a
+ field public static final int Widget_Material_CompoundButton_Star = 16974443; // 0x103026b
+ field public static final int Widget_Material_DatePicker = 16974444; // 0x103026c
+ field public static final int Widget_Material_DropDownItem = 16974445; // 0x103026d
+ field public static final int Widget_Material_DropDownItem_Spinner = 16974446; // 0x103026e
+ field public static final int Widget_Material_EditText = 16974447; // 0x103026f
+ field public static final int Widget_Material_ExpandableListView = 16974448; // 0x1030270
+ field public static final int Widget_Material_FastScroll = 16974449; // 0x1030271
+ field public static final int Widget_Material_GridView = 16974450; // 0x1030272
+ field public static final int Widget_Material_HorizontalScrollView = 16974451; // 0x1030273
+ field public static final int Widget_Material_ImageButton = 16974452; // 0x1030274
+ field public static final int Widget_Material_Light = 16974481; // 0x1030291
+ field public static final int Widget_Material_Light_ActionBar = 16974482; // 0x1030292
+ field public static final int Widget_Material_Light_ActionBar_Solid = 16974483; // 0x1030293
+ field public static final int Widget_Material_Light_ActionBar_TabBar = 16974484; // 0x1030294
+ field public static final int Widget_Material_Light_ActionBar_TabText = 16974485; // 0x1030295
+ field public static final int Widget_Material_Light_ActionBar_TabView = 16974486; // 0x1030296
+ field public static final int Widget_Material_Light_ActionButton = 16974487; // 0x1030297
+ field public static final int Widget_Material_Light_ActionButton_CloseMode = 16974488; // 0x1030298
+ field public static final int Widget_Material_Light_ActionButton_Overflow = 16974489; // 0x1030299
+ field public static final int Widget_Material_Light_ActionMode = 16974490; // 0x103029a
+ field public static final int Widget_Material_Light_AutoCompleteTextView = 16974491; // 0x103029b
+ field public static final int Widget_Material_Light_Button = 16974492; // 0x103029c
+ field public static final int Widget_Material_Light_ButtonBar = 16974498; // 0x10302a2
+ field public static final int Widget_Material_Light_ButtonBar_AlertDialog = 16974499; // 0x10302a3
+ field public static final int Widget_Material_Light_Button_Borderless = 16974493; // 0x103029d
+ field public static final int Widget_Material_Light_Button_Borderless_Small = 16974494; // 0x103029e
+ field public static final int Widget_Material_Light_Button_Inset = 16974495; // 0x103029f
+ field public static final int Widget_Material_Light_Button_Small = 16974496; // 0x10302a0
+ field public static final int Widget_Material_Light_Button_Toggle = 16974497; // 0x10302a1
+ field public static final int Widget_Material_Light_CalendarView = 16974500; // 0x10302a4
+ field public static final int Widget_Material_Light_CheckedTextView = 16974501; // 0x10302a5
+ field public static final int Widget_Material_Light_CompoundButton_CheckBox = 16974502; // 0x10302a6
+ field public static final int Widget_Material_Light_CompoundButton_RadioButton = 16974503; // 0x10302a7
+ field public static final int Widget_Material_Light_CompoundButton_Star = 16974504; // 0x10302a8
+ field public static final int Widget_Material_Light_DropDownItem = 16974505; // 0x10302a9
+ field public static final int Widget_Material_Light_DropDownItem_Spinner = 16974506; // 0x10302aa
+ field public static final int Widget_Material_Light_EditText = 16974507; // 0x10302ab
+ field public static final int Widget_Material_Light_ExpandableListView = 16974508; // 0x10302ac
+ field public static final int Widget_Material_Light_FastScroll = 16974509; // 0x10302ad
+ field public static final int Widget_Material_Light_GridView = 16974510; // 0x10302ae
+ field public static final int Widget_Material_Light_HorizontalScrollView = 16974511; // 0x10302af
+ field public static final int Widget_Material_Light_ImageButton = 16974512; // 0x10302b0
+ field public static final int Widget_Material_Light_ListPopupWindow = 16974513; // 0x10302b1
+ field public static final int Widget_Material_Light_ListView = 16974514; // 0x10302b2
+ field public static final int Widget_Material_Light_ListView_DropDown = 16974515; // 0x10302b3
+ field public static final int Widget_Material_Light_MediaRouteButton = 16974516; // 0x10302b4
+ field public static final int Widget_Material_Light_PopupMenu = 16974517; // 0x10302b5
+ field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974518; // 0x10302b6
+ field public static final int Widget_Material_Light_PopupWindow = 16974519; // 0x10302b7
+ field public static final int Widget_Material_Light_ProgressBar = 16974520; // 0x10302b8
+ field public static final int Widget_Material_Light_ProgressBar_Horizontal = 16974521; // 0x10302b9
+ field public static final int Widget_Material_Light_ProgressBar_Inverse = 16974522; // 0x10302ba
+ field public static final int Widget_Material_Light_ProgressBar_Large = 16974523; // 0x10302bb
+ field public static final int Widget_Material_Light_ProgressBar_Large_Inverse = 16974524; // 0x10302bc
+ field public static final int Widget_Material_Light_ProgressBar_Small = 16974525; // 0x10302bd
+ field public static final int Widget_Material_Light_ProgressBar_Small_Inverse = 16974526; // 0x10302be
+ field public static final int Widget_Material_Light_ProgressBar_Small_Title = 16974527; // 0x10302bf
+ field public static final int Widget_Material_Light_RatingBar = 16974528; // 0x10302c0
+ field public static final int Widget_Material_Light_RatingBar_Indicator = 16974529; // 0x10302c1
+ field public static final int Widget_Material_Light_RatingBar_Small = 16974530; // 0x10302c2
+ field public static final int Widget_Material_Light_ScrollView = 16974531; // 0x10302c3
+ field public static final int Widget_Material_Light_SeekBar = 16974532; // 0x10302c4
+ field public static final int Widget_Material_Light_SegmentedButton = 16974533; // 0x10302c5
+ field public static final int Widget_Material_Light_Spinner = 16974535; // 0x10302c7
+ field public static final int Widget_Material_Light_StackView = 16974534; // 0x10302c6
+ field public static final int Widget_Material_Light_Tab = 16974536; // 0x10302c8
+ field public static final int Widget_Material_Light_TabWidget = 16974537; // 0x10302c9
+ field public static final int Widget_Material_Light_TextView = 16974538; // 0x10302ca
+ field public static final int Widget_Material_Light_TextView_SpinnerItem = 16974539; // 0x10302cb
+ field public static final int Widget_Material_Light_WebTextView = 16974540; // 0x10302cc
+ field public static final int Widget_Material_Light_WebView = 16974541; // 0x10302cd
+ field public static final int Widget_Material_ListPopupWindow = 16974453; // 0x1030275
+ field public static final int Widget_Material_ListView = 16974454; // 0x1030276
+ field public static final int Widget_Material_ListView_DropDown = 16974455; // 0x1030277
+ field public static final int Widget_Material_MediaRouteButton = 16974456; // 0x1030278
+ field public static final int Widget_Material_PopupMenu = 16974457; // 0x1030279
+ field public static final int Widget_Material_PopupMenu_Overflow = 16974458; // 0x103027a
+ field public static final int Widget_Material_PopupWindow = 16974459; // 0x103027b
+ field public static final int Widget_Material_ProgressBar = 16974460; // 0x103027c
+ field public static final int Widget_Material_ProgressBar_Horizontal = 16974461; // 0x103027d
+ field public static final int Widget_Material_ProgressBar_Large = 16974462; // 0x103027e
+ field public static final int Widget_Material_ProgressBar_Small = 16974463; // 0x103027f
+ field public static final int Widget_Material_ProgressBar_Small_Title = 16974464; // 0x1030280
+ field public static final int Widget_Material_RatingBar = 16974465; // 0x1030281
+ field public static final int Widget_Material_RatingBar_Indicator = 16974466; // 0x1030282
+ field public static final int Widget_Material_RatingBar_Small = 16974467; // 0x1030283
+ field public static final int Widget_Material_ScrollView = 16974468; // 0x1030284
+ field public static final int Widget_Material_SeekBar = 16974469; // 0x1030285
+ field public static final int Widget_Material_SegmentedButton = 16974470; // 0x1030286
+ field public static final int Widget_Material_Spinner = 16974472; // 0x1030288
+ field public static final int Widget_Material_StackView = 16974471; // 0x1030287
+ field public static final int Widget_Material_Tab = 16974473; // 0x1030289
+ field public static final int Widget_Material_TabWidget = 16974474; // 0x103028a
+ field public static final int Widget_Material_TextView = 16974475; // 0x103028b
+ field public static final int Widget_Material_TextView_SpinnerItem = 16974476; // 0x103028c
+ field public static final int Widget_Material_Toolbar = 16974477; // 0x103028d
+ field public static final int Widget_Material_Toolbar_Button_Navigation = 16974478; // 0x103028e
+ field public static final int Widget_Material_WebTextView = 16974479; // 0x103028f
+ field public static final int Widget_Material_WebView = 16974480; // 0x1030290
field public static final int Widget_PopupMenu = 16973958; // 0x1030086
field public static final int Widget_PopupWindow = 16973878; // 0x1030036
field public static final int Widget_ProgressBar = 16973852; // 0x103001c
@@ -2461,6 +2465,8 @@ package android {
field public static final int Widget_TextView = 16973858; // 0x1030022
field public static final int Widget_TextView_PopupMenu = 16973865; // 0x1030029
field public static final int Widget_TextView_SpinnerItem = 16973866; // 0x103002a
+ field public static final int Widget_Toolbar = 16974339; // 0x1030203
+ field public static final int Widget_Toolbar_Button_Navigation = 16974340; // 0x1030204
field public static final int Widget_WebView = 16973875; // 0x1030033
field public static final int l_resource_pad1 = 16974336; // 0x1030200
field public static final int l_resource_pad10 = 16974327; // 0x10301f7
@@ -3339,6 +3345,7 @@ package android.app {
method public void openContextMenu(android.view.View);
method public void openOptionsMenu();
method public void overridePendingTransition(int, int);
+ method public void postponeEnterTransition();
method public void recreate();
method public void registerForContextMenu(android.view.View);
method public final deprecated void removeDialog(int);
@@ -3394,6 +3401,7 @@ package android.app {
method public deprecated void startManagingCursor(android.database.Cursor);
method public boolean startNextMatchingActivity(android.content.Intent);
method public boolean startNextMatchingActivity(android.content.Intent, android.os.Bundle);
+ method public void startPostponedEnterTransition();
method public void startSearch(java.lang.String, boolean, android.os.Bundle, boolean);
method public void stopLockTask();
method public deprecated void stopManagingCursor(android.database.Cursor);
@@ -5369,23 +5377,9 @@ package android.app.backup {
}
-package android.app.maintenance {
+package android.app.job {
- public abstract class IdleService extends android.app.Service {
- ctor public IdleService();
- method public final void finishIdle();
- method public final android.os.IBinder onBind(android.content.Intent);
- method public abstract boolean onIdleStart();
- method public abstract void onIdleStop();
- field public static final java.lang.String PERMISSION_BIND = "android.permission.BIND_IDLE_SERVICE";
- field public static final java.lang.String SERVICE_INTERFACE = "android.service.idle.IdleService";
- }
-
-}
-
-package android.app.task {
-
- public class Task implements android.os.Parcelable {
+ public class JobInfo implements android.os.Parcelable {
method public int describeContents();
method public int getBackoffPolicy();
method public android.os.PersistableBundle getExtras();
@@ -5403,55 +5397,55 @@ package android.app.task {
field public static final android.os.Parcelable.Creator CREATOR;
}
- public static abstract interface Task.BackoffPolicy {
+ public static abstract interface JobInfo.BackoffPolicy {
field public static final int EXPONENTIAL = 1; // 0x1
field public static final int LINEAR = 0; // 0x0
}
- public static final class Task.Builder {
- ctor public Task.Builder(int, android.content.ComponentName);
- method public android.app.task.Task build();
- method public android.app.task.Task.Builder setBackoffCriteria(long, int);
- method public android.app.task.Task.Builder setExtras(android.os.PersistableBundle);
- method public android.app.task.Task.Builder setMinimumLatency(long);
- method public android.app.task.Task.Builder setOverrideDeadline(long);
- method public android.app.task.Task.Builder setPeriodic(long);
- method public android.app.task.Task.Builder setRequiredNetworkCapabilities(int);
- method public android.app.task.Task.Builder setRequiresCharging(boolean);
- method public android.app.task.Task.Builder setRequiresDeviceIdle(boolean);
+ public static final class JobInfo.Builder {
+ ctor public JobInfo.Builder(int, android.content.ComponentName);
+ method public android.app.job.JobInfo build();
+ method public android.app.job.JobInfo.Builder setBackoffCriteria(long, int);
+ method public android.app.job.JobInfo.Builder setExtras(android.os.PersistableBundle);
+ method public android.app.job.JobInfo.Builder setMinimumLatency(long);
+ method public android.app.job.JobInfo.Builder setOverrideDeadline(long);
+ method public android.app.job.JobInfo.Builder setPeriodic(long);
+ method public android.app.job.JobInfo.Builder setRequiredNetworkCapabilities(int);
+ method public android.app.job.JobInfo.Builder setRequiresCharging(boolean);
+ method public android.app.job.JobInfo.Builder setRequiresDeviceIdle(boolean);
}
- public static abstract interface Task.NetworkType {
+ public static abstract interface JobInfo.NetworkType {
field public static final int ANY = 1; // 0x1
field public static final int NONE = 0; // 0x0
field public static final int UNMETERED = 2; // 0x2
}
- public abstract class TaskManager {
- ctor public TaskManager();
- method public abstract void cancel(int);
- method public abstract void cancelAll();
- method public abstract java.util.List<android.app.task.Task> getAllPendingTasks();
- method public abstract int schedule(android.app.task.Task);
- field public static final int RESULT_FAILURE = 0; // 0x0
- field public static final int RESULT_SUCCESS = 1; // 0x1
- }
-
- public class TaskParams implements android.os.Parcelable {
+ public class JobParameters implements android.os.Parcelable {
method public int describeContents();
method public android.os.PersistableBundle getExtras();
- method public int getTaskId();
+ method public int getJobId();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
- public abstract class TaskService extends android.app.Service {
- ctor public TaskService();
+ public abstract class JobScheduler {
+ ctor public JobScheduler();
+ method public abstract void cancel(int);
+ method public abstract void cancelAll();
+ method public abstract java.util.List<android.app.job.JobInfo> getAllPendingJobs();
+ method public abstract int schedule(android.app.job.JobInfo);
+ field public static final int RESULT_FAILURE = 0; // 0x0
+ field public static final int RESULT_SUCCESS = 1; // 0x1
+ }
+
+ public abstract class JobService extends android.app.Service {
+ ctor public JobService();
+ method public final void jobFinished(android.app.job.JobParameters, boolean);
method public final android.os.IBinder onBind(android.content.Intent);
- method public abstract boolean onStartTask(android.app.task.TaskParams);
- method public abstract boolean onStopTask(android.app.task.TaskParams);
- method public final void taskFinished(android.app.task.TaskParams, boolean);
- field public static final java.lang.String PERMISSION_BIND = "android.permission.BIND_TASK_SERVICE";
+ method public abstract boolean onStartJob(android.app.job.JobParameters);
+ method public abstract boolean onStopJob(android.app.job.JobParameters);
+ field public static final java.lang.String PERMISSION_BIND = "android.permission.BIND_JOB_SERVICE";
}
}
@@ -7020,6 +7014,7 @@ package android.content {
field public static final java.lang.String FINGERPRINT_SERVICE = "fingerprint";
field public static final java.lang.String INPUT_METHOD_SERVICE = "input_method";
field public static final java.lang.String INPUT_SERVICE = "input";
+ field public static final java.lang.String JOB_SCHEDULER_SERVICE = "jobscheduler";
field public static final java.lang.String KEYGUARD_SERVICE = "keyguard";
field public static final java.lang.String LAUNCHER_APPS_SERVICE = "launcherapps";
field public static final java.lang.String LAYOUT_INFLATER_SERVICE = "layout_inflater";
@@ -7041,7 +7036,6 @@ package android.content {
field public static final java.lang.String SEARCH_SERVICE = "search";
field public static final java.lang.String SENSOR_SERVICE = "sensor";
field public static final java.lang.String STORAGE_SERVICE = "storage";
- field public static final java.lang.String TASK_SERVICE = "task";
field public static final java.lang.String TELEPHONY_SERVICE = "phone";
field public static final java.lang.String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
field public static final java.lang.String TV_INPUT_SERVICE = "tv_input";
@@ -11502,6 +11496,7 @@ package android.graphics.drawable {
public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
ctor public RippleDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
+ method public void setColor(android.content.res.ColorStateList);
}
public class RotateDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
@@ -13689,6 +13684,7 @@ package android.media {
method public void adjustStreamVolume(int, int, int);
method public void adjustSuggestedStreamVolume(int, int, int);
method public void adjustVolume(int, int);
+ method public int allocateAudioSessionId();
method public void dispatchMediaKeyEvent(android.view.KeyEvent);
method public int getMode();
method public java.lang.String getParameters(java.lang.String);
@@ -13749,6 +13745,7 @@ package android.media {
field public static final int AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK = -3; // 0xfffffffd
field public static final int AUDIOFOCUS_REQUEST_FAILED = 0; // 0x0
field public static final int AUDIOFOCUS_REQUEST_GRANTED = 1; // 0x1
+ field public static final int ERROR = -1; // 0xffffffff
field public static final java.lang.String EXTRA_RINGER_MODE = "android.media.EXTRA_RINGER_MODE";
field public static final java.lang.String EXTRA_SCO_AUDIO_PREVIOUS_STATE = "android.media.extra.SCO_AUDIO_PREVIOUS_STATE";
field public static final java.lang.String EXTRA_SCO_AUDIO_STATE = "android.media.extra.SCO_AUDIO_STATE";
@@ -13928,6 +13925,7 @@ package android.media {
method public static boolean hasProfile(int);
method public static boolean hasProfile(int, int);
field public static final int QUALITY_1080P = 6; // 0x6
+ field public static final int QUALITY_2160P = 8; // 0x8
field public static final int QUALITY_480P = 4; // 0x4
field public static final int QUALITY_720P = 5; // 0x5
field public static final int QUALITY_CIF = 3; // 0x3
@@ -13936,6 +13934,7 @@ package android.media {
field public static final int QUALITY_QCIF = 2; // 0x2
field public static final int QUALITY_QVGA = 7; // 0x7
field public static final int QUALITY_TIME_LAPSE_1080P = 1006; // 0x3ee
+ field public static final int QUALITY_TIME_LAPSE_2160P = 1008; // 0x3f0
field public static final int QUALITY_TIME_LAPSE_480P = 1004; // 0x3ec
field public static final int QUALITY_TIME_LAPSE_720P = 1005; // 0x3ed
field public static final int QUALITY_TIME_LAPSE_CIF = 1003; // 0x3eb
@@ -15826,8 +15825,11 @@ package android.media.tv {
field public static final int TYPE_ISDB_S = 262656; // 0x40200
field public static final int TYPE_ISDB_T = 262144; // 0x40000
field public static final int TYPE_ISDB_TB = 262400; // 0x40100
+ field public static final int TYPE_NTSC = 1; // 0x1
field public static final int TYPE_OTHER = 0; // 0x0
+ field public static final int TYPE_PAL = 2; // 0x2
field public static final int TYPE_PASSTHROUGH = 65536; // 0x10000
+ field public static final int TYPE_SECAM = 3; // 0x3
field public static final int TYPE_S_DMB = 393472; // 0x60100
field public static final int TYPE_T_DMB = 393216; // 0x60000
}
@@ -26016,21 +26018,28 @@ package android.service.notification {
method public final void cancelNotification(java.lang.String);
method public final void cancelNotifications(java.lang.String[]);
method public android.service.notification.StatusBarNotification[] getActiveNotifications();
- method public android.service.notification.NotificationListenerService.Ranking getCurrentRanking();
+ method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking();
method public android.os.IBinder onBind(android.content.Intent);
method public void onListenerConnected();
- method public abstract void onNotificationPosted(android.service.notification.StatusBarNotification);
- method public void onNotificationRankingUpdate();
- method public abstract void onNotificationRemoved(android.service.notification.StatusBarNotification);
+ method public void onNotificationPosted(android.service.notification.StatusBarNotification);
+ method public void onNotificationPosted(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
+ method public void onNotificationRankingUpdate(android.service.notification.NotificationListenerService.RankingMap);
+ method public void onNotificationRemoved(android.service.notification.StatusBarNotification);
+ method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
}
- public static class NotificationListenerService.Ranking implements android.os.Parcelable {
+ public static class NotificationListenerService.Ranking {
+ method public java.lang.String getKey();
+ method public int getRank();
+ method public boolean isAmbient();
+ method public boolean isInterceptedByDoNotDisturb();
+ }
+
+ public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
method public int describeContents();
method public java.lang.String[] getOrderedKeys();
- method public int getRank(java.lang.String);
- method public boolean isAmbient(java.lang.String);
- method public boolean isInterceptedByDoNotDisturb(java.lang.String);
+ method public android.service.notification.NotificationListenerService.Ranking getRanking(java.lang.String);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
}
diff --git a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
index dce0a75..e6847a9 100644
--- a/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
+++ b/cmds/settings/src/com/android/commands/settings/SettingsCmd.java
@@ -20,6 +20,7 @@ import android.app.ActivityManagerNative;
import android.app.IActivityManager;
import android.app.IActivityManager.ContentProviderHolder;
import android.content.IContentProvider;
+import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
@@ -33,7 +34,8 @@ public final class SettingsCmd {
enum CommandVerb {
UNSPECIFIED,
GET,
- PUT
+ PUT,
+ DELETE
}
static String[] mArgs;
@@ -74,6 +76,8 @@ public final class SettingsCmd {
mVerb = CommandVerb.GET;
} else if ("put".equalsIgnoreCase(arg)) {
mVerb = CommandVerb.PUT;
+ } else if ("delete".equalsIgnoreCase(arg)) {
+ mVerb = CommandVerb.DELETE;
} else {
// invalid
System.err.println("Invalid command: " + arg);
@@ -87,7 +91,7 @@ public final class SettingsCmd {
break; // invalid
}
mTable = arg.toLowerCase();
- } else if (mVerb == CommandVerb.GET) {
+ } else if (mVerb == CommandVerb.GET || mVerb == CommandVerb.DELETE) {
mKey = arg;
if (mNextArg >= mArgs.length) {
valid = true;
@@ -136,6 +140,10 @@ public final class SettingsCmd {
case PUT:
putForUser(provider, mUser, mTable, mKey, mValue);
break;
+ case DELETE:
+ System.out.println("Deleted "
+ + deleteForUser(provider, mUser, mTable, mKey) + " rows");
+ break;
default:
System.err.println("Unspecified command");
break;
@@ -211,9 +219,31 @@ public final class SettingsCmd {
}
}
+ int deleteForUser(IContentProvider provider, int userHandle,
+ final String table, final String key) {
+ Uri targetUri;
+ if ("system".equals(table)) targetUri = Settings.System.getUriFor(key);
+ else if ("secure".equals(table)) targetUri = Settings.Secure.getUriFor(key);
+ else if ("global".equals(table)) targetUri = Settings.Global.getUriFor(key);
+ else {
+ System.err.println("Invalid table; no delete performed");
+ throw new IllegalArgumentException("Invalid table " + table);
+ }
+
+ int num = 0;
+ try {
+ num = provider.delete(null, targetUri, null, null);
+ } catch (RemoteException e) {
+ System.err.println("Can't clear key " + key + " in " + table + " for user "
+ + userHandle);
+ }
+ return num;
+ }
+
private static void printUsage() {
System.err.println("usage: settings [--user NUM] get namespace key");
System.err.println(" settings [--user NUM] put namespace key value");
+ System.err.println(" settings [--user NUM] delete namespace key");
System.err.println("\n'namespace' is one of {system, secure, global}, case-insensitive");
System.err.println("If '--user NUM' is not given, the operations are performed on the owner user.");
}
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 23b5f29..f6883e2 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -5326,7 +5326,8 @@ public class Activity extends ContextThemeWrapper
*
* @hide
*/
- void convertToTranslucent(TranslucentConversionListener callback, ActivityOptions options) {
+ public void convertToTranslucent(TranslucentConversionListener callback,
+ ActivityOptions options) {
boolean drawComplete;
try {
mTranslucentCallback = callback;
@@ -5615,6 +5616,34 @@ public class Activity extends ContextThemeWrapper
mExitTransitionListener = listener;
}
+ /**
+ * Postpone the entering activity transition when Activity was started with
+ * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity,
+ * android.util.Pair[])}.
+ * <p>This method gives the Activity the ability to delay starting the entering and
+ * shared element transitions until all data is loaded. Until then, the Activity won't
+ * draw into its window, leaving the window transparent. This may also cause the
+ * returning animation to be delayed until data is ready. This method should be
+ * called in {@link #onCreate(android.os.Bundle)} or in
+ * {@link #onActivityReenter(int, android.content.Intent)}.
+ * {@link #startPostponedEnterTransition()} must be called to allow the Activity to
+ * start the transitions. If the Activity did not use
+ * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity,
+ * android.util.Pair[])}, then this method does nothing.</p>
+ */
+ public void postponeEnterTransition() {
+ mActivityTransitionState.postponeEnterTransition();
+ }
+
+ /**
+ * Begin postponed transitions after {@link #postponeEnterTransition()} was called.
+ * If postponeEnterTransition() was called, you must call startPostponedEnterTransition()
+ * to have your Activity start drawing.
+ */
+ public void startPostponedEnterTransition() {
+ mActivityTransitionState.startPostponedEnterTransition();
+ }
+
// ------------------ Internal API ------------------
final void setParent(Activity parent) {
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index a057c3e..9160452 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -394,8 +394,18 @@ public class ActivityOptions {
if (sharedElements != null) {
for (int i = 0; i < sharedElements.length; i++) {
Pair<View, String> sharedElement = sharedElements[i];
- names.add(sharedElement.second);
- mappedNames.add(sharedElement.first.getViewName());
+ String sharedElementName = sharedElement.second;
+ if (sharedElementName == null) {
+ throw new IllegalArgumentException("Shared element name must not be null");
+ }
+ String viewName = sharedElement.first.getViewName();
+ if (viewName == null) {
+ throw new IllegalArgumentException("Shared elements must have non-null " +
+ "viewNames");
+ }
+
+ names.add(sharedElementName);
+ mappedNames.add(viewName);
}
}
diff --git a/core/java/android/app/ActivityTransitionCoordinator.java b/core/java/android/app/ActivityTransitionCoordinator.java
index a4384f8..1f3218b 100644
--- a/core/java/android/app/ActivityTransitionCoordinator.java
+++ b/core/java/android/app/ActivityTransitionCoordinator.java
@@ -214,11 +214,21 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
ArrayList<String> allSharedElementNames,
ArrayList<String> accepted, ArrayList<String> localNames,
SharedElementListener listener, boolean isReturning) {
+ this(window, allSharedElementNames, listener, isReturning);
+ viewsReady(accepted, localNames);
+ }
+
+ public ActivityTransitionCoordinator(Window window,
+ ArrayList<String> allSharedElementNames,
+ SharedElementListener listener, boolean isReturning) {
super(new Handler());
mWindow = window;
mListener = listener;
mAllSharedElementNames = allSharedElementNames;
mIsReturning = isReturning;
+ }
+
+ protected void viewsReady(ArrayList<String> accepted, ArrayList<String> localNames) {
setSharedElements(accepted, localNames);
if (getViewsTransition() != null) {
getDecor().captureTransitioningViews(mTransitioningViews);
@@ -269,6 +279,8 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
return names;
}
+ public ArrayList<String> getAllSharedElementNames() { return mAllSharedElementNames; }
+
public static void setViewVisibility(Collection<View> views, int visibility) {
if (views != null) {
for (View view : views) {
@@ -335,6 +347,10 @@ abstract class ActivityTransitionCoordinator extends ResultReceiver {
String name = mAllSharedElementNames.get(i);
View sharedElement = sharedElements.get(name);
if (sharedElement != null) {
+ if (sharedElement.getViewName() == null) {
+ throw new IllegalArgumentException("Shared elements must have " +
+ "non-null viewNames");
+ }
mSharedElementNames.add(name);
mSharedElements.add(sharedElement);
}
diff --git a/core/java/android/app/ActivityTransitionState.java b/core/java/android/app/ActivityTransitionState.java
index b32e9ad..d94dadd 100644
--- a/core/java/android/app/ActivityTransitionState.java
+++ b/core/java/android/app/ActivityTransitionState.java
@@ -87,6 +87,11 @@ class ActivityTransitionState {
*/
private boolean mHasExited;
+ /**
+ * Postpone painting and starting the enter transition until this is false.
+ */
+ private boolean mIsEnterPostponed;
+
public ActivityTransitionState() {
}
@@ -140,15 +145,38 @@ class ActivityTransitionState {
if (mEnterActivityOptions.isReturning()) {
restoreExitedViews();
activity.getWindow().getDecorView().setVisibility(View.VISIBLE);
- mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity,
- resultReceiver, sharedElementNames, mExitingFrom, mExitingTo);
+ }
+ mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity,
+ resultReceiver, sharedElementNames, mEnterActivityOptions.isReturning());
+
+ if (!mIsEnterPostponed) {
+ startEnter();
+ }
+ }
+
+ public void postponeEnterTransition() {
+ mIsEnterPostponed = true;
+ }
+
+ public void startPostponedEnterTransition() {
+ if (mIsEnterPostponed) {
+ mIsEnterPostponed = false;
+ if (mEnterTransitionCoordinator != null) {
+ startEnter();
+ }
+ }
+ }
+
+ private void startEnter() {
+ if (mEnterActivityOptions.isReturning()) {
+ mEnterTransitionCoordinator.viewsReady(mExitingFrom, mExitingTo);
} else {
- mEnterTransitionCoordinator = new EnterTransitionCoordinator(activity,
- resultReceiver, sharedElementNames, null, null);
- mEnteringNames = sharedElementNames;
+ mEnterTransitionCoordinator.viewsReady(null, null);
+ mEnteringNames = mEnterTransitionCoordinator.getAllSharedElementNames();
mEnteringFrom = mEnterTransitionCoordinator.getAcceptedNames();
mEnteringTo = mEnterTransitionCoordinator.getMappedNames();
}
+
mExitingFrom = null;
mExitingTo = null;
mEnterActivityOptions = null;
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index c29d75e..94ea2c5 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -354,9 +354,11 @@ public class ActivityView extends ViewGroup {
private static class ActivityContainerWrapper {
private final IActivityContainer mIActivityContainer;
private final CloseGuard mGuard = CloseGuard.get();
+ boolean mOpened; // Protected by mGuard.
ActivityContainerWrapper(IActivityContainer container) {
mIActivityContainer = container;
+ mOpened = true;
mGuard.open("release");
}
@@ -424,11 +426,16 @@ public class ActivityView extends ViewGroup {
}
void release() {
- if (DEBUG) Log.v(TAG, "ActivityContainerWrapper: release called");
- try {
- mIActivityContainer.release();
- mGuard.close();
- } catch (RemoteException e) {
+ synchronized (mGuard) {
+ if (mOpened) {
+ if (DEBUG) Log.v(TAG, "ActivityContainerWrapper: release called");
+ try {
+ mIActivityContainer.release();
+ mGuard.close();
+ } catch (RemoteException e) {
+ }
+ mOpened = false;
+ }
}
}
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index ad506e4..52d4585 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -135,7 +135,7 @@ import android.view.textservice.TextServicesManager;
import android.accounts.AccountManager;
import android.accounts.IAccountManager;
import android.app.admin.DevicePolicyManager;
-import android.app.task.ITaskManager;
+import android.app.job.IJobScheduler;
import android.app.trust.TrustManager;
import com.android.internal.annotations.GuardedBy;
@@ -706,10 +706,10 @@ class ContextImpl extends Context {
return new UsageStatsManager(ctx.getOuterContext());
}});
- registerService(TASK_SERVICE, new ServiceFetcher() {
+ registerService(JOB_SCHEDULER_SERVICE, new ServiceFetcher() {
public Object createService(ContextImpl ctx) {
- IBinder b = ServiceManager.getService(TASK_SERVICE);
- return new TaskManagerImpl(ITaskManager.Stub.asInterface(b));
+ IBinder b = ServiceManager.getService(JOB_SCHEDULER_SERVICE);
+ return new JobSchedulerImpl(IJobScheduler.Stub.asInterface(b));
}});
}
diff --git a/core/java/android/app/EnterTransitionCoordinator.java b/core/java/android/app/EnterTransitionCoordinator.java
index 4b052e7..779e3de 100644
--- a/core/java/android/app/EnterTransitionCoordinator.java
+++ b/core/java/android/app/EnterTransitionCoordinator.java
@@ -53,18 +53,37 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
private boolean mIsCanceled;
private ObjectAnimator mBackgroundAnimator;
private boolean mIsExitTransitionComplete;
+ private boolean mIsReadyForTransition;
+ private Bundle mSharedElementsBundle;
public EnterTransitionCoordinator(Activity activity, ResultReceiver resultReceiver,
- ArrayList<String> sharedElementNames,
- ArrayList<String> acceptedNames, ArrayList<String> mappedNames) {
- super(activity.getWindow(), sharedElementNames, acceptedNames, mappedNames,
- getListener(activity, acceptedNames), acceptedNames != null);
+ ArrayList<String> sharedElementNames, boolean isReturning) {
+ super(activity.getWindow(), sharedElementNames,
+ getListener(activity, isReturning), isReturning);
mActivity = activity;
setResultReceiver(resultReceiver);
prepareEnter();
Bundle resultReceiverBundle = new Bundle();
resultReceiverBundle.putParcelable(KEY_REMOTE_RECEIVER, this);
mResultReceiver.send(MSG_SET_REMOTE_RECEIVER, resultReceiverBundle);
+ getDecor().getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ if (mIsReadyForTransition) {
+ getDecor().getViewTreeObserver().removeOnPreDrawListener(this);
+ }
+ return mIsReadyForTransition;
+ }
+ });
+ }
+
+ public void viewsReady(ArrayList<String> accepted, ArrayList<String> localNames) {
+ if (mIsReadyForTransition) {
+ return;
+ }
+ super.viewsReady(accepted, localNames);
+
+ mIsReadyForTransition = true;
if (mIsReturning) {
mHandler = new Handler() {
@Override
@@ -75,6 +94,13 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
mHandler.sendEmptyMessageDelayed(MSG_CANCEL, MAX_WAIT_MS);
send(MSG_SEND_SHARED_ELEMENT_DESTINATION, null);
}
+ setViewVisibility(mSharedElements, View.INVISIBLE);
+ if (getViewsTransition() != null) {
+ setViewVisibility(mTransitioningViews, View.INVISIBLE);
+ }
+ if (mSharedElementsBundle != null) {
+ onTakeSharedElements();
+ }
}
private void sendSharedElementDestination() {
@@ -94,9 +120,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
}
}
- private static SharedElementListener getListener(Activity activity,
- ArrayList<String> acceptedNames) {
- boolean isReturning = acceptedNames != null;
+ private static SharedElementListener getListener(Activity activity, boolean isReturning) {
return isReturning ? activity.mExitTransitionListener : activity.mEnterTransitionListener;
}
@@ -108,7 +132,8 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
if (mHandler != null) {
mHandler.removeMessages(MSG_CANCEL);
}
- onTakeSharedElements(resultData);
+ mSharedElementsBundle = resultData;
+ onTakeSharedElements();
}
break;
case MSG_EXIT_TRANSITION_COMPLETE:
@@ -139,7 +164,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
mSharedElementNames.clear();
mSharedElements.clear();
mAllSharedElementNames.clear();
- onTakeSharedElements(null);
+ startSharedElementTransition(null);
onRemoteExitTransitionComplete();
}
}
@@ -149,10 +174,6 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
}
protected void prepareEnter() {
- setViewVisibility(mSharedElements, View.INVISIBLE);
- if (getViewsTransition() != null) {
- setViewVisibility(mTransitioningViews, View.INVISIBLE);
- }
mActivity.overridePendingTransition(0, 0);
if (!mIsReturning) {
mActivity.convertToTranslucent(null, null);
@@ -185,7 +206,25 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
}
}
- protected void onTakeSharedElements(Bundle sharedElementState) {
+ protected void onTakeSharedElements() {
+ if (!mIsReadyForTransition || mSharedElementsBundle == null) {
+ return;
+ }
+ final Bundle sharedElementState = mSharedElementsBundle;
+ mSharedElementsBundle = null;
+ getDecor().getViewTreeObserver()
+ .addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ @Override
+ public boolean onPreDraw() {
+ getDecor().getViewTreeObserver().removeOnPreDrawListener(this);
+ startSharedElementTransition(sharedElementState);
+ return false;
+ }
+ });
+ getDecor().invalidate();
+ }
+
+ private void startSharedElementTransition(Bundle sharedElementState) {
setEpicenter();
// Remove rejected shared elements
ArrayList<String> rejectedNames = new ArrayList<String>(mAllSharedElementNames);
@@ -299,8 +338,8 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
}
public void stop() {
+ makeOpaque();
mHasStopped = true;
- mActivity = null;
mIsCanceled = true;
mResultReceiver = null;
if (mBackgroundAnimator != null) {
@@ -310,7 +349,7 @@ class EnterTransitionCoordinator extends ActivityTransitionCoordinator {
}
private void makeOpaque() {
- if (!mHasStopped) {
+ if (!mHasStopped && mActivity != null) {
mActivity.convertFromTranslucent();
mActivity = null;
}
diff --git a/core/java/android/app/TaskManagerImpl.java b/core/java/android/app/JobSchedulerImpl.java
index fe29fb7..09038d5 100644
--- a/core/java/android/app/TaskManagerImpl.java
+++ b/core/java/android/app/JobSchedulerImpl.java
@@ -17,38 +17,38 @@
// in android.app so ContextImpl has package access
package android.app;
-import android.app.task.ITaskManager;
-import android.app.task.Task;
-import android.app.task.TaskManager;
+import android.app.job.JobInfo;
+import android.app.job.JobScheduler;
+import android.app.job.IJobScheduler;
import android.os.RemoteException;
import java.util.List;
/**
- * Concrete implementation of the TaskManager interface
+ * Concrete implementation of the JobScheduler interface
* @hide
*/
-public class TaskManagerImpl extends TaskManager {
- ITaskManager mBinder;
+public class JobSchedulerImpl extends JobScheduler {
+ IJobScheduler mBinder;
- /* package */ TaskManagerImpl(ITaskManager binder) {
+ /* package */ JobSchedulerImpl(IJobScheduler binder) {
mBinder = binder;
}
@Override
- public int schedule(Task task) {
+ public int schedule(JobInfo job) {
try {
- return mBinder.schedule(task);
+ return mBinder.schedule(job);
} catch (RemoteException e) {
- return TaskManager.RESULT_FAILURE;
+ return JobScheduler.RESULT_FAILURE;
}
}
@Override
- public void cancel(int taskId) {
+ public void cancel(int jobId) {
try {
- mBinder.cancel(taskId);
+ mBinder.cancel(jobId);
} catch (RemoteException e) {}
}
@@ -62,9 +62,9 @@ public class TaskManagerImpl extends TaskManager {
}
@Override
- public List<Task> getAllPendingTasks() {
+ public List<JobInfo> getAllPendingJobs() {
try {
- return mBinder.getAllPendingTasks();
+ return mBinder.getAllPendingJobs();
} catch (RemoteException e) {
return null;
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index a1cdf59..276f936 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -23,7 +23,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
@@ -31,7 +30,6 @@ import android.media.AudioManager;
import android.media.session.MediaSessionToken;
import android.net.Uri;
import android.os.BadParcelableException;
-import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -2568,7 +2566,7 @@ public class Notification implements Parcelable
R.id.icon,
true,
-1,
- mColor,
+ resolveColor(),
PorterDuff.Mode.SRC_ATOP,
-1);
}
@@ -2595,17 +2593,22 @@ public class Notification implements Parcelable
R.id.right_icon,
true,
-1,
- mColor,
+ resolveColor(),
PorterDuff.Mode.SRC_ATOP,
-1);
}
}
+ private int sanitizeColor() {
+ if (mColor != COLOR_DEFAULT) {
+ mColor |= 0xFF000000; // no alpha for custom colors
+ }
+ return mColor;
+ }
+
private int resolveColor() {
if (mColor == COLOR_DEFAULT) {
- mColor = mContext.getResources().getColor(R.color.notification_icon_bg_color);
- } else {
- mColor |= 0xFF000000; // no alpha for custom colors
+ return mContext.getResources().getColor(R.color.notification_icon_bg_color);
}
return mColor;
}
@@ -2621,7 +2624,7 @@ public class Notification implements Parcelable
n.iconLevel = mSmallIconLevel;
n.number = mNumber;
- n.color = resolveColor();
+ n.color = sanitizeColor();
n.contentView = makeContentView();
n.contentIntent = mContentIntent;
diff --git a/core/java/android/app/VoiceInteractor.java b/core/java/android/app/VoiceInteractor.java
index 85e970c..0d94721 100644
--- a/core/java/android/app/VoiceInteractor.java
+++ b/core/java/android/app/VoiceInteractor.java
@@ -293,7 +293,7 @@ public class VoiceInteractor {
IVoiceInteractorRequest submit(IVoiceInteractor interactor, String packageName,
IVoiceInteractorCallback callback) throws RemoteException {
- return interactor.startConfirmation(packageName, callback, mCommand, mArgs);
+ return interactor.startCommand(packageName, callback, mCommand, mArgs);
}
}
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4aa4294..04be028 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -136,7 +136,7 @@ public class DevicePolicyManager {
* @hide
*/
public static final String ACTION_PROVISIONING_USER_HAS_CONSENTED
- = "android.app.action.USER_HAS_CONSENTED";
+ = "android.app.action.ACTION_PROVISIONING_USER_HAS_CONSENTED";
/**
* A String extra holding the name of the package of the mobile device management application
diff --git a/core/java/android/app/task/ITaskCallback.aidl b/core/java/android/app/job/IJobCallback.aidl
index d8a32fd..2d3948f 100644
--- a/core/java/android/app/task/ITaskCallback.aidl
+++ b/core/java/android/app/job/IJobCallback.aidl
@@ -14,43 +14,40 @@
* limitations under the License.
*/
-package android.app.task;
-
-import android.app.task.ITaskService;
-import android.app.task.TaskParams;
+package android.app.job;
/**
- * The server side of the TaskManager IPC protocols. The app-side implementation
+ * The server side of the JobScheduler IPC protocols. The app-side implementation
* invokes on this interface to indicate completion of the (asynchronous) instructions
* issued by the server.
*
* In all cases, the 'who' parameter is the caller's service binder, used to track
- * which Task Service instance is reporting.
+ * which Job Service instance is reporting.
*
* {@hide}
*/
-interface ITaskCallback {
+interface IJobCallback {
/**
* Immediate callback to the system after sending a start signal, used to quickly detect ANR.
*
- * @param taskId Unique integer used to identify this task.
- * @param ongoing True to indicate that the client is processing the task. False if the task is
+ * @param jobId Unique integer used to identify this job.
+ * @param ongoing True to indicate that the client is processing the job. False if the job is
* complete
*/
- void acknowledgeStartMessage(int taskId, boolean ongoing);
+ void acknowledgeStartMessage(int jobId, boolean ongoing);
/**
* Immediate callback to the system after sending a stop signal, used to quickly detect ANR.
*
- * @param taskId Unique integer used to identify this task.
- * @param rescheulde Whether or not to reschedule this task.
+ * @param jobId Unique integer used to identify this job.
+ * @param reschedule Whether or not to reschedule this job.
*/
- void acknowledgeStopMessage(int taskId, boolean reschedule);
+ void acknowledgeStopMessage(int jobId, boolean reschedule);
/*
- * Tell the task manager that the client is done with its execution, so that it can go on to
+ * Tell the job manager that the client is done with its execution, so that it can go on to
* the next one and stop attributing wakelock time to us etc.
*
- * @param taskId Unique integer used to identify this task.
- * @param reschedule Whether or not to reschedule this task.
+ * @param jobId Unique integer used to identify this job.
+ * @param reschedule Whether or not to reschedule this job.
*/
- void taskFinished(int taskId, boolean reschedule);
+ void jobFinished(int jobId, boolean reschedule);
}
diff --git a/core/java/android/app/task/ITaskManager.aidl b/core/java/android/app/job/IJobScheduler.aidl
index b56c78a..f1258ae 100644
--- a/core/java/android/app/task/ITaskManager.aidl
+++ b/core/java/android/app/job/IJobScheduler.aidl
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package android.app.task;
+package android.app.job;
-import android.app.task.Task;
+import android.app.job.JobInfo;
/**
- * IPC interface that supports the app-facing {@link #TaskManager} api.
+ * IPC interface that supports the app-facing {@link #JobScheduler} api.
* {@hide}
*/
-interface ITaskManager {
- int schedule(in Task task);
- void cancel(int taskId);
+interface IJobScheduler {
+ int schedule(in JobInfo job);
+ void cancel(int jobId);
void cancelAll();
- List<Task> getAllPendingTasks();
+ List<JobInfo> getAllPendingJobs();
}
diff --git a/core/java/android/app/task/ITaskService.aidl b/core/java/android/app/job/IJobService.aidl
index 87b0191..63f8b81 100644
--- a/core/java/android/app/task/ITaskService.aidl
+++ b/core/java/android/app/job/IJobService.aidl
@@ -14,22 +14,19 @@
* limitations under the License.
*/
-package android.app.task;
+package android.app.job;
-import android.app.task.ITaskCallback;
-import android.app.task.TaskParams;
-
-import android.os.Bundle;
+import android.app.job.JobParameters;
/**
* Interface that the framework uses to communicate with application code that implements a
- * TaskService. End user code does not implement this interface directly; instead, the app's
- * service implementation will extend android.app.task.TaskService.
+ * JobService. End user code does not implement this interface directly; instead, the app's
+ * service implementation will extend android.app.job.JobService.
* {@hide}
*/
-oneway interface ITaskService {
- /** Begin execution of application's task. */
- void startTask(in TaskParams taskParams);
+oneway interface IJobService {
+ /** Begin execution of application's job. */
+ void startJob(in JobParameters jobParams);
/** Stop execution of application's task. */
- void stopTask(in TaskParams taskParams);
+ void stopJob(in JobParameters jobParams);
}
diff --git a/core/java/android/app/task/Task.aidl b/core/java/android/app/job/JobInfo.aidl
index 1f25439..7b198a8 100644
--- a/core/java/android/app/task/Task.aidl
+++ b/core/java/android/app/job/JobInfo.aidl
@@ -14,7 +14,6 @@
* limitations under the License.
*/
-package android.app.task;
+package android.app.job;
-parcelable Task;
- \ No newline at end of file
+parcelable JobInfo;
diff --git a/core/java/android/app/task/Task.java b/core/java/android/app/job/JobInfo.java
index 0e660b3..a22e4cd 100644
--- a/core/java/android/app/task/Task.java
+++ b/core/java/android/app/job/JobInfo.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package android.app.task;
+package android.app.job;
import android.content.ComponentName;
import android.os.Bundle;
@@ -23,22 +23,22 @@ import android.os.Parcelable;
import android.os.PersistableBundle;
/**
- * Container of data passed to the {@link android.app.task.TaskManager} fully encapsulating the
+ * Container of data passed to the {@link android.app.job.JobScheduler} fully encapsulating the
* parameters required to schedule work against the calling application. These are constructed
- * using the {@link Task.Builder}.
+ * using the {@link JobInfo.Builder}.
*/
-public class Task implements Parcelable {
+public class JobInfo implements Parcelable {
public interface NetworkType {
/** Default. */
public final int NONE = 0;
- /** This task requires network connectivity. */
+ /** This job requires network connectivity. */
public final int ANY = 1;
- /** This task requires network connectivity that is unmetered. */
+ /** This job requires network connectivity that is unmetered. */
public final int UNMETERED = 2;
}
/**
- * Amount of backoff a task has initially by default, in milliseconds.
+ * Amount of backoff a job has initially by default, in milliseconds.
* @hide.
*/
public static final long DEFAULT_INITIAL_BACKOFF_MILLIS = 5000L;
@@ -63,7 +63,7 @@ public class Task implements Parcelable {
public final int EXPONENTIAL = 1;
}
- private final int taskId;
+ private final int jobId;
// TODO: Change this to use PersistableBundle when that lands in master.
private final PersistableBundle extras;
private final ComponentName service;
@@ -80,10 +80,10 @@ public class Task implements Parcelable {
private final int backoffPolicy;
/**
- * Unique task id associated with this class. This is assigned to your task by the scheduler.
+ * Unique job id associated with this class. This is assigned to your job by the scheduler.
*/
public int getId() {
- return taskId;
+ return jobId;
}
/**
@@ -94,43 +94,43 @@ public class Task implements Parcelable {
}
/**
- * Name of the service endpoint that will be called back into by the TaskManager.
+ * Name of the service endpoint that will be called back into by the JobScheduler.
*/
public ComponentName getService() {
return service;
}
/**
- * Whether this task needs the device to be plugged in.
+ * Whether this job needs the device to be plugged in.
*/
public boolean isRequireCharging() {
return requireCharging;
}
/**
- * Whether this task needs the device to be in an Idle maintenance window.
+ * Whether this job needs the device to be in an Idle maintenance window.
*/
public boolean isRequireDeviceIdle() {
return requireDeviceIdle;
}
/**
- * See {@link android.app.task.Task.NetworkType} for a description of this value.
+ * See {@link android.app.job.JobInfo.NetworkType} for a description of this value.
*/
public int getNetworkCapabilities() {
return networkCapabilities;
}
/**
- * Set for a task that does not recur periodically, to specify a delay after which the task
- * will be eligible for execution. This value is not set if the task recurs periodically.
+ * Set for a job that does not recur periodically, to specify a delay after which the job
+ * will be eligible for execution. This value is not set if the job recurs periodically.
*/
public long getMinLatencyMillis() {
return minLatencyMillis;
}
/**
- * See {@link Builder#setOverrideDeadline(long)}. This value is not set if the task recurs
+ * See {@link Builder#setOverrideDeadline(long)}. This value is not set if the job recurs
* periodically.
*/
public long getMaxExecutionDelayMillis() {
@@ -138,23 +138,23 @@ public class Task implements Parcelable {
}
/**
- * Track whether this task will repeat with a given period.
+ * Track whether this job will repeat with a given period.
*/
public boolean isPeriodic() {
return isPeriodic;
}
/**
- * Set to the interval between occurrences of this task. This value is <b>not</b> set if the
- * task does not recur periodically.
+ * Set to the interval between occurrences of this job. This value is <b>not</b> set if the
+ * job does not recur periodically.
*/
public long getIntervalMillis() {
return intervalMillis;
}
/**
- * The amount of time the TaskManager will wait before rescheduling a failed task. This value
- * will be increased depending on the backoff policy specified at task creation time. Defaults
+ * The amount of time the JobScheduler will wait before rescheduling a failed job. This value
+ * will be increased depending on the backoff policy specified at job creation time. Defaults
* to 5 seconds.
*/
public long getInitialBackoffMillis() {
@@ -162,7 +162,7 @@ public class Task implements Parcelable {
}
/**
- * See {@link android.app.task.Task.BackoffPolicy} for an explanation of the values this field
+ * See {@link android.app.job.JobInfo.BackoffPolicy} for an explanation of the values this field
* can take. This defaults to exponential.
*/
public int getBackoffPolicy() {
@@ -187,8 +187,8 @@ public class Task implements Parcelable {
return hasLateConstraint;
}
- private Task(Parcel in) {
- taskId = in.readInt();
+ private JobInfo(Parcel in) {
+ jobId = in.readInt();
extras = in.readPersistableBundle();
service = in.readParcelable(null);
requireCharging = in.readInt() == 1;
@@ -204,10 +204,10 @@ public class Task implements Parcelable {
hasLateConstraint = in.readInt() == 1;
}
- private Task(Task.Builder b) {
- taskId = b.mTaskId;
+ private JobInfo(JobInfo.Builder b) {
+ jobId = b.mJobId;
extras = b.mExtras;
- service = b.mTaskService;
+ service = b.mJobService;
requireCharging = b.mRequiresCharging;
requireDeviceIdle = b.mRequiresDeviceIdle;
networkCapabilities = b.mNetworkCapabilities;
@@ -228,7 +228,7 @@ public class Task implements Parcelable {
@Override
public void writeToParcel(Parcel out, int flags) {
- out.writeInt(taskId);
+ out.writeInt(jobId);
out.writePersistableBundle(extras);
out.writeParcelable(service, flags);
out.writeInt(requireCharging ? 1 : 0);
@@ -244,23 +244,23 @@ public class Task implements Parcelable {
out.writeInt(hasLateConstraint ? 1 : 0);
}
- public static final Creator<Task> CREATOR = new Creator<Task>() {
+ public static final Creator<JobInfo> CREATOR = new Creator<JobInfo>() {
@Override
- public Task createFromParcel(Parcel in) {
- return new Task(in);
+ public JobInfo createFromParcel(Parcel in) {
+ return new JobInfo(in);
}
@Override
- public Task[] newArray(int size) {
- return new Task[size];
+ public JobInfo[] newArray(int size) {
+ return new JobInfo[size];
}
};
- /** Builder class for constructing {@link Task} objects. */
+ /** Builder class for constructing {@link JobInfo} objects. */
public static final class Builder {
- private int mTaskId;
+ private int mJobId;
private PersistableBundle mExtras = PersistableBundle.EMPTY;
- private ComponentName mTaskService;
+ private ComponentName mJobService;
// Requirements.
private boolean mRequiresCharging;
private boolean mRequiresDeviceIdle;
@@ -280,15 +280,15 @@ public class Task implements Parcelable {
private boolean mBackoffPolicySet = false;
/**
- * @param taskId Application-provided id for this task. Subsequent calls to cancel, or
- * tasks created with the same taskId, will update the pre-existing task with
+ * @param jobId Application-provided id for this job. Subsequent calls to cancel, or
+ * jobs created with the same jobId, will update the pre-existing job with
* the same id.
- * @param taskService The endpoint that you implement that will receive the callback from the
- * TaskManager.
+ * @param jobService The endpoint that you implement that will receive the callback from the
+ * JobScheduler.
*/
- public Builder(int taskId, ComponentName taskService) {
- mTaskService = taskService;
- mTaskId = taskId;
+ public Builder(int jobId, ComponentName jobService) {
+ mJobService = jobService;
+ mJobId = jobId;
}
/**
@@ -302,10 +302,10 @@ public class Task implements Parcelable {
/**
* Set some description of the kind of network capabilities you would like to have. This
- * will be a parameter defined in {@link android.app.task.Task.NetworkType}.
+ * will be a parameter defined in {@link android.app.job.JobInfo.NetworkType}.
* Not calling this function means the network is not necessary.
* Bear in mind that calling this function defines network as a strict requirement for your
- * task if the network requested is not available your task will never run. See
+ * job if the network requested is not available your job will never run. See
* {@link #setOverrideDeadline(long)} to change this behaviour.
*/
public Builder setRequiredNetworkCapabilities(int networkCapabilities) {
@@ -313,10 +313,10 @@ public class Task implements Parcelable {
return this;
}
- /*
- * Specify that to run this task, the device needs to be plugged in. This defaults to
+ /**
+ * Specify that to run this job, the device needs to be plugged in. This defaults to
* false.
- * @param requireCharging Whether or not the device is plugged in.
+ * @param requiresCharging Whether or not the device is plugged in.
*/
public Builder setRequiresCharging(boolean requiresCharging) {
mRequiresCharging = requiresCharging;
@@ -324,11 +324,11 @@ public class Task implements Parcelable {
}
/**
- * Specify that to run, the task needs the device to be in idle mode. This defaults to
+ * Specify that to run, the job needs the device to be in idle mode. This defaults to
* false.
* <p>Idle mode is a loose definition provided by the system, which means that the device
* is not in use, and has not been in use for some time. As such, it is a good time to
- * perform resource heavy tasks. Bear in mind that battery usage will still be attributed
+ * perform resource heavy jobs. Bear in mind that battery usage will still be attributed
* to your application, and surfaced to the user in battery stats.</p>
* @param requiresDeviceIdle Whether or not the device need be within an idle maintenance
* window.
@@ -339,17 +339,17 @@ public class Task implements Parcelable {
}
/**
- * Specify that this task should recur with the provided interval, not more than once per
- * period. You have no control over when within this interval this task will be executed,
+ * Specify that this job should recur with the provided interval, not more than once per
+ * period. You have no control over when within this interval this job will be executed,
* only the guarantee that it will be executed at most once within this interval.
- * A periodic task will be repeated until the phone is turned off, however it will only be
+ * A periodic job will be repeated until the phone is turned off, however it will only be
* persisted beyond boot if the client app has declared the
* {@link android.Manifest.permission#RECEIVE_BOOT_COMPLETED} permission. You can schedule
- * periodic tasks without this permission, they simply will cease to exist after the phone
+ * periodic jobs without this permission, they simply will cease to exist after the phone
* restarts.
* Setting this function on the builder with {@link #setMinimumLatency(long)} or
* {@link #setOverrideDeadline(long)} will result in an error.
- * @param intervalMillis Millisecond interval for which this task will repeat.
+ * @param intervalMillis Millisecond interval for which this job will repeat.
*/
public Builder setPeriodic(long intervalMillis) {
mIsPeriodic = true;
@@ -359,11 +359,11 @@ public class Task implements Parcelable {
}
/**
- * Specify that this task should be delayed by the provided amount of time.
- * Because it doesn't make sense setting this property on a periodic task, doing so will
+ * Specify that this job should be delayed by the provided amount of time.
+ * Because it doesn't make sense setting this property on a periodic job, doing so will
* throw an {@link java.lang.IllegalArgumentException} when
- * {@link android.app.task.Task.Builder#build()} is called.
- * @param minLatencyMillis Milliseconds before which this task will not be considered for
+ * {@link android.app.job.JobInfo.Builder#build()} is called.
+ * @param minLatencyMillis Milliseconds before which this job will not be considered for
* execution.
*/
public Builder setMinimumLatency(long minLatencyMillis) {
@@ -373,11 +373,11 @@ public class Task implements Parcelable {
}
/**
- * Set deadline which is the maximum scheduling latency. The task will be run by this
+ * Set deadline which is the maximum scheduling latency. The job will be run by this
* deadline even if other requirements are not met. Because it doesn't make sense setting
- * this property on a periodic task, doing so will throw an
+ * this property on a periodic job, doing so will throw an
* {@link java.lang.IllegalArgumentException} when
- * {@link android.app.task.Task.Builder#build()} is called.
+ * {@link android.app.job.JobInfo.Builder#build()} is called.
*/
public Builder setOverrideDeadline(long maxExecutionDelayMillis) {
mMaxExecutionDelayMillis = maxExecutionDelayMillis;
@@ -389,13 +389,13 @@ public class Task implements Parcelable {
* Set up the back-off/retry policy.
* This defaults to some respectable values: {5 seconds, Exponential}. We cap back-off at
* 1hr.
- * Note that trying to set a backoff criteria for a task with
+ * Note that trying to set a backoff criteria for a job with
* {@link #setRequiresDeviceIdle(boolean)} will throw an exception when you call build().
- * This is because back-off typically does not make sense for these types of tasks. See
- * {@link android.app.task.TaskService#taskFinished(android.app.task.TaskParams, boolean)}
- * for more description of the return value for the case of a task executing while in idle
+ * This is because back-off typically does not make sense for these types of jobs. See
+ * {@link android.app.job.JobService#jobFinished(android.app.job.JobParameters, boolean)}
+ * for more description of the return value for the case of a job executing while in idle
* mode.
- * @param initialBackoffMillis Millisecond time interval to wait initially when task has
+ * @param initialBackoffMillis Millisecond time interval to wait initially when job has
* failed.
* @param backoffPolicy is one of {@link BackoffPolicy}
*/
@@ -407,25 +407,25 @@ public class Task implements Parcelable {
}
/**
- * @return The task object to hand to the TaskManager. This object is immutable.
+ * @return The job object to hand to the JobScheduler. This object is immutable.
*/
- public Task build() {
+ public JobInfo build() {
mExtras = new PersistableBundle(mExtras); // Make our own copy.
- // Check that a deadline was not set on a periodic task.
+ // Check that a deadline was not set on a periodic job.
if (mIsPeriodic && (mMaxExecutionDelayMillis != 0L)) {
throw new IllegalArgumentException("Can't call setOverrideDeadline() on a " +
- "periodic task.");
+ "periodic job.");
}
if (mIsPeriodic && (mMinLatencyMillis != 0L)) {
throw new IllegalArgumentException("Can't call setMinimumLatency() on a " +
- "periodic task");
+ "periodic job");
}
if (mBackoffPolicySet && mRequiresDeviceIdle) {
- throw new IllegalArgumentException("An idle mode task will not respect any" +
+ throw new IllegalArgumentException("An idle mode job will not respect any" +
" back-off policy, so calling setBackoffCriteria with" +
" setRequiresDeviceIdle is an error.");
}
- return new Task(this);
+ return new JobInfo(this);
}
}
diff --git a/core/java/android/app/task/TaskParams.aidl b/core/java/android/app/job/JobParameters.aidl
index 9b25855..e7551b9 100644
--- a/core/java/android/app/task/TaskParams.aidl
+++ b/core/java/android/app/job/JobParameters.aidl
@@ -14,6 +14,6 @@
* limitations under the License.
*/
-package android.app.task;
+package android.app.job;
-parcelable TaskParams; \ No newline at end of file
+parcelable JobParameters;
diff --git a/core/java/android/app/task/TaskParams.java b/core/java/android/app/job/JobParameters.java
index f4908c6..724856a 100644
--- a/core/java/android/app/task/TaskParams.java
+++ b/core/java/android/app/job/JobParameters.java
@@ -14,40 +14,42 @@
* limitations under the License
*/
-package android.app.task;
+package android.app.job;
+import android.app.job.IJobCallback;
+import android.app.job.IJobCallback.Stub;
import android.os.IBinder;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.PersistableBundle;
/**
- * Contains the parameters used to configure/identify your task. You do not create this object
+ * Contains the parameters used to configure/identify your job. You do not create this object
* yourself, instead it is handed in to your application by the System.
*/
-public class TaskParams implements Parcelable {
+public class JobParameters implements Parcelable {
- private final int taskId;
+ private final int jobId;
private final PersistableBundle extras;
private final IBinder callback;
/** @hide */
- public TaskParams(int taskId, PersistableBundle extras, IBinder callback) {
- this.taskId = taskId;
+ public JobParameters(int jobId, PersistableBundle extras, IBinder callback) {
+ this.jobId = jobId;
this.extras = extras;
this.callback = callback;
}
/**
- * @return The unique id of this task, specified at creation time.
+ * @return The unique id of this job, specified at creation time.
*/
- public int getTaskId() {
- return taskId;
+ public int getJobId() {
+ return jobId;
}
/**
- * @return The extras you passed in when constructing this task with
- * {@link android.app.task.Task.Builder#setExtras(android.os.PersistableBundle)}. This will
+ * @return The extras you passed in when constructing this job with
+ * {@link android.app.job.JobInfo.Builder#setExtras(android.os.PersistableBundle)}. This will
* never be null. If you did not set any extras this will be an empty bundle.
*/
public PersistableBundle getExtras() {
@@ -55,12 +57,12 @@ public class TaskParams implements Parcelable {
}
/** @hide */
- public ITaskCallback getCallback() {
- return ITaskCallback.Stub.asInterface(callback);
+ public IJobCallback getCallback() {
+ return IJobCallback.Stub.asInterface(callback);
}
- private TaskParams(Parcel in) {
- taskId = in.readInt();
+ private JobParameters(Parcel in) {
+ jobId = in.readInt();
extras = in.readPersistableBundle();
callback = in.readStrongBinder();
}
@@ -72,20 +74,20 @@ public class TaskParams implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(taskId);
+ dest.writeInt(jobId);
dest.writePersistableBundle(extras);
dest.writeStrongBinder(callback);
}
- public static final Creator<TaskParams> CREATOR = new Creator<TaskParams>() {
+ public static final Creator<JobParameters> CREATOR = new Creator<JobParameters>() {
@Override
- public TaskParams createFromParcel(Parcel in) {
- return new TaskParams(in);
+ public JobParameters createFromParcel(Parcel in) {
+ return new JobParameters(in);
}
@Override
- public TaskParams[] newArray(int size) {
- return new TaskParams[size];
+ public JobParameters[] newArray(int size) {
+ return new JobParameters[size];
}
};
}
diff --git a/core/java/android/app/job/JobScheduler.java b/core/java/android/app/job/JobScheduler.java
new file mode 100644
index 0000000..7fe192c
--- /dev/null
+++ b/core/java/android/app/job/JobScheduler.java
@@ -0,0 +1,72 @@
+/*
+ * 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 android.app.job;
+
+import java.util.List;
+
+import android.content.Context;
+
+/**
+ * Class for scheduling various types of jobs with the scheduling framework on the device.
+ *
+ * <p>You do not
+ * instantiate this class directly; instead, retrieve it through
+ * {@link android.content.Context#getSystemService
+ * Context.getSystemService(Context.JOB_SCHEDULER_SERVICE)}.
+ */
+public abstract class JobScheduler {
+ /**
+ * Returned from {@link #schedule(JobInfo)} when an invalid parameter was supplied. This can occur
+ * if the run-time for your job is too short, or perhaps the system can't resolve the
+ * requisite {@link JobService} in your package.
+ */
+ public static final int RESULT_FAILURE = 0;
+ /**
+ * Returned from {@link #schedule(JobInfo)} if this application has made too many requests for
+ * work over too short a time.
+ */
+ // TODO: Determine if this is necessary.
+ public static final int RESULT_SUCCESS = 1;
+
+ /**
+ * @param job The job you wish scheduled. See
+ * {@link android.app.job.JobInfo.Builder JobInfo.Builder} for more detail on the sorts of jobs
+ * you can schedule.
+ * @return If >0, this int returns the jobId of the successfully scheduled job.
+ * Otherwise you have to compare the return value to the error codes defined in this class.
+ */
+ public abstract int schedule(JobInfo job);
+
+ /**
+ * Cancel a job that is pending in the JobScheduler.
+ * @param jobId unique identifier for this job. Obtain this value from the jobs returned by
+ * {@link #getAllPendingJobs()}.
+ * @return
+ */
+ public abstract void cancel(int jobId);
+
+ /**
+ * Cancel all jobs that have been registered with the JobScheduler by this package.
+ */
+ public abstract void cancelAll();
+
+ /**
+ * @return a list of all the jobs registered by this package that have not yet been executed.
+ */
+ public abstract List<JobInfo> getAllPendingJobs();
+
+}
diff --git a/core/java/android/app/task/TaskService.java b/core/java/android/app/job/JobService.java
index 8ce4484..eea0268 100644
--- a/core/java/android/app/task/TaskService.java
+++ b/core/java/android/app/job/JobService.java
@@ -14,9 +14,12 @@
* limitations under the License
*/
-package android.app.task;
+package android.app.job;
import android.app.Service;
+import android.app.job.IJobCallback;
+import android.app.job.IJobService;
+import android.app.job.IJobService.Stub;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
@@ -28,72 +31,72 @@ import android.util.Log;
import com.android.internal.annotations.GuardedBy;
/**
- * <p>Entry point for the callback from the {@link android.app.task.TaskManager}.</p>
+ * <p>Entry point for the callback from the {@link android.app.job.JobScheduler}.</p>
* <p>This is the base class that handles asynchronous requests that were previously scheduled. You
- * are responsible for overriding {@link TaskService#onStartTask(TaskParams)}, which is where
- * you will implement your task logic.</p>
- * <p>This service executes each incoming task on a {@link android.os.Handler} running on your
+ * are responsible for overriding {@link JobService#onStartJob(JobParameters)}, which is where
+ * you will implement your job logic.</p>
+ * <p>This service executes each incoming job on a {@link android.os.Handler} running on your
* application's main thread. This means that you <b>must</b> offload your execution logic to
* another thread/handler/{@link android.os.AsyncTask} of your choosing. Not doing so will result
- * in blocking any future callbacks from the TaskManager - specifically
- * {@link #onStopTask(android.app.task.TaskParams)}, which is meant to inform you that the
+ * in blocking any future callbacks from the JobManager - specifically
+ * {@link #onStopJob(android.app.job.JobParameters)}, which is meant to inform you that the
* scheduling requirements are no longer being met.</p>
*/
-public abstract class TaskService extends Service {
- private static final String TAG = "TaskService";
+public abstract class JobService extends Service {
+ private static final String TAG = "JobService";
/**
- * Task services must be protected with this permission:
+ * Job services must be protected with this permission:
*
* <pre class="prettyprint">
- * <service android:name="MyTaskService"
- * android:permission="android.permission.BIND_TASK_SERVICE" >
+ * <service android:name="MyJobService"
+ * android:permission="android.permission.BIND_JOB_SERVICE" >
* ...
* </service>
* </pre>
*
- * <p>If a task service is declared in the manifest but not protected with this
+ * <p>If a job service is declared in the manifest but not protected with this
* permission, that service will be ignored by the OS.
*/
public static final String PERMISSION_BIND =
- "android.permission.BIND_TASK_SERVICE";
+ "android.permission.BIND_JOB_SERVICE";
/**
* Identifier for a message that will result in a call to
- * {@link #onStartTask(android.app.task.TaskParams)}.
+ * {@link #onStartJob(android.app.job.JobParameters)}.
*/
- private final int MSG_EXECUTE_TASK = 0;
+ private final int MSG_EXECUTE_JOB = 0;
/**
- * Message that will result in a call to {@link #onStopTask(android.app.task.TaskParams)}.
+ * Message that will result in a call to {@link #onStopJob(android.app.job.JobParameters)}.
*/
- private final int MSG_STOP_TASK = 1;
+ private final int MSG_STOP_JOB = 1;
/**
- * Message that the client has completed execution of this task.
+ * Message that the client has completed execution of this job.
*/
- private final int MSG_TASK_FINISHED = 2;
+ private final int MSG_JOB_FINISHED = 2;
/** Lock object for {@link #mHandler}. */
private final Object mHandlerLock = new Object();
/**
- * Handler we post tasks to. Responsible for calling into the client logic, and handling the
+ * Handler we post jobs to. Responsible for calling into the client logic, and handling the
* callback to the system.
*/
@GuardedBy("mHandlerLock")
- TaskHandler mHandler;
+ JobHandler mHandler;
/** Binder for this service. */
- ITaskService mBinder = new ITaskService.Stub() {
+ IJobService mBinder = new IJobService.Stub() {
@Override
- public void startTask(TaskParams taskParams) {
+ public void startJob(JobParameters jobParams) {
ensureHandler();
- Message m = Message.obtain(mHandler, MSG_EXECUTE_TASK, taskParams);
+ Message m = Message.obtain(mHandler, MSG_EXECUTE_JOB, jobParams);
m.sendToTarget();
}
@Override
- public void stopTask(TaskParams taskParams) {
+ public void stopJob(JobParameters jobParams) {
ensureHandler();
- Message m = Message.obtain(mHandler, MSG_STOP_TASK, taskParams);
+ Message m = Message.obtain(mHandler, MSG_STOP_JOB, jobParams);
m.sendToTarget();
}
};
@@ -102,7 +105,7 @@ public abstract class TaskService extends Service {
void ensureHandler() {
synchronized (mHandlerLock) {
if (mHandler == null) {
- mHandler = new TaskHandler(getMainLooper());
+ mHandler = new JobHandler(getMainLooper());
}
}
}
@@ -112,45 +115,45 @@ public abstract class TaskService extends Service {
* (app-specified) mechanism.
* @hide
*/
- class TaskHandler extends Handler {
- TaskHandler(Looper looper) {
+ class JobHandler extends Handler {
+ JobHandler(Looper looper) {
super(looper);
}
@Override
public void handleMessage(Message msg) {
- final TaskParams params = (TaskParams) msg.obj;
+ final JobParameters params = (JobParameters) msg.obj;
switch (msg.what) {
- case MSG_EXECUTE_TASK:
+ case MSG_EXECUTE_JOB:
try {
- boolean workOngoing = TaskService.this.onStartTask(params);
+ boolean workOngoing = JobService.this.onStartJob(params);
ackStartMessage(params, workOngoing);
} catch (Exception e) {
- Log.e(TAG, "Error while executing task: " + params.getTaskId());
+ Log.e(TAG, "Error while executing job: " + params.getJobId());
throw new RuntimeException(e);
}
break;
- case MSG_STOP_TASK:
+ case MSG_STOP_JOB:
try {
- boolean ret = TaskService.this.onStopTask(params);
+ boolean ret = JobService.this.onStopJob(params);
ackStopMessage(params, ret);
} catch (Exception e) {
- Log.e(TAG, "Application unable to handle onStopTask.", e);
+ Log.e(TAG, "Application unable to handle onStopJob.", e);
throw new RuntimeException(e);
}
break;
- case MSG_TASK_FINISHED:
+ case MSG_JOB_FINISHED:
final boolean needsReschedule = (msg.arg2 == 1);
- ITaskCallback callback = params.getCallback();
+ IJobCallback callback = params.getCallback();
if (callback != null) {
try {
- callback.taskFinished(params.getTaskId(), needsReschedule);
+ callback.jobFinished(params.getJobId(), needsReschedule);
} catch (RemoteException e) {
- Log.e(TAG, "Error reporting task finish to system: binder has gone" +
+ Log.e(TAG, "Error reporting job finish to system: binder has gone" +
"away.");
}
} else {
- Log.e(TAG, "finishTask() called for a nonexistent task id.");
+ Log.e(TAG, "finishJob() called for a nonexistent job id.");
}
break;
default:
@@ -159,34 +162,34 @@ public abstract class TaskService extends Service {
}
}
- private void ackStartMessage(TaskParams params, boolean workOngoing) {
- final ITaskCallback callback = params.getCallback();
- final int taskId = params.getTaskId();
+ private void ackStartMessage(JobParameters params, boolean workOngoing) {
+ final IJobCallback callback = params.getCallback();
+ final int jobId = params.getJobId();
if (callback != null) {
try {
- callback.acknowledgeStartMessage(taskId, workOngoing);
+ callback.acknowledgeStartMessage(jobId, workOngoing);
} catch(RemoteException e) {
- Log.e(TAG, "System unreachable for starting task.");
+ Log.e(TAG, "System unreachable for starting job.");
}
} else {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Attempting to ack a task that has already been processed.");
+ Log.d(TAG, "Attempting to ack a job that has already been processed.");
}
}
}
- private void ackStopMessage(TaskParams params, boolean reschedule) {
- final ITaskCallback callback = params.getCallback();
- final int taskId = params.getTaskId();
+ private void ackStopMessage(JobParameters params, boolean reschedule) {
+ final IJobCallback callback = params.getCallback();
+ final int jobId = params.getJobId();
if (callback != null) {
try {
- callback.acknowledgeStopMessage(taskId, reschedule);
+ callback.acknowledgeStopMessage(jobId, reschedule);
} catch(RemoteException e) {
- Log.e(TAG, "System unreachable for stopping task.");
+ Log.e(TAG, "System unreachable for stopping job.");
}
} else {
if (Log.isLoggable(TAG, Log.DEBUG)) {
- Log.d(TAG, "Attempting to ack a task that has already been processed.");
+ Log.d(TAG, "Attempting to ack a job that has already been processed.");
}
}
}
@@ -198,59 +201,59 @@ public abstract class TaskService extends Service {
}
/**
- * Override this method with the callback logic for your task. Any such logic needs to be
+ * Override this method with the callback logic for your job. Any such logic needs to be
* performed on a separate thread, as this function is executed on your application's main
* thread.
*
- * @param params Parameters specifying info about this task, including the extras bundle you
- * optionally provided at task-creation time.
+ * @param params Parameters specifying info about this job, including the extras bundle you
+ * optionally provided at job-creation time.
* @return True if your service needs to process the work (on a separate thread). False if
- * there's no more work to be done for this task.
+ * there's no more work to be done for this job.
*/
- public abstract boolean onStartTask(TaskParams params);
+ public abstract boolean onStartJob(JobParameters params);
/**
- * This method is called if the system has determined that you must stop execution of your task
- * even before you've had a chance to call {@link #taskFinished(TaskParams, boolean)}.
+ * This method is called if the system has determined that you must stop execution of your job
+ * even before you've had a chance to call {@link #jobFinished(JobParameters, boolean)}.
*
* <p>This will happen if the requirements specified at schedule time are no longer met. For
* example you may have requested WiFi with
- * {@link android.app.task.Task.Builder#setRequiredNetworkCapabilities(int)}, yet while your
- * task was executing the user toggled WiFi. Another example is if you had specified
- * {@link android.app.task.Task.Builder#setRequiresDeviceIdle(boolean)}, and the phone left its
+ * {@link android.app.job.JobInfo.Builder#setRequiredNetworkCapabilities(int)}, yet while your
+ * job was executing the user toggled WiFi. Another example is if you had specified
+ * {@link android.app.job.JobInfo.Builder#setRequiresDeviceIdle(boolean)}, and the phone left its
* idle maintenance window. You are solely responsible for the behaviour of your application
* upon receipt of this message; your app will likely start to misbehave if you ignore it. One
* immediate repercussion is that the system will cease holding a wakelock for you.</p>
*
- * @param params Parameters specifying info about this task.
- * @return True to indicate to the TaskManager whether you'd like to reschedule this task based
- * on the retry criteria provided at task creation-time. False to drop the task. Regardless of
- * the value returned, your task must stop executing.
+ * @param params Parameters specifying info about this job.
+ * @return True to indicate to the JobManager whether you'd like to reschedule this job based
+ * on the retry criteria provided at job creation-time. False to drop the job. Regardless of
+ * the value returned, your job must stop executing.
*/
- public abstract boolean onStopTask(TaskParams params);
+ public abstract boolean onStopJob(JobParameters params);
/**
- * Callback to inform the TaskManager you've finished executing. This can be called from any
+ * Callback to inform the JobManager you've finished executing. This can be called from any
* thread, as it will ultimately be run on your application's main thread. When the system
* receives this message it will release the wakelock being held.
* <p>
* You can specify post-execution behaviour to the scheduler here with
- * <code>needsReschedule </code>. This will apply a back-off timer to your task based on
+ * <code>needsReschedule </code>. This will apply a back-off timer to your job based on
* the default, or what was set with
- * {@link android.app.task.Task.Builder#setBackoffCriteria(long, int)}. The original
- * requirements are always honoured even for a backed-off task. Note that a task running in
- * idle mode will not be backed-off. Instead what will happen is the task will be re-added
+ * {@link android.app.job.JobInfo.Builder#setBackoffCriteria(long, int)}. The original
+ * requirements are always honoured even for a backed-off job. Note that a job running in
+ * idle mode will not be backed-off. Instead what will happen is the job will be re-added
* to the queue and re-executed within a future idle maintenance window.
* </p>
*
- * @param params Parameters specifying system-provided info about this task, this was given to
- * your application in {@link #onStartTask(TaskParams)}.
- * @param needsReschedule True if this task is complete, false if you want the TaskManager to
+ * @param params Parameters specifying system-provided info about this job, this was given to
+ * your application in {@link #onStartJob(JobParameters)}.
+ * @param needsReschedule True if this job is complete, false if you want the JobManager to
* reschedule you.
*/
- public final void taskFinished(TaskParams params, boolean needsReschedule) {
+ public final void jobFinished(JobParameters params, boolean needsReschedule) {
ensureHandler();
- Message m = Message.obtain(mHandler, MSG_TASK_FINISHED, params);
+ Message m = Message.obtain(mHandler, MSG_JOB_FINISHED, params);
m.arg2 = needsReschedule ? 1 : 0;
m.sendToTarget();
}
diff --git a/core/java/android/app/maintenance/package.html b/core/java/android/app/maintenance/package.html
new file mode 100644
index 0000000..1c9bf9d
--- /dev/null
+++ b/core/java/android/app/maintenance/package.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+ {@hide}
+</body>
+</html>
diff --git a/core/java/android/app/task/TaskManager.java b/core/java/android/app/task/TaskManager.java
deleted file mode 100644
index 00f57da..0000000
--- a/core/java/android/app/task/TaskManager.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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 android.app.task;
-
-import java.util.List;
-
-import android.content.Context;
-
-/**
- * Class for scheduling various types of tasks with the scheduling framework on the device.
- *
- * <p>You do not
- * instantiate this class directly; instead, retrieve it through
- * {@link android.content.Context#getSystemService
- * Context.getSystemService(Context.TASK_SERVICE)}.
- */
-public abstract class TaskManager {
- /*
- * Returned from {@link #schedule(Task)} when an invalid parameter was supplied. This can occur
- * if the run-time for your task is too short, or perhaps the system can't resolve the
- * requisite {@link TaskService} in your package.
- */
- public static final int RESULT_FAILURE = 0;
- /**
- * Returned from {@link #schedule(Task)} if this application has made too many requests for
- * work over too short a time.
- */
- // TODO: Determine if this is necessary.
- public static final int RESULT_SUCCESS = 1;
-
- /**
- * @param task The task you wish scheduled. See
- * {@link android.app.task.Task.Builder Task.Builder} for more detail on the sorts of tasks
- * you can schedule.
- * @return If >0, this int returns the taskId of the successfully scheduled task.
- * Otherwise you have to compare the return value to the error codes defined in this class.
- */
- public abstract int schedule(Task task);
-
- /**
- * Cancel a task that is pending in the TaskManager.
- * @param taskId unique identifier for this task. Obtain this value from the tasks returned by
- * {@link #getAllPendingTasks()}.
- * @return
- */
- public abstract void cancel(int taskId);
-
- /**
- * Cancel all tasks that have been registered with the TaskManager by this package.
- */
- public abstract void cancelAll();
-
- /**
- * @return a list of all the tasks registered by this package that have not yet been executed.
- */
- public abstract List<Task> getAllPendingTasks();
-
-}
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 2897887..ccf8451 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -2059,7 +2059,7 @@ public abstract class Context {
PRINT_SERVICE,
MEDIA_SESSION_SERVICE,
BATTERY_SERVICE,
- TASK_SERVICE,
+ JOB_SCHEDULER_SERVICE,
})
@Retention(RetentionPolicy.SOURCE)
public @interface ServiceName {}
@@ -2116,8 +2116,8 @@ public abstract class Context {
* <dd> A {@link android.app.DownloadManager} for requesting HTTP downloads
* <dt> {@link #BATTERY_SERVICE} ("batterymanager")
* <dd> A {@link android.os.BatteryManager} for managing battery state
- * <dt> {@link #TASK_SERVICE} ("taskmanager")
- * <dd> A {@link android.app.task.TaskManager} for managing scheduled tasks
+ * <dt> {@link #JOB_SCHEDULER_SERVICE} ("taskmanager")
+ * <dd> A {@link android.app.job.JobScheduler} for managing scheduled tasks
* </dl>
*
* <p>Note: System services obtained via this API may be closely associated with
@@ -2171,8 +2171,8 @@ public abstract class Context {
* @see android.app.DownloadManager
* @see #BATTERY_SERVICE
* @see android.os.BatteryManager
- * @see #TASK_SERVICE
- * @see android.app.task.TaskManager
+ * @see #JOB_SCHEDULER_SERVICE
+ * @see android.app.job.JobScheduler
*/
public abstract Object getSystemService(@ServiceName @NonNull String name);
@@ -2769,12 +2769,12 @@ public abstract class Context {
/**
* Use with {@link #getSystemService} to retrieve a {@link
- * android.app.task.TaskManager} instance for managing occasional
+ * android.app.job.JobScheduler} instance for managing occasional
* background tasks.
* @see #getSystemService
- * @see android.app.task.TaskManager
+ * @see android.app.job.JobScheduler
*/
- public static final String TASK_SERVICE = "task";
+ public static final String JOB_SCHEDULER_SERVICE = "jobscheduler";
/**
* Determine whether the given permission is allowed for a particular
diff --git a/core/java/android/hardware/camera2/CameraCaptureSession.java b/core/java/android/hardware/camera2/CameraCaptureSession.java
index 5fd0f9b..d98bdc2 100644
--- a/core/java/android/hardware/camera2/CameraCaptureSession.java
+++ b/core/java/android/hardware/camera2/CameraCaptureSession.java
@@ -29,19 +29,19 @@ import java.util.List;
*
* <p>Creating a session is an expensive operation and can take several hundred milliseconds, since
* it requires configuring the camera device's internal pipelines and allocating memory buffers for
- * sending images to the desired targets. While
- * {@link CameraDevice#createCaptureSession createCaptureSession} will provide a
- * CameraCaptureSession object immediately, configuration won't be complete until the
- * {@link CameraCaptureSession.StateListener#onConfigured onConfigured} callback is called for the
- * first time. If configuration cannot be completed, then the
+ * sending images to the desired targets. Therefore the setup is done asynchronously, and
+ * {@link CameraDevice#createCaptureSession createCaptureSession} will send the ready-to-use
+ * CameraCaptureSession to the provided listener's
+ * {@link CameraCaptureSession.StateListener#onConfigured onConfigured} callback. If configuration
+ * cannot be completed, then the
* {@link CameraCaptureSession.StateListener#onConfigureFailed onConfigureFailed} is called, and the
* session will not become active.</p>
- *
+ *<!--
* <p>Any capture requests (repeating or non-repeating) submitted before the session is ready will
* be queued up and will begin capture once the session becomes ready. In case the session cannot be
* configured and {@link StateListener#onConfigureFailed onConfigureFailed} is called, all queued
* capture requests are discarded.</p>
- *
+ *-->
* <p>If a new session is created by the camera device, then the previous session is closed, and its
* associated {@link StateListener#onClosed onClosed} callback will be invoked. All
* of the session methods will throw an IllegalStateException if called once the session is
@@ -166,10 +166,6 @@ public abstract class CameraCaptureSession implements AutoCloseable {
* capture request will be processed before any further repeating
* requests are processed.<p>
*
- * <p>Repeating requests are a simple way for an application to maintain a
- * preview or other continuous stream of frames, without having to submit
- * requests through {@link #capture} at video rates.</p>
- *
* <p>To stop the repeating capture, call {@link #stopRepeating}. Calling
* {@link #abortCaptures} will also clear the request.</p>
*
@@ -323,7 +319,7 @@ public abstract class CameraCaptureSession implements AutoCloseable {
*
* @see #setRepeatingRequest
* @see #setRepeatingBurst
- * @see #configureOutputs
+ * @see CameraDevice#createCaptureSession
*/
public abstract void abortCaptures() throws CameraAccessException;
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java
index 08cfc87..9eea545 100644
--- a/core/java/android/hardware/camera2/CameraCharacteristics.java
+++ b/core/java/android/hardware/camera2/CameraCharacteristics.java
@@ -30,7 +30,7 @@ import java.util.List;
*
* <p>These properties are fixed for a given CameraDevice, and can be queried
* through the {@link CameraManager CameraManager}
- * interface in addition to through the CameraDevice interface.</p>
+ * interface with {@link CameraManager#getCameraCharacteristics}.</p>
*
* <p>{@link CameraCharacteristics} objects are immutable.</p>
*
@@ -320,7 +320,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
/**
* <p>List of frame rate ranges supported by the
- * AE algorithm/hardware</p>
+ * auto-exposure (AE) algorithm/hardware</p>
*/
public static final Key<android.util.Range<Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES =
new Key<android.util.Range<Integer>[]>("android.control.aeAvailableTargetFpsRanges", new TypeReference<android.util.Range<Integer>[]>() {{ }});
@@ -343,7 +343,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<Rational>("android.control.aeCompensationStep", Rational.class);
/**
- * <p>List of AF modes that can be
+ * <p>List of auto-focus (AF) modes that can be
* selected with {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}.</p>
* <p>Not all the auto-focus modes may be supported by a
* given camera device. This entry lists the valid modes for
@@ -496,7 +496,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<int[]>("android.hotPixel.availableHotPixelModes", int[].class);
/**
- * <p>Supported resolutions for the JPEG thumbnail</p>
+ * <p>Supported resolutions for the JPEG thumbnail.</p>
* <p>Below condiditions will be satisfied for this size list:</p>
* <ul>
* <li>The sizes will be sorted by increasing pixel area (width x height).
@@ -555,7 +555,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* <p>List containing a subset of the optical image
* stabilization (OIS) modes specified in
* {@link CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE android.lens.opticalStabilizationMode}.</p>
- * <p>If OIS is not implemented for a given camera device, this should
+ * <p>If OIS is not implemented for a given camera device, this will
* contain only OFF.</p>
*
* @see CaptureRequest#LENS_OPTICAL_STABILIZATION_MODE
@@ -612,7 +612,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
/**
* <p>Direction the camera faces relative to
- * device screen</p>
+ * device screen.</p>
* @see #LENS_FACING_FRONT
* @see #LENS_FACING_BACK
*/
@@ -622,7 +622,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
/**
* <p>The set of noise reduction modes supported by this camera device.</p>
* <p>This tag lists the valid modes for {@link CaptureRequest#NOISE_REDUCTION_MODE android.noiseReduction.mode}.</p>
- * <p>Full-capability camera devices must laways support OFF and FAST.</p>
+ * <p>Full-capability camera devices must always support OFF and FAST.</p>
*
* @see CaptureRequest#NOISE_REDUCTION_MODE
*/
@@ -778,17 +778,20 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<Byte>("android.request.pipelineMaxDepth", byte.class);
/**
- * <p>Optional. Defaults to 1. Defines how many sub-components
+ * <p>Defines how many sub-components
* a result will be composed of.</p>
* <p>In order to combat the pipeline latency, partial results
* may be delivered to the application layer from the camera device as
* soon as they are available.</p>
- * <p>A value of 1 means that partial results are not supported.</p>
- * <p>A typical use case for this might be: after requesting an AF lock the
- * new AF state might be available 50% of the way through the pipeline.
- * The camera device could then immediately dispatch this state via a
- * partial result to the framework/application layer, and the rest of
- * the metadata via later partial results.</p>
+ * <p>Optional; defaults to 1. A value of 1 means that partial
+ * results are not supported, and only the final TotalCaptureResult will
+ * be produced by the camera device.</p>
+ * <p>A typical use case for this might be: after requesting an
+ * auto-focus (AF) lock the new AF state might be available 50%
+ * of the way through the pipeline. The camera device could
+ * then immediately dispatch this state via a partial result to
+ * the application, and the rest of the metadata via later
+ * partial results.</p>
*/
public static final Key<Integer> REQUEST_PARTIAL_RESULT_COUNT =
new Key<Integer>("android.request.partialResultCount", int.class);
@@ -805,8 +808,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* to do this query each of android.request.availableRequestKeys,
* android.request.availableResultKeys,
* android.request.availableCharacteristicsKeys.</p>
- * <p>XX: Maybe these should go into {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel}
- * as a table instead?</p>
* <p>The following capabilities are guaranteed to be available on
* {@link CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL android.info.supportedHardwareLevel} <code>==</code> FULL devices:</p>
* <ul>
@@ -814,14 +815,11 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* <li>MANUAL_POST_PROCESSING</li>
* </ul>
* <p>Other capabilities may be available on either FULL or LIMITED
- * devices, but the app. should query this field to be sure.</p>
+ * devices, but the application should query this field to be sure.</p>
*
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
- * @see #REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE
- * @see #REQUEST_AVAILABLE_CAPABILITIES_OPTIONAL
* @see #REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR
* @see #REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING
- * @see #REQUEST_AVAILABLE_CAPABILITIES_ZSL
* @see #REQUEST_AVAILABLE_CAPABILITIES_DNG
*/
public static final Key<int[]> REQUEST_AVAILABLE_CAPABILITIES =
@@ -837,7 +835,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* at a more granular level than capabilities. This is especially
* important for optional keys that are not listed under any capability
* in {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}.</p>
- * <p>TODO: This should be used by #getAvailableCaptureRequestKeys.</p>
*
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
* @hide
@@ -862,7 +859,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* at a more granular level than capabilities. This is especially
* important for optional keys that are not listed under any capability
* in {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}.</p>
- * <p>TODO: This should be used by #getAvailableCaptureResultKeys.</p>
*
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
* @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
@@ -878,7 +874,6 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* android.request.availableResultKeys (except that it applies for
* CameraCharacteristics instead of CaptureResult). See above for more
* details.</p>
- * <p>TODO: This should be used by CameraCharacteristics#getKeys.</p>
* @hide
*/
public static final Key<int[]> REQUEST_AVAILABLE_CHARACTERISTICS_KEYS =
@@ -926,10 +921,15 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<android.util.Size[]>("android.scaler.availableJpegSizes", android.util.Size[].class);
/**
- * <p>The maximum ratio between active area width
- * and crop region width, or between active area height and
- * crop region height, if the crop region height is larger
- * than width</p>
+ * <p>The maximum ratio between both active area width
+ * and crop region width, and active area height and
+ * crop region height.</p>
+ * <p>This represents the maximum amount of zooming possible by
+ * the camera device, or equivalently, the minimum cropping
+ * window size.</p>
+ * <p>Crop regions that have a width or height that is smaller
+ * than this ratio allows will be rounded up to the minimum
+ * allowed size by the camera device.</p>
*/
public static final Key<Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM =
new Key<Float>("android.scaler.availableMaxDigitalZoom", float.class);
@@ -1326,15 +1326,21 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<android.graphics.Rect>("android.sensor.info.activeArraySize", android.graphics.Rect.class);
/**
- * <p>Range of valid sensitivities</p>
+ * <p>Range of valid sensitivities.</p>
+ * <p>The minimum and maximum valid values for the
+ * {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} control.</p>
+ * <p>The values are the standard ISO sensitivity values,
+ * as defined in ISO 12232:2006.</p>
+ *
+ * @see CaptureRequest#SENSOR_SENSITIVITY
*/
public static final Key<android.util.Range<Integer>> SENSOR_INFO_SENSITIVITY_RANGE =
new Key<android.util.Range<Integer>>("android.sensor.info.sensitivityRange", new TypeReference<android.util.Range<Integer>>() {{ }});
/**
- * <p>Arrangement of color filters on sensor;
+ * <p>The arrangement of color filters on sensor;
* represents the colors in the top-left 2x2 section of
- * the sensor, in reading order</p>
+ * the sensor, in reading order.</p>
* @see #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB
* @see #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG
* @see #SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG
@@ -1372,8 +1378,11 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
/**
* <p>The physical dimensions of the full pixel
- * array</p>
- * <p>Needed for FOV calculation for old API</p>
+ * array.</p>
+ * <p>This is the physical size of the sensor pixel
+ * array defined by {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
*/
public static final Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE =
new Key<android.util.SizeF>("android.sensor.info.physicalSize", android.util.SizeF.class);
@@ -1381,9 +1390,17 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
/**
* <p>Dimensions of full pixel array, possibly
* including black calibration pixels.</p>
- * <p>Maximum output resolution for raw format must
- * match this in
- * android.scaler.availableStreamConfigurations.</p>
+ * <p>The pixel count of the full pixel array,
+ * which covers {@link CameraCharacteristics#SENSOR_INFO_PHYSICAL_SIZE android.sensor.info.physicalSize} area.</p>
+ * <p>If a camera device supports raw sensor formats, either this
+ * or {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize} is the maximum output
+ * raw size listed in {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP android.scaler.streamConfigurationMap}.
+ * If a size corresponding to pixelArraySize is listed, the resulting
+ * raw sensor image will include black pixels.</p>
+ *
+ * @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see CameraCharacteristics#SENSOR_INFO_PHYSICAL_SIZE
*/
public static final Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE =
new Key<android.util.Size>("android.sensor.info.pixelArraySize", android.util.Size.class);
@@ -1638,8 +1655,8 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<Integer>("android.sensor.orientation", int.class);
/**
- * <p>Optional. Defaults to [OFF]. Lists the supported test
- * pattern modes for {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode}.</p>
+ * <p>Lists the supported sensor test pattern modes for {@link CaptureRequest#SENSOR_TEST_PATTERN_MODE android.sensor.testPatternMode}.</p>
+ * <p>Optional. Defaults to [OFF].</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
* @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
@@ -1648,10 +1665,9 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<int[]>("android.sensor.availableTestPatternModes", int[].class);
/**
- * <p>Which face detection modes are available,
- * if any</p>
- * <p>OFF means face detection is disabled, it must
- * be included in the list.</p>
+ * <p>The face detection modes that are available
+ * for this camera device.</p>
+ * <p>OFF is always supported.</p>
* <p>SIMPLE means the device supports the
* android.statistics.faceRectangles and
* android.statistics.faceScores outputs.</p>
@@ -1663,8 +1679,8 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
new Key<int[]>("android.statistics.info.availableFaceDetectModes", int[].class);
/**
- * <p>Maximum number of simultaneously detectable
- * faces</p>
+ * <p>The maximum number of simultaneously detectable
+ * faces.</p>
*/
public static final Key<Integer> STATISTICS_INFO_MAX_FACE_COUNT =
new Key<Integer>("android.statistics.info.maxFaceCount", int.class);
@@ -1673,7 +1689,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri
* <p>The set of hot pixel map output modes supported by this camera device.</p>
* <p>This tag lists valid output modes for {@link CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE android.statistics.hotPixelMapMode}.</p>
* <p>If no hotpixel map is available for this camera device, this will contain
- * only OFF. If the hotpixel map is available, this should include both
+ * only OFF. If the hotpixel map is available, this will include both
* the ON and OFF options.</p>
*
* @see CaptureRequest#STATISTICS_HOT_PIXEL_MAP_MODE
diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java
index e9213c5..68f4d64 100644
--- a/core/java/android/hardware/camera2/CameraDevice.java
+++ b/core/java/android/hardware/camera2/CameraDevice.java
@@ -52,7 +52,7 @@ public abstract class CameraDevice implements AutoCloseable {
* Create a request suitable for a camera preview window. Specifically, this
* means that high frame rate is given priority over the highest-quality
* post-processing. These requests would normally be used with the
- * {@link #setRepeatingRequest} method.
+ * {@link CameraCaptureSession#setRepeatingRequest} method.
*
* @see #createCaptureRequest
*/
@@ -61,7 +61,7 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* Create a request suitable for still image capture. Specifically, this
* means prioritizing image quality over frame rate. These requests would
- * commonly be used with the {@link #capture} method.
+ * commonly be used with the {@link CameraCaptureSession#capture} method.
*
* @see #createCaptureRequest
*/
@@ -71,7 +71,7 @@ public abstract class CameraDevice implements AutoCloseable {
* Create a request suitable for video recording. Specifically, this means
* that a stable frame rate is used, and post-processing is set for
* recording quality. These requests would commonly be used with the
- * {@link #setRepeatingRequest} method.
+ * {@link CameraCaptureSession#setRepeatingRequest} method.
*
* @see #createCaptureRequest
*/
@@ -81,8 +81,8 @@ public abstract class CameraDevice implements AutoCloseable {
* Create a request suitable for still image capture while recording
* video. Specifically, this means maximizing image quality without
* disrupting the ongoing recording. These requests would commonly be used
- * with the {@link #capture} method while a request based on
- * {@link #TEMPLATE_RECORD} is is in use with {@link #setRepeatingRequest}.
+ * with the {@link CameraCaptureSession#capture} method while a request based on
+ * {@link #TEMPLATE_RECORD} is is in use with {@link CameraCaptureSession#setRepeatingRequest}.
*
* @see #createCaptureRequest
*/
@@ -132,116 +132,6 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* <p>Set up a new output set of Surfaces for the camera device.</p>
*
- * <p>The configuration determines the set of potential output Surfaces for
- * the camera device for each capture request. A given request may use all
- * or a only some of the outputs. This method must be called before requests
- * can be submitted to the camera with {@link #capture capture},
- * {@link #captureBurst captureBurst},
- * {@link #setRepeatingRequest setRepeatingRequest}, or
- * {@link #setRepeatingBurst setRepeatingBurst}.</p>
- *
- * <p>Surfaces suitable for inclusion as a camera output can be created for
- * various use cases and targets:</p>
- *
- * <ul>
- *
- * <li>For drawing to a {@link android.view.SurfaceView SurfaceView}: Set
- * the size of the Surface with
- * {@link android.view.SurfaceHolder#setFixedSize} to be one of the
- * supported
- * {@link StreamConfigurationMap#getOutputSizes(Class) processed sizes}
- * before calling {@link android.view.SurfaceHolder#getSurface}.</li>
- *
- * <li>For accessing through an OpenGL texture via a
- * {@link android.graphics.SurfaceTexture SurfaceTexture}: Set the size of
- * the SurfaceTexture with
- * {@link android.graphics.SurfaceTexture#setDefaultBufferSize} to be one
- * of the supported
- * {@link StreamConfigurationMap#getOutputSizes(Class) processed sizes}
- * before creating a Surface from the SurfaceTexture with
- * {@link Surface#Surface}.</li>
- *
- * <li>For recording with {@link android.media.MediaCodec}: Call
- * {@link android.media.MediaCodec#createInputSurface} after configuring
- * the media codec to use one of the
- * {@link StreamConfigurationMap#getOutputSizes(Class) processed sizes}
- * </li>
- *
- * <li>For recording with {@link android.media.MediaRecorder}: TODO</li>
- *
- * <li>For efficient YUV processing with {@link android.renderscript}:
- * Create a RenderScript
- * {@link android.renderscript.Allocation Allocation} with a supported YUV
- * type, the IO_INPUT flag, and one of the supported
- * {@link StreamConfigurationMap#getOutputSizes(int) processed sizes}. Then
- * obtain the Surface with
- * {@link android.renderscript.Allocation#getSurface}.</li>
- *
- * <li>For access to uncompressed or {@link ImageFormat#JPEG JPEG} data in the application:
- * Create a {@link android.media.ImageReader} object with the desired
- * {@link StreamConfigurationMap#getOutputFormats() image format}, and a size from the matching
- * {@link StreamConfigurationMap#getOutputSizes(int) processed size} and {@code format}.
- * Then obtain a {@link Surface} from it.</li>
- * </ul>
- *
- * </p>
- *
- * <p>This function can take several hundred milliseconds to execute, since
- * camera hardware may need to be powered on or reconfigured.</p>
- *
- * <p>The camera device will query each Surface's size and formats upon this
- * call, so they must be set to a valid setting at this time (in particular:
- * if the format is user-visible, it must be one of
- * {@link StreamConfigurationMap#getOutputFormats}; and the size must be one of
- * {@link StreamConfigurationMap#getOutputSizes(int)}).</p>
- *
- * <p>When this method is called with valid Surfaces, the device will transition to the {@link
- * StateListener#onBusy busy state}. Once configuration is complete, the device will transition
- * into the {@link StateListener#onIdle idle state}. Capture requests using the newly-configured
- * Surfaces may then be submitted with {@link #capture}, {@link #captureBurst}, {@link
- * #setRepeatingRequest}, or {@link #setRepeatingBurst}.</p>
- *
- * <p>If this method is called while the camera device is still actively processing previously
- * submitted captures, then the following sequence of events occurs: The device transitions to
- * the busy state and calls the {@link StateListener#onBusy} callback. Second, if a repeating
- * request is set it is cleared. Third, the device finishes up all in-flight and pending
- * requests. Finally, once the device is idle, it then reconfigures its outputs, and calls the
- * {@link StateListener#onIdle} method once it is again ready to accept capture
- * requests. Therefore, no submitted work is discarded. To idle as fast as possible, use {@link
- * #flush} and wait for the idle callback before calling configureOutputs. This will discard
- * work, but reaches the new configuration sooner.</p>
- *
- * <p>Using larger resolution outputs, or more outputs, can result in slower
- * output rate from the device.</p>
- *
- * <p>Configuring the outputs with an empty or null list will transition the camera into an
- * {@link StateListener#onUnconfigured unconfigured state} instead of the {@link
- * StateListener#onIdle idle state}. </p>
- *
- * <p>Calling configureOutputs with the same arguments as the last call to
- * configureOutputs has no effect, and the {@link StateListener#onBusy busy}
- * and {@link StateListener#onIdle idle} state transitions will happen
- * immediately.</p>
- *
- * @param outputs The new set of Surfaces that should be made available as
- * targets for captured image data.
- *
- * @throws IllegalArgumentException if the set of output Surfaces do not
- * meet the requirements
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera device is not idle, or
- * if the camera device has been closed
- *
- * @see StateListener#onBusy
- * @see StateListener#onIdle
- * @see StateListener#onActive
- * @see StateListener#onUnconfigured
- * @see #stopRepeating
- * @see #flush
- * @see StreamConfigurationMap#getOutputFormats()
- * @see StreamConfigurationMap#getOutputSizes(int)
- * @see StreamConfigurationMap#getOutputSizes(Class)
* @deprecated Use {@link #createCaptureSession} instead
*/
@Deprecated
@@ -342,10 +232,7 @@ public abstract class CameraDevice implements AutoCloseable {
* @param listener The listener to notify about the status of the new capture session.
* @param handler The handler on which the listener should be invoked, or {@code null} to use
* the current thread's {@link android.os.Looper looper}.
- * <!--
- * @return A new camera capture session to use, or null if an empty/null set of Surfaces is
- * provided.
- * -->
+ *
* @throws IllegalArgumentException if the set of output Surfaces do not meet the requirements,
* the listener is null, or the handler is null but the current
* thread has no looper.
@@ -393,92 +280,16 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* <p>Submit a request for an image to be captured by this CameraDevice.</p>
*
- * <p>The request defines all the parameters for capturing the single image,
- * including sensor, lens, flash, and post-processing settings.</p>
- *
- * <p>Each request will produce one {@link CaptureResult} and produce new
- * frames for one or more target Surfaces, set with the CaptureRequest
- * builder's {@link CaptureRequest.Builder#addTarget} method. The target
- * surfaces must be configured as active outputs with
- * {@link #configureOutputs} before calling this method.</p>
- *
- * <p>Multiple requests can be in progress at once. They are processed in
- * first-in, first-out order, with minimal delays between each
- * capture. Requests submitted through this method have higher priority than
- * those submitted through {@link #setRepeatingRequest} or
- * {@link #setRepeatingBurst}, and will be processed as soon as the current
- * repeat/repeatBurst processing completes.</p>
- *
- * @param request the settings for this capture
- * @param listener The callback object to notify once this request has been
- * processed. If null, no metadata will be produced for this capture,
- * although image data will still be produced.
- * @param handler the handler on which the listener should be invoked, or
- * {@code null} to use the current thread's {@link android.os.Looper
- * looper}.
- *
- * @return int A unique capture sequence ID used by
- * {@link CaptureListener#onCaptureSequenceCompleted}.
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is currently busy or unconfigured,
- * or the camera device has been closed.
- * @throws IllegalArgumentException If the request targets Surfaces not
- * currently configured as outputs. Or if the handler is null, the listener
- * is not null, and the calling thread has no looper.
- *
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#capture} instead
*/
@Deprecated
public abstract int capture(CaptureRequest request, CaptureListener listener, Handler handler)
throws CameraAccessException;
/**
- * Submit a list of requests to be captured in sequence as a burst. The
- * burst will be captured in the minimum amount of time possible, and will
- * not be interleaved with requests submitted by other capture or repeat
- * calls.
- *
- * <p>The requests will be captured in order, each capture producing one
- * {@link CaptureResult} and image buffers for one or more target
- * {@link android.view.Surface surfaces}. The target surfaces for each
- * request (set with {@link CaptureRequest.Builder#addTarget}) must be
- * configured as active outputs with {@link #configureOutputs} before
- * calling this method.</p>
- *
- * <p>The main difference between this method and simply calling
- * {@link #capture} repeatedly is that this method guarantees that no
- * other requests will be interspersed with the burst.</p>
+ * Submit a list of requests to be captured in sequence as a burst.
*
- * @param requests the list of settings for this burst capture
- * @param listener The callback object to notify each time one of the
- * requests in the burst has been processed. If null, no metadata will be
- * produced for any requests in this burst, although image data will still
- * be produced.
- * @param handler the handler on which the listener should be invoked, or
- * {@code null} to use the current thread's {@link android.os.Looper
- * looper}.
- *
- * @return int A unique capture sequence ID used by
- * {@link CaptureListener#onCaptureSequenceCompleted}.
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is currently busy or unconfigured,
- * or the camera device has been closed.
- * @throws IllegalArgumentException If the requests target Surfaces not
- * currently configured as outputs. Or if the handler is null, the listener
- * is not null, and the calling thread has no looper. Or if no requests were
- * passed in.
- *
- * @see #capture
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#captureBurst} instead
*/
@Deprecated
public abstract int captureBurst(List<CaptureRequest> requests, CaptureListener listener,
@@ -487,58 +298,7 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* Request endlessly repeating capture of images by this CameraDevice.
*
- * <p>With this method, the CameraDevice will continually capture images
- * using the settings in the provided {@link CaptureRequest}, at the maximum
- * rate possible.</p>
- *
- * <p>Repeating requests are a simple way for an application to maintain a
- * preview or other continuous stream of frames, without having to
- * continually submit identical requests through {@link #capture}.</p>
- *
- * <p>Repeat requests have lower priority than those submitted
- * through {@link #capture} or {@link #captureBurst}, so if
- * {@link #capture} is called when a repeating request is active, the
- * capture request will be processed before any further repeating
- * requests are processed.<p>
- *
- * <p>Repeating requests are a simple way for an application to maintain a
- * preview or other continuous stream of frames, without having to submit
- * requests through {@link #capture} at video rates.</p>
- *
- * <p>To stop the repeating capture, call {@link #stopRepeating}. Calling
- * {@link #flush} will also clear the request.</p>
- *
- * <p>Calling this method will replace any earlier repeating request or
- * burst set up by this method or {@link #setRepeatingBurst}, although any
- * in-progress burst will be completed before the new repeat request will be
- * used.</p>
- *
- * @param request the request to repeat indefinitely
- * @param listener The callback object to notify every time the
- * request finishes processing. If null, no metadata will be
- * produced for this stream of requests, although image data will
- * still be produced.
- * @param handler the handler on which the listener should be invoked, or
- * {@code null} to use the current thread's {@link android.os.Looper
- * looper}.
- *
- * @return int A unique capture sequence ID used by
- * {@link CaptureListener#onCaptureSequenceCompleted}.
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is currently busy or unconfigured,
- * or the camera device has been closed.
- * @throws IllegalArgumentException If the requests reference Surfaces not
- * currently configured as outputs. Or if the handler is null, the listener
- * is not null, and the calling thread has no looper.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingBurst
- * @see #stopRepeating
- * @see #flush
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#setRepeatingRequest} instead
*/
@Deprecated
public abstract int setRepeatingRequest(CaptureRequest request, CaptureListener listener,
@@ -548,58 +308,7 @@ public abstract class CameraDevice implements AutoCloseable {
* <p>Request endlessly repeating capture of a sequence of images by this
* CameraDevice.</p>
*
- * <p>With this method, the CameraDevice will continually capture images,
- * cycling through the settings in the provided list of
- * {@link CaptureRequest CaptureRequests}, at the maximum rate possible.</p>
- *
- * <p>If a request is submitted through {@link #capture} or
- * {@link #captureBurst}, the current repetition of the request list will be
- * completed before the higher-priority request is handled. This guarantees
- * that the application always receives a complete repeat burst captured in
- * minimal time, instead of bursts interleaved with higher-priority
- * captures, or incomplete captures.</p>
- *
- * <p>Repeating burst requests are a simple way for an application to
- * maintain a preview or other continuous stream of frames where each
- * request is different in a predicatable way, without having to continually
- * submit requests through {@link #captureBurst} .</p>
- *
- * <p>To stop the repeating capture, call {@link #stopRepeating}. Any
- * ongoing burst will still be completed, however. Calling
- * {@link #flush} will also clear the request.</p>
- *
- * <p>Calling this method will replace a previously-set repeating request or
- * burst set up by this method or {@link #setRepeatingRequest}, although any
- * in-progress burst will be completed before the new repeat burst will be
- * used.</p>
- *
- * @param requests the list of requests to cycle through indefinitely
- * @param listener The callback object to notify each time one of the
- * requests in the repeating bursts has finished processing. If null, no
- * metadata will be produced for this stream of requests, although image
- * data will still be produced.
- * @param handler the handler on which the listener should be invoked, or
- * {@code null} to use the current thread's {@link android.os.Looper
- * looper}.
- *
- * @return int A unique capture sequence ID used by
- * {@link CaptureListener#onCaptureSequenceCompleted}.
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is currently busy or unconfigured,
- * or the camera device has been closed.
- * @throws IllegalArgumentException If the requests reference Surfaces not
- * currently configured as outputs. Or if the handler is null, the listener
- * is not null, and the calling thread has no looper. Or if no requests were
- * passed in.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #stopRepeating
- * @see #flush
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#setRepeatingBurst} instead
*/
@Deprecated
public abstract int setRepeatingBurst(List<CaptureRequest> requests, CaptureListener listener,
@@ -608,24 +317,9 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* <p>Cancel any ongoing repeating capture set by either
* {@link #setRepeatingRequest setRepeatingRequest} or
- * {@link #setRepeatingBurst}. Has no effect on requests submitted through
- * {@link #capture capture} or {@link #captureBurst captureBurst}.</p>
+ * {@link #setRepeatingBurst}.
*
- * <p>Any currently in-flight captures will still complete, as will any
- * burst that is mid-capture. To ensure that the device has finished
- * processing all of its capture requests and is in idle state, wait for the
- * {@link StateListener#onIdle} callback after calling this
- * method..</p>
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is currently busy or unconfigured,
- * or the camera device has been closed.
- *
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- * @see StateListener#onIdle
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#stopRepeating} instead
*/
@Deprecated
public abstract void stopRepeating() throws CameraAccessException;
@@ -634,36 +328,7 @@ public abstract class CameraDevice implements AutoCloseable {
* Flush all captures currently pending and in-progress as fast as
* possible.
*
- * <p>The camera device will discard all of its current work as fast as
- * possible. Some in-flight captures may complete successfully and call
- * {@link CaptureListener#onCaptureCompleted}, while others will trigger
- * their {@link CaptureListener#onCaptureFailed} callbacks. If a repeating
- * request or a repeating burst is set, it will be cleared by the flush.</p>
- *
- * <p>This method is the fastest way to idle the camera device for
- * reconfiguration with {@link #configureOutputs}, at the cost of discarding
- * in-progress work. Once the flush is complete, the idle callback will be
- * called.</p>
- *
- * <p>Flushing will introduce at least a brief pause in the stream of data
- * from the camera device, since once the flush is complete, the first new
- * request has to make it through the entire camera pipeline before new
- * output buffers are produced.</p>
- *
- * <p>This means that using {@code flush()} to simply remove pending
- * requests is not recommended; it's best used for quickly switching output
- * configurations, or for cancelling long in-progress requests (such as a
- * multi-second capture).</p>
- *
- * @throws CameraAccessException if the camera device is no longer connected or has
- * encountered a fatal error
- * @throws IllegalStateException if the camera is not idle/active,
- * or the camera device has been closed.
- *
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- * @see #configureOutputs
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession#abortCaptures} instead
*/
@Deprecated
public abstract void flush() throws CameraAccessException;
@@ -690,15 +355,7 @@ public abstract class CameraDevice implements AutoCloseable {
* <p>A listener for tracking the progress of a {@link CaptureRequest}
* submitted to the camera device.</p>
*
- * <p>This listener is called when a request triggers a capture to start,
- * and when the capture is complete. In case on an error capturing an image,
- * the error method is triggered instead of the completion method.</p>
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- * @deprecated Use {@link CameraCaptureSession} instead
+ * @deprecated Use {@link CameraCaptureSession.CaptureListener} instead
*/
@Deprecated
public static abstract class CaptureListener {
@@ -715,29 +372,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called when the camera device has started capturing
* the output image for the request, at the beginning of image exposure.
*
- * <p>This callback is invoked right as the capture of a frame begins,
- * so it is the most appropriate time for playing a shutter sound,
- * or triggering UI indicators of capture.</p>
- *
- * <p>The request that is being used for this capture is provided, along
- * with the actual timestamp for the start of exposure. This timestamp
- * matches the timestamp that will be included in
- * {@link CaptureResult#SENSOR_TIMESTAMP the result timestamp field},
- * and in the buffers sent to each output Surface. These buffer
- * timestamps are accessible through, for example,
- * {@link android.media.Image#getTimestamp() Image.getTimestamp()} or
- * {@link android.graphics.SurfaceTexture#getTimestamp()}.</p>
- *
- * <p>For the simplest way to play a shutter sound camera shutter or a
- * video recording start/stop sound, see the
- * {@link android.media.MediaActionSound} class.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera the CameraDevice sending the callback
- * @param request the request for the capture that just begun
- * @param timestamp the timestamp at start of capture, in nanoseconds.
- *
* @see android.media.MediaActionSound
*/
public void onCaptureStarted(CameraDevice camera,
@@ -749,25 +383,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called when some results from an image capture are
* available.
*
- * <p>The result provided here will contain some subset of the fields of
- * a full result. Multiple onCapturePartial calls may happen per
- * capture; a given result field will only be present in one partial
- * capture at most. The final onCaptureCompleted call will always
- * contain all the fields, whether onCapturePartial was called or
- * not.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera The CameraDevice sending the callback.
- * @param request The request that was given to the CameraDevice
- * @param result The partial output metadata from the capture, which
- * includes a subset of the CaptureResult fields.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
- *
* @hide
*/
public void onCapturePartial(CameraDevice camera,
@@ -779,37 +394,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called when an image capture makes partial forward progress; some
* (but not all) results from an image capture are available.
*
- * <p>The result provided here will contain some subset of the fields of
- * a full result. Multiple {@link #onCaptureProgressed} calls may happen per
- * capture; a given result field will only be present in one partial
- * capture at most. The final {@link #onCaptureCompleted} call will always
- * contain all the fields (in particular, the union of all the fields of all
- * the partial results composing the total result).</p>
- *
- * <p>For each request, some result data might be available earlier than others. The typical
- * delay between each partial result (per request) is a single frame interval.
- * For performance-oriented use-cases, applications should query the metadata they need
- * to make forward progress from the partial results and avoid waiting for the completed
- * result.</p>
- *
- * <p>Each request will generate at least {@code 1} partial results, and at most
- * {@link CameraCharacteristics#REQUEST_PARTIAL_RESULT_COUNT} partial results.</p>
- *
- * <p>Depending on the request settings, the number of partial results per request
- * will vary, although typically the partial count could be the same as long as the
- * camera device subsystems enabled stay the same.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera The CameraDevice sending the callback.
- * @param request The request that was given to the CameraDevice
- * @param partialResult The partial output metadata from the capture, which
- * includes a subset of the {@link TotalCaptureResult} fields.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
*/
public void onCaptureProgressed(CameraDevice camera,
CaptureRequest request, CaptureResult partialResult) {
@@ -819,26 +403,6 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* This method is called when an image capture has fully completed and all the
* result metadata is available.
- *
- * <p>This callback will always fire after the last {@link #onCaptureProgressed};
- * in other words, no more partial results will be delivered once the completed result
- * is available.</p>
- *
- * <p>For performance-intensive use-cases where latency is a factor, consider
- * using {@link #onCaptureProgressed} instead.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera The CameraDevice sending the callback.
- * @param request The request that was given to the CameraDevice
- * @param result The total output metadata from the capture, including the
- * final capture parameters and the state of the camera system during
- * capture.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
*/
public void onCaptureCompleted(CameraDevice camera,
CaptureRequest request, TotalCaptureResult result) {
@@ -849,29 +413,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called instead of {@link #onCaptureCompleted} when the
* camera device failed to produce a {@link CaptureResult} for the
* request.
- *
- * <p>Other requests are unaffected, and some or all image buffers from
- * the capture may have been pushed to their respective output
- * streams.</p>
- *
- * <p>Some partial results may have been delivered before the capture fails;
- * however after this callback fires, no more partial results will be delivered by
- * {@link #onCaptureProgressed}.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera
- * The CameraDevice sending the callback.
- * @param request
- * The request that was given to the CameraDevice
- * @param failure
- * The output failure from the capture, including the failure reason
- * and the frame number.
- *
- * @see #capture
- * @see #captureBurst
- * @see #setRepeatingRequest
- * @see #setRepeatingBurst
*/
public void onCaptureFailed(CameraDevice camera,
CaptureRequest request, CaptureFailure failure) {
@@ -882,26 +423,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called independently of the others in CaptureListener,
* when a capture sequence finishes and all {@link CaptureResult}
* or {@link CaptureFailure} for it have been returned via this listener.
- *
- * <p>In total, there will be at least one result/failure returned by this listener
- * before this callback is invoked. If the capture sequence is aborted before any
- * requests have been processed, {@link #onCaptureSequenceAborted} is invoked instead.</p>
- *
- * <p>The default implementation does nothing.</p>
- *
- * @param camera
- * The CameraDevice sending the callback.
- * @param sequenceId
- * A sequence ID returned by the {@link #capture} family of functions.
- * @param frameNumber
- * The last frame number (returned by {@link CaptureResult#getFrameNumber}
- * or {@link CaptureFailure#getFrameNumber}) in the capture sequence.
- *
- * @see CaptureResult#getFrameNumber()
- * @see CaptureFailure#getFrameNumber()
- * @see CaptureResult#getSequenceId()
- * @see CaptureFailure#getSequenceId()
- * @see #onCaptureSequenceAborted
*/
public void onCaptureSequenceCompleted(CameraDevice camera,
int sequenceId, long frameNumber) {
@@ -912,25 +433,6 @@ public abstract class CameraDevice implements AutoCloseable {
* This method is called independently of the others in CaptureListener,
* when a capture sequence aborts before any {@link CaptureResult}
* or {@link CaptureFailure} for it have been returned via this listener.
- *
- * <p>Due to the asynchronous nature of the camera device, not all submitted captures
- * are immediately processed. It is possible to clear out the pending requests
- * by a variety of operations such as {@link CameraDevice#stopRepeating} or
- * {@link CameraDevice#flush}. When such an event happens,
- * {@link #onCaptureSequenceCompleted} will not be called.</p>
- *
- * <p>The default implementation does nothing.</p>
- *
- * @param camera
- * The CameraDevice sending the callback.
- * @param sequenceId
- * A sequence ID returned by the {@link #capture} family of functions.
- *
- * @see CaptureResult#getFrameNumber()
- * @see CaptureFailure#getFrameNumber()
- * @see CaptureResult#getSequenceId()
- * @see CaptureFailure#getSequenceId()
- * @see #onCaptureSequenceCompleted
*/
public void onCaptureSequenceAborted(CameraDevice camera,
int sequenceId) {
@@ -945,14 +447,14 @@ public abstract class CameraDevice implements AutoCloseable {
* <p>A listener must be provided to the {@link CameraManager#openCamera}
* method to open a camera device.</p>
*
- * <p>These events include notifications about the device becoming idle (
- * allowing for {@link #configureOutputs} to be called), about device
- * disconnection, and about unexpected device errors.</p>
+ * <p>These events include notifications about the device completing startup (
+ * allowing for {@link #createCaptureSession} to be called), about device
+ * disconnection or closure, and about unexpected device errors.</p>
*
- * <p>Events about the progress of specific {@link CaptureRequest
- * CaptureRequests} are provided through a {@link CaptureListener} given to
- * the {@link #capture}, {@link #captureBurst}, {@link
- * #setRepeatingRequest}, or {@link #setRepeatingBurst} methods.
+ * <p>Events about the progress of specific {@link CaptureRequest CaptureRequests} are provided
+ * through a {@link CameraCaptureSession.CaptureListener} given to the
+ * {@link CameraCaptureSession#capture}, {@link CameraCaptureSession#captureBurst},
+ * {@link CameraCaptureSession#setRepeatingRequest}, or {@link CameraCaptureSession#setRepeatingBurst} methods.
*
* @see CameraManager#openCamera
*/
@@ -1026,8 +528,9 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* The method called when a camera device has finished opening.
*
- * <p>An opened camera will immediately afterwards transition into
- * {@link #onUnconfigured}.</p>
+ * <p>At this point, the camera device is ready to use, and
+ * {@link CameraDevice#createCaptureSession} can be called to set up the first capture
+ * session.</p>
*
* @param camera the camera device that has become opened
*/
@@ -1036,21 +539,7 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* The method called when a camera device has no outputs configured.
*
- * <p>An unconfigured camera device needs to be configured with
- * {@link CameraDevice#configureOutputs} before being able to
- * submit any capture request.</p>
- *
- * <p>This state may be entered by a newly opened camera or by
- * calling {@link CameraDevice#configureOutputs} with a null/empty
- * list of Surfaces when idle.</p>
- *
- * <p>Any attempts to submit a capture request while in this state
- * will result in an {@link IllegalStateException} being thrown.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera the camera device has that become unconfigured
- * @deprecated Use {@link CameraCaptureSession.StateListener} instead.
+ * @deprecated Use {@link #onOpened} instead.
*/
@Deprecated
public void onUnconfigured(CameraDevice camera) {
@@ -1061,27 +550,7 @@ public abstract class CameraDevice implements AutoCloseable {
* The method called when a camera device begins processing
* {@link CaptureRequest capture requests}.
*
- * <p>A camera may not be re-configured while in this state. The camera
- * will transition to the idle state once all pending captures have
- * completed. If a repeating request is set, the camera will remain active
- * until it is cleared and the remaining requests finish processing. To
- * transition to the idle state as quickly as possible, call {@link #flush()},
- * which will idle the camera device as quickly as possible, likely canceling
- * most in-progress captures.</p>
- *
- * <p>All calls except for {@link CameraDevice#configureOutputs} are
- * legal while in this state.
- * </p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera the camera device that has become active
- *
- * @see CameraDevice#capture
- * @see CameraDevice#captureBurst
- * @see CameraDevice#setRepeatingBurst
- * @see CameraDevice#setRepeatingRequest
- * @deprecated Use {@link CameraCaptureSession.StateListener} instead.
+ * @deprecated Use {@link CameraCaptureSession.StateListener#onActive} instead.
*/
@Deprecated
public void onActive(CameraDevice camera) {
@@ -1091,32 +560,7 @@ public abstract class CameraDevice implements AutoCloseable {
/**
* The method called when a camera device is busy.
*
- * <p>A camera becomes busy while it's outputs are being configured
- * (after a call to {@link CameraDevice#configureOutputs} or while it's
- * being flushed (after a call to {@link CameraDevice#flush}.</p>
- *
- * <p>Once the on-going operations are complete, the camera will automatically
- * transition into {@link #onIdle} if there is at least one configured output,
- * or {@link #onUnconfigured} otherwise.</p>
- *
- * <p>Any attempts to manipulate the camera while its is busy
- * will result in an {@link IllegalStateException} being thrown.</p>
- *
- * <p>Only the following methods are valid to call while in this state:
- * <ul>
- * <li>{@link CameraDevice#getId}</li>
- * <li>{@link CameraDevice#createCaptureRequest}</li>
- * <li>{@link CameraDevice#close}</li>
- * </ul>
- * </p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera the camera device that has become busy
- *
- * @see CameraDevice#configureOutputs
- * @see CameraDevice#flush
- * @deprecated Use {@link CameraCaptureSession.StateListener} instead.
+ * @deprecated Use {@link CameraCaptureSession.StateListener#onConfigured} instead.
*/
@Deprecated
public void onBusy(CameraDevice camera) {
@@ -1142,30 +586,7 @@ public abstract class CameraDevice implements AutoCloseable {
* The method called when a camera device has finished processing all
* submitted capture requests and has reached an idle state.
*
- * <p>An idle camera device can have its outputs changed by calling {@link
- * CameraDevice#configureOutputs}, which will transition it into the busy state.</p>
- *
- * <p>To idle and reconfigure outputs without canceling any submitted
- * capture requests, the application needs to clear its repeating
- * request/burst, if set, with {@link CameraDevice#stopRepeating}, and
- * then wait for this callback to be called before calling {@link
- * CameraDevice#configureOutputs}.</p>
- *
- * <p>To idle and reconfigure a camera device as fast as possible, the
- * {@link CameraDevice#flush} method can be used, which will discard all
- * pending and in-progress capture requests. Once the {@link
- * CameraDevice#flush} method is called, the application must wait for
- * this callback to fire before calling {@link
- * CameraDevice#configureOutputs}.</p>
- *
- * <p>The default implementation of this method does nothing.</p>
- *
- * @param camera the camera device that has become idle
- *
- * @see CameraDevice#configureOutputs
- * @see CameraDevice#stopRepeating
- * @see CameraDevice#flush
- * @deprecated Use {@link CameraCaptureSession.StateListener} instead.
+ * @deprecated Use {@link CameraCaptureSession.StateListener#onReady} instead.
*/
@Deprecated
public void onIdle(CameraDevice camera) {
@@ -1221,7 +642,7 @@ public abstract class CameraDevice implements AutoCloseable {
*
* @param camera The device reporting the error
* @param error The error code, one of the
- * {@code CameraDeviceListener.ERROR_*} values.
+ * {@code StateListener.ERROR_*} values.
*
* @see #ERROR_CAMERA_DEVICE
* @see #ERROR_CAMERA_SERVICE
diff --git a/core/java/android/hardware/camera2/CameraManager.java b/core/java/android/hardware/camera2/CameraManager.java
index 7c0f37e..0901562 100644
--- a/core/java/android/hardware/camera2/CameraManager.java
+++ b/core/java/android/hardware/camera2/CameraManager.java
@@ -35,7 +35,7 @@ import android.util.ArrayMap;
import java.util.ArrayList;
/**
- * <p>An interface for iterating, listing, and connecting to
+ * <p>A system service manager for detecting, characterizing, and connecting to
* {@link CameraDevice CameraDevices}.</p>
*
* <p>You can get an instance of this class by calling
@@ -357,14 +357,18 @@ public final class CameraManager {
}
/**
- * Interface for listening to camera devices becoming available or
- * unavailable.
+ * A listener for camera devices becoming available or
+ * unavailable to open.
*
* <p>Cameras become available when they are no longer in use, or when a new
* removable camera is connected. They become unavailable when some
* application or service starts using a camera, or when a removable camera
* is disconnected.</p>
*
+ * <p>Extend this listener and pass an instance of the subclass to
+ * {@link CameraManager#addAvailabilityListener} to be notified of such availability
+ * changes.</p>
+ *
* @see addAvailabilityListener
*/
public static abstract class AvailabilityListener {
diff --git a/core/java/android/hardware/camera2/CameraMetadata.java b/core/java/android/hardware/camera2/CameraMetadata.java
index 94a5a79..33e1915 100644
--- a/core/java/android/hardware/camera2/CameraMetadata.java
+++ b/core/java/android/hardware/camera2/CameraMetadata.java
@@ -157,8 +157,8 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>The lens focus distance is not accurate, and the units used for
- * {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} do not correspond to any physical units.
- * Setting the lens to the same focus distance on separate occasions may
+ * {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} do not correspond to any physical units.</p>
+ * <p>Setting the lens to the same focus distance on separate occasions may
* result in a different real focus distance, depending on factors such
* as the orientation of the device, the age of the focusing mechanism,
* and the device temperature. The focus distance value will still be
@@ -172,20 +172,24 @@ public abstract class CameraMetadata<TKey> {
public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = 0;
/**
- * <p>The lens focus distance is measured in diopters. However, setting the lens
- * to the same focus distance on separate occasions may result in a
- * different real focus distance, depending on factors such as the
- * orientation of the device, the age of the focusing mechanism, and
- * the device temperature.</p>
+ * <p>The lens focus distance is measured in diopters.</p>
+ * <p>However, setting the lens to the same focus distance
+ * on separate occasions may result in a different real
+ * focus distance, depending on factors such as the
+ * orientation of the device, the age of the focusing
+ * mechanism, and the device temperature.</p>
* @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
*/
public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = 1;
/**
- * <p>The lens focus distance is measured in diopters. The lens mechanism is
- * calibrated so that setting the same focus distance is repeatable on
- * multiple occasions with good accuracy, and the focus distance corresponds
- * to the real physical distance to the plane of best focus.</p>
+ * <p>The lens focus distance is measured in diopters, and
+ * is calibrated.</p>
+ * <p>The lens mechanism is calibrated so that setting the
+ * same focus distance is repeatable on multiple
+ * occasions with good accuracy, and the focus distance
+ * corresponds to the real physical distance to the plane
+ * of best focus.</p>
* @see CameraCharacteristics#LENS_INFO_FOCUS_DISTANCE_CALIBRATION
*/
public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = 2;
@@ -195,11 +199,13 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>The camera device faces the same direction as the device's screen.</p>
* @see CameraCharacteristics#LENS_FACING
*/
public static final int LENS_FACING_FRONT = 0;
/**
+ * <p>The camera device faces the opposite direction as the device's screen.</p>
* @see CameraCharacteristics#LENS_FACING
*/
public static final int LENS_FACING_BACK = 1;
@@ -215,11 +221,10 @@ public abstract class CameraMetadata<TKey> {
* <p>The full set of features supported by this capability makes
* the camera2 api backwards compatible with the camera1
* (android.hardware.Camera) API.</p>
- * <p>TODO: @hide this. Doesn't really mean anything except
- * act as a catch-all for all the 'base' functionality.</p>
*
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
+ * @hide
*/
public static final int REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0;
@@ -228,15 +233,14 @@ public abstract class CameraMetadata<TKey> {
* tags or functionality not encapsulated by one of the other
* capabilities.</p>
* <p>A typical example is all tags marked 'optional'.</p>
- * <p>TODO: @hide. We may not need this if we @hide all the optional
- * tags not belonging to a capability.</p>
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
+ * @hide
*/
public static final int REQUEST_AVAILABLE_CAPABILITIES_OPTIONAL = 1;
/**
* <p>The camera device can be manually controlled (3A algorithms such
- * as auto exposure, and auto focus can be bypassed).
+ * as auto-exposure, and auto-focus can be bypassed).
* The camera device supports basic manual control of the sensor image
* acquisition related stages. This means the following controls are
* guaranteed to be supported:</p>
@@ -257,11 +261,11 @@ public abstract class CameraMetadata<TKey> {
* <li>{@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}</li>
* </ul>
* </li>
- * <li>Manual lens control<ul>
+ * <li>Manual lens control (if the lens is adjustable)<ul>
* <li>android.lens.*</li>
* </ul>
* </li>
- * <li>Manual flash control<ul>
+ * <li>Manual flash control (if a flash unit is present)<ul>
* <li>android.flash.*</li>
* </ul>
* </li>
@@ -312,8 +316,6 @@ public abstract class CameraMetadata<TKey> {
* </ul>
* <p>If auto white balance is enabled, then the camera device
* will accurately report the values applied by AWB in the result.</p>
- * <p>The camera device will also support everything in MANUAL_SENSOR
- * except manual lens control and manual flash control.</p>
* <p>A given camera device may also support additional post-processing
* controls, but this capability only covers the above list of controls.</p>
*
@@ -340,8 +342,8 @@ public abstract class CameraMetadata<TKey> {
* (both input/output) will match the maximum available
* resolution of JPEG streams.</li>
* </ul>
- * <p>@hide this, TODO: remove it when input related APIs are ready.</p>
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
+ * @hide
*/
public static final int REQUEST_AVAILABLE_CAPABILITIES_ZSL = 4;
@@ -355,12 +357,14 @@ public abstract class CameraMetadata<TKey> {
* <li>RAW16 is reprocessable into both YUV_420_888 and JPEG
* formats.</li>
* <li>The maximum available resolution for RAW16 streams (both
- * input/output) will match the value in
- * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize}.</li>
+ * input/output) will match either the value in
+ * {@link CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE android.sensor.info.pixelArraySize} or
+ * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}.</li>
* <li>All DNG-related optional metadata entries are provided
* by the camera device.</li>
* </ul>
*
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
* @see CameraCharacteristics#SENSOR_INFO_PIXEL_ARRAY_SIZE
* @see CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES
*/
@@ -371,13 +375,13 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>The camera device will only support centered crop regions.</p>
+ * <p>The camera device only supports centered crop regions.</p>
* @see CameraCharacteristics#SCALER_CROPPING_TYPE
*/
public static final int SCALER_CROPPING_TYPE_CENTER_ONLY = 0;
/**
- * <p>The camera device will support arbitrarily chosen crop regions.</p>
+ * <p>The camera device supports arbitrarily chosen crop regions.</p>
* @see CameraCharacteristics#SCALER_CROPPING_TYPE
*/
public static final int SCALER_CROPPING_TYPE_FREEFORM = 1;
@@ -523,7 +527,7 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>android.led.transmit control is used</p>
+ * <p>android.led.transmit control is used.</p>
* @see CameraCharacteristics#LED_AVAILABLE_LEDS
* @hide
*/
@@ -534,11 +538,14 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>This camera device has only limited capabilities.</p>
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
*/
public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0;
/**
+ * <p>This camera device is capable of supporting advanced imaging
+ * applications.</p>
* @see CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL
*/
public static final int INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1;
@@ -548,9 +555,9 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>Every frame has the requests immediately applied.
- * (and furthermore for all results,
- * <code>android.sync.frameNumber == android.request.frameCount</code>)</p>
+ * <p>Every frame has the requests immediately applied.</p>
+ * <p>Furthermore for all results,
+ * <code>android.sync.frameNumber == android.request.frameCount</code></p>
* <p>Changing controls over multiple requests one after another will
* produce results that have those controls applied atomically
* each frame.</p>
@@ -590,8 +597,8 @@ public abstract class CameraMetadata<TKey> {
public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0;
/**
- * <p>Must not slow down capture rate relative to sensor raw
- * output.</p>
+ * <p>Color correction processing must not slow down
+ * capture rate relative to sensor raw output.</p>
* <p>Advanced white balance adjustments above and beyond
* the specified white balance pipeline may be applied.</p>
* <p>If AWB is enabled with <code>{@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} != OFF</code>, then
@@ -604,8 +611,9 @@ public abstract class CameraMetadata<TKey> {
public static final int COLOR_CORRECTION_MODE_FAST = 1;
/**
- * <p>Capture rate (relative to sensor raw output)
- * may be reduced by high quality.</p>
+ * <p>Color correction processing operates at improved
+ * quality but reduced capture rate (relative to sensor raw
+ * output).</p>
* <p>Advanced white balance adjustments above and beyond
* the specified white balance pipeline may be applied.</p>
* <p>If AWB is enabled with <code>{@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} != OFF</code>, then
@@ -656,8 +664,8 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>The camera device's autoexposure routine is disabled;
- * the application-selected {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
+ * <p>The camera device's autoexposure routine is disabled.</p>
+ * <p>The application-selected {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
* {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} and
* {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration} are used by the camera
* device, along with android.flash.* fields, if there's
@@ -672,7 +680,8 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>The camera device's autoexposure routine is active,
- * with no flash control. The application's values for
+ * with no flash control.</p>
+ * <p>The application's values for
* {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime},
* {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, and
* {@link CaptureRequest#SENSOR_FRAME_DURATION android.sensor.frameDuration} are ignored. The
@@ -689,10 +698,10 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>Like ON, except that the camera device also controls
* the camera's flash unit, firing it in low-light
- * conditions. The flash may be fired during a
- * precapture sequence (triggered by
- * {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) and may be fired
- * for captures for which the
+ * conditions.</p>
+ * <p>The flash may be fired during a precapture sequence
+ * (triggered by {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) and
+ * may be fired for captures for which the
* {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} field is set to
* STILL_CAPTURE</p>
*
@@ -705,10 +714,10 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>Like ON, except that the camera device also controls
* the camera's flash unit, always firing it for still
- * captures. The flash may be fired during a precapture
- * sequence (triggered by
- * {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) and will always
- * be fired for captures for which the
+ * captures.</p>
+ * <p>The flash may be fired during a precapture sequence
+ * (triggered by {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}) and
+ * will always be fired for captures for which the
* {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} field is set to
* STILL_CAPTURE</p>
*
@@ -720,9 +729,10 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>Like ON_AUTO_FLASH, but with automatic red eye
- * reduction. If deemed necessary by the camera device,
- * a red eye reduction flash will fire during the
- * precapture sequence.</p>
+ * reduction.</p>
+ * <p>If deemed necessary by the camera device, a red eye
+ * reduction flash will fire during the precapture
+ * sequence.</p>
* @see CaptureRequest#CONTROL_AE_MODE
*/
public static final int CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4;
@@ -739,8 +749,9 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>The precapture metering sequence will be started
- * by the camera device. The exact effect of the precapture
- * trigger depends on the current AE mode and state.</p>
+ * by the camera device.</p>
+ * <p>The exact effect of the precapture trigger depends on
+ * the current AE mode and state.</p>
* @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
*/
public static final int CONTROL_AE_PRECAPTURE_TRIGGER_START = 1;
@@ -752,7 +763,7 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>The auto-focus routine does not control the lens;
* {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance} is controlled by the
- * application</p>
+ * application.</p>
*
* @see CaptureRequest#LENS_FOCUS_DISTANCE
* @see CaptureRequest#CONTROL_AF_MODE
@@ -760,12 +771,14 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_AF_MODE_OFF = 0;
/**
- * <p>If lens is not fixed focus.</p>
- * <p>Use {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} to determine if lens
- * is fixed-focus. In this mode, the lens does not move unless
+ * <p>Basic automatic focus mode.</p>
+ * <p>In this mode, the lens does not move unless
* the autofocus trigger action is called. When that trigger
- * is activated, AF must transition to ACTIVE_SCAN, then to
+ * is activated, AF will transition to ACTIVE_SCAN, then to
* the outcome of the scan (FOCUSED or NOT_FOCUSED).</p>
+ * <p>Always supported if lens is not fixed focus.</p>
+ * <p>Use {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} to determine if lens
+ * is fixed-focus.</p>
* <p>Triggering AF_CANCEL resets the lens position to default,
* and sets the AF state to INACTIVE.</p>
*
@@ -775,11 +788,16 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_AF_MODE_AUTO = 1;
/**
+ * <p>Close-up focusing mode.</p>
* <p>In this mode, the lens does not move unless the
- * autofocus trigger action is called.</p>
- * <p>When that trigger is activated, AF must transition to
+ * autofocus trigger action is called. When that trigger is
+ * activated, AF will transition to ACTIVE_SCAN, then to
+ * the outcome of the scan (FOCUSED or NOT_FOCUSED). This
+ * mode is optimized for focusing on objects very close to
+ * the camera.</p>
+ * <p>When that trigger is activated, AF will transition to
* ACTIVE_SCAN, then to the outcome of the scan (FOCUSED or
- * NOT_FOCUSED). Triggering cancel AF resets the lens
+ * NOT_FOCUSED). Triggering cancel AF resets the lens
* position to default, and sets the AF state to
* INACTIVE.</p>
* @see CaptureRequest#CONTROL_AF_MODE
@@ -830,8 +848,11 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4;
/**
- * <p>Extended depth of field (digital focus). AF
- * trigger is ignored, AF state should always be
+ * <p>Extended depth of field (digital focus) mode.</p>
+ * <p>The camera device will produce images with an extended
+ * depth of field automatically; no special focusing
+ * operations need to be done before taking a picture.</p>
+ * <p>AF triggers are ignored, and the AF state will always be
* INACTIVE.</p>
* @see CaptureRequest#CONTROL_AF_MODE
*/
@@ -865,8 +886,8 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>The camera device's auto white balance routine is disabled;
- * the application-selected color transform matrix
+ * <p>The camera device's auto-white balance routine is disabled.</p>
+ * <p>The application-selected color transform matrix
* ({@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}) and gains
* ({@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}) are used by the camera
* device for manual white balance control.</p>
@@ -878,9 +899,12 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_AWB_MODE_OFF = 0;
/**
- * <p>The camera device's auto white balance routine is active;
- * the application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
- * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.</p>
+ * <p>The camera device's auto-white balance routine is active.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
*
* @see CaptureRequest#COLOR_CORRECTION_GAINS
* @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
@@ -889,65 +913,125 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_AWB_MODE_AUTO = 1;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses incandescent light as the assumed scene
- * illumination for white balance. While the exact white balance
- * transforms are up to the camera device, they will approximately
- * match the CIE standard illuminant A.</p>
+ * illumination for white balance.</p>
+ * <p>While the exact white balance transforms are up to the
+ * camera device, they will approximately match the CIE
+ * standard illuminant A.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_INCANDESCENT = 2;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses fluorescent light as the assumed scene
- * illumination for white balance. While the exact white balance
- * transforms are up to the camera device, they will approximately
- * match the CIE standard illuminant F2.</p>
+ * illumination for white balance.</p>
+ * <p>While the exact white balance transforms are up to the
+ * camera device, they will approximately match the CIE
+ * standard illuminant F2.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_FLUORESCENT = 3;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses warm fluorescent light as the assumed scene
- * illumination for white balance. While the exact white balance
- * transforms are up to the camera device, they will approximately
- * match the CIE standard illuminant F4.</p>
+ * illumination for white balance.</p>
+ * <p>While the exact white balance transforms are up to the
+ * camera device, they will approximately match the CIE
+ * standard illuminant F4.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_WARM_FLUORESCENT = 4;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses daylight light as the assumed scene
- * illumination for white balance. While the exact white balance
- * transforms are up to the camera device, they will approximately
- * match the CIE standard illuminant D65.</p>
+ * illumination for white balance.</p>
+ * <p>While the exact white balance transforms are up to the
+ * camera device, they will approximately match the CIE
+ * standard illuminant D65.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_DAYLIGHT = 5;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses cloudy daylight light as the assumed scene
* illumination for white balance.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses twilight light as the assumed scene
* illumination for white balance.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_TWILIGHT = 7;
/**
- * <p>The camera device's auto white balance routine is disabled;
+ * <p>The camera device's auto-white balance routine is disabled;
* the camera device uses shade light as the assumed scene
* illumination for white balance.</p>
+ * <p>The application's values for {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}
+ * and {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} are ignored.
+ * For devices that support the MANUAL_POST_PROCESSING capability, the
+ * values used by the camera device for the transform and gains
+ * will be available in the capture result for this request.</p>
+ *
+ * @see CaptureRequest#COLOR_CORRECTION_GAINS
+ * @see CaptureRequest#COLOR_CORRECTION_TRANSFORM
* @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final int CONTROL_AWB_MODE_SHADE = 8;
@@ -957,38 +1041,43 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>This request doesn't fall into the other
- * categories. Default to preview-like
+ * <p>The goal of this request doesn't fall into the other
+ * categories. The camera device will default to preview-like
* behavior.</p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_CUSTOM = 0;
/**
- * <p>This request is for a preview-like usecase. The
- * precapture trigger may be used to start off a metering
- * w/flash sequence</p>
+ * <p>This request is for a preview-like use case.</p>
+ * <p>The precapture trigger may be used to start off a metering
+ * w/flash sequence.</p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_PREVIEW = 1;
/**
* <p>This request is for a still capture-type
- * usecase.</p>
+ * use case.</p>
+ * <p>If the flash unit is under automatic control, it may fire as needed.</p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2;
/**
* <p>This request is for a video recording
- * usecase.</p>
+ * use case.</p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3;
/**
* <p>This request is for a video snapshot (still
- * image while recording video) usecase</p>
+ * image while recording video) use case.</p>
+ * <p>The camera device should take the highest-quality image
+ * possible (given the other settings) without disrupting the
+ * frame rate of video recording.<br />
+ * </p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4;
@@ -997,15 +1086,16 @@ public abstract class CameraMetadata<TKey> {
* <p>This request is for a ZSL usecase; the
* application will stream full-resolution images and
* reprocess one or several later for a final
- * capture</p>
+ * capture.</p>
* @see CaptureRequest#CONTROL_CAPTURE_INTENT
*/
public static final int CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5;
/**
* <p>This request is for manual capture use case where
- * the applications want to directly control the capture parameters
- * (e.g. {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity} etc.).</p>
+ * the applications want to directly control the capture parameters.</p>
+ * <p>For example, the application may wish to manually control
+ * {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}, {@link CaptureRequest#SENSOR_SENSITIVITY android.sensor.sensitivity}, etc.</p>
*
* @see CaptureRequest#SENSOR_EXPOSURE_TIME
* @see CaptureRequest#SENSOR_SENSITIVITY
@@ -1025,7 +1115,8 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>A "monocolor" effect where the image is mapped into
- * a single color. This will typically be grayscale.</p>
+ * a single color.</p>
+ * <p>This will typically be grayscale.</p>
* @see CaptureRequest#CONTROL_EFFECT_MODE
*/
public static final int CONTROL_EFFECT_MODE_MONO = 1;
@@ -1085,31 +1176,42 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>Full application control of pipeline. All 3A
- * routines are disabled, no other settings in
- * android.control.* have any effect</p>
+ * <p>Full application control of pipeline.</p>
+ * <p>All control by the device's metering and focusing (3A)
+ * routines is disabled, and no other settings in
+ * android.control.* have any effect, except that
+ * {@link CaptureRequest#CONTROL_CAPTURE_INTENT android.control.captureIntent} may be used by the camera
+ * device to select post-processing values for processing
+ * blocks that do not allow for manual control, or are not
+ * exposed by the camera API.</p>
+ * <p>However, the camera device's 3A routines may continue to
+ * collect statistics and update their internal state so that
+ * when control is switched to AUTO mode, good control values
+ * can be immediately applied.</p>
+ *
+ * @see CaptureRequest#CONTROL_CAPTURE_INTENT
* @see CaptureRequest#CONTROL_MODE
*/
public static final int CONTROL_MODE_OFF = 0;
/**
- * <p>Use settings for each individual 3A routine.
- * Manual control of capture parameters is disabled. All
+ * <p>Use settings for each individual 3A routine.</p>
+ * <p>Manual control of capture parameters is disabled. All
* controls in android.control.* besides sceneMode take
- * effect</p>
+ * effect.</p>
* @see CaptureRequest#CONTROL_MODE
*/
public static final int CONTROL_MODE_AUTO = 1;
/**
- * <p>Use specific scene mode. Enabling this disables
- * control.aeMode, control.awbMode and control.afMode
- * controls; the camera device will ignore those settings while
- * USE_SCENE_MODE is active (except for FACE_PRIORITY
- * scene mode). Other control entries are still active.
- * This setting can only be used if scene mode is supported
- * (i.e. {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes} contain some modes
- * other than DISABLED).</p>
+ * <p>Use a specific scene mode.</p>
+ * <p>Enabling this disables control.aeMode, control.awbMode and
+ * control.afMode controls; the camera device will ignore
+ * those settings while USE_SCENE_MODE is active (except for
+ * FACE_PRIORITY scene mode). Other control entries are still
+ * active. This setting can only be used if scene mode is
+ * supported (i.e. {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}
+ * contain some modes other than DISABLED).</p>
*
* @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
* @see CaptureRequest#CONTROL_MODE
@@ -1119,7 +1221,12 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>Same as OFF mode, except that this capture will not be
* used by camera device background auto-exposure, auto-white balance and
- * auto-focus algorithms to update their statistics.</p>
+ * auto-focus algorithms (3A) to update their statistics.</p>
+ * <p>Specifically, the 3A routines are locked to the last
+ * values set from a request with AUTO, OFF, or
+ * USE_SCENE_MODE, and any statistics or state updates
+ * collected from manual captures with OFF_KEEP_STATE will be
+ * discarded by the camera device.</p>
* @see CaptureRequest#CONTROL_MODE
*/
public static final int CONTROL_MODE_OFF_KEEP_STATE = 3;
@@ -1137,8 +1244,9 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>If face detection support exists, use face
* detection data for auto-focus, auto-white balance, and
- * auto-exposure routines. If face detection statistics are
- * disabled (i.e. {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} is set to OFF),
+ * auto-exposure routines.</p>
+ * <p>If face detection statistics are disabled
+ * (i.e. {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} is set to OFF),
* this should still operate correctly (but will not return
* face detection statistics to the framework).</p>
* <p>Unlike the other scene modes, {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode},
@@ -1154,8 +1262,8 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_SCENE_MODE_FACE_PRIORITY = 1;
/**
- * <p>Optimized for photos of quickly moving objects.
- * Similar to SPORTS.</p>
+ * <p>Optimized for photos of quickly moving objects.</p>
+ * <p>Similar to SPORTS.</p>
* @see CaptureRequest#CONTROL_SCENE_MODE
*/
public static final int CONTROL_SCENE_MODE_ACTION = 2;
@@ -1224,8 +1332,8 @@ public abstract class CameraMetadata<TKey> {
public static final int CONTROL_SCENE_MODE_FIREWORKS = 12;
/**
- * <p>Optimized for photos of quickly moving people.
- * Similar to ACTION.</p>
+ * <p>Optimized for photos of quickly moving people.</p>
+ * <p>Similar to ACTION.</p>
* @see CaptureRequest#CONTROL_SCENE_MODE
*/
public static final int CONTROL_SCENE_MODE_SPORTS = 13;
@@ -1257,11 +1365,13 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>Video stabilization is disabled.</p>
* @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
*/
public static final int CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0;
/**
+ * <p>Video stabilization is enabled.</p>
* @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
*/
public static final int CONTROL_VIDEO_STABILIZATION_MODE_ON = 1;
@@ -1271,21 +1381,20 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>No edge enhancement is applied</p>
+ * <p>No edge enhancement is applied.</p>
* @see CaptureRequest#EDGE_MODE
*/
public static final int EDGE_MODE_OFF = 0;
/**
- * <p>Must not slow down frame rate relative to sensor
+ * <p>Apply edge enhancement at a quality level that does not slow down frame rate relative to sensor
* output</p>
* @see CaptureRequest#EDGE_MODE
*/
public static final int EDGE_MODE_FAST = 1;
/**
- * <p>Frame rate may be reduced by high
- * quality</p>
+ * <p>Apply high-quality edge enhancement, at a cost of reducing output frame rate.</p>
* @see CaptureRequest#EDGE_MODE
*/
public static final int EDGE_MODE_HIGH_QUALITY = 2;
@@ -1318,10 +1427,10 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>No hot pixel correction is applied.</p>
* <p>The frame rate must not be reduced relative to sensor raw output
* for this option.</p>
- * <p>No hot pixel correction is applied.
- * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ * <p>The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
*
* @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
@@ -1329,10 +1438,9 @@ public abstract class CameraMetadata<TKey> {
public static final int HOT_PIXEL_MODE_OFF = 0;
/**
- * <p>The frame rate must not be reduced relative to sensor raw output
- * for this option.</p>
- * <p>Hot pixel correction is applied.
- * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ * <p>Hot pixel correction is applied, without reducing frame
+ * rate relative to sensor raw output.</p>
+ * <p>The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
*
* @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
@@ -1340,10 +1448,9 @@ public abstract class CameraMetadata<TKey> {
public static final int HOT_PIXEL_MODE_FAST = 1;
/**
- * <p>The frame rate may be reduced relative to sensor raw output
- * for this option.</p>
- * <p>A high-quality hot pixel correction is applied.
- * The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
+ * <p>High-quality hot pixel correction is applied, at a cost
+ * of reducing frame rate relative to sensor raw output.</p>
+ * <p>The hotpixel map may be returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.</p>
*
* @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
* @see CaptureRequest#HOT_PIXEL_MODE
@@ -1371,21 +1478,21 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>No noise reduction is applied</p>
+ * <p>No noise reduction is applied.</p>
* @see CaptureRequest#NOISE_REDUCTION_MODE
*/
public static final int NOISE_REDUCTION_MODE_OFF = 0;
/**
- * <p>Must not slow down frame rate relative to sensor
- * output</p>
+ * <p>Noise reduction is applied without reducing frame rate relative to sensor
+ * output.</p>
* @see CaptureRequest#NOISE_REDUCTION_MODE
*/
public static final int NOISE_REDUCTION_MODE_FAST = 1;
/**
- * <p>May slow down frame rate to provide highest
- * quality</p>
+ * <p>High-quality noise reduction is applied, at the cost of reducing frame rate
+ * relative to sensor output.</p>
* @see CaptureRequest#NOISE_REDUCTION_MODE
*/
public static final int NOISE_REDUCTION_MODE_HIGH_QUALITY = 2;
@@ -1395,8 +1502,9 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>Default. No test pattern mode is used, and the camera
+ * <p>No test pattern mode is used, and the camera
* device returns captures from the image sensor.</p>
+ * <p>This is the default if the key is not set.</p>
* @see CaptureRequest#SENSOR_TEST_PATTERN_MODE
*/
public static final int SENSOR_TEST_PATTERN_MODE_OFF = 0;
@@ -1500,19 +1608,21 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>No lens shading correction is applied</p>
+ * <p>No lens shading correction is applied.</p>
* @see CaptureRequest#SHADING_MODE
*/
public static final int SHADING_MODE_OFF = 0;
/**
- * <p>Must not slow down frame rate relative to sensor raw output</p>
+ * <p>Apply lens shading corrections, without slowing
+ * frame rate relative to sensor raw output</p>
* @see CaptureRequest#SHADING_MODE
*/
public static final int SHADING_MODE_FAST = 1;
/**
- * <p>Frame rate may be reduced by high quality</p>
+ * <p>Apply high-quality lens shading correction, at the
+ * cost of reduced frame rate.</p>
* @see CaptureRequest#SHADING_MODE
*/
public static final int SHADING_MODE_HIGH_QUALITY = 2;
@@ -1522,20 +1632,28 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>Do not include face detection statistics in capture
+ * results.</p>
* @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
*/
public static final int STATISTICS_FACE_DETECT_MODE_OFF = 0;
/**
- * <p>Optional Return rectangle and confidence
- * only</p>
+ * <p>Return face rectangle and confidence values only.</p>
+ * <p>In this mode, only android.statistics.faceRectangles and
+ * android.statistics.faceScores outputs are valid.</p>
* @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
*/
public static final int STATISTICS_FACE_DETECT_MODE_SIMPLE = 1;
/**
- * <p>Optional Return all face
- * metadata</p>
+ * <p>Return all face
+ * metadata.</p>
+ * <p>In this mode,
+ * android.statistics.faceRectangles,
+ * android.statistics.faceScores,
+ * android.statistics.faceIds, and
+ * android.statistics.faceLandmarks outputs are valid.</p>
* @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
*/
public static final int STATISTICS_FACE_DETECT_MODE_FULL = 2;
@@ -1545,11 +1663,13 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>Do not include a lens shading map in the capture result.</p>
* @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
*/
public static final int STATISTICS_LENS_SHADING_MAP_MODE_OFF = 0;
/**
+ * <p>Include a lens shading map in the capture result.</p>
* @see CaptureRequest#STATISTICS_LENS_SHADING_MAP_MODE
*/
public static final int STATISTICS_LENS_SHADING_MAP_MODE_ON = 1;
@@ -1573,15 +1693,15 @@ public abstract class CameraMetadata<TKey> {
public static final int TONEMAP_MODE_CONTRAST_CURVE = 0;
/**
- * <p>Advanced gamma mapping and color enhancement may be applied.</p>
- * <p>Should not slow down frame rate relative to raw sensor output.</p>
+ * <p>Advanced gamma mapping and color enhancement may be applied, without
+ * reducing frame rate compared to raw sensor output.</p>
* @see CaptureRequest#TONEMAP_MODE
*/
public static final int TONEMAP_MODE_FAST = 1;
/**
- * <p>Advanced gamma mapping and color enhancement may be applied.</p>
- * <p>May slow down frame rate relative to raw sensor output.</p>
+ * <p>High-quality gamma mapping and color enhancement will be applied, at
+ * the cost of reduced frame rate compared to raw sensor output.</p>
* @see CaptureRequest#TONEMAP_MODE
*/
public static final int TONEMAP_MODE_HIGH_QUALITY = 2;
@@ -1591,7 +1711,8 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>AE is off or recently reset. When a camera device is opened, it starts in
+ * <p>AE is off or recently reset.</p>
+ * <p>When a camera device is opened, it starts in
* this state. This is a transient state, the camera device may skip reporting
* this state in capture result.</p>
* @see CaptureResult#CONTROL_AE_STATE
@@ -1600,7 +1721,8 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>AE doesn't yet have a good set of control values
- * for the current scene. This is a transient state, the camera device may skip
+ * for the current scene.</p>
+ * <p>This is a transient state, the camera device may skip
* reporting this state in capture result.</p>
* @see CaptureResult#CONTROL_AE_STATE
*/
@@ -1629,11 +1751,13 @@ public abstract class CameraMetadata<TKey> {
/**
* <p>AE has been asked to do a precapture sequence
- * (through the {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} START),
- * and is currently executing it. Once PRECAPTURE
- * completes, AE will transition to CONVERGED or
- * FLASH_REQUIRED as appropriate. This is a transient state, the
- * camera device may skip reporting this state in capture result.</p>
+ * and is currently executing it.</p>
+ * <p>Precapture can be triggered through setting
+ * {@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger} to START.</p>
+ * <p>Once PRECAPTURE completes, AE will transition to CONVERGED
+ * or FLASH_REQUIRED as appropriate. This is a transient
+ * state, the camera device may skip reporting this state in
+ * capture result.</p>
*
* @see CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER
* @see CaptureResult#CONTROL_AE_STATE
@@ -1645,61 +1769,78 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>AF off or has not yet tried to scan/been asked
- * to scan. When a camera device is opened, it starts in
- * this state. This is a transient state, the camera device may
- * skip reporting this state in capture result.</p>
+ * <p>AF is off or has not yet tried to scan/been asked
+ * to scan.</p>
+ * <p>When a camera device is opened, it starts in this
+ * state. This is a transient state, the camera device may
+ * skip reporting this state in capture
+ * result.</p>
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_INACTIVE = 0;
/**
- * <p>if CONTINUOUS_* modes are supported. AF is
- * currently doing an AF scan initiated by a continuous
- * autofocus mode. This is a transient state, the camera device may
- * skip reporting this state in capture result.</p>
+ * <p>AF is currently performing an AF scan initiated the
+ * camera device in a continuous autofocus mode.</p>
+ * <p>Only used by CONTINUOUS_* AF modes. This is a transient
+ * state, the camera device may skip reporting this state in
+ * capture result.</p>
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_PASSIVE_SCAN = 1;
/**
- * <p>if CONTINUOUS_* modes are supported. AF currently
- * believes it is in focus, but may restart scanning at
- * any time. This is a transient state, the camera device may skip
- * reporting this state in capture result.</p>
+ * <p>AF currently believes it is in focus, but may
+ * restart scanning at any time.</p>
+ * <p>Only used by CONTINUOUS_* AF modes. This is a transient
+ * state, the camera device may skip reporting this state in
+ * capture result.</p>
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_PASSIVE_FOCUSED = 2;
/**
- * <p>if AUTO or MACRO modes are supported. AF is doing
- * an AF scan because it was triggered by AF trigger. This is a
- * transient state, the camera device may skip reporting
- * this state in capture result.</p>
+ * <p>AF is performing an AF scan because it was
+ * triggered by AF trigger.</p>
+ * <p>Only used by AUTO or MACRO AF modes. This is a transient
+ * state, the camera device may skip reporting this state in
+ * capture result.</p>
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_ACTIVE_SCAN = 3;
/**
- * <p>if any AF mode besides OFF is supported. AF
- * believes it is focused correctly and is
- * locked.</p>
+ * <p>AF believes it is focused correctly and has locked
+ * focus.</p>
+ * <p>This state is reached only after an explicit START AF trigger has been
+ * sent ({@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}), when good focus has been obtained.</p>
+ * <p>The lens will remain stationary until the AF mode ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) is changed or
+ * a new AF trigger is sent to the camera device ({@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}).</p>
+ *
+ * @see CaptureRequest#CONTROL_AF_MODE
+ * @see CaptureRequest#CONTROL_AF_TRIGGER
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_FOCUSED_LOCKED = 4;
/**
- * <p>if any AF mode besides OFF is supported. AF has
- * failed to focus successfully and is
- * locked.</p>
+ * <p>AF has failed to focus successfully and has locked
+ * focus.</p>
+ * <p>This state is reached only after an explicit START AF trigger has been
+ * sent ({@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}), when good focus cannot be obtained.</p>
+ * <p>The lens will remain stationary until the AF mode ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) is changed or
+ * a new AF trigger is sent to the camera device ({@link CaptureRequest#CONTROL_AF_TRIGGER android.control.afTrigger}).</p>
+ *
+ * @see CaptureRequest#CONTROL_AF_MODE
+ * @see CaptureRequest#CONTROL_AF_TRIGGER
* @see CaptureResult#CONTROL_AF_STATE
*/
public static final int CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5;
/**
- * <p>if CONTINUOUS_* modes are supported. AF finished a
- * passive scan without finding focus, and may restart
- * scanning at any time. This is a transient state, the camera
+ * <p>AF finished a passive scan without finding focus,
+ * and may restart scanning at any time.</p>
+ * <p>Only used by CONTINUOUS_* AF modes. This is a transient state, the camera
* device may skip reporting this state in capture result.</p>
* @see CaptureResult#CONTROL_AF_STATE
*/
@@ -1710,16 +1851,19 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>AWB is not in auto mode. When a camera device is opened, it
- * starts in this state. This is a transient state, the camera device may
- * skip reporting this state in capture result.</p>
+ * <p>AWB is not in auto mode, or has not yet started metering.</p>
+ * <p>When a camera device is opened, it starts in this
+ * state. This is a transient state, the camera device may
+ * skip reporting this state in capture
+ * result.</p>
* @see CaptureResult#CONTROL_AWB_STATE
*/
public static final int CONTROL_AWB_STATE_INACTIVE = 0;
/**
* <p>AWB doesn't yet have a good set of control
- * values for the current scene. This is a transient state, the camera device
+ * values for the current scene.</p>
+ * <p>This is a transient state, the camera device
* may skip reporting this state in capture result.</p>
* @see CaptureResult#CONTROL_AWB_STATE
*/
@@ -1767,8 +1911,9 @@ public abstract class CameraMetadata<TKey> {
public static final int FLASH_STATE_FIRED = 3;
/**
- * <p>Flash partially illuminated this frame. This is usually due to the next
- * or previous frame having the flash fire, and the flash spilling into this capture
+ * <p>Flash partially illuminated this frame.</p>
+ * <p>This is usually due to the next or previous frame having
+ * the flash fire, and the flash spilling into this capture
* due to hardware limitations.</p>
* @see CaptureResult#FLASH_STATE
*/
@@ -1791,8 +1936,10 @@ public abstract class CameraMetadata<TKey> {
public static final int LENS_STATE_STATIONARY = 0;
/**
- * <p>Any of the lens parameters ({@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance},
- * {@link CaptureRequest#LENS_FILTER_DENSITY android.lens.filterDensity} or {@link CaptureRequest#LENS_APERTURE android.lens.aperture}) is changing.</p>
+ * <p>One or several of the lens parameters
+ * ({@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, {@link CaptureRequest#LENS_FOCUS_DISTANCE android.lens.focusDistance},
+ * {@link CaptureRequest#LENS_FILTER_DENSITY android.lens.filterDensity} or {@link CaptureRequest#LENS_APERTURE android.lens.aperture}) is
+ * currently changing.</p>
*
* @see CaptureRequest#LENS_APERTURE
* @see CaptureRequest#LENS_FILTER_DENSITY
@@ -1807,16 +1954,22 @@ public abstract class CameraMetadata<TKey> {
//
/**
+ * <p>The camera device does not detect any flickering illumination
+ * in the current scene.</p>
* @see CaptureResult#STATISTICS_SCENE_FLICKER
*/
public static final int STATISTICS_SCENE_FLICKER_NONE = 0;
/**
+ * <p>The camera device detects illumination flickering at 50Hz
+ * in the current scene.</p>
* @see CaptureResult#STATISTICS_SCENE_FLICKER
*/
public static final int STATISTICS_SCENE_FLICKER_50HZ = 1;
/**
+ * <p>The camera device detects illumination flickering at 60Hz
+ * in the current scene.</p>
* @see CaptureResult#STATISTICS_SCENE_FLICKER
*/
public static final int STATISTICS_SCENE_FLICKER_60HZ = 2;
@@ -1826,8 +1979,8 @@ public abstract class CameraMetadata<TKey> {
//
/**
- * <p>The current result is not yet fully synchronized to any request.
- * Synchronization is in progress, and reading metadata from this
+ * <p>The current result is not yet fully synchronized to any request.</p>
+ * <p>Synchronization is in progress, and reading metadata from this
* result may include a mix of data that have taken effect since the
* last synchronization time.</p>
* <p>In some future result, within {@link CameraCharacteristics#SYNC_MAX_LATENCY android.sync.maxLatency} frames,
@@ -1842,10 +1995,10 @@ public abstract class CameraMetadata<TKey> {
public static final int SYNC_FRAME_NUMBER_CONVERGING = -1;
/**
- * <p>The current result's synchronization status is unknown. The
- * result may have already converged, or it may be in progress.
- * Reading from this result may include some mix of settings from
- * past requests.</p>
+ * <p>The current result's synchronization status is unknown.</p>
+ * <p>The result may have already converged, or it may be in
+ * progress. Reading from this result may include some mix
+ * of settings from past requests.</p>
* <p>After a settings change, the new settings will eventually all
* take effect for the output buffers and results. However, this
* value will not change when that happens. Altering settings
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index d4dfdd5..bf7bd37 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -43,14 +43,14 @@ import java.util.Objects;
* <p>CaptureRequests can be created by using a {@link Builder} instance,
* obtained by calling {@link CameraDevice#createCaptureRequest}</p>
*
- * <p>CaptureRequests are given to {@link CameraDevice#capture} or
- * {@link CameraDevice#setRepeatingRequest} to capture images from a camera.</p>
+ * <p>CaptureRequests are given to {@link CameraCaptureSession#capture} or
+ * {@link CameraCaptureSession#setRepeatingRequest} to capture images from a camera.</p>
*
* <p>Each request can specify a different subset of target Surfaces for the
* camera to send the captured data to. All the surfaces used in a request must
* be part of the surface list given to the last call to
- * {@link CameraDevice#configureOutputs}, when the request is submitted to the
- * camera device.</p>
+ * {@link CameraDevice#createCaptureSession}, when the request is submitted to the
+ * session.</p>
*
* <p>For example, a request meant for repeating preview might only include the
* Surface for the preview SurfaceView or SurfaceTexture, while a
@@ -357,11 +357,11 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* request fields to one of the templates defined in {@link CameraDevice}.
*
* @see CameraDevice#createCaptureRequest
- * @see #TEMPLATE_PREVIEW
- * @see #TEMPLATE_RECORD
- * @see #TEMPLATE_STILL_CAPTURE
- * @see #TEMPLATE_VIDEO_SNAPSHOT
- * @see #TEMPLATE_MANUAL
+ * @see CameraDevice#TEMPLATE_PREVIEW
+ * @see CameraDevice#TEMPLATE_RECORD
+ * @see CameraDevice#TEMPLATE_STILL_CAPTURE
+ * @see CameraDevice#TEMPLATE_VIDEO_SNAPSHOT
+ * @see CameraDevice#TEMPLATE_MANUAL
*/
public final static class Builder {
@@ -381,7 +381,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>Add a surface to the list of targets for this request</p>
*
* <p>The Surface added must be one of the surfaces included in the most
- * recent call to {@link CameraDevice#configureOutputs}, when the
+ * recent call to {@link CameraDevice#createCaptureSession}, when the
* request is given to the camera device.</p>
*
* <p>Adding a target more than once has no effect.</p>
@@ -473,7 +473,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>The mode control selects how the image data is converted from the
* sensor's native color into linear sRGB color.</p>
- * <p>When auto-white balance is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
+ * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
* control is overridden by the AWB routine. When AWB is disabled, the
* application controls how the color mapping is performed.</p>
* <p>We define the expected processing pipeline below. For consistency
@@ -524,7 +524,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>A color transform matrix to use to transform
- * from sensor RGB color space to output linear sRGB color space</p>
+ * from sensor RGB color space to output linear sRGB color space.</p>
* <p>This matrix is either set by the camera device when the request
* {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
* directly by the application in the request when the
@@ -600,13 +600,17 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.control.aeAntibandingMode", int.class);
/**
- * <p>Adjustment to AE target image
- * brightness</p>
- * <p>For example, if EV step is 0.333, '6' will mean an
- * exposure compensation of +2 EV; -3 will mean an exposure
- * compensation of -1 EV. Note that this control will only be effective
- * if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control will take effect even when
- * {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
+ * <p>Adjustment to auto-exposure (AE) target image
+ * brightness.</p>
+ * <p>The adjustment is measured as a count of steps, with the
+ * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
+ * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
+ * <p>For example, if the exposure value (EV) step is 0.333, '6'
+ * will mean an exposure compensation of +2 EV; -3 will mean an
+ * exposure compensation of -1 EV. One EV represents a doubling
+ * of image brightness. Note that this control will only be
+ * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
+ * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
* <p>In the event of exposure compensation value being changed, camera device
* may take several frames to reach the newly requested exposure target.
* During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
@@ -614,6 +618,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
* FLASH_REQUIRED (if the scene is too dark for still capture).</p>
*
+ * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
+ * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
* @see CaptureRequest#CONTROL_AE_LOCK
* @see CaptureRequest#CONTROL_AE_MODE
* @see CaptureResult#CONTROL_AE_STATE
@@ -622,7 +628,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.control.aeExposureCompensation", int.class);
/**
- * <p>Whether AE is currently locked to its latest
+ * <p>Whether auto-exposure (AE) is currently locked to its latest
* calculated values.</p>
* <p>Note that even when AE is locked, the flash may be
* fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH / ON_ALWAYS_FLASH /
@@ -711,9 +717,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Range over which fps can be adjusted to
- * maintain exposure</p>
- * <p>Only constrains AE algorithm, not manual control
- * of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}</p>
+ * maintain exposure.</p>
+ * <p>Only constrains auto-exposure (AE) algorithm, not
+ * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}</p>
*
* @see CaptureRequest#SENSOR_EXPOSURE_TIME
*/
@@ -727,9 +733,18 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* included at all in the request settings. When included and
* set to START, the camera device will trigger the autoexposure
* precapture metering sequence.</p>
- * <p>The effect of AE precapture trigger depends on the current
- * AE mode and state; see {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture
- * state transition details.</p>
+ * <p>The precapture sequence should triggered before starting a
+ * high-quality still capture for final metering decisions to
+ * be made, and for firing pre-capture flash pulses to estimate
+ * scene brightness and required final capture flash power, when
+ * the flash is enabled.</p>
+ * <p>Normally, this entry should be set to START for only a
+ * single request, and the application should wait until the
+ * sequence completes before starting a new one.</p>
+ * <p>The exact effect of auto-exposure (AE) precapture trigger
+ * depends on the current AE mode and state; see
+ * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
+ * details.</p>
*
* @see CaptureResult#CONTROL_AE_STATE
* @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
@@ -739,8 +754,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
/**
- * <p>Whether AF is currently enabled, and what
- * mode it is set to</p>
+ * <p>Whether auto-focus (AF) is currently enabled, and what
+ * mode it is set to.</p>
* <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
* (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>).</p>
* <p>If the lens is controlled by the camera device auto-focus algorithm,
@@ -793,7 +808,11 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
* <p>When set to CANCEL, the camera device will cancel any active trigger,
* and return to its initial AF state.</p>
- * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what that means for each AF mode.</p>
+ * <p>Generally, applications should set this entry to START or CANCEL for only a
+ * single capture, and then return it to IDLE (or not set at all). Specifying
+ * START for multiple captures in a row means restarting the AF operation over
+ * and over again.</p>
+ * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
*
* @see CaptureResult#CONTROL_AF_STATE
* @see #CONTROL_AF_TRIGGER_IDLE
@@ -804,31 +823,37 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.control.afTrigger", int.class);
/**
- * <p>Whether AWB is currently locked to its
+ * <p>Whether auto-white balance (AWB) is currently locked to its
* latest calculated values.</p>
- * <p>Note that AWB lock is only meaningful for AUTO
- * mode; in other modes, AWB is already fixed to a specific
- * setting.</p>
+ * <p>Note that AWB lock is only meaningful when
+ * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
+ * AWB is already fixed to a specific setting.</p>
+ *
+ * @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final Key<Boolean> CONTROL_AWB_LOCK =
new Key<Boolean>("android.control.awbLock", boolean.class);
/**
- * <p>Whether AWB is currently setting the color
+ * <p>Whether auto-white balance (AWB) is currently setting the color
* transform fields, and what its illumination target
* is.</p>
* <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
- * <p>When set to the ON mode, the camera device's auto white balance
+ * <p>When set to the ON mode, the camera device's auto-white balance
* routine is enabled, overriding the application's selected
* {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
* {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
- * <p>When set to the OFF mode, the camera device's auto white balance
+ * <p>When set to the OFF mode, the camera device's auto-white balance
* routine is disabled. The application manually controls the white
* balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
* and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
- * <p>When set to any other modes, the camera device's auto white balance
- * routine is disabled. The camera device uses each particular illumination
- * target for white balance adjustment.</p>
+ * <p>When set to any other modes, the camera device's auto-white
+ * balance routine is disabled. The camera device uses each
+ * particular illumination target for white balance
+ * adjustment. The application's values for
+ * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
+ * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
+ * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
*
* @see CaptureRequest#COLOR_CORRECTION_GAINS
* @see CaptureRequest#COLOR_CORRECTION_MODE
@@ -879,8 +904,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* strategy.</p>
* <p>This control (except for MANUAL) is only effective if
* <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
- * <p>ZERO_SHUTTER_LAG must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
- * contains ZSL. MANUAL must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
+ * <p>ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
+ * contains ZSL. MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
* contains MANUAL_SENSOR.</p>
*
* @see CaptureRequest#CONTROL_MODE
@@ -955,7 +980,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>This is the mode that that is active when
* <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY,
* these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode},
- * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.</p>
+ * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.
+ * The scene modes available for a given camera device are listed in
+ * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}.</p>
* <p>The interpretation and implementation of these scene modes is left
* to the implementor of the camera device. Their behavior will not be
* consistent across all devices, and any given device may only implement
@@ -963,6 +990,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
*
* @see CaptureRequest#CONTROL_AE_MODE
* @see CaptureRequest#CONTROL_AF_MODE
+ * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
* @see CaptureRequest#CONTROL_AWB_MODE
* @see CaptureRequest#CONTROL_MODE
* @see #CONTROL_SCENE_MODE_DISABLED
@@ -988,7 +1016,9 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Whether video stabilization is
- * active</p>
+ * active.</p>
+ * <p>Video stabilization automatically translates and scales images from the camera
+ * in order to stabilize motion between consecutive frames.</p>
* <p>If enabled, video stabilization can modify the
* {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream
* stabilized</p>
@@ -1030,7 +1060,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>When set to OFF, the camera device will not fire flash for this capture.</p>
* <p>When set to SINGLE, the camera device will fire flash regardless of the camera
* device's auto-exposure routine's result. When used in still capture case, this
- * control should be used along with AE precapture metering sequence
+ * control should be used along with auto-exposure (AE) precapture metering sequence
* ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
* <p>When set to TORCH, the flash will be on continuously. This mode can be used
* for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
@@ -1102,21 +1132,21 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Compression quality of the final JPEG
- * image</p>
- * <p>85-95 is typical usage range</p>
+ * image.</p>
+ * <p>85-95 is typical usage range.</p>
*/
public static final Key<Byte> JPEG_QUALITY =
new Key<Byte>("android.jpeg.quality", byte.class);
/**
* <p>Compression quality of JPEG
- * thumbnail</p>
+ * thumbnail.</p>
*/
public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
/**
- * <p>Resolution of embedded JPEG thumbnail</p>
+ * <p>Resolution of embedded JPEG thumbnail.</p>
* <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
* but the captured JPEG will still be a valid image.</p>
* <p>When a jpeg image capture is issued, the thumbnail size selected should have
@@ -1204,7 +1234,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Distance to plane of sharpest focus,
- * measured from frontmost surface of the lens</p>
+ * measured from frontmost surface of the lens.</p>
* <p>0 means infinity focus. Used value will be clamped
* to [0, {@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance}].</p>
* <p>Like {@link CaptureRequest#LENS_FOCAL_LENGTH android.lens.focalLength}, this setting won't be applied
@@ -1222,12 +1252,18 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Sets whether the camera device uses optical image stabilization (OIS)
* when capturing images.</p>
- * <p>OIS is used to compensate for motion blur due to small movements of
- * the camera during capture. Unlike digital image stabilization, OIS makes
- * use of mechanical elements to stabilize the camera sensor, and thus
- * allows for longer exposure times before camera shake becomes
- * apparent.</p>
- * <p>This is not expected to be supported on most devices.</p>
+ * <p>OIS is used to compensate for motion blur due to small
+ * movements of the camera during capture. Unlike digital image
+ * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
+ * makes use of mechanical elements to stabilize the camera
+ * sensor, and thus allows for longer exposure times before
+ * camera shake becomes apparent.</p>
+ * <p>Not all devices will support OIS; see
+ * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
+ * available controls.</p>
+ *
+ * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
+ * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
* @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
* @see #LENS_OPTICAL_STABILIZATION_MODE_ON
*/
@@ -1235,16 +1271,15 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.lens.opticalStabilizationMode", int.class);
/**
- * <p>Mode of operation for the noise reduction
- * algorithm</p>
+ * <p>Mode of operation for the noise reduction algorithm.</p>
* <p>Noise filtering control. OFF means no noise reduction
* will be applied by the camera device.</p>
- * <p>This must be set to a valid mode in
+ * <p>This must be set to a valid mode from
* {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}.</p>
* <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
* will be applied. HIGH_QUALITY mode indicates that the camera device
* will use the highest-quality noise filtering algorithms,
- * even if it slows down capture rate. FAST means the camera device should not
+ * even if it slows down capture rate. FAST means the camera device will not
* slow down capture rate when applying noise filtering.</p>
*
* @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
@@ -1265,40 +1300,39 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.request.id", int.class);
/**
- * <p>(x, y, width, height).</p>
- * <p>A rectangle with the top-level corner of (x,y) and size
- * (width, height). The region of the sensor that is used for
- * output. Each stream must use this rectangle to produce its
- * output, cropping to a smaller region if necessary to
- * maintain the stream's aspect ratio.</p>
- * <p>HAL2.x uses only (x, y, width)</p>
- * <p>The crop region is applied after the RAW to other color space (e.g. YUV)
- * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage,
- * it is not croppable. The crop region will be ignored by raw streams.</p>
+ * <p>The region of the sensor to read out for this capture.</p>
+ * <p>The crop region coordinate system is based off
+ * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the
+ * top-left corner of the sensor active array.</p>
+ * <p>Output streams use this rectangle to produce their output,
+ * cropping to a smaller region if necessary to maintain the
+ * stream's aspect ratio, then scaling the sensor input to
+ * match the output's configured resolution.</p>
+ * <p>The crop region is applied after the RAW to other color
+ * space (e.g. YUV) conversion. Since raw streams
+ * (e.g. RAW16) don't have the conversion stage, they are not
+ * croppable. The crop region will be ignored by raw streams.</p>
* <p>For non-raw streams, any additional per-stream cropping will
* be done to maximize the final pixel area of the stream.</p>
* <p>For example, if the crop region is set to a 4:3 aspect
- * ratio, then 4:3 streams should use the exact crop
- * region. 16:9 streams should further crop vertically
+ * ratio, then 4:3 streams will use the exact crop
+ * region. 16:9 streams will further crop vertically
* (letterbox).</p>
* <p>Conversely, if the crop region is set to a 16:9, then 4:3
- * outputs should crop horizontally (pillarbox), and 16:9
- * streams should match exactly. These additional crops must
+ * outputs will crop horizontally (pillarbox), and 16:9
+ * streams will match exactly. These additional crops will
* be centered within the crop region.</p>
- * <p>The output streams must maintain square pixels at all
- * times, no matter what the relative aspect ratios of the
- * crop region and the stream are. Negative values for
- * corner are allowed for raw output if full pixel array is
- * larger than active pixel array. Width and height may be
- * rounded to nearest larger supportable width, especially
- * for raw output, where only a few fixed scales may be
- * possible. The width and height of the crop region cannot
- * be set to be smaller than floor( activeArraySize.width /
- * {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} ) and floor(
- * activeArraySize.height /
- * {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom}), respectively.</p>
+ * <p>The width and height of the crop region cannot
+ * be set to be smaller than
+ * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
+ * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
+ * <p>The camera device may adjust the crop region to account
+ * for rounding and other hardware requirements; the final
+ * crop region used will be included in the output capture
+ * result.</p>
*
* @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
*/
public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
@@ -1391,12 +1425,20 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Long>("android.sensor.frameDuration", long.class);
/**
- * <p>Gain applied to image data. Must be
- * implemented through analog gain only if set to values
- * below 'maximum analog sensitivity'.</p>
- * <p>If the sensor can't apply this exact gain, it should lessen the
- * gain to the nearest possible value (rather than gain more).</p>
- * <p>ISO 12232:2006 REI method</p>
+ * <p>The amount of gain applied to sensor data
+ * before processing.</p>
+ * <p>The sensitivity is the standard ISO sensitivity value,
+ * as defined in ISO 12232:2006.</p>
+ * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
+ * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
+ * is guaranteed to use only analog amplification for applying the gain.</p>
+ * <p>If the camera device cannot apply the exact sensitivity
+ * requested, it will reduce the gain to the nearest supported
+ * value. The final sensitivity used will be available in the
+ * output capture result.</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
+ * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
*/
public static final Key<Integer> SENSOR_SENSITIVITY =
new Key<Integer>("android.sensor.sensitivity", int.class);
@@ -1421,7 +1463,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>When enabled, the sensor sends a test pattern instead of
* doing a real exposure from the camera.</p>
* <p>When a test pattern is enabled, all manual sensor controls specified
- * by android.sensor.* should be ignored. All other controls should
+ * by android.sensor.* will be ignored. All other controls should
* work as normal.</p>
* <p>For example, if manual flash is enabled, flash firing should still
* occur (and that the test pattern remain unmodified, since the flash
@@ -1459,7 +1501,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* lens shading map data in android.statistics.lensShadingMap, with size specified
* by android.lens.info.shadingMapSize; the returned shading map data will be the one
* applied by the camera device for this capture request.</p>
- * <p>The shading map data may depend on the AE and AWB statistics, therefore the reliability
+ * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore the reliability
* of the map data may be affected by the AE and AWB algorithms. When AE and AWB are in
* AUTO modes({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF and {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} <code>!=</code> OFF),
* to get best results, it is recommended that the applications wait for the AE and AWB to
@@ -1476,8 +1518,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
new Key<Integer>("android.shading.mode", int.class);
/**
- * <p>State of the face detector
- * unit</p>
+ * <p>Control for the face detector
+ * unit.</p>
* <p>Whether face detection is enabled, and whether it
* should output just the basic fields or the full set of
* fields. Value must be one of the
@@ -1494,7 +1536,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
/**
* <p>Operating mode for hotpixel map generation.</p>
* <p>If set to ON, a hotpixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
- * If set to OFF, no hotpixel map should be returned.</p>
+ * If set to OFF, no hotpixel map will be returned.</p>
* <p>This must be set to a valid mode from {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}.</p>
*
* @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
@@ -1507,7 +1549,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
* <p>Whether the camera device will output the lens
* shading map in output result metadata.</p>
* <p>When set to ON,
- * android.statistics.lensShadingMap must be provided in
+ * android.statistics.lensShadingMap will be provided in
* the output result metadata.</p>
* @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
* @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java
index 7d07c92..3d17ed3 100644
--- a/core/java/android/hardware/camera2/CaptureResult.java
+++ b/core/java/android/hardware/camera2/CaptureResult.java
@@ -319,7 +319,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>The mode control selects how the image data is converted from the
* sensor's native color into linear sRGB color.</p>
- * <p>When auto-white balance is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
+ * <p>When auto-white balance (AWB) is enabled with {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, this
* control is overridden by the AWB routine. When AWB is disabled, the
* application controls how the color mapping is performed.</p>
* <p>We define the expected processing pipeline below. For consistency
@@ -370,7 +370,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>A color transform matrix to use to transform
- * from sensor RGB color space to output linear sRGB color space</p>
+ * from sensor RGB color space to output linear sRGB color space.</p>
* <p>This matrix is either set by the camera device when the request
* {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} is not TRANSFORM_MATRIX, or
* directly by the application in the request when the
@@ -446,13 +446,17 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.aeAntibandingMode", int.class);
/**
- * <p>Adjustment to AE target image
- * brightness</p>
- * <p>For example, if EV step is 0.333, '6' will mean an
- * exposure compensation of +2 EV; -3 will mean an exposure
- * compensation of -1 EV. Note that this control will only be effective
- * if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control will take effect even when
- * {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
+ * <p>Adjustment to auto-exposure (AE) target image
+ * brightness.</p>
+ * <p>The adjustment is measured as a count of steps, with the
+ * step size defined by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP android.control.aeCompensationStep} and the
+ * allowed range by {@link CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE android.control.aeCompensationRange}.</p>
+ * <p>For example, if the exposure value (EV) step is 0.333, '6'
+ * will mean an exposure compensation of +2 EV; -3 will mean an
+ * exposure compensation of -1 EV. One EV represents a doubling
+ * of image brightness. Note that this control will only be
+ * effective if {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF. This control
+ * will take effect even when {@link CaptureRequest#CONTROL_AE_LOCK android.control.aeLock} <code>== true</code>.</p>
* <p>In the event of exposure compensation value being changed, camera device
* may take several frames to reach the newly requested exposure target.
* During that time, {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} field will be in the SEARCHING
@@ -460,6 +464,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* change from SEARCHING to either CONVERGED, LOCKED (if AE lock is enabled), or
* FLASH_REQUIRED (if the scene is too dark for still capture).</p>
*
+ * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_RANGE
+ * @see CameraCharacteristics#CONTROL_AE_COMPENSATION_STEP
* @see CaptureRequest#CONTROL_AE_LOCK
* @see CaptureRequest#CONTROL_AE_MODE
* @see CaptureResult#CONTROL_AE_STATE
@@ -468,7 +474,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.aeExposureCompensation", int.class);
/**
- * <p>Whether AE is currently locked to its latest
+ * <p>Whether auto-exposure (AE) is currently locked to its latest
* calculated values.</p>
* <p>Note that even when AE is locked, the flash may be
* fired if the {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} is ON_AUTO_FLASH / ON_ALWAYS_FLASH /
@@ -557,9 +563,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Range over which fps can be adjusted to
- * maintain exposure</p>
- * <p>Only constrains AE algorithm, not manual control
- * of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}</p>
+ * maintain exposure.</p>
+ * <p>Only constrains auto-exposure (AE) algorithm, not
+ * manual control of {@link CaptureRequest#SENSOR_EXPOSURE_TIME android.sensor.exposureTime}</p>
*
* @see CaptureRequest#SENSOR_EXPOSURE_TIME
*/
@@ -573,9 +579,18 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* included at all in the request settings. When included and
* set to START, the camera device will trigger the autoexposure
* precapture metering sequence.</p>
- * <p>The effect of AE precapture trigger depends on the current
- * AE mode and state; see {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture
- * state transition details.</p>
+ * <p>The precapture sequence should triggered before starting a
+ * high-quality still capture for final metering decisions to
+ * be made, and for firing pre-capture flash pulses to estimate
+ * scene brightness and required final capture flash power, when
+ * the flash is enabled.</p>
+ * <p>Normally, this entry should be set to START for only a
+ * single request, and the application should wait until the
+ * sequence completes before starting a new one.</p>
+ * <p>The exact effect of auto-exposure (AE) precapture trigger
+ * depends on the current AE mode and state; see
+ * {@link CaptureResult#CONTROL_AE_STATE android.control.aeState} for AE precapture state transition
+ * details.</p>
*
* @see CaptureResult#CONTROL_AE_STATE
* @see #CONTROL_AE_PRECAPTURE_TRIGGER_IDLE
@@ -585,7 +600,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.aePrecaptureTrigger", int.class);
/**
- * <p>Current state of AE algorithm</p>
+ * <p>Current state of the auto-exposure (AE) algorithm.</p>
* <p>Switching between or enabling AE modes ({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode}) always
* resets the AE state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
* or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
@@ -783,8 +798,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.aeState", int.class);
/**
- * <p>Whether AF is currently enabled, and what
- * mode it is set to</p>
+ * <p>Whether auto-focus (AF) is currently enabled, and what
+ * mode it is set to.</p>
* <p>Only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} = AUTO and the lens is not fixed focus
* (i.e. <code>{@link CameraCharacteristics#LENS_INFO_MINIMUM_FOCUS_DISTANCE android.lens.info.minimumFocusDistance} &gt; 0</code>).</p>
* <p>If the lens is controlled by the camera device auto-focus algorithm,
@@ -837,7 +852,11 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* autofocus algorithm. If autofocus is disabled, this trigger has no effect.</p>
* <p>When set to CANCEL, the camera device will cancel any active trigger,
* and return to its initial AF state.</p>
- * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what that means for each AF mode.</p>
+ * <p>Generally, applications should set this entry to START or CANCEL for only a
+ * single capture, and then return it to IDLE (or not set at all). Specifying
+ * START for multiple captures in a row means restarting the AF operation over
+ * and over again.</p>
+ * <p>See {@link CaptureResult#CONTROL_AF_STATE android.control.afState} for what the trigger means for each AF mode.</p>
*
* @see CaptureResult#CONTROL_AF_STATE
* @see #CONTROL_AF_TRIGGER_IDLE
@@ -848,7 +867,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.afTrigger", int.class);
/**
- * <p>Current state of AF algorithm.</p>
+ * <p>Current state of auto-focus (AF) algorithm.</p>
* <p>Switching between or enabling AF modes ({@link CaptureRequest#CONTROL_AF_MODE android.control.afMode}) always
* resets the AF state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
* or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
@@ -1027,13 +1046,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <td align="center">PASSIVE_SCAN</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">FOCUSED_LOCKED</td>
- * <td align="center">Immediate trans. If focus is good, Lens now locked</td>
+ * <td align="center">Immediate transition, if focus is good. Lens now locked</td>
* </tr>
* <tr>
* <td align="center">PASSIVE_SCAN</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">NOT_FOCUSED_LOCKED</td>
- * <td align="center">Immediate trans. if focus is bad, Lens now locked</td>
+ * <td align="center">Immediate transition, if focus is bad. Lens now locked</td>
* </tr>
* <tr>
* <td align="center">PASSIVE_SCAN</td>
@@ -1057,13 +1076,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <td align="center">PASSIVE_FOCUSED</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">FOCUSED_LOCKED</td>
- * <td align="center">Immediate trans. Lens now locked</td>
+ * <td align="center">Immediate transition, lens now locked</td>
* </tr>
* <tr>
* <td align="center">PASSIVE_UNFOCUSED</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">NOT_FOCUSED_LOCKED</td>
- * <td align="center">Immediate trans. Lens now locked</td>
+ * <td align="center">Immediate transition, lens now locked</td>
* </tr>
* <tr>
* <td align="center">FOCUSED_LOCKED</td>
@@ -1130,13 +1149,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <td align="center">PASSIVE_SCAN</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">FOCUSED_LOCKED</td>
- * <td align="center">Eventual trans. once focus good, Lens now locked</td>
+ * <td align="center">Eventual transition once the focus is good. Lens now locked</td>
* </tr>
* <tr>
* <td align="center">PASSIVE_SCAN</td>
* <td align="center">AF_TRIGGER</td>
* <td align="center">NOT_FOCUSED_LOCKED</td>
- * <td align="center">Eventual trans. if cannot focus, Lens now locked</td>
+ * <td align="center">Eventual transition if cannot find focus. Lens now locked</td>
* </tr>
* <tr>
* <td align="center">PASSIVE_SCAN</td>
@@ -1245,31 +1264,37 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.afState", int.class);
/**
- * <p>Whether AWB is currently locked to its
+ * <p>Whether auto-white balance (AWB) is currently locked to its
* latest calculated values.</p>
- * <p>Note that AWB lock is only meaningful for AUTO
- * mode; in other modes, AWB is already fixed to a specific
- * setting.</p>
+ * <p>Note that AWB lock is only meaningful when
+ * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} is in the AUTO mode; in other modes,
+ * AWB is already fixed to a specific setting.</p>
+ *
+ * @see CaptureRequest#CONTROL_AWB_MODE
*/
public static final Key<Boolean> CONTROL_AWB_LOCK =
new Key<Boolean>("android.control.awbLock", boolean.class);
/**
- * <p>Whether AWB is currently setting the color
+ * <p>Whether auto-white balance (AWB) is currently setting the color
* transform fields, and what its illumination target
* is.</p>
* <p>This control is only effective if {@link CaptureRequest#CONTROL_MODE android.control.mode} is AUTO.</p>
- * <p>When set to the ON mode, the camera device's auto white balance
+ * <p>When set to the ON mode, the camera device's auto-white balance
* routine is enabled, overriding the application's selected
* {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
* {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
- * <p>When set to the OFF mode, the camera device's auto white balance
+ * <p>When set to the OFF mode, the camera device's auto-white balance
* routine is disabled. The application manually controls the white
* balance by {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform}, {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains}
* and {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode}.</p>
- * <p>When set to any other modes, the camera device's auto white balance
- * routine is disabled. The camera device uses each particular illumination
- * target for white balance adjustment.</p>
+ * <p>When set to any other modes, the camera device's auto-white
+ * balance routine is disabled. The camera device uses each
+ * particular illumination target for white balance
+ * adjustment. The application's values for
+ * {@link CaptureRequest#COLOR_CORRECTION_TRANSFORM android.colorCorrection.transform},
+ * {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} and
+ * {@link CaptureRequest#COLOR_CORRECTION_MODE android.colorCorrection.mode} are ignored.</p>
*
* @see CaptureRequest#COLOR_CORRECTION_GAINS
* @see CaptureRequest#COLOR_CORRECTION_MODE
@@ -1320,8 +1345,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* strategy.</p>
* <p>This control (except for MANUAL) is only effective if
* <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} != OFF</code> and any 3A routine is active.</p>
- * <p>ZERO_SHUTTER_LAG must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
- * contains ZSL. MANUAL must be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
+ * <p>ZERO_SHUTTER_LAG will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
+ * contains ZSL. MANUAL will be supported if {@link CameraCharacteristics#REQUEST_AVAILABLE_CAPABILITIES android.request.availableCapabilities}
* contains MANUAL_SENSOR.</p>
*
* @see CaptureRequest#CONTROL_MODE
@@ -1338,7 +1363,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.control.captureIntent", int.class);
/**
- * <p>Current state of AWB algorithm</p>
+ * <p>Current state of auto-white balance (AWB) algorithm.</p>
* <p>Switching between or enabling AWB modes ({@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}) always
* resets the AWB state to INACTIVE. Similarly, switching between {@link CaptureRequest#CONTROL_MODE android.control.mode},
* or {@link CaptureRequest#CONTROL_SCENE_MODE android.control.sceneMode} if <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code> resets all
@@ -1526,7 +1551,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p>This is the mode that that is active when
* <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == USE_SCENE_MODE</code>. Aside from FACE_PRIORITY,
* these modes will disable {@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode},
- * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.</p>
+ * {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode}, and {@link CaptureRequest#CONTROL_AF_MODE android.control.afMode} while in use.
+ * The scene modes available for a given camera device are listed in
+ * {@link CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES android.control.availableSceneModes}.</p>
* <p>The interpretation and implementation of these scene modes is left
* to the implementor of the camera device. Their behavior will not be
* consistent across all devices, and any given device may only implement
@@ -1534,6 +1561,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
*
* @see CaptureRequest#CONTROL_AE_MODE
* @see CaptureRequest#CONTROL_AF_MODE
+ * @see CameraCharacteristics#CONTROL_AVAILABLE_SCENE_MODES
* @see CaptureRequest#CONTROL_AWB_MODE
* @see CaptureRequest#CONTROL_MODE
* @see #CONTROL_SCENE_MODE_DISABLED
@@ -1559,7 +1587,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Whether video stabilization is
- * active</p>
+ * active.</p>
+ * <p>Video stabilization automatically translates and scales images from the camera
+ * in order to stabilize motion between consecutive frames.</p>
* <p>If enabled, video stabilization can modify the
* {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} to keep the video stream
* stabilized</p>
@@ -1601,7 +1631,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p>When set to OFF, the camera device will not fire flash for this capture.</p>
* <p>When set to SINGLE, the camera device will fire flash regardless of the camera
* device's auto-exposure routine's result. When used in still capture case, this
- * control should be used along with AE precapture metering sequence
+ * control should be used along with auto-exposure (AE) precapture metering sequence
* ({@link CaptureRequest#CONTROL_AE_PRECAPTURE_TRIGGER android.control.aePrecaptureTrigger}), otherwise, the image may be incorrectly exposed.</p>
* <p>When set to TORCH, the flash will be on continuously. This mode can be used
* for use cases such as preview, auto-focus assist, still capture, or video recording.</p>
@@ -1690,21 +1720,21 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Compression quality of the final JPEG
- * image</p>
- * <p>85-95 is typical usage range</p>
+ * image.</p>
+ * <p>85-95 is typical usage range.</p>
*/
public static final Key<Byte> JPEG_QUALITY =
new Key<Byte>("android.jpeg.quality", byte.class);
/**
* <p>Compression quality of JPEG
- * thumbnail</p>
+ * thumbnail.</p>
*/
public static final Key<Byte> JPEG_THUMBNAIL_QUALITY =
new Key<Byte>("android.jpeg.thumbnailQuality", byte.class);
/**
- * <p>Resolution of embedded JPEG thumbnail</p>
+ * <p>Resolution of embedded JPEG thumbnail.</p>
* <p>When set to (0, 0) value, the JPEG EXIF will not contain thumbnail,
* but the captured JPEG will still be a valid image.</p>
* <p>When a jpeg image capture is issued, the thumbnail size selected should have
@@ -1792,7 +1822,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Distance to plane of sharpest focus,
- * measured from frontmost surface of the lens</p>
+ * measured from frontmost surface of the lens.</p>
* <p>Should be zero for fixed-focus cameras</p>
*/
public static final Key<Float> LENS_FOCUS_DISTANCE =
@@ -1800,7 +1830,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>The range of scene distances that are in
- * sharp focus (depth of field)</p>
+ * sharp focus (depth of field).</p>
* <p>If variable focus not supported, can still report
* fixed depth of field range</p>
*/
@@ -1810,12 +1840,18 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Sets whether the camera device uses optical image stabilization (OIS)
* when capturing images.</p>
- * <p>OIS is used to compensate for motion blur due to small movements of
- * the camera during capture. Unlike digital image stabilization, OIS makes
- * use of mechanical elements to stabilize the camera sensor, and thus
- * allows for longer exposure times before camera shake becomes
- * apparent.</p>
- * <p>This is not expected to be supported on most devices.</p>
+ * <p>OIS is used to compensate for motion blur due to small
+ * movements of the camera during capture. Unlike digital image
+ * stabilization ({@link CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE android.control.videoStabilizationMode}), OIS
+ * makes use of mechanical elements to stabilize the camera
+ * sensor, and thus allows for longer exposure times before
+ * camera shake becomes apparent.</p>
+ * <p>Not all devices will support OIS; see
+ * {@link CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION android.lens.info.availableOpticalStabilization} for
+ * available controls.</p>
+ *
+ * @see CaptureRequest#CONTROL_VIDEO_STABILIZATION_MODE
+ * @see CameraCharacteristics#LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION
* @see #LENS_OPTICAL_STABILIZATION_MODE_OFF
* @see #LENS_OPTICAL_STABILIZATION_MODE_ON
*/
@@ -1859,16 +1895,15 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.lens.state", int.class);
/**
- * <p>Mode of operation for the noise reduction
- * algorithm</p>
+ * <p>Mode of operation for the noise reduction algorithm.</p>
* <p>Noise filtering control. OFF means no noise reduction
* will be applied by the camera device.</p>
- * <p>This must be set to a valid mode in
+ * <p>This must be set to a valid mode from
* {@link CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES android.noiseReduction.availableNoiseReductionModes}.</p>
* <p>FAST/HIGH_QUALITY both mean camera device determined noise filtering
* will be applied. HIGH_QUALITY mode indicates that the camera device
* will use the highest-quality noise filtering algorithms,
- * even if it slows down capture rate. FAST means the camera device should not
+ * even if it slows down capture rate. FAST means the camera device will not
* slow down capture rate when applying noise filtering.</p>
*
* @see CameraCharacteristics#NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
@@ -1934,40 +1969,39 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Byte>("android.request.pipelineDepth", byte.class);
/**
- * <p>(x, y, width, height).</p>
- * <p>A rectangle with the top-level corner of (x,y) and size
- * (width, height). The region of the sensor that is used for
- * output. Each stream must use this rectangle to produce its
- * output, cropping to a smaller region if necessary to
- * maintain the stream's aspect ratio.</p>
- * <p>HAL2.x uses only (x, y, width)</p>
- * <p>The crop region is applied after the RAW to other color space (e.g. YUV)
- * conversion. Since raw streams (e.g. RAW16) don't have the conversion stage,
- * it is not croppable. The crop region will be ignored by raw streams.</p>
+ * <p>The region of the sensor to read out for this capture.</p>
+ * <p>The crop region coordinate system is based off
+ * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with <code>(0, 0)</code> being the
+ * top-left corner of the sensor active array.</p>
+ * <p>Output streams use this rectangle to produce their output,
+ * cropping to a smaller region if necessary to maintain the
+ * stream's aspect ratio, then scaling the sensor input to
+ * match the output's configured resolution.</p>
+ * <p>The crop region is applied after the RAW to other color
+ * space (e.g. YUV) conversion. Since raw streams
+ * (e.g. RAW16) don't have the conversion stage, they are not
+ * croppable. The crop region will be ignored by raw streams.</p>
* <p>For non-raw streams, any additional per-stream cropping will
* be done to maximize the final pixel area of the stream.</p>
* <p>For example, if the crop region is set to a 4:3 aspect
- * ratio, then 4:3 streams should use the exact crop
- * region. 16:9 streams should further crop vertically
+ * ratio, then 4:3 streams will use the exact crop
+ * region. 16:9 streams will further crop vertically
* (letterbox).</p>
* <p>Conversely, if the crop region is set to a 16:9, then 4:3
- * outputs should crop horizontally (pillarbox), and 16:9
- * streams should match exactly. These additional crops must
+ * outputs will crop horizontally (pillarbox), and 16:9
+ * streams will match exactly. These additional crops will
* be centered within the crop region.</p>
- * <p>The output streams must maintain square pixels at all
- * times, no matter what the relative aspect ratios of the
- * crop region and the stream are. Negative values for
- * corner are allowed for raw output if full pixel array is
- * larger than active pixel array. Width and height may be
- * rounded to nearest larger supportable width, especially
- * for raw output, where only a few fixed scales may be
- * possible. The width and height of the crop region cannot
- * be set to be smaller than floor( activeArraySize.width /
- * {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} ) and floor(
- * activeArraySize.height /
- * {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom}), respectively.</p>
+ * <p>The width and height of the crop region cannot
+ * be set to be smaller than
+ * <code>floor( activeArraySize.width / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code> and
+ * <code>floor( activeArraySize.height / {@link CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM android.scaler.availableMaxDigitalZoom} )</code>, respectively.</p>
+ * <p>The camera device may adjust the crop region to account
+ * for rounding and other hardware requirements; the final
+ * crop region used will be included in the output capture
+ * result.</p>
*
* @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
*/
public static final Key<android.graphics.Rect> SCALER_CROP_REGION =
new Key<android.graphics.Rect>("android.scaler.cropRegion", android.graphics.Rect.class);
@@ -2060,21 +2094,35 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Long>("android.sensor.frameDuration", long.class);
/**
- * <p>Gain applied to image data. Must be
- * implemented through analog gain only if set to values
- * below 'maximum analog sensitivity'.</p>
- * <p>If the sensor can't apply this exact gain, it should lessen the
- * gain to the nearest possible value (rather than gain more).</p>
- * <p>ISO 12232:2006 REI method</p>
+ * <p>The amount of gain applied to sensor data
+ * before processing.</p>
+ * <p>The sensitivity is the standard ISO sensitivity value,
+ * as defined in ISO 12232:2006.</p>
+ * <p>The sensitivity must be within {@link CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE android.sensor.info.sensitivityRange}, and
+ * if if it less than {@link CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY android.sensor.maxAnalogSensitivity}, the camera device
+ * is guaranteed to use only analog amplification for applying the gain.</p>
+ * <p>If the camera device cannot apply the exact sensitivity
+ * requested, it will reduce the gain to the nearest supported
+ * value. The final sensitivity used will be available in the
+ * output capture result.</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_SENSITIVITY_RANGE
+ * @see CameraCharacteristics#SENSOR_MAX_ANALOG_SENSITIVITY
*/
public static final Key<Integer> SENSOR_SENSITIVITY =
new Key<Integer>("android.sensor.sensitivity", int.class);
/**
* <p>Time at start of exposure of first
- * row</p>
- * <p>Monotonic, should be synced to other timestamps in
- * system</p>
+ * row of the image sensor, in nanoseconds.</p>
+ * <p>The timestamps are also included in all image
+ * buffers produced for the same capture, and will be identical
+ * on all the outputs. The timestamps measure time since an
+ * unspecified starting point, and are monotonically
+ * increasing.</p>
+ * <p>They can be compared with the timestamps for other captures
+ * from the same camera device, but are not guaranteed to be
+ * comparable to any other time source.</p>
*/
public static final Key<Long> SENSOR_TIMESTAMP =
new Key<Long>("android.sensor.timestamp", long.class);
@@ -2150,7 +2198,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p>When enabled, the sensor sends a test pattern instead of
* doing a real exposure from the camera.</p>
* <p>When a test pattern is enabled, all manual sensor controls specified
- * by android.sensor.* should be ignored. All other controls should
+ * by android.sensor.* will be ignored. All other controls should
* work as normal.</p>
* <p>For example, if manual flash is enabled, flash firing should still
* occur (and that the test pattern remain unmodified, since the flash
@@ -2188,7 +2236,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* lens shading map data in android.statistics.lensShadingMap, with size specified
* by android.lens.info.shadingMapSize; the returned shading map data will be the one
* applied by the camera device for this capture request.</p>
- * <p>The shading map data may depend on the AE and AWB statistics, therefore the reliability
+ * <p>The shading map data may depend on the auto-exposure (AE) and AWB statistics, therefore the reliability
* of the map data may be affected by the AE and AWB algorithms. When AE and AWB are in
* AUTO modes({@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} <code>!=</code> OFF and {@link CaptureRequest#CONTROL_AWB_MODE android.control.awbMode} <code>!=</code> OFF),
* to get best results, it is recommended that the applications wait for the AE and AWB to
@@ -2205,8 +2253,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.shading.mode", int.class);
/**
- * <p>State of the face detector
- * unit</p>
+ * <p>Control for the face detector
+ * unit.</p>
* <p>Whether face detection is enabled, and whether it
* should output just the basic fields or the full set of
* fields. Value must be one of the
@@ -2221,9 +2269,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
new Key<Integer>("android.statistics.faceDetectMode", int.class);
/**
- * <p>List of unique IDs for detected
- * faces</p>
- * <p>Only available if faceDetectMode == FULL</p>
+ * <p>List of unique IDs for detected faces.</p>
+ * <p>Each detected face is given a unique ID that is valid for as long as the face is visible
+ * to the camera device. A face that leaves the field of view and later returns may be
+ * assigned a new ID.</p>
+ * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL</p>
+ *
+ * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
* @hide
*/
public static final Key<int[]> STATISTICS_FACE_IDS =
@@ -2231,8 +2283,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>List of landmarks for detected
- * faces</p>
- * <p>Only available if faceDetectMode == FULL</p>
+ * faces.</p>
+ * <p>The coordinate system is that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
+ * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
+ * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} == FULL</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
* @hide
*/
public static final Key<int[]> STATISTICS_FACE_LANDMARKS =
@@ -2240,8 +2297,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>List of the bounding rectangles for detected
- * faces</p>
- * <p>Only available if faceDetectMode != OFF</p>
+ * faces.</p>
+ * <p>The coordinate system is that of {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}, with
+ * <code>(0, 0)</code> being the top-left pixel of the active array.</p>
+ * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF</p>
+ *
+ * @see CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE
+ * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
* @hide
*/
public static final Key<android.graphics.Rect[]> STATISTICS_FACE_RECTANGLES =
@@ -2250,8 +2312,9 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>List of the face confidence scores for
* detected faces</p>
- * <p>Only available if faceDetectMode != OFF. The value should be
- * meaningful (for example, setting 100 at all times is illegal).</p>
+ * <p>Only available if {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE android.statistics.faceDetectMode} != OFF.</p>
+ *
+ * @see CaptureRequest#STATISTICS_FACE_DETECT_MODE
* @hide
*/
public static final Key<byte[]> STATISTICS_FACE_SCORES =
@@ -2370,7 +2433,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* applied to that frame.</p>
* <p>The 4 channel gains are defined in Bayer domain,
* see {@link CaptureRequest#COLOR_CORRECTION_GAINS android.colorCorrection.gains} for details.</p>
- * <p>This value should always be calculated by the AWB block,
+ * <p>This value should always be calculated by the auto-white balance (AWB) block,
* regardless of the android.control.* current values.</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
*
@@ -2396,7 +2459,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* that frame.</p>
* <p>These estimates must be provided for all frames, even if
* capture settings and color transforms are set by the application.</p>
- * <p>This value should always be calculated by the AWB block,
+ * <p>This value should always be calculated by the auto-white balance (AWB) block,
* regardless of the android.control.* current values.</p>
* <p><b>Optional</b> - This value may be {@code null} on some devices.</p>
* @deprecated
@@ -2415,12 +2478,13 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* The camera device uses this entry to tell the application what the scene
* illuminant frequency is.</p>
* <p>When manual exposure control is enabled
- * (<code>{@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} == OFF</code> or <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} == OFF</code>),
- * the {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} doesn't do the antibanding, and the
- * application can ensure it selects exposure times that do not cause banding
- * issues by looking into this metadata field. See {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode}
- * for more details.</p>
- * <p>Report NONE if there doesn't appear to be flickering illumination.</p>
+ * (<code>{@link CaptureRequest#CONTROL_AE_MODE android.control.aeMode} == OFF</code> or <code>{@link CaptureRequest#CONTROL_MODE android.control.mode} ==
+ * OFF</code>), the {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} doesn't perform
+ * antibanding, and the application can ensure it selects
+ * exposure times that do not cause banding issues by looking
+ * into this metadata field. See
+ * {@link CaptureRequest#CONTROL_AE_ANTIBANDING_MODE android.control.aeAntibandingMode} for more details.</p>
+ * <p>Reports NONE if there doesn't appear to be flickering illumination.</p>
*
* @see CaptureRequest#CONTROL_AE_ANTIBANDING_MODE
* @see CaptureRequest#CONTROL_AE_MODE
@@ -2435,7 +2499,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
/**
* <p>Operating mode for hotpixel map generation.</p>
* <p>If set to ON, a hotpixel map is returned in {@link CaptureResult#STATISTICS_HOT_PIXEL_MAP android.statistics.hotPixelMap}.
- * If set to OFF, no hotpixel map should be returned.</p>
+ * If set to OFF, no hotpixel map will be returned.</p>
* <p>This must be set to a valid mode from {@link CameraCharacteristics#STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES android.statistics.info.availableHotPixelMapModes}.</p>
*
* @see CaptureResult#STATISTICS_HOT_PIXEL_MAP
@@ -2463,7 +2527,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> {
* <p>Whether the camera device will output the lens
* shading map in output result metadata.</p>
* <p>When set to ON,
- * android.statistics.lensShadingMap must be provided in
+ * android.statistics.lensShadingMap will be provided in
* the output result metadata.</p>
* @see #STATISTICS_LENS_SHADING_MAP_MODE_OFF
* @see #STATISTICS_LENS_SHADING_MAP_MODE_ON
diff --git a/core/java/android/hardware/camera2/package.html b/core/java/android/hardware/camera2/package.html
index 9f6c2a9..ef0d7bd 100644
--- a/core/java/android/hardware/camera2/package.html
+++ b/core/java/android/hardware/camera2/package.html
@@ -34,49 +34,71 @@ framerate on most Android devices.</p>
CameraDevices} provide a set of static property information that
describes the hardware device and the available settings and output
parameters for the device. This information is provided through the
-{@link android.hardware.camera2.CameraCharacteristics} object.</p>
+{@link android.hardware.camera2.CameraCharacteristics} object, and is
+available through {@link
+android.hardware.camera2.CameraManager#getCameraCharacteristics}</p>
<p>To capture or stream images from a camera device, the application
-must first configure a set of output Surfaces for use with the camera
-device, with {@link
-android.hardware.camera2.CameraDevice#configureOutputs}. Each
-Surface has to be pre-configured with an appropriate size and format
-(if applicable) to match the sizes and formats available from the
-camera device. A target Surface can be obtained from a variety of
-classes, including {@link android.view.SurfaceView}, {@link
-android.graphics.SurfaceTexture} via {@link
-android.view.Surface#Surface(SurfaceTexture), {@link
-android.media.MediaCodec}, and {@link android.media.ImageReader}.
+must first create a {@link
+android.hardware.camera2.CameraCaptureSession camera capture session}
+with a set of output Surfaces for use with the camera device, with
+{@link
+android.hardware.camera2.CameraDevice#createCaptureSession}. Each
+Surface has to be pre-configured with an {@link
+android.hardware.camera2.params.StreamConfigurationMap appropriate
+size and format} (if applicable) to match the sizes and formats
+available from the camera device. A target Surface can be obtained
+from a variety of classes, including {@link android.view.SurfaceView},
+{@link android.graphics.SurfaceTexture} via
+{@link android.view.Surface#Surface(SurfaceTexture)},
+{@link android.media.MediaCodec}, {@link android.media.MediaRecorder},
+{@link android.renderscript.Allocation}, and {@link android.media.ImageReader}.
</p>
+<p>Generally, camera preview images are sent to {@link
+android.view.SurfaceView} or {@link android.view.TextureView} (via its
+{@link android.graphics.SurfaceTexture}). Capture of JPEG images or
+RAW buffers for {@link android.hardware.camera2.DngCreator} can be done
+with {@link android.media.ImageReader} with the
+{android.graphics.ImageFormat#JPEG} and
+{android.graphics.ImageFormat#RAW_SENSOR} formats. Application-driven
+processing of camera data in RenderScript, OpenGL ES, or directly in
+managed or native code is best done through {@link
+android.renderscript.Allocation} with a YUV {@link
+android.renderscript.Type}, {@link android.graphics.SurfaceTexture},
+and {@link android.media.ImageReader} with a
+{android.graphics.ImageFormat#YUV_420_888} format, respectively.</p>
+
<p>The application then needs to construct a {@link
android.hardware.camera2.CaptureRequest}, which defines all the
capture parameters needed by a camera device to capture a single
image. The request also lists which of the configured output Surfaces
should be used as targets for this capture. The CameraDevice has a
{@link android.hardware.camera2.CameraDevice#createCaptureRequest
-convenience factory method} for creating a request for a given use
-case which is optimized for the Android device the application is
-running on.</p>
+factory method} for creating a {@link
+android.hardware.camera2.CaptureRequest.Builder request builder} for a
+given use case, which is optimized for the Android device the
+application is running on.</p>
-<p>Once the request has been set up, it can be handed to the
-CameraDevice either for a one-shot {@link
-android.hardware.camera2.CameraDevice#capture} or for an endlessly
-{@link android.hardware.camera2.CameraDevice#setRepeatingRequest
-repeating} use. Both methods also accept a list of requests to use as
-a burst capture / repeating burst. Repeating requests have a lower
-priority than captures, so a request submitted
+<p>Once the request has been set up, it can be handed to the active
+capture session either for a one-shot {@link
+android.hardware.camera2.CameraCaptureSession#capture capture} or for
+an endlessly {@link
+android.hardware.camera2.CameraCaptureSession#setRepeatingRequest
+repeating} use. Both methods also have a variant that accepts a list
+of requests to use as a burst capture / repeating burst. Repeating
+requests have a lower priority than captures, so a request submitted
through <code>capture()</code> while there's a repeating request
-configured will be captured as soon as the current repeat (burst)
-capture completes.</p>
+configured will be captured before any new instances of the currently
+repeating (burst) capture will begin capture.</p>
<p>After processing a request, the camera device will produce a {@link
-android.hardware.camera2.CaptureResult} object, which contains
+android.hardware.camera2.TotalCaptureResult} object, which contains
information about the state of the camera device at time of capture,
and the final settings used. These may vary somewhat from the request,
if rounding or resolving contradictory parameters was necessary. The
camera device will also send a frame of image data into each of the
-output streams included in the request. These are produced
+output {@code Surfaces} included in the request. These are produced
asynchronously relative to the output CaptureResult, sometimes
substantially later.</p>
diff --git a/core/java/android/hardware/camera2/params/StreamConfiguration.java b/core/java/android/hardware/camera2/params/StreamConfiguration.java
index 1c6b6e9..a6fc10f 100644
--- a/core/java/android/hardware/camera2/params/StreamConfiguration.java
+++ b/core/java/android/hardware/camera2/params/StreamConfiguration.java
@@ -28,8 +28,9 @@ import android.util.Size;
/**
* Immutable class to store the available stream
- * {@link CameraCharacteristics#SCALER_AVAILABLE_STREAM_CONFIGURATIONS configurations} to be used
- * when configuring streams with {@link CameraDevice#configureOutputs}.
+ * {@link CameraCharacteristics#SCALER_AVAILABLE_STREAM_CONFIGURATIONS configurations} to set up
+ * {@link android.view.Surface Surfaces} for creating a {@link CameraCaptureSession capture session}
+ * with {@link CameraDevice#createCaptureSession}.
* <!-- TODO: link to input stream configuration -->
*
* <p>This is the authoritative list for all input/output formats (and sizes respectively
@@ -124,7 +125,7 @@ public final class StreamConfiguration {
*
* @return {@code true} if output configuration, {@code false} otherwise
*
- * @see CameraDevice#configureOutputs
+ * @see CameraDevice#createCaptureSession
*/
public boolean isOutput() {
return !mInput;
diff --git a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
index 4cd6d15..3036425 100644
--- a/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
+++ b/core/java/android/hardware/camera2/params/StreamConfigurationMap.java
@@ -34,8 +34,10 @@ import static com.android.internal.util.Preconditions.*;
/**
* Immutable class to store the available stream
- * {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP configurations} to be used
- * when configuring streams with {@link CameraDevice#configureOutputs}.
+ * {@link CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP configurations} to set up
+ * {@link android.view.Surface Surfaces} for creating a
+ * {@link android.hardware.camera2.CameraCaptureSession capture session} with
+ * {@link android.hardware.camera2.CameraDevice#createCaptureSession}.
* <!-- TODO: link to input stream configuration -->
*
* <p>This is the authoritative list for all <!-- input/ -->output formats (and sizes respectively
@@ -56,7 +58,7 @@ import static com.android.internal.util.Preconditions.*;
* }</code></pre>
*
* @see CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP
- * @see CameraDevice#configureOutputs
+ * @see CameraDevice#createCaptureSession
*/
public final class StreamConfigurationMap {
@@ -155,8 +157,8 @@ public final class StreamConfigurationMap {
}
/**
- * Determine whether or not output streams can be
- * {@link CameraDevice#configureOutputs configured} with a particular user-defined format.
+ * Determine whether or not output surfaces with a particular user-defined format can be passed
+ * {@link CameraDevice#createCaptureSession createCaptureSession}.
*
* <p>This method determines that the output {@code format} is supported by the camera device;
* each output {@code surface} target may or may not itself support that {@code format}.
@@ -168,7 +170,7 @@ public final class StreamConfigurationMap {
* @param format an image format from either {@link ImageFormat} or {@link PixelFormat}
* @return
* {@code true} iff using a {@code surface} with this {@code format} will be
- * supported with {@link CameraDevice#configureOutputs}
+ * supported with {@link CameraDevice#createCaptureSession}
*
* @throws IllegalArgumentException
* if the image format was not a defined named constant
@@ -176,7 +178,7 @@ public final class StreamConfigurationMap {
*
* @see ImageFormat
* @see PixelFormat
- * @see CameraDevice#configureOutputs
+ * @see CameraDevice#createCaptureSession
*/
public boolean isOutputSupportedFor(int format) {
checkArgumentFormat(format);
@@ -210,7 +212,7 @@ public final class StreamConfigurationMap {
*
* <p>Generally speaking this means that creating a {@link Surface} from that class <i>may</i>
* provide a producer endpoint that is suitable to be used with
- * {@link CameraDevice#configureOutputs}.</p>
+ * {@link CameraDevice#createCaptureSession}.</p>
*
* <p>Since not all of the above classes support output of all format and size combinations,
* the particular combination should be queried with {@link #isOutputSupportedFor(Surface)}.</p>
@@ -220,7 +222,7 @@ public final class StreamConfigurationMap {
*
* @throws NullPointerException if {@code klass} was {@code null}
*
- * @see CameraDevice#configureOutputs
+ * @see CameraDevice#createCaptureSession
* @see #isOutputSupportedFor(Surface)
*/
public static <T> boolean isOutputSupportedFor(Class<T> klass) {
@@ -244,8 +246,8 @@ public final class StreamConfigurationMap {
}
/**
- * Determine whether or not the {@code surface} in its current state is suitable to be
- * {@link CameraDevice#configureOutputs configured} as an output.
+ * Determine whether or not the {@code surface} in its current state is suitable to be included
+ * in a {@link CameraDevice#createCaptureSession capture session} as an output.
*
* <p>Not all surfaces are usable with the {@link CameraDevice}, and not all configurations
* of that {@code surface} are compatible. Some classes that provide the {@code surface} are
@@ -269,7 +271,7 @@ public final class StreamConfigurationMap {
*
* @throws NullPointerException if {@code surface} was {@code null}
*
- * @see CameraDevice#configureOutputs
+ * @see CameraDevice#createCaptureSession
* @see #isOutputSupportedFor(Class)
*/
public boolean isOutputSupportedFor(Surface surface) {
diff --git a/core/java/android/net/RouteInfo.java b/core/java/android/net/RouteInfo.java
index af27e1d..8b42bcd 100644
--- a/core/java/android/net/RouteInfo.java
+++ b/core/java/android/net/RouteInfo.java
@@ -361,7 +361,7 @@ public class RouteInfo implements Parcelable {
RouteInfo target = (RouteInfo) obj;
- return Objects.equals(mDestination, target.getDestination()) &&
+ return Objects.equals(mDestination, target.getDestinationLinkAddress()) &&
Objects.equals(mGateway, target.getGateway()) &&
Objects.equals(mInterface, target.getInterface());
}
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index fa85903..3853003 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -156,8 +156,8 @@ public class Browser {
* @param title Title for the bookmark. Can be null or empty string.
* @param url Url for the bookmark. Can be null or empty string.
*/
- public static final void saveBookmark(Context c,
- String title,
+ public static final void saveBookmark(Context c,
+ String title,
String url) {
Intent i = new Intent(Intent.ACTION_INSERT, Browser.BOOKMARKS_URI);
i.putExtra("title", title);
@@ -234,10 +234,10 @@ public class Browser {
*
* @param cr The ContentResolver used to access the database.
*/
- public static final Cursor getAllBookmarks(ContentResolver cr) throws
+ public static final Cursor getAllBookmarks(ContentResolver cr) throws
IllegalStateException {
return cr.query(Bookmarks.CONTENT_URI,
- new String[] { Bookmarks.URL },
+ new String[] { Bookmarks.URL },
Bookmarks.IS_FOLDER + " = 0", null, null);
}
@@ -398,24 +398,17 @@ public class Browser {
// TODO make a single request to the provider to do this in a single transaction
Cursor cursor = null;
try {
-
+
// Select non-bookmark history, ordered by date
cursor = cr.query(History.CONTENT_URI,
new String[] { History._ID, History.URL, History.DATE_LAST_VISITED },
null, null, History.DATE_LAST_VISITED + " ASC");
if (cursor.moveToFirst() && cursor.getCount() >= MAX_HISTORY_COUNT) {
- WebIconDatabase iconDb = null;
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
- iconDb = WebIconDatabase.getInstance();
- }
/* eliminate oldest history items */
for (int i = 0; i < TRUNCATE_N_OLDEST; i++) {
cr.delete(ContentUris.withAppendedId(History.CONTENT_URI, cursor.getLong(0)),
null, null);
- if (iconDb != null) {
- iconDb.releaseIconForPageUrl(cursor.getString(1));
- }
if (!cursor.moveToNext()) break;
}
}
@@ -475,18 +468,6 @@ public class Browser {
cursor = cr.query(History.CONTENT_URI, new String[] { History.URL }, whereClause,
null, null);
if (cursor.moveToFirst()) {
- WebIconDatabase iconDb = null;
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
- iconDb = WebIconDatabase.getInstance();
- }
- do {
- // Delete favicons
- // TODO don't release if the URL is bookmarked
- if (iconDb != null) {
- iconDb.releaseIconForPageUrl(cursor.getString(0));
- }
- } while (cursor.moveToNext());
-
cr.delete(History.CONTENT_URI, whereClause, null);
}
} catch (IllegalStateException e) {
@@ -531,7 +512,7 @@ public class Browser {
* @param cr The ContentResolver used to access the database.
* @param url url to remove.
*/
- public static final void deleteFromHistory(ContentResolver cr,
+ public static final void deleteFromHistory(ContentResolver cr,
String url) {
cr.delete(History.CONTENT_URI, History.URL + "=?", new String[] { url });
}
@@ -565,7 +546,7 @@ public class Browser {
Log.e(LOGTAG, "clearSearches", e);
}
}
-
+
/**
* Request all icons from the database. This call must either be called
* in the main thread or have had Looper.prepare() invoked in the calling
@@ -574,14 +555,12 @@ public class Browser {
* @param cr The ContentResolver used to access the database.
* @param where Clause to be used to limit the query from the database.
* Must be an allowable string to be passed into a database query.
- * @param listener IconListener that gets the icons once they are
+ * @param listener IconListener that gets the icons once they are
* retrieved.
*/
public static final void requestAllIcons(ContentResolver cr, String where,
WebIconDatabase.IconListener listener) {
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
- WebIconDatabase.getInstance().bulkRequestIconForPageUrl(cr, where, listener);
- }
+ // Do nothing: this is no longer used.
}
/**
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index bec401e..1001677 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -791,6 +791,15 @@ public final class Settings {
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_PAIRING_SETTINGS = "android.settings.PAIRING_SETTINGS";
+ /**
+ * Activity Action: Show battery saver settings.
+ *
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_BATTERY_SAVER_SETTINGS
+ = "android.settings.BATTERY_SAVER_SETTINGS";
+
// End of Intent actions for Settings
/**
@@ -6024,6 +6033,13 @@ public final class Settings {
*/
public static final String LOW_POWER_MODE = "low_power";
+ /**
+ * Battery level [1-99] at which low power mode automatically turns on.
+ * If 0, it will not automatically turn on.
+ * @hide
+ */
+ public static final String LOW_POWER_MODE_TRIGGER_LEVEL = "low_power_trigger_level";
+
/**
* If 1, the activity manager will aggressively finish activities and
* processes as soon as they are no longer needed. If 0, the normal
diff --git a/core/java/android/service/notification/NotificationListenerService.java b/core/java/android/service/notification/NotificationListenerService.java
index fd475cd..8bd0f4d 100644
--- a/core/java/android/service/notification/NotificationListenerService.java
+++ b/core/java/android/service/notification/NotificationListenerService.java
@@ -29,6 +29,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.util.ArrayMap;
import android.util.Log;
import java.util.List;
@@ -54,7 +55,7 @@ public abstract class NotificationListenerService extends Service {
+ "[" + getClass().getSimpleName() + "]";
private INotificationListenerWrapper mWrapper = null;
- private Ranking mRanking;
+ private RankingMap mRankingMap;
private INotificationManager mNoMan;
@@ -75,7 +76,43 @@ public abstract class NotificationListenerService extends Service {
* object as well as its identifying information (tag and id) and source
* (package name).
*/
- public abstract void onNotificationPosted(StatusBarNotification sbn);
+ public void onNotificationPosted(StatusBarNotification sbn) {
+ // optional
+ }
+
+ /**
+ * Implement this method to learn about new notifications as they are posted by apps.
+ *
+ * @param sbn A data structure encapsulating the original {@link android.app.Notification}
+ * object as well as its identifying information (tag and id) and source
+ * (package name).
+ * @param rankingMap The current ranking map that can be used to retrieve ranking information
+ * for active notifications, including the newly posted one.
+ */
+ public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) {
+ onNotificationPosted(sbn);
+ }
+
+ /**
+ * Implement this method to learn when notifications are removed.
+ * <P>
+ * This might occur because the user has dismissed the notification using system UI (or another
+ * notification listener) or because the app has withdrawn the notification.
+ * <P>
+ * NOTE: The {@link StatusBarNotification} object you receive will be "light"; that is, the
+ * result from {@link StatusBarNotification#getNotification} may be missing some heavyweight
+ * fields such as {@link android.app.Notification#contentView} and
+ * {@link android.app.Notification#largeIcon}. However, all other fields on
+ * {@link StatusBarNotification}, sufficient to match this call with a prior call to
+ * {@link #onNotificationPosted(StatusBarNotification)}, will be intact.
+ *
+ * @param sbn A data structure encapsulating at least the original information (tag and id)
+ * and source (package name) used to post the {@link android.app.Notification} that
+ * was just removed.
+ */
+ public void onNotificationRemoved(StatusBarNotification sbn) {
+ // optional
+ }
/**
* Implement this method to learn when notifications are removed.
@@ -93,8 +130,13 @@ public abstract class NotificationListenerService extends Service {
* @param sbn A data structure encapsulating at least the original information (tag and id)
* and source (package name) used to post the {@link android.app.Notification} that
* was just removed.
+ * @param rankingMap The current ranking map that can be used to retrieve ranking information
+ * for active notifications.
+ *
*/
- public abstract void onNotificationRemoved(StatusBarNotification sbn);
+ public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) {
+ onNotificationRemoved(sbn);
+ }
/**
* Implement this method to learn about when the listener is enabled and connected to
@@ -107,10 +149,11 @@ public abstract class NotificationListenerService extends Service {
/**
* Implement this method to be notified when the notification ranking changes.
- * <P>
- * Call {@link #getCurrentRanking()} to retrieve the new ranking.
+ *
+ * @param rankingMap The current ranking map that can be used to retrieve ranking information
+ * for active notifications.
*/
- public void onNotificationRankingUpdate() {
+ public void onNotificationRankingUpdate(RankingMap rankingMap) {
// optional
}
@@ -241,16 +284,19 @@ public abstract class NotificationListenerService extends Service {
*
* <p>
* The returned object represents the current ranking snapshot and only
- * applies for currently active notifications. Hence you must retrieve a
- * new Ranking after each notification event such as
- * {@link #onNotificationPosted(StatusBarNotification)},
- * {@link #onNotificationRemoved(StatusBarNotification)}, etc.
+ * applies for currently active notifications.
+ * <p>
+ * Generally you should use the RankingMap that is passed with events such
+ * as {@link #onNotificationPosted(StatusBarNotification, RankingMap)},
+ * {@link #onNotificationRemoved(StatusBarNotification, RankingMap)}, and
+ * so on. This method should only be used when needing access outside of
+ * such events, for example to retrieve the RankingMap right after
+ * initialization.
*
- * @return A {@link NotificationListenerService.Ranking} object providing
- * access to ranking information
+ * @return A {@link RankingMap} object providing access to ranking information
*/
- public Ranking getCurrentRanking() {
- return mRanking;
+ public RankingMap getCurrentRanking() {
+ return mRankingMap;
}
@Override
@@ -313,7 +359,7 @@ public abstract class NotificationListenerService extends Service {
synchronized (mWrapper) {
applyUpdate(update);
try {
- NotificationListenerService.this.onNotificationPosted(sbn);
+ NotificationListenerService.this.onNotificationPosted(sbn, mRankingMap);
} catch (Throwable t) {
Log.w(TAG, "Error running onNotificationPosted", t);
}
@@ -326,7 +372,7 @@ public abstract class NotificationListenerService extends Service {
synchronized (mWrapper) {
applyUpdate(update);
try {
- NotificationListenerService.this.onNotificationRemoved(sbn);
+ NotificationListenerService.this.onNotificationRemoved(sbn, mRankingMap);
} catch (Throwable t) {
Log.w(TAG, "Error running onNotificationRemoved", t);
}
@@ -351,7 +397,7 @@ public abstract class NotificationListenerService extends Service {
synchronized (mWrapper) {
applyUpdate(update);
try {
- NotificationListenerService.this.onNotificationRankingUpdate();
+ NotificationListenerService.this.onNotificationRankingUpdate(mRankingMap);
} catch (Throwable t) {
Log.w(TAG, "Error running onNotificationRankingUpdate", t);
}
@@ -360,7 +406,65 @@ public abstract class NotificationListenerService extends Service {
}
private void applyUpdate(NotificationRankingUpdate update) {
- mRanking = new Ranking(update);
+ mRankingMap = new RankingMap(update);
+ }
+
+ /**
+ * Provides access to ranking information on a currently active
+ * notification.
+ *
+ * <p>
+ * Note that this object is not updated on notification events (such as
+ * {@link #onNotificationPosted(StatusBarNotification, RankingMap)},
+ * {@link #onNotificationRemoved(StatusBarNotification)}, etc.). Make sure
+ * to retrieve a new Ranking from the current {@link RankingMap} whenever
+ * a notification event occurs.
+ */
+ public static class Ranking {
+ private final String mKey;
+ private final int mRank;
+ private final boolean mIsAmbient;
+ private final boolean mIsInterceptedByDnd;
+
+ private Ranking(String key, int rank, boolean isAmbient, boolean isInterceptedByDnd) {
+ mKey = key;
+ mRank = rank;
+ mIsAmbient = isAmbient;
+ mIsInterceptedByDnd = isInterceptedByDnd;
+ }
+
+ /**
+ * Returns the key of the notification this Ranking applies to.
+ */
+ public String getKey() {
+ return mKey;
+ }
+
+ /**
+ * Returns the rank of the notification.
+ *
+ * @return the rank of the notification, that is the 0-based index in
+ * the list of active notifications.
+ */
+ public int getRank() {
+ return mRank;
+ }
+
+ /**
+ * Returns whether the notification is an ambient notification, that is
+ * a notification that doesn't require the user's immediate attention.
+ */
+ public boolean isAmbient() {
+ return mIsAmbient;
+ }
+
+ /**
+ * Returns whether the notification was intercepted by
+ * &quot;Do not disturb&quot;.
+ */
+ public boolean isInterceptedByDoNotDisturb() {
+ return mIsInterceptedByDnd;
+ }
}
/**
@@ -371,11 +475,14 @@ public abstract class NotificationListenerService extends Service {
* Note that this object represents a ranking snapshot that only applies to
* notifications active at the time of retrieval.
*/
- public static class Ranking implements Parcelable {
+ public static class RankingMap implements Parcelable {
private final NotificationRankingUpdate mRankingUpdate;
+ private final ArrayMap<String, Ranking> mRankingCache;
+ private boolean mRankingCacheInitialized;
- private Ranking(NotificationRankingUpdate rankingUpdate) {
+ private RankingMap(NotificationRankingUpdate rankingUpdate) {
mRankingUpdate = rankingUpdate;
+ mRankingCache = new ArrayMap<>(rankingUpdate.getOrderedKeys().length);
}
/**
@@ -389,56 +496,37 @@ public abstract class NotificationListenerService extends Service {
}
/**
- * Returns the rank of the notification with the given key, that is the
- * index of <code>key</code> in the array of keys returned by
- * {@link #getOrderedKeys()}.
+ * Returns the Ranking for the notification with the given key.
*
- * @return The rank of the notification with the given key; -1 when the
- * given key is unknown.
+ * @return the Ranking of the notification with the given key;
+ * <code>null</code> when the key is unknown.
*/
- public int getRank(String key) {
- // TODO: Optimize.
- String[] orderedKeys = mRankingUpdate.getOrderedKeys();
- for (int i = 0; i < orderedKeys.length; i++) {
- if (orderedKeys[i].equals(key)) {
- return i;
+ public Ranking getRanking(String key) {
+ synchronized (mRankingCache) {
+ if (!mRankingCacheInitialized) {
+ initializeRankingCache();
+ mRankingCacheInitialized = true;
}
}
- return -1;
+ return mRankingCache.get(key);
}
- /**
- * Returns whether the notification with the given key was intercepted
- * by &quot;Do not disturb&quot;.
- */
- public boolean isInterceptedByDoNotDisturb(String key) {
- // TODO: Optimize.
- for (String interceptedKey : mRankingUpdate.getDndInterceptedKeys()) {
- if (interceptedKey.equals(key)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns whether the notification with the given key is an ambient
- * notification, that is a notification that doesn't require the user's
- * immediate attention.
- */
- public boolean isAmbient(String key) {
- // TODO: Optimize.
- int firstAmbientIndex = mRankingUpdate.getFirstAmbientIndex();
- if (firstAmbientIndex < 0) {
- return false;
- }
+ private void initializeRankingCache() {
String[] orderedKeys = mRankingUpdate.getOrderedKeys();
- for (int i = firstAmbientIndex; i < orderedKeys.length; i++) {
- if (orderedKeys[i].equals(key)) {
- return true;
+ int firstAmbientIndex = mRankingUpdate.getFirstAmbientIndex();
+ for (int i = 0; i < orderedKeys.length; i++) {
+ String key = orderedKeys[i];
+ boolean isAmbient = firstAmbientIndex > -1 && firstAmbientIndex <= i;
+ boolean isInterceptedByDnd = false;
+ // TODO: Optimize.
+ for (String s : mRankingUpdate.getDndInterceptedKeys()) {
+ if (s.equals(key)) {
+ isInterceptedByDnd = true;
+ break;
+ }
}
+ mRankingCache.put(key, new Ranking(key, i, isAmbient, isInterceptedByDnd));
}
- return false;
}
// ----------- Parcelable
@@ -453,16 +541,16 @@ public abstract class NotificationListenerService extends Service {
dest.writeParcelable(mRankingUpdate, flags);
}
- public static final Creator<Ranking> CREATOR = new Creator<Ranking>() {
+ public static final Creator<RankingMap> CREATOR = new Creator<RankingMap>() {
@Override
- public Ranking createFromParcel(Parcel source) {
+ public RankingMap createFromParcel(Parcel source) {
NotificationRankingUpdate rankingUpdate = source.readParcelable(null);
- return new Ranking(rankingUpdate);
+ return new RankingMap(rankingUpdate);
}
@Override
- public Ranking[] newArray(int size) {
- return new Ranking[size];
+ public RankingMap[] newArray(int size) {
+ return new RankingMap[size];
}
};
}
diff --git a/core/java/android/service/voice/DspInfo.java b/core/java/android/service/voice/DspInfo.java
new file mode 100644
index 0000000..0862309
--- /dev/null
+++ b/core/java/android/service/voice/DspInfo.java
@@ -0,0 +1,56 @@
+/*
+ * 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 android.service.voice;
+
+import java.util.UUID;
+
+/**
+ * Properties of the DSP hardware on the device.
+ * @hide
+ */
+public class DspInfo {
+ /**
+ * Unique voice engine Id (changes with each version).
+ */
+ public final UUID voiceEngineId;
+
+ /**
+ * Human readable voice detection engine implementor.
+ */
+ public final String voiceEngineImplementor;
+ /**
+ * Human readable voice detection engine description.
+ */
+ public final String voiceEngineDescription;
+ /**
+ * Human readable voice detection engine version
+ */
+ public final int voiceEngineVersion;
+ /**
+ * Rated power consumption when detection is active.
+ */
+ public final int powerConsumptionMw;
+
+ public DspInfo(UUID voiceEngineId, String voiceEngineImplementor,
+ String voiceEngineDescription, int version, int powerConsumptionMw) {
+ this.voiceEngineId = voiceEngineId;
+ this.voiceEngineImplementor = voiceEngineImplementor;
+ this.voiceEngineDescription = voiceEngineDescription;
+ this.voiceEngineVersion = version;
+ this.powerConsumptionMw = powerConsumptionMw;
+ }
+}
diff --git a/core/java/android/service/voice/KeyphraseEnrollmentInfo.java b/core/java/android/service/voice/KeyphraseEnrollmentInfo.java
new file mode 100644
index 0000000..ebe41ce
--- /dev/null
+++ b/core/java/android/service/voice/KeyphraseEnrollmentInfo.java
@@ -0,0 +1,246 @@
+/*
+ * 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 android.service.voice;
+
+import android.Manifest;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
+import android.util.AttributeSet;
+import android.util.Slog;
+import android.util.Xml;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.List;
+
+/** @hide */
+public class KeyphraseEnrollmentInfo {
+ private static final String TAG = "KeyphraseEnrollmentInfo";
+ /**
+ * Name under which a Hotword enrollment component publishes information about itself.
+ * This meta-data should reference an XML resource containing a
+ * <code>&lt;{@link
+ * android.R.styleable#VoiceEnrollmentApplication
+ * voice-enrollment-application}&gt;</code> tag.
+ */
+ private static final String VOICE_KEYPHRASE_META_DATA = "android.voice_enrollment";
+ /**
+ * Activity Action: Show activity for managing the keyphrases for hotword detection.
+ * This needs to be defined by an activity that supports enrolling users for hotword/keyphrase
+ * detection.
+ */
+ public static final String ACTION_MANAGE_VOICE_KEYPHRASES =
+ "com.android.intent.action.MANAGE_VOICE_KEYPHRASES";
+ /**
+ * Intent extra: The intent extra for un-enrolling a user for a particular keyphrase.
+ */
+ public static final String EXTRA_VOICE_KEYPHRASE_UNENROLL =
+ "com.android.intent.extra.VOICE_KEYPHRASE_UNENROLL";
+ /**
+ * Intent extra: The hint text to be shown on the voice keyphrase management UI.
+ */
+ public static final String EXTRA_VOICE_KEYPHRASE_HINT_TEXT =
+ "com.android.intent.extra.VOICE_KEYPHRASE_HINT_TEXT";
+ /**
+ * Intent extra: The voice locale to use while managing the keyphrase.
+ */
+ public static final String EXTRA_VOICE_KEYPHRASE_LOCALE =
+ "com.android.intent.extra.VOICE_KEYPHRASE_LOCALE";
+
+ private KeyphraseInfo[] mKeyphrases;
+ private String mEnrollmentPackage;
+ private String mParseError;
+
+ public KeyphraseEnrollmentInfo(PackageManager pm) {
+ // Find the apps that supports enrollment for hotword keyhphrases,
+ // Pick a privileged app and obtain the information about the supported keyphrases
+ // from its metadata.
+ List<ResolveInfo> ris = pm.queryIntentActivities(
+ new Intent(ACTION_MANAGE_VOICE_KEYPHRASES), PackageManager.MATCH_DEFAULT_ONLY);
+ if (ris == null || ris.isEmpty()) {
+ // No application capable of enrolling for voice keyphrases is present.
+ mParseError = "No enrollment application found";
+ return;
+ }
+
+ boolean found = false;
+ ApplicationInfo ai = null;
+ for (ResolveInfo ri : ris) {
+ try {
+ ai = pm.getApplicationInfo(
+ ri.activityInfo.packageName, PackageManager.GET_META_DATA);
+ if ((ai.flags & ApplicationInfo.FLAG_PRIVILEGED) == 0) {
+ // The application isn't privileged (/system/priv-app).
+ // The enrollment application needs to be a privileged system app.
+ Slog.w(TAG, ai.packageName + "is not a privileged system app");
+ continue;
+ }
+ if (!Manifest.permission.MANAGE_VOICE_KEYPHRASES.equals(ai.permission)) {
+ // The application trying to manage keyphrases doesn't
+ // require the MANAGE_VOICE_KEYPHRASES permission.
+ Slog.w(TAG, ai.packageName + " does not require MANAGE_VOICE_KEYPHRASES");
+ continue;
+ }
+ mEnrollmentPackage = ai.packageName;
+ found = true;
+ break;
+ } catch (PackageManager.NameNotFoundException e) {
+ Slog.w(TAG, "error parsing voice enrollment meta-data", e);
+ }
+ }
+
+ if (!found) {
+ mKeyphrases = null;
+ mParseError = "No suitable enrollment application found";
+ return;
+ }
+
+ XmlResourceParser parser = null;
+ try {
+ parser = ai.loadXmlMetaData(pm, VOICE_KEYPHRASE_META_DATA);
+ if (parser == null) {
+ mParseError = "No " + VOICE_KEYPHRASE_META_DATA + " meta-data for "
+ + ai.packageName;
+ return;
+ }
+
+ Resources res = pm.getResourcesForApplication(ai);
+ AttributeSet attrs = Xml.asAttributeSet(parser);
+
+ int type;
+ while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
+ && type != XmlPullParser.START_TAG) {
+ }
+
+ String nodeName = parser.getName();
+ if (!"voice-enrollment-application".equals(nodeName)) {
+ mParseError = "Meta-data does not start with voice-enrollment-application tag";
+ return;
+ }
+
+ TypedArray array = res.obtainAttributes(attrs,
+ com.android.internal.R.styleable.VoiceEnrollmentApplication);
+ int searchKeyphraseId = array.getInt(
+ com.android.internal.R.styleable.VoiceEnrollmentApplication_searchKeyphraseId,
+ -1);
+ if (searchKeyphraseId != -1) {
+ String searchKeyphrase = array.getString(com.android.internal.R.styleable
+ .VoiceEnrollmentApplication_searchKeyphrase);
+ String searchKeyphraseSupportedLocales =
+ array.getString(com.android.internal.R.styleable
+ .VoiceEnrollmentApplication_searchKeyphraseSupportedLocales);
+ String[] supportedLocales = new String[0];
+ // Get all the supported locales from the comma-delimted string.
+ if (searchKeyphraseSupportedLocales != null
+ && !searchKeyphraseSupportedLocales.isEmpty()) {
+ supportedLocales = searchKeyphraseSupportedLocales.split(",");
+ }
+ mKeyphrases = new KeyphraseInfo[1];
+ mKeyphrases[0] = new KeyphraseInfo(
+ searchKeyphraseId, searchKeyphrase, supportedLocales);
+ } else {
+ mParseError = "searchKeyphraseId not specified in meta-data";
+ return;
+ }
+ } catch (XmlPullParserException e) {
+ mParseError = "Error parsing keyphrase enrollment meta-data: " + e;
+ Slog.w(TAG, "error parsing keyphrase enrollment meta-data", e);
+ return;
+ } catch (IOException e) {
+ mParseError = "Error parsing keyphrase enrollment meta-data: " + e;
+ Slog.w(TAG, "error parsing keyphrase enrollment meta-data", e);
+ return;
+ } catch (PackageManager.NameNotFoundException e) {
+ mParseError = "Error parsing keyphrase enrollment meta-data: " + e;
+ Slog.w(TAG, "error parsing keyphrase enrollment meta-data", e);
+ return;
+ } finally {
+ if (parser != null) parser.close();
+ }
+ }
+
+ public String getParseError() {
+ return mParseError;
+ }
+
+ /**
+ * @return An array of available keyphrases that can be enrolled on the system.
+ * It may be null if no keyphrases can be enrolled.
+ */
+ public KeyphraseInfo[] getKeyphrases() {
+ return mKeyphrases;
+ }
+
+ /**
+ * Returns an intent to launch an activity that manages the given keyphrase
+ * for the locale.
+ *
+ * @param enroll Indicates if the intent should enroll the user or un-enroll them.
+ * @param keyphrase The keyphrase that the user needs to be enrolled to.
+ * @param locale The locale for which the enrollment needs to be performed.
+ * @return An {@link Intent} to manage the keyphrase. This can be null if managing the
+ * given keyphrase/locale combination isn't possible.
+ */
+ public Intent getManageKeyphraseIntent(boolean enroll, String keyphrase, String locale) {
+ if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
+ Slog.w(TAG, "No enrollment application exists");
+ return null;
+ }
+
+ if (isKeyphraseEnrollmentSupported(keyphrase, locale)) {
+ Intent intent = new Intent(ACTION_MANAGE_VOICE_KEYPHRASES)
+ .setPackage(mEnrollmentPackage)
+ .putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT, keyphrase)
+ .putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE, locale);
+ if (!enroll) intent.putExtra(EXTRA_VOICE_KEYPHRASE_UNENROLL, true);
+ return intent;
+ }
+ return null;
+ }
+
+ /**
+ * Indicates if enrollment is supported for the given keyphrase & locale.
+ *
+ * @param keyphrase The keyphrase that the user needs to be enrolled to.
+ * @param locale The locale for which the enrollment needs to be performed.
+ * @return true, if an enrollment client supports the given keyphrase and the given locale.
+ */
+ public boolean isKeyphraseEnrollmentSupported(String keyphrase, String locale) {
+ if (mKeyphrases == null || mKeyphrases.length == 0) {
+ Slog.w(TAG, "Enrollment application doesn't support keyphrases");
+ return false;
+ }
+ for (KeyphraseInfo keyphraseInfo : mKeyphrases) {
+ // Check if the given keyphrase is supported in the locale provided by
+ // the enrollment application.
+ String supportedKeyphrase = keyphraseInfo.keyphrase;
+ if (supportedKeyphrase.equalsIgnoreCase(keyphrase)
+ && keyphraseInfo.supportedLocales.contains(locale)) {
+ return true;
+ }
+ }
+ Slog.w(TAG, "Enrollment application doesn't support the given keyphrase");
+ return false;
+ }
+}
diff --git a/core/java/android/service/voice/KeyphraseInfo.java b/core/java/android/service/voice/KeyphraseInfo.java
new file mode 100644
index 0000000..d266e1a
--- /dev/null
+++ b/core/java/android/service/voice/KeyphraseInfo.java
@@ -0,0 +1,27 @@
+package android.service.voice;
+
+import android.util.ArraySet;
+
+/**
+ * A Voice Keyphrase.
+ * @hide
+ */
+public class KeyphraseInfo {
+ public final int id;
+ public final String keyphrase;
+ public final ArraySet<String> supportedLocales;
+
+ public KeyphraseInfo(int id, String keyphrase, String[] supportedLocales) {
+ this.id = id;
+ this.keyphrase = keyphrase;
+ this.supportedLocales = new ArraySet<String>(supportedLocales.length);
+ for (String locale : supportedLocales) {
+ this.supportedLocales.add(locale);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "id=" + id + ", keyphrase=" + keyphrase + ", supported-locales=" + supportedLocales;
+ }
+}
diff --git a/core/java/android/service/voice/SoundTriggerManager.java b/core/java/android/service/voice/SoundTriggerManager.java
new file mode 100644
index 0000000..2d049b9
--- /dev/null
+++ b/core/java/android/service/voice/SoundTriggerManager.java
@@ -0,0 +1,73 @@
+/*
+ * 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 android.service.voice;
+
+import android.hardware.soundtrigger.SoundTrigger;
+import android.hardware.soundtrigger.SoundTrigger.ModuleProperties;
+
+import java.util.ArrayList;
+
+/**
+ * Manager for {@link SoundTrigger} APIs.
+ * Currently this just acts as an abstraction over all SoundTrigger API calls.
+ * @hide
+ */
+public class SoundTriggerManager {
+ /** The {@link DspInfo} for the system, or null if none exists. */
+ public DspInfo dspInfo;
+
+ public SoundTriggerManager() {
+ ArrayList <ModuleProperties> modules = new ArrayList<>();
+ int status = SoundTrigger.listModules(modules);
+ if (status != SoundTrigger.STATUS_OK || modules.size() == 0) {
+ // TODO(sansid, elaurent): Figure out how to handle errors in listing the modules here.
+ dspInfo = null;
+ } else {
+ // TODO(sansid, elaurent): Figure out how to determine which module corresponds to the
+ // DSP hardware.
+ ModuleProperties properties = modules.get(0);
+ dspInfo = new DspInfo(properties.uuid, properties.implementor, properties.description,
+ properties.version, properties.powerConsumptionMw);
+ }
+ }
+
+ /**
+ * @return True, if the keyphrase is supported on DSP for the given locale.
+ */
+ public boolean isKeyphraseSupported(String keyphrase, String locale) {
+ // TODO(sansid): We also need to look into a SoundTrigger API that let's us
+ // query this. For now just return supported if there's a DSP available.
+ return dspInfo != null;
+ }
+
+ /**
+ * @return True, if the keyphrase is has been enrolled for the given locale.
+ */
+ public boolean isKeyphraseEnrolled(String keyphrase, String locale) {
+ // TODO(sansid, elaurent): Query SoundTrigger to list currently loaded sound models.
+ // They have been enrolled.
+ return false;
+ }
+
+ /**
+ * @return True, if a recognition for the keyphrase is active for the given locale.
+ */
+ public boolean isKeyphraseActive(String keyphrase, String locale) {
+ // TODO(sansid, elaurent): Check if the recognition for the keyphrase is currently active.
+ return false;
+ }
+}
diff --git a/core/java/android/service/voice/VoiceInteractionService.java b/core/java/android/service/voice/VoiceInteractionService.java
index e15489b..e0329f8 100644
--- a/core/java/android/service/voice/VoiceInteractionService.java
+++ b/core/java/android/service/voice/VoiceInteractionService.java
@@ -17,7 +17,6 @@
package android.service.voice;
import android.annotation.SdkConstant;
-import android.app.Instrumentation;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
@@ -25,8 +24,11 @@ import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
+
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IVoiceInteractionManagerService;
+
/**
* Top-level service of the current global voice interactor, which is providing
* support for hotwording, the back-end of a {@link android.app.VoiceInteractor}, etc.
@@ -51,6 +53,16 @@ public class VoiceInteractionService extends Service {
public static final String SERVICE_INTERFACE =
"android.service.voice.VoiceInteractionService";
+ // TODO(sansid): Unhide these.
+ /** @hide */
+ public static final int KEYPHRASE_UNAVAILABLE = 0;
+ /** @hide */
+ public static final int KEYPHRASE_UNENROLLED = 1;
+ /** @hide */
+ public static final int KEYPHRASE_ENROLLED = 2;
+ /** @hide */
+ public static final int KEYPHRASE_ACTIVE = 3;
+
/**
* Name under which a VoiceInteractionService component publishes information about itself.
* This meta-data should reference an XML resource containing a
@@ -64,6 +76,9 @@ public class VoiceInteractionService extends Service {
IVoiceInteractionManagerService mSystemService;
+ private SoundTriggerManager mSoundTriggerManager;
+ private KeyphraseEnrollmentInfo mKeyphraseEnrollmentInfo;
+
public void startSession(Bundle args) {
try {
mSystemService.startSession(mInterface, args);
@@ -76,6 +91,8 @@ public class VoiceInteractionService extends Service {
super.onCreate();
mSystemService = IVoiceInteractionManagerService.Stub.asInterface(
ServiceManager.getService(Context.VOICE_INTERACTION_MANAGER_SERVICE));
+ mKeyphraseEnrollmentInfo = new KeyphraseEnrollmentInfo(getPackageManager());
+ mSoundTriggerManager = new SoundTriggerManager();
}
@Override
@@ -85,4 +102,44 @@ public class VoiceInteractionService extends Service {
}
return null;
}
+
+ /**
+ * Gets the state of always-on hotword detection for the given keyphrase and locale
+ * on this system.
+ * Availability implies that the hardware on this system is capable of listening for
+ * the given keyphrase or not.
+ * The return code is one of {@link #KEYPHRASE_UNAVAILABLE}, {@link #KEYPHRASE_UNENROLLED}
+ * {@link #KEYPHRASE_ENROLLED} or {@link #KEYPHRASE_ACTIVE}.
+ *
+ * @param keyphrase The keyphrase whose availability is being checked.
+ * @param locale The locale for which the availability is being checked.
+ * @return Indicates if always-on hotword detection is available for the given keyphrase.
+ * TODO(sansid): Unhide this.
+ * @hide
+ */
+ public final int getAlwaysOnKeyphraseAvailability(String keyphrase, String locale) {
+ // The available keyphrases is a combination of DSP availability and
+ // the keyphrases that have an enrollment application for them.
+ if (!mSoundTriggerManager.isKeyphraseSupported(keyphrase, locale)
+ || !mKeyphraseEnrollmentInfo.isKeyphraseEnrollmentSupported(keyphrase, locale)) {
+ return KEYPHRASE_UNAVAILABLE;
+ }
+ if (!mSoundTriggerManager.isKeyphraseEnrolled(keyphrase, locale)) {
+ return KEYPHRASE_UNENROLLED;
+ }
+ if (!mSoundTriggerManager.isKeyphraseActive(keyphrase, locale)) {
+ return KEYPHRASE_ENROLLED;
+ } else {
+ return KEYPHRASE_ACTIVE;
+ }
+ }
+
+ /**
+ * @return Details of keyphrases available for enrollment.
+ * @hide
+ */
+ @VisibleForTesting
+ protected final KeyphraseEnrollmentInfo getKeyphraseEnrollmentInfo() {
+ return mKeyphraseEnrollmentInfo;
+ }
}
diff --git a/core/java/android/speech/tts/RequestConfig.java b/core/java/android/speech/tts/RequestConfig.java
index 4b5385f..84880c0 100644
--- a/core/java/android/speech/tts/RequestConfig.java
+++ b/core/java/android/speech/tts/RequestConfig.java
@@ -1,3 +1,18 @@
+/*
+ * 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 android.speech.tts;
import android.media.AudioManager;
diff --git a/core/java/android/speech/tts/RequestConfigHelper.java b/core/java/android/speech/tts/RequestConfigHelper.java
index b25c985..3b5490b 100644
--- a/core/java/android/speech/tts/RequestConfigHelper.java
+++ b/core/java/android/speech/tts/RequestConfigHelper.java
@@ -1,3 +1,18 @@
+/*
+ * 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 android.speech.tts;
import android.speech.tts.TextToSpeechClient.EngineStatus;
diff --git a/core/java/android/speech/tts/SynthesisRequestV2.java b/core/java/android/speech/tts/SynthesisRequestV2.java
index 130e3f9..a42aa16 100644
--- a/core/java/android/speech/tts/SynthesisRequestV2.java
+++ b/core/java/android/speech/tts/SynthesisRequestV2.java
@@ -1,3 +1,18 @@
+/*
+ * 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 android.speech.tts;
import android.os.Bundle;
diff --git a/core/java/android/speech/tts/VoiceInfo.java b/core/java/android/speech/tts/VoiceInfo.java
index 16b9a97..71629dc 100644
--- a/core/java/android/speech/tts/VoiceInfo.java
+++ b/core/java/android/speech/tts/VoiceInfo.java
@@ -1,3 +1,18 @@
+/*
+ * 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 android.speech.tts;
import android.os.Bundle;
diff --git a/core/java/android/text/util/Linkify.java b/core/java/android/text/util/Linkify.java
index deb138d..c1341e1 100644
--- a/core/java/android/text/util/Linkify.java
+++ b/core/java/android/text/util/Linkify.java
@@ -465,32 +465,39 @@ public class Linkify {
String address;
int base = 0;
- while ((address = WebView.findAddress(string)) != null) {
- int start = string.indexOf(address);
+ try {
+ while ((address = WebView.findAddress(string)) != null) {
+ int start = string.indexOf(address);
- if (start < 0) {
- break;
- }
+ if (start < 0) {
+ break;
+ }
- LinkSpec spec = new LinkSpec();
- int length = address.length();
- int end = start + length;
-
- spec.start = base + start;
- spec.end = base + end;
- string = string.substring(end);
- base += end;
-
- String encodedAddress = null;
-
- try {
- encodedAddress = URLEncoder.encode(address,"UTF-8");
- } catch (UnsupportedEncodingException e) {
- continue;
- }
+ LinkSpec spec = new LinkSpec();
+ int length = address.length();
+ int end = start + length;
- spec.url = "geo:0,0?q=" + encodedAddress;
- links.add(spec);
+ spec.start = base + start;
+ spec.end = base + end;
+ string = string.substring(end);
+ base += end;
+
+ String encodedAddress = null;
+
+ try {
+ encodedAddress = URLEncoder.encode(address,"UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ continue;
+ }
+
+ spec.url = "geo:0,0?q=" + encodedAddress;
+ links.add(spec);
+ }
+ } catch (UnsupportedOperationException e) {
+ // findAddress may fail with an unsupported exception on platforms without a WebView.
+ // In this case, we will not append anything to the links variable: it would have died
+ // in WebView.findAddress.
+ return;
}
}
diff --git a/core/java/android/transition/Transition.java b/core/java/android/transition/Transition.java
index e9c2bba..0a4f641 100644
--- a/core/java/android/transition/Transition.java
+++ b/core/java/android/transition/Transition.java
@@ -603,76 +603,76 @@ public abstract class Transition implements Cloneable {
for (int i = 0; i < startValuesList.size(); ++i) {
TransitionValues start = startValuesList.get(i);
TransitionValues end = endValuesList.get(i);
- // Only bother trying to animate with values that differ between start/end
- if (start != null || end != null) {
- if (start == null || !start.equals(end)) {
- if (DBG) {
- View view = (end != null) ? end.view : start.view;
- Log.d(LOG_TAG, " differing start/end values for view " +
- view);
- if (start == null || end == null) {
- Log.d(LOG_TAG, " " + ((start == null) ?
- "start null, end non-null" : "start non-null, end null"));
- } else {
- for (String key : start.values.keySet()) {
- Object startValue = start.values.get(key);
- Object endValue = end.values.get(key);
- if (startValue != endValue && !startValue.equals(endValue)) {
- Log.d(LOG_TAG, " " + key + ": start(" + startValue +
- "), end(" + endValue +")");
- }
+ // Only bother trying to animate with valid values that differ between start/end
+ boolean isInvalidStart = start != null && !isValidTarget(start.view);
+ boolean isInvalidEnd = end != null && !isValidTarget(end.view);
+ boolean isChanged = start != end && (start == null || !start.equals(end));
+ if (isChanged && !isInvalidStart && !isInvalidEnd) {
+ if (DBG) {
+ View view = (end != null) ? end.view : start.view;
+ Log.d(LOG_TAG, " differing start/end values for view " + view);
+ if (start == null || end == null) {
+ Log.d(LOG_TAG, " " + ((start == null) ?
+ "start null, end non-null" : "start non-null, end null"));
+ } else {
+ for (String key : start.values.keySet()) {
+ Object startValue = start.values.get(key);
+ Object endValue = end.values.get(key);
+ if (startValue != endValue && !startValue.equals(endValue)) {
+ Log.d(LOG_TAG, " " + key + ": start(" + startValue +
+ "), end(" + endValue + ")");
}
}
}
- // TODO: what to do about targetIds and itemIds?
- Animator animator = createAnimator(sceneRoot, start, end);
- if (animator != null) {
- // Save animation info for future cancellation purposes
- View view = null;
- TransitionValues infoValues = null;
- if (end != null) {
- view = end.view;
- String[] properties = getTransitionProperties();
- if (view != null && properties != null && properties.length > 0) {
- infoValues = new TransitionValues();
- infoValues.view = view;
- TransitionValues newValues = endValues.viewValues.get(view);
- if (newValues != null) {
- for (int j = 0; j < properties.length; ++j) {
- infoValues.values.put(properties[j],
- newValues.values.get(properties[j]));
- }
+ }
+ // TODO: what to do about targetIds and itemIds?
+ Animator animator = createAnimator(sceneRoot, start, end);
+ if (animator != null) {
+ // Save animation info for future cancellation purposes
+ View view = null;
+ TransitionValues infoValues = null;
+ if (end != null) {
+ view = end.view;
+ String[] properties = getTransitionProperties();
+ if (view != null && properties != null && properties.length > 0) {
+ infoValues = new TransitionValues();
+ infoValues.view = view;
+ TransitionValues newValues = endValues.viewValues.get(view);
+ if (newValues != null) {
+ for (int j = 0; j < properties.length; ++j) {
+ infoValues.values.put(properties[j],
+ newValues.values.get(properties[j]));
}
- int numExistingAnims = runningAnimators.size();
- for (int j = 0; j < numExistingAnims; ++j) {
- Animator anim = runningAnimators.keyAt(j);
- AnimationInfo info = runningAnimators.get(anim);
- if (info.values != null && info.view == view &&
- ((info.name == null && getName() == null) ||
- info.name.equals(getName()))) {
- if (info.values.equals(infoValues)) {
- // Favor the old animator
- animator = null;
- break;
- }
+ }
+ int numExistingAnims = runningAnimators.size();
+ for (int j = 0; j < numExistingAnims; ++j) {
+ Animator anim = runningAnimators.keyAt(j);
+ AnimationInfo info = runningAnimators.get(anim);
+ if (info.values != null && info.view == view &&
+ ((info.name == null && getName() == null) ||
+ info.name.equals(getName()))) {
+ if (info.values.equals(infoValues)) {
+ // Favor the old animator
+ animator = null;
+ break;
}
}
}
- } else {
- view = (start != null) ? start.view : null;
}
- if (animator != null) {
- if (mPropagation != null) {
- long delay = mPropagation
- .getStartDelay(sceneRoot, this, start, end);
- startDelays.put(mAnimators.size(), delay);
- minStartDelay = Math.min(delay, minStartDelay);
- }
- AnimationInfo info = new AnimationInfo(view, getName(),
- sceneRoot.getWindowId(), infoValues);
- runningAnimators.put(animator, info);
- mAnimators.add(animator);
+ } else {
+ view = (start != null) ? start.view : null;
+ }
+ if (animator != null) {
+ if (mPropagation != null) {
+ long delay = mPropagation
+ .getStartDelay(sceneRoot, this, start, end);
+ startDelays.put(mAnimators.size(), delay);
+ minStartDelay = Math.min(delay, minStartDelay);
}
+ AnimationInfo info = new AnimationInfo(view, getName(),
+ sceneRoot.getWindowId(), infoValues);
+ runningAnimators.put(animator, info);
+ mAnimators.add(animator);
}
}
}
diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
index 5b9372d..4748402 100644
--- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java
+++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
@@ -225,17 +225,11 @@ public final class AccessibilityInteractionClient
try {
IAccessibilityServiceConnection connection = getConnection(connectionId);
if (connection != null) {
- List<AccessibilityWindowInfo> windows = sAccessibilityCache.getWindows();
- if (windows != null) {
- if (DEBUG) {
- Log.i(LOG_TAG, "Window cache hit");
- }
- return windows;
- }
- if (DEBUG) {
- Log.i(LOG_TAG, "Window cache miss");
- }
- windows = connection.getWindows();
+ // The system is just sending data for windows that we introspected
+ // and changed but not ones that appeared, so we have to always call
+ // into the system process. This is less expensice as opposed to
+ // sending all windows on every window change.
+ List<AccessibilityWindowInfo> windows = connection.getWindows();
if (windows != null) {
final int windowCount = windows.size();
for (int i = 0; i < windowCount; i++) {
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index de46804..15dfed1 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -89,6 +89,7 @@ LOCAL_SRC_FILES:= \
android_util_Process.cpp \
android_util_StringBlock.cpp \
android_util_XmlBlock.cpp \
+ android/graphics/AndroidPicture.cpp \
android/graphics/AutoDecodeCancel.cpp \
android/graphics/Bitmap.cpp \
android/graphics/BitmapFactory.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index f8e6bc3..f2b9bac 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -244,9 +244,6 @@ AndroidRuntime::AndroidRuntime(char* argBlockStart, const size_t argBlockLength)
mArgBlockLength(argBlockLength)
{
SkGraphics::Init();
- // this sets our preference for 16bit images during decode
- // in case the src is opaque and 24bit
- SkImageDecoder::SetDeviceConfig(SkBitmap::kRGB_565_Config);
// There is also a global font cache, but its budget is specified in code
// see SkFontHost_android.cpp
@@ -825,8 +822,9 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
mOptions.add(opt);
}
- // Whether the profile should start upon app startup or be delayed by some random offset.
- property_get("dalvik.vm.profile.start-immediately", propBuf, "0");
+ // Whether the profile should start upon app startup or be delayed by some random offset
+ // (in seconds) that is bound between 0 and a fixed value.
+ property_get("dalvik.vm.profile.start-immed", propBuf, "0");
if (propBuf[0] == '1') {
opt.optionString = "-Xprofile-start-immediately";
mOptions.add(opt);
diff --git a/core/jni/android/graphics/AndroidPicture.cpp b/core/jni/android/graphics/AndroidPicture.cpp
new file mode 100644
index 0000000..5977ab2
--- /dev/null
+++ b/core/jni/android/graphics/AndroidPicture.cpp
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+#include "AndroidPicture.h"
+#include "SkCanvas.h"
+#include "SkStream.h"
+
+AndroidPicture::AndroidPicture(const AndroidPicture* src) {
+ if (NULL != src) {
+ mWidth = src->width();
+ mHeight = src->height();
+ if (NULL != src->mPicture.get()) {
+ mPicture.reset(SkRef(src->mPicture.get()));
+ } if (NULL != src->mRecorder.get()) {
+ mPicture.reset(src->makePartialCopy());
+ }
+ } else {
+ mWidth = 0;
+ mHeight = 0;
+ }
+}
+
+SkCanvas* AndroidPicture::beginRecording(int width, int height) {
+ mPicture.reset(NULL);
+ mRecorder.reset(new SkPictureRecorder);
+ mWidth = width;
+ mHeight = height;
+ return mRecorder->beginRecording(width, height, NULL, 0);
+}
+
+void AndroidPicture::endRecording() {
+ if (NULL != mRecorder.get()) {
+ mPicture.reset(mRecorder->endRecording());
+ mRecorder.reset(NULL);
+ }
+}
+
+int AndroidPicture::width() const {
+ if (NULL != mPicture.get()) {
+ SkASSERT(mPicture->width() == mWidth);
+ SkASSERT(mPicture->height() == mHeight);
+ }
+
+ return mWidth;
+}
+
+int AndroidPicture::height() const {
+ if (NULL != mPicture.get()) {
+ SkASSERT(mPicture->width() == mWidth);
+ SkASSERT(mPicture->height() == mHeight);
+ }
+
+ return mHeight;
+}
+
+AndroidPicture* AndroidPicture::CreateFromStream(SkStream* stream) {
+ AndroidPicture* newPict = new AndroidPicture;
+
+ newPict->mPicture.reset(SkPicture::CreateFromStream(stream));
+ if (NULL != newPict->mPicture.get()) {
+ newPict->mWidth = newPict->mPicture->width();
+ newPict->mHeight = newPict->mPicture->height();
+ }
+
+ return newPict;
+}
+
+void AndroidPicture::serialize(SkWStream* stream) const {
+ if (NULL != mRecorder.get()) {
+ SkAutoTDelete<SkPicture> tempPict(this->makePartialCopy());
+ tempPict->serialize(stream);
+ } else if (NULL != mPicture.get()) {
+ mPicture->serialize(stream);
+ } else {
+ SkPicture empty;
+ empty.serialize(stream);
+ }
+}
+
+void AndroidPicture::draw(SkCanvas* canvas) {
+ if (NULL != mRecorder.get()) {
+ this->endRecording();
+ SkASSERT(NULL != mPicture.get());
+ }
+ if (NULL != mPicture.get()) {
+ // TODO: remove this const_cast once pictures are immutable
+ const_cast<SkPicture*>(mPicture.get())->draw(canvas);
+ }
+}
+
+SkPicture* AndroidPicture::makePartialCopy() const {
+ SkASSERT(NULL != mRecorder.get());
+
+ SkPictureRecorder reRecorder;
+
+ SkCanvas* canvas = reRecorder.beginRecording(mWidth, mHeight, NULL, 0);
+ mRecorder->partialReplay(canvas);
+ return reRecorder.endRecording();
+}
diff --git a/core/jni/android/graphics/AndroidPicture.h b/core/jni/android/graphics/AndroidPicture.h
new file mode 100644
index 0000000..f434941
--- /dev/null
+++ b/core/jni/android/graphics/AndroidPicture.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_PICTURE_H
+#define ANDROID_PICTURE_H
+
+#include "SkPicture.h"
+#include "SkPictureRecorder.h"
+#include "SkRefCnt.h"
+#include "SkTemplates.h"
+
+class SkCanvas;
+class SkPicture;
+class SkPictureRecorder;
+class SkStream;
+class SkWStream;
+
+// Skia's SkPicture class has been split into an SkPictureRecorder
+// and an SkPicture. AndroidPicture recreates the functionality
+// of the old SkPicture interface by flip-flopping between the two
+// new classes.
+class AndroidPicture {
+public:
+ explicit AndroidPicture(const AndroidPicture* src = NULL);
+
+ SkCanvas* beginRecording(int width, int height);
+
+ void endRecording();
+
+ int width() const;
+
+ int height() const;
+
+ static AndroidPicture* CreateFromStream(SkStream* stream);
+
+ void serialize(SkWStream* stream) const;
+
+ void draw(SkCanvas* canvas);
+
+private:
+ int mWidth;
+ int mHeight;
+ SkAutoTUnref<const SkPicture> mPicture;
+ SkAutoTDelete<SkPictureRecorder> mRecorder;
+
+ // Make a copy of a picture that is in the midst of being recorded. The
+ // resulting picture will have balanced saves and restores.
+ SkPicture* makePartialCopy() const;
+};
+#endif // ANDROID_PICTURE_H
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 0328517..9998995 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -361,24 +361,50 @@ static jboolean Bitmap_recycle(JNIEnv* env, jobject, jlong bitmapHandle) {
}
static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle,
- jint width, jint height, jint configHandle, jint allocSize) {
+ jint width, jint height, jint configHandle, jint allocSize,
+ jboolean requestPremul) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle);
- if (width * height * SkBitmap::ComputeBytesPerPixel(config) > allocSize) {
+ SkColorType colorType = SkBitmapConfigToColorType(config);
+
+ // ARGB_4444 is a deprecated format, convert automatically to 8888
+ if (colorType == kARGB_4444_SkColorType) {
+ colorType = kN32_SkColorType;
+ }
+
+ if (width * height * SkColorTypeBytesPerPixel(colorType) > allocSize) {
// done in native as there's no way to get BytesPerPixel in Java
doThrowIAE(env, "Bitmap not large enough to support new configuration");
return;
}
SkPixelRef* ref = bitmap->pixelRef();
- SkSafeRef(ref);
- bitmap->setConfig(config, width, height);
+ ref->ref();
+ SkAlphaType alphaType;
+ if (bitmap->colorType() != kRGB_565_SkColorType
+ && bitmap->alphaType() == kOpaque_SkAlphaType) {
+ // If the original bitmap was set to opaque, keep that setting, unless it
+ // was 565, which is required to be opaque.
+ alphaType = kOpaque_SkAlphaType;
+ } else {
+ // Otherwise respect the premultiplied request.
+ alphaType = requestPremul ? kPremul_SkAlphaType : kUnpremul_SkAlphaType;
+ }
+ bitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType));
+ // FIXME: Skia thinks of an SkPixelRef as having a constant SkImageInfo (except for
+ // its alphatype), so it would make more sense from Skia's perspective to create a
+ // new SkPixelRef. That said, libhwui uses the pointer to the SkPixelRef as a key
+ // for its cache, so it won't realize this is the same Java Bitmap.
+ SkImageInfo& info = const_cast<SkImageInfo&>(ref->info());
+ // Use the updated from the SkBitmap, which may have corrected an invalid alphatype.
+ // (e.g. 565 non-opaque)
+ info = bitmap->info();
bitmap->setPixelRef(ref);
// notifyPixelsChanged will increment the generation ID even though the actual pixel data
// hasn't been touched. This signals the renderer that the bitmap (including width, height,
- // and config) has changed.
+ // colortype and alphatype) has changed.
ref->notifyPixelsChanged();
- SkSafeUnref(ref);
+ ref->unref();
}
// These must match the int values in Bitmap.java
@@ -799,7 +825,7 @@ static JNINativeMethod gBitmapMethods[] = {
(void*)Bitmap_copy },
{ "nativeDestructor", "(J)V", (void*)Bitmap_destructor },
{ "nativeRecycle", "(J)Z", (void*)Bitmap_recycle },
- { "nativeReconfigure", "(JIIII)V", (void*)Bitmap_reconfigure },
+ { "nativeReconfigure", "(JIIIIZ)V", (void*)Bitmap_reconfigure },
{ "nativeCompress", "(JIILjava/io/OutputStream;[B)Z",
(void*)Bitmap_compress },
{ "nativeErase", "(JI)V", (void*)Bitmap_erase },
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 3b44f97..6de3b9e 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -19,11 +19,14 @@
#include <android_runtime/AndroidRuntime.h>
#include "SkCanvas.h"
+#include "SkClipStack.h"
#include "SkDevice.h"
+#include "SkDeque.h"
#include "SkDrawFilter.h"
#include "SkGraphics.h"
#include "SkPorterDuff.h"
#include "SkShader.h"
+#include "SkTArray.h"
#include "SkTemplates.h"
#ifdef USE_MINIKIN
@@ -43,11 +46,42 @@
namespace android {
+class ClipCopier : public SkCanvas::ClipVisitor {
+public:
+ ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
+
+ virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) {
+ m_dstCanvas->clipRect(rect, op, antialias);
+ }
+ virtual void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) {
+ m_dstCanvas->clipRRect(rrect, op, antialias);
+ }
+ virtual void clipPath(const SkPath& path, SkRegion::Op op, bool antialias) {
+ m_dstCanvas->clipPath(path, op, antialias);
+ }
+
+private:
+ SkCanvas* m_dstCanvas;
+};
+
// Holds an SkCanvas reference plus additional native data.
class NativeCanvasWrapper {
+private:
+ struct SaveRec {
+ int saveCount;
+ SkCanvas::SaveFlags saveFlags;
+ };
+
public:
NativeCanvasWrapper(SkCanvas* canvas)
- : mCanvas(canvas) { }
+ : mCanvas(canvas)
+ , mSaveStack(NULL) {
+ SkASSERT(canvas);
+ }
+
+ ~NativeCanvasWrapper() {
+ delete mSaveStack;
+ }
SkCanvas* getCanvas() const {
return mCanvas.get();
@@ -56,28 +90,127 @@ public:
void setCanvas(SkCanvas* canvas) {
SkASSERT(canvas);
mCanvas.reset(canvas);
- }
-private:
- SkAutoTUnref<SkCanvas> mCanvas;
-};
+ delete mSaveStack;
+ mSaveStack = NULL;
+ }
-class ClipCopier : public SkCanvas::ClipVisitor {
-public:
- ClipCopier(SkCanvas* dstCanvas) : m_dstCanvas(dstCanvas) {}
+ int save(SkCanvas::SaveFlags flags) {
+ int count = mCanvas->save();
+ recordPartialSave(flags);
+ return count;
+ }
- virtual void clipRect(const SkRect& rect, SkRegion::Op op, bool antialias) {
- m_dstCanvas->clipRect(rect, op, antialias);
+ int saveLayer(const SkRect* bounds, const SkPaint* paint,
+ SkCanvas::SaveFlags flags) {
+ int count = mCanvas->saveLayer(bounds, paint,
+ static_cast<SkCanvas::SaveFlags>(flags | SkCanvas::kMatrixClip_SaveFlag));
+ recordPartialSave(flags);
+ return count;
}
- virtual void clipRRect(const SkRRect& rrect, SkRegion::Op op, bool antialias) {
- m_dstCanvas->clipRRect(rrect, op, antialias);
+
+ int saveLayerAlpha(const SkRect* bounds, U8CPU alpha,
+ SkCanvas::SaveFlags flags) {
+ int count = mCanvas->saveLayerAlpha(bounds, alpha,
+ static_cast<SkCanvas::SaveFlags>(flags | SkCanvas::kMatrixClip_SaveFlag));
+ recordPartialSave(flags);
+ return count;
}
- virtual void clipPath(const SkPath& path, SkRegion::Op op, bool antialias) {
- m_dstCanvas->clipPath(path, op, antialias);
+
+ void restore() {
+ const SaveRec* rec = (NULL == mSaveStack)
+ ? NULL
+ : static_cast<SaveRec*>(mSaveStack->back());
+ int currentSaveCount = mCanvas->getSaveCount() - 1;
+ SkASSERT(NULL == rec || currentSaveCount >= rec->saveCount);
+
+ if (NULL == rec || rec->saveCount != currentSaveCount) {
+ // Fast path - no record for this frame.
+ mCanvas->restore();
+ return;
+ }
+
+ bool preserveMatrix = !(rec->saveFlags & SkCanvas::kMatrix_SaveFlag);
+ bool preserveClip = !(rec->saveFlags & SkCanvas::kClip_SaveFlag);
+
+ SkMatrix savedMatrix;
+ if (preserveMatrix) {
+ savedMatrix = mCanvas->getTotalMatrix();
+ }
+
+ SkTArray<SkClipStack::Element> savedClips;
+ if (preserveClip) {
+ saveClipsForFrame(savedClips, currentSaveCount);
+ }
+
+ mCanvas->restore();
+
+ if (preserveMatrix) {
+ mCanvas->setMatrix(savedMatrix);
+ }
+
+ if (preserveClip && !savedClips.empty()) {
+ applyClips(savedClips);
+ }
+
+ mSaveStack->pop_back();
}
private:
- SkCanvas* m_dstCanvas;
+ void recordPartialSave(SkCanvas::SaveFlags flags) {
+ // A partial save is a save operation which doesn't capture the full canvas state.
+ // (either kMatrix_SaveFlags or kClip_SaveFlag is missing).
+
+ // Mask-out non canvas state bits.
+ flags = static_cast<SkCanvas::SaveFlags>(flags & SkCanvas::kMatrixClip_SaveFlag);
+
+ if (SkCanvas::kMatrixClip_SaveFlag == flags) {
+ // not a partial save.
+ return;
+ }
+
+ if (NULL == mSaveStack) {
+ mSaveStack = new SkDeque(sizeof(struct SaveRec), 8);
+ }
+
+ SaveRec* rec = static_cast<SaveRec*>(mSaveStack->push_back());
+ // Store the save counter in the SkClipStack domain.
+ // (0-based, equal to the number of save ops on the stack).
+ rec->saveCount = mCanvas->getSaveCount() - 1;
+ rec->saveFlags = flags;
+ }
+
+ void saveClipsForFrame(SkTArray<SkClipStack::Element>& clips,
+ int frameSaveCount) {
+ SkClipStack::Iter clipIterator(*mCanvas->getClipStack(),
+ SkClipStack::Iter::kTop_IterStart);
+ while (const SkClipStack::Element* elem = clipIterator.next()) {
+ if (elem->getSaveCount() < frameSaveCount) {
+ // done with the current frame.
+ break;
+ }
+ SkASSERT(elem->getSaveCount() == frameSaveCount);
+ clips.push_back(*elem);
+ }
+ }
+
+ void applyClips(const SkTArray<SkClipStack::Element>& clips) {
+ ClipCopier clipCopier(mCanvas);
+
+ // The clip stack stores clips in device space.
+ SkMatrix origMatrix = mCanvas->getTotalMatrix();
+ mCanvas->resetMatrix();
+
+ // We pushed the clips in reverse order.
+ for (int i = clips.count() - 1; i >= 0; --i) {
+ clips[i].replay(&clipCopier);
+ }
+
+ mCanvas->setMatrix(origMatrix);
+ }
+
+ SkAutoTUnref<SkCanvas> mCanvas;
+ SkDeque* mSaveStack; // lazily allocated, tracks partial saves.
};
// Returns true if the SkCanvas's clip is non-empty.
@@ -88,11 +221,15 @@ static jboolean hasNonEmptyClip(const SkCanvas& canvas) {
class SkCanvasGlue {
public:
+ // Get the native wrapper for a given handle.
+ static inline NativeCanvasWrapper* getNativeWrapper(jlong nativeHandle) {
+ SkASSERT(nativeHandle);
+ return reinterpret_cast<NativeCanvasWrapper*>(nativeHandle);
+ }
// Get the SkCanvas for a given native handle.
static inline SkCanvas* getNativeCanvas(jlong nativeHandle) {
- SkASSERT(nativeHandle);
- NativeCanvasWrapper* wrapper = reinterpret_cast<NativeCanvasWrapper*>(nativeHandle);
+ NativeCanvasWrapper* wrapper = getNativeWrapper(nativeHandle);
SkCanvas* canvas = wrapper->getCanvas();
SkASSERT(canvas);
@@ -186,56 +323,56 @@ public:
}
static jint save(JNIEnv*, jobject, jlong canvasHandle, jint flagsHandle) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
+ NativeCanvasWrapper* wrapper = getNativeWrapper(canvasHandle);
SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(flagsHandle);
- return static_cast<jint>(canvas->save(flags));
+ return static_cast<jint>(wrapper->save(flags));
}
static jint saveLayer(JNIEnv* env, jobject, jlong canvasHandle,
jfloat l, jfloat t, jfloat r, jfloat b,
- jlong paintHandle, jint flags) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
+ jlong paintHandle, jint flagsHandle) {
+ NativeCanvasWrapper* wrapper = getNativeWrapper(canvasHandle);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(flagsHandle);
SkRect bounds;
bounds.set(l, t, r, b);
- int result = canvas->saveLayer(&bounds, paint,
- static_cast<SkCanvas::SaveFlags>(flags));
- return static_cast<jint>(result);
+ return static_cast<jint>(wrapper->saveLayer(&bounds, paint, flags));
}
static jint saveLayerAlpha(JNIEnv* env, jobject, jlong canvasHandle,
jfloat l, jfloat t, jfloat r, jfloat b,
- jint alpha, jint flags) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
+ jint alpha, jint flagsHandle) {
+ NativeCanvasWrapper* wrapper = getNativeWrapper(canvasHandle);
+ SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(flagsHandle);
SkRect bounds;
bounds.set(l, t, r, b);
- int result = canvas->saveLayerAlpha(&bounds, alpha,
- static_cast<SkCanvas::SaveFlags>(flags));
- return static_cast<jint>(result);
+ return static_cast<jint>(wrapper->saveLayerAlpha(&bounds, alpha, flags));
}
static void restore(JNIEnv* env, jobject, jlong canvasHandle) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
- if (canvas->getSaveCount() <= 1) { // cannot restore anymore
+ NativeCanvasWrapper* wrapper = getNativeWrapper(canvasHandle);
+ if (wrapper->getCanvas()->getSaveCount() <= 1) { // cannot restore anymore
doThrowISE(env, "Underflow in restore");
return;
}
- canvas->restore();
+ wrapper->restore();
}
static jint getSaveCount(JNIEnv*, jobject, jlong canvasHandle) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
- return static_cast<jint>(canvas->getSaveCount());
+ return static_cast<jint>(getNativeCanvas(canvasHandle)->getSaveCount());
}
static void restoreToCount(JNIEnv* env, jobject, jlong canvasHandle,
jint restoreCount) {
- SkCanvas* canvas = getNativeCanvas(canvasHandle);
+ NativeCanvasWrapper* wrapper = getNativeWrapper(canvasHandle);
if (restoreCount < 1) {
doThrowIAE(env, "Underflow in restoreToCount");
return;
}
- canvas->restoreToCount(restoreCount);
+
+ while (wrapper->getCanvas()->getSaveCount() > restoreCount) {
+ wrapper->restore();
+ }
}
static void translate(JNIEnv*, jobject, jlong canvasHandle,
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 64ad223..a4337cc 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -3,6 +3,7 @@
#include "jni.h"
#include "JNIHelp.h"
#include "GraphicsJNI.h"
+#include "AndroidPicture.h"
#include "SkCanvas.h"
#include "SkDevice.h"
@@ -345,13 +346,13 @@ android::TypefaceImpl* GraphicsJNI::getNativeTypeface(JNIEnv* env, jobject paint
return p;
}
-SkPicture* GraphicsJNI::getNativePicture(JNIEnv* env, jobject picture)
+AndroidPicture* GraphicsJNI::getNativePicture(JNIEnv* env, jobject picture)
{
SkASSERT(env);
SkASSERT(picture);
SkASSERT(env->IsInstanceOf(picture, gPicture_class));
jlong pictureHandle = env->GetLongField(picture, gPicture_nativeInstanceID);
- SkPicture* p = reinterpret_cast<SkPicture*>(pictureHandle);
+ AndroidPicture* p = reinterpret_cast<AndroidPicture*>(pictureHandle);
SkASSERT(p);
return p;
}
diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h
index 73dd11b..2e2f920 100644
--- a/core/jni/android/graphics/GraphicsJNI.h
+++ b/core/jni/android/graphics/GraphicsJNI.h
@@ -14,7 +14,7 @@
class SkBitmapRegionDecoder;
class SkCanvas;
class SkPaint;
-class SkPicture;
+class AndroidPicture;
class GraphicsJNI {
public:
@@ -50,7 +50,7 @@ public:
static SkPaint* getNativePaint(JNIEnv*, jobject paint);
static android::TypefaceImpl* getNativeTypeface(JNIEnv*, jobject paint);
static SkBitmap* getNativeBitmap(JNIEnv*, jobject bitmap);
- static SkPicture* getNativePicture(JNIEnv*, jobject picture);
+ static AndroidPicture* getNativePicture(JNIEnv*, jobject picture);
static SkRegion* getNativeRegion(JNIEnv*, jobject region);
// Given the 'native' long held by the Rasterizer.java object, return a
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index a8a3dae..0683f73 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -17,9 +17,9 @@
#include "jni.h"
#include "GraphicsJNI.h"
#include <android_runtime/AndroidRuntime.h>
+#include "AndroidPicture.h"
#include "SkCanvas.h"
-#include "SkPicture.h"
#include "SkStream.h"
#include "SkTemplates.h"
#include "CreateJavaOutputStreamAdaptor.h"
@@ -29,45 +29,41 @@ namespace android {
class SkPictureGlue {
public:
static jlong newPicture(JNIEnv* env, jobject, jlong srcHandle) {
- const SkPicture* src = reinterpret_cast<SkPicture*>(srcHandle);
- if (src) {
- return reinterpret_cast<jlong>(new SkPicture(*src));
- } else {
- return reinterpret_cast<jlong>(new SkPicture);
- }
+ const AndroidPicture* src = reinterpret_cast<AndroidPicture*>(srcHandle);
+ return reinterpret_cast<jlong>(new AndroidPicture(src));
}
static jlong deserialize(JNIEnv* env, jobject, jobject jstream,
jbyteArray jstorage) {
- SkPicture* picture = NULL;
+ AndroidPicture* picture = NULL;
SkStream* strm = CreateJavaInputStreamAdaptor(env, jstream, jstorage);
if (strm) {
- picture = SkPicture::CreateFromStream(strm);
+ picture = AndroidPicture::CreateFromStream(strm);
delete strm;
}
return reinterpret_cast<jlong>(picture);
}
static void killPicture(JNIEnv* env, jobject, jlong pictureHandle) {
- SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
+ AndroidPicture* picture = reinterpret_cast<AndroidPicture*>(pictureHandle);
SkASSERT(picture);
- picture->unref();
+ delete picture;
}
static void draw(JNIEnv* env, jobject, jlong canvasHandle,
jlong pictureHandle) {
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(canvasHandle);
- SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
+ AndroidPicture* picture = reinterpret_cast<AndroidPicture*>(pictureHandle);
SkASSERT(canvas);
SkASSERT(picture);
picture->draw(canvas);
}
static jboolean serialize(JNIEnv* env, jobject, jlong pictureHandle,
- jobject jstream, jbyteArray jstorage) {
- SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
+ jobject jstream, jbyteArray jstorage) {
+ AndroidPicture* picture = reinterpret_cast<AndroidPicture*>(pictureHandle);
SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
-
+
if (NULL != strm) {
picture->serialize(strm);
delete strm;
@@ -78,19 +74,21 @@ public:
static jint getWidth(JNIEnv* env, jobject jpic) {
NPE_CHECK_RETURN_ZERO(env, jpic);
- int width = GraphicsJNI::getNativePicture(env, jpic)->width();
+ AndroidPicture* pict = GraphicsJNI::getNativePicture(env, jpic);
+ int width = pict->width();
return static_cast<jint>(width);
}
static jint getHeight(JNIEnv* env, jobject jpic) {
NPE_CHECK_RETURN_ZERO(env, jpic);
- int height = GraphicsJNI::getNativePicture(env, jpic)->height();
+ AndroidPicture* pict = GraphicsJNI::getNativePicture(env, jpic);
+ int height = pict->height();
return static_cast<jint>(height);
}
static jlong beginRecording(JNIEnv* env, jobject, jlong pictHandle,
- jint w, jint h) {
- SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
+ jint w, jint h) {
+ AndroidPicture* pict = reinterpret_cast<AndroidPicture*>(pictHandle);
// beginRecording does not ref its return value, it just returns it.
SkCanvas* canvas = pict->beginRecording(w, h);
// the java side will wrap this guy in a Canvas.java, which will call
@@ -101,7 +99,7 @@ public:
}
static void endRecording(JNIEnv* env, jobject, jlong pictHandle) {
- SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
+ AndroidPicture* pict = reinterpret_cast<AndroidPicture*>(pictHandle);
pict->endRecording();
}
};
diff --git a/core/jni/android/graphics/pdf/PdfDocument.cpp b/core/jni/android/graphics/pdf/PdfDocument.cpp
index d54aaa8..3812c27 100644
--- a/core/jni/android/graphics/pdf/PdfDocument.cpp
+++ b/core/jni/android/graphics/pdf/PdfDocument.cpp
@@ -24,6 +24,7 @@
#include "SkCanvas.h"
#include "SkDocument.h"
#include "SkPicture.h"
+#include "SkPictureRecorder.h"
#include "SkStream.h"
#include "SkRect.h"
@@ -32,15 +33,22 @@ namespace android {
struct PageRecord {
PageRecord(int width, int height, const SkRect& contentRect)
- : mPicture(new SkPicture()), mWidth(width), mHeight(height) {
+ : mPictureRecorder(new SkPictureRecorder())
+ , mPicture(NULL)
+ , mWidth(width)
+ , mHeight(height) {
mContentRect = contentRect;
}
~PageRecord() {
- mPicture->unref();
+ delete mPictureRecorder;
+ if (NULL != mPicture) {
+ mPicture->unref();
+ }
}
- SkPicture* const mPicture;
+ SkPictureRecorder* mPictureRecorder;
+ SkPicture* mPicture;
const int mWidth;
const int mHeight;
SkRect mContentRect;
@@ -62,8 +70,8 @@ public:
mPages.push_back(page);
mCurrentPage = page;
- SkCanvas* canvas = page->mPicture->beginRecording(
- contentRect.width(), contentRect.height(), 0);
+ SkCanvas* canvas = page->mPictureRecorder->beginRecording(
+ contentRect.width(), contentRect.height(), NULL, 0);
// We pass this canvas to Java where it is used to construct
// a Java Canvas object which dereferences the pointer when it
@@ -75,7 +83,11 @@ public:
void finishPage() {
assert(mCurrentPage != NULL);
- mCurrentPage->mPicture->endRecording();
+ assert(mCurrentPage->mPictureRecorder != NULL);
+ assert(mCurrentPage->mPicture == NULL);
+ mCurrentPage->mPicture = mCurrentPage->mPictureRecorder->endRecording();
+ delete mCurrentPage->mPictureRecorder;
+ mCurrentPage->mPictureRecorder = NULL;
mCurrentPage = NULL;
}
@@ -89,7 +101,7 @@ public:
canvas->clipRect(page->mContentRect);
canvas->translate(page->mContentRect.left(), page->mContentRect.top());
- canvas->drawPicture(*page->mPicture);
+ canvas->drawPicture(page->mPicture);
document->endPage();
}
@@ -97,11 +109,10 @@ public:
}
void close() {
+ assert(NULL == mCurrentPage);
for (unsigned i = 0; i < mPages.size(); i++) {
delete mPages[i];
}
- delete mCurrentPage;
- mCurrentPage = NULL;
}
private:
diff --git a/core/jni/android_media_AudioSystem.cpp b/core/jni/android_media_AudioSystem.cpp
index bf47dd3..ee4c619 100644
--- a/core/jni/android_media_AudioSystem.cpp
+++ b/core/jni/android_media_AudioSystem.cpp
@@ -244,6 +244,12 @@ android_media_AudioSystem_isSourceActive(JNIEnv *env, jobject thiz, jint source)
}
static jint
+android_media_AudioSystem_newAudioSessionId(JNIEnv *env, jobject thiz)
+{
+ return AudioSystem::newAudioSessionId();
+}
+
+static jint
android_media_AudioSystem_setParameters(JNIEnv *env, jobject thiz, jstring keyValuePairs)
{
const jchar* c_keyValuePairs = env->GetStringCritical(keyValuePairs, 0);
@@ -1295,6 +1301,7 @@ static JNINativeMethod gMethods[] = {
{"isStreamActive", "(II)Z", (void *)android_media_AudioSystem_isStreamActive},
{"isStreamActiveRemotely","(II)Z", (void *)android_media_AudioSystem_isStreamActiveRemotely},
{"isSourceActive", "(I)Z", (void *)android_media_AudioSystem_isSourceActive},
+ {"newAudioSessionId", "()I", (void *)android_media_AudioSystem_newAudioSessionId},
{"setDeviceConnectionState", "(IILjava/lang/String;)I", (void *)android_media_AudioSystem_setDeviceConnectionState},
{"getDeviceConnectionState", "(ILjava/lang/String;)I", (void *)android_media_AudioSystem_getDeviceConnectionState},
{"setPhoneState", "(I)I", (void *)android_media_AudioSystem_setPhoneState},
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 11f87cc..3d14aaf 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -95,6 +95,7 @@ sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj) {
env->GetLongField(surfaceObj, gSurfaceClassInfo.mNativeObject));
env->MonitorExit(lock);
}
+ env->DeleteLocalRef(lock);
return sur;
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 28d4487..3067cdd0 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -1770,11 +1770,11 @@
<!-- Allows the system to bind to an application's task services
@hide -->
- <permission android:name="android.permission.BIND_TASK_SERVICE"
+ <permission android:name="android.permission.BIND_JOB_SERVICE"
android:protectionLevel="signature"
- android:label="@string/permlab_bindTaskService"
- android:description="@string/permdesc_bindTaskService" />
- <uses-permission android:name="android.permission.BIND_TASK_SERVICE"/>
+ android:label="@string/permlab_bindJobService"
+ android:description="@string/permdesc_bindJobService" />
+ <uses-permission android:name="android.permission.BIND_JOB_SERVICE"/>
<!-- ========================================= -->
<!-- Permissions for special development tools -->
@@ -2071,6 +2071,14 @@
android:description="@string/permdesc_bindVoiceInteraction"
android:protectionLevel="signature" />
+ <!-- Must be required by hotword enrollment application,
+ to ensure that only the system can interact with it.
+ @hide <p>Not for use by third-party applications.</p> -->
+ <permission android:name="android.permission.MANAGE_VOICE_KEYPHRASES"
+ android:label="@string/permlab_manageVoiceKeyphrases"
+ android:description="@string/permdesc_manageVoiceKeyphrases"
+ android:protectionLevel="signature|system" />
+
<!-- Must be required by a {@link com.android.media.remotedisplay.RemoteDisplayProvider},
to ensure that only the system can bind to it.
@hide -->
@@ -2699,7 +2707,8 @@
android:theme="@style/Theme.Holo.Dialog.Alert"
android:finishOnCloseSystemDialogs="true"
android:excludeFromRecents="true"
- android:multiprocess="true">
+ android:multiprocess="true"
+ android:documentLaunchMode="never">
<intent-filter>
<action android:name="android.intent.action.CHOOSER" />
<category android:name="android.intent.category.DEFAULT" />
@@ -2721,7 +2730,7 @@
</activity-alias>
<activity-alias android:name="com.android.internal.app.ForwardIntentToManagedProfile"
android:targetActivity="com.android.internal.app.IntentForwarderActivity"
- android:icon="@drawable/work_icon"
+ android:icon="@drawable/ic_afw_icon"
android:exported="true"
android:label="@string/managed_profile_label">
</activity-alias>
@@ -2805,7 +2814,7 @@
</activity>
<activity android:name="com.android.internal.app.RestrictionsPinActivity"
- android:theme="@style/Theme.Holo.Dialog.Alert"
+ android:theme="@style/Theme.Material.Light.Dialog.Alert"
android:excludeFromRecents="true"
android:windowSoftInputMode="adjustPan"
android:process=":ui">
@@ -2888,8 +2897,8 @@
</service>
<service android:name="com.android.server.MountServiceIdler"
- android:exported="false"
- android:permission="android.permission.BIND_TASK_SERVICE" >
+ android:exported="true"
+ android:permission="android.permission.BIND_JOB_SERVICE" >
</service>
</application>
diff --git a/core/res/res/drawable-hdpi/ic_afw_icon.png b/core/res/res/drawable-hdpi/ic_afw_icon.png
new file mode 100644
index 0000000..fc986fe
--- /dev/null
+++ b/core/res/res/drawable-hdpi/ic_afw_icon.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_afw_icon.png b/core/res/res/drawable-mdpi/ic_afw_icon.png
new file mode 100644
index 0000000..deb7966
--- /dev/null
+++ b/core/res/res/drawable-mdpi/ic_afw_icon.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/ic_afw_icon.png b/core/res/res/drawable-xhdpi/ic_afw_icon.png
new file mode 100644
index 0000000..ec4f44b
--- /dev/null
+++ b/core/res/res/drawable-xhdpi/ic_afw_icon.png
Binary files differ
diff --git a/core/res/res/drawable-xxhdpi/ic_afw_icon.png b/core/res/res/drawable-xxhdpi/ic_afw_icon.png
new file mode 100644
index 0000000..6888377
--- /dev/null
+++ b/core/res/res/drawable-xxhdpi/ic_afw_icon.png
Binary files differ
diff --git a/core/res/res/drawable/btn_borderless_material.xml b/core/res/res/drawable/btn_borderless_material.xml
index 1967b38..a459089 100644
--- a/core/res/res/drawable/btn_borderless_material.xml
+++ b/core/res/res/drawable/btn_borderless_material.xml
@@ -15,7 +15,7 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?attr/colorControlHighlight">
+ android:color="?attr/colorControlHighlight">
<item android:id="@id/mask"
android:drawable="@drawable/btn_mtrl_alpha" />
</ripple>
diff --git a/core/res/res/drawable/btn_default_material.xml b/core/res/res/drawable/btn_default_material.xml
index acec900..9cee3ab 100644
--- a/core/res/res/drawable/btn_default_material.xml
+++ b/core/res/res/drawable/btn_default_material.xml
@@ -15,7 +15,7 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?attr/colorControlHighlight">
+ android:color="?attr/colorControlHighlight">
<item>
<nine-patch android:src="@drawable/btn_mtrl_alpha"
android:tint="?attr/colorButtonNormal" />
diff --git a/core/res/res/drawable/btn_toggle_material.xml b/core/res/res/drawable/btn_toggle_material.xml
index 4532c77..73fe4d3 100644
--- a/core/res/res/drawable/btn_toggle_material.xml
+++ b/core/res/res/drawable/btn_toggle_material.xml
@@ -21,7 +21,7 @@
android:insetRight="4dp">
<layer-list android:paddingMode="stack">
<item>
- <ripple android:tint="?attr/colorControlHighlight">
+ <ripple android:color="?attr/colorControlHighlight">
<item>
<nine-patch android:src="@drawable/btn_toggle_mtrl_alpha"
android:tint="?attr/colorButtonNormal" />
diff --git a/core/res/res/drawable/edit_text_material.xml b/core/res/res/drawable/edit_text_material.xml
index 26fd889..86cec8f 100644
--- a/core/res/res/drawable/edit_text_material.xml
+++ b/core/res/res/drawable/edit_text_material.xml
@@ -15,8 +15,7 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?attr/colorControlActivated"
- android:tintMode="src_over">
+ android:color="?attr/colorControlActivated">
<item>
<selector>
<item android:state_enabled="false">
diff --git a/core/res/res/drawable/item_background_borderless_material.xml b/core/res/res/drawable/item_background_borderless_material.xml
index c2a1c127..b730618 100644
--- a/core/res/res/drawable/item_background_borderless_material.xml
+++ b/core/res/res/drawable/item_background_borderless_material.xml
@@ -15,5 +15,4 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?attr/colorControlHighlight"
- android:pinned="true" />
+ android:color="?attr/colorControlHighlight" />
diff --git a/core/res/res/drawable/item_background_material.xml b/core/res/res/drawable/item_background_material.xml
index 039ca51..45ff181 100644
--- a/core/res/res/drawable/item_background_material.xml
+++ b/core/res/res/drawable/item_background_material.xml
@@ -15,8 +15,8 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?attr/colorControlHighlight">
+ android:color="?attr/colorControlHighlight">
<item android:id="@id/mask">
<color android:color="@color/white" />
</item>
-</ripple> \ No newline at end of file
+</ripple>
diff --git a/core/res/res/drawable/notification_bg_dim.xml b/core/res/res/drawable/notification_bg_dim.xml
index ae03d82..5c245f8 100644
--- a/core/res/res/drawable/notification_bg_dim.xml
+++ b/core/res/res/drawable/notification_bg_dim.xml
@@ -15,9 +15,7 @@
~ limitations under the License
-->
-<ripple
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="#ff444444"
- >
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="#ff444444">
<item android:drawable="@drawable/notification_bg_normal" />
</ripple> \ No newline at end of file
diff --git a/core/res/res/drawable/notification_material_bg_dim.xml b/core/res/res/drawable/notification_material_bg_dim.xml
index a908be7..9b691e6 100644
--- a/core/res/res/drawable/notification_material_bg_dim.xml
+++ b/core/res/res/drawable/notification_material_bg_dim.xml
@@ -15,15 +15,18 @@
~ limitations under the License
-->
-<ripple
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="#ffffffff"
- android:tintMode="src_over"
- >
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="@color/white">
<item>
<shape>
<solid android:color="#d4ffffff" />
<corners android:radius="@dimen/notification_material_rounded_rect_radius" />
</shape>
</item>
-</ripple> \ No newline at end of file
+ <item android:id="@id/mask">
+ <shape>
+ <solid android:color="@color/white" />
+ <corners android:radius="@dimen/notification_material_rounded_rect_radius" />
+ </shape>
+ </item>
+</ripple>
diff --git a/core/res/res/layout/notification_template_material_big_base.xml b/core/res/res/layout/notification_template_material_big_base.xml
index bdf27c8..0564a8f 100644
--- a/core/res/res/layout/notification_template_material_big_base.xml
+++ b/core/res/res/layout/notification_template_material_big_base.xml
@@ -145,7 +145,7 @@
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:visibility="gone"
- style="@style/Widget.Material.Light.ProgressBar.Horizontal"
+ style="@style/Widget.StatusBar.Material.ProgressBar"
/>
</LinearLayout>
<ImageView
diff --git a/core/res/res/layout/notification_template_material_big_media.xml b/core/res/res/layout/notification_template_material_big_media.xml
index c89b9f9..f8e1986 100644
--- a/core/res/res/layout/notification_template_material_big_media.xml
+++ b/core/res/res/layout/notification_template_material_big_media.xml
@@ -38,7 +38,6 @@
android:minHeight="@dimen/notification_large_icon_height"
android:paddingTop="2dp"
android:orientation="vertical"
- android:background="@color/notification_media_info_bg"
>
<LinearLayout
android:id="@+id/line1"
@@ -147,7 +146,7 @@
android:layout_height="6dp"
android:layout_gravity="top"
android:visibility="gone"
- style="@style/Widget.StatusBar.Material.ProgressBar"
+ style="@style/Widget.StatusBar.Material.ProgressBar.Media"
/>
</FrameLayout>
</LinearLayout>
diff --git a/core/res/res/layout/notification_template_material_big_text.xml b/core/res/res/layout/notification_template_material_big_text.xml
index 6f8c3a9..1de5add 100644
--- a/core/res/res/layout/notification_template_material_big_text.xml
+++ b/core/res/res/layout/notification_template_material_big_text.xml
@@ -99,7 +99,7 @@
android:layout_marginEnd="8dp"
android:visibility="gone"
android:layout_weight="0"
- style="@style/Widget.Material.Light.ProgressBar.Horizontal"
+ style="@style/Widget.StatusBar.Material.ProgressBar"
/>
<TextView android:id="@+id/big_text"
android:textAppearance="@style/TextAppearance.StatusBar.Material.EventContent"
diff --git a/core/res/res/layout/preference_widget_checkbox.xml b/core/res/res/layout/preference_widget_checkbox.xml
index bfd7f0a..f794346 100644
--- a/core/res/res/layout/preference_widget_checkbox.xml
+++ b/core/res/res/layout/preference_widget_checkbox.xml
@@ -21,4 +21,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
- android:clickable="false" />
+ android:clickable="false"
+ android:background="@null" />
diff --git a/core/res/res/layout/preference_widget_switch.xml b/core/res/res/layout/preference_widget_switch.xml
index 534c7ec..04a310b 100644
--- a/core/res/res/layout/preference_widget_switch.xml
+++ b/core/res/res/layout/preference_widget_switch.xml
@@ -21,4 +21,5 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dip"
- android:focusable="false" />
+ android:focusable="false"
+ android:background="@null" />
diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml
index 8d82a17..6052fb0 100644
--- a/core/res/res/values-watch/config.xml
+++ b/core/res/res/values-watch/config.xml
@@ -36,4 +36,8 @@
<!-- Maximum velocity to initiate a fling, as measured in dips per second. -->
<dimen name="config_viewMaxFlingVelocity">8000dp</dimen>
+ <!-- Number of notifications to keep in the notification service historical archive.
+ Reduced intentionally for watches to retain minimal memory footprint -->
+ <integer name="config_notificationServiceArchiveSize">1</integer>
+
</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a751906..2fea91e 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -4675,12 +4675,8 @@
<!-- Drawable used to show animated touch feedback. -->
<declare-styleable name="RippleDrawable">
- <!-- The tint to use for ripple effects. This attribute is required. -->
- <attr name="tint" />
- <!-- Specifies the Porter-Duff blending mode used to apply the tint. The default value is src_atop, which draws over the opaque parts of the drawable. -->
- <attr name="tintMode" />
- <!-- Whether to pin ripple effects to the center of the drawable. Default value is false. -->
- <attr name="pinned" format="boolean" />
+ <!-- The color to use for ripple effects. This attribute is required. -->
+ <attr name="color" />
</declare-styleable>
<declare-styleable name="ScaleDrawable">
@@ -6394,6 +6390,16 @@
<attr name="settingsActivity" />
</declare-styleable>
+ <!-- Use <code>voice-enrollment-application</code>
+ as the root tag of the XML resource that escribes the supported keyphrases (hotwords)
+ by the enrollment application.
+ Described here are the attributes that can be included in that tag. -->
+ <declare-styleable name="VoiceEnrollmentApplication">
+ <attr name="searchKeyphraseId" format="integer" />
+ <attr name="searchKeyphrase" format="string" />
+ <attr name="searchKeyphraseSupportedLocales" format="string" />
+ </declare-styleable>
+
<!-- Attributes used to style the Action Bar. -->
<declare-styleable name="ActionBar">
<!-- The type of navigation to use. -->
diff --git a/core/res/res/values/colors.xml b/core/res/res/values/colors.xml
index 9bf2ce8..9f6c7ad 100644
--- a/core/res/res/values/colors.xml
+++ b/core/res/res/values/colors.xml
@@ -135,7 +135,6 @@
<color name="notification_action_legacy_color_filter">#ff555555</color>
<color name="notification_media_action_bg">#00000000</color>
- <color name="notification_media_info_bg">#40FFFFFF</color>
<color name="notification_media_progress">#FFFFFFFF</color>
<!-- Keyguard colors -->
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 5555cf6..9ff9b11 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -589,7 +589,7 @@
<!-- Display low battery warning when battery level dips to this value.
Also, the battery stats are flushed to disk when we hit this level. -->
- <integer name="config_criticalBatteryWarningLevel">4</integer>
+ <integer name="config_criticalBatteryWarningLevel">5</integer>
<!-- Shutdown if the battery temperature exceeds (this value * 0.1) Celsius. -->
<integer name="config_shutdownBatteryTemperature">680</integer>
@@ -597,8 +597,9 @@
<!-- Display low battery warning when battery level dips to this value -->
<integer name="config_lowBatteryWarningLevel">15</integer>
- <!-- Close low battery warning when battery level reaches this value -->
- <integer name="config_lowBatteryCloseWarningLevel">20</integer>
+ <!-- Close low battery warning when battery level reaches the lowBatteryWarningLevel
+ plus this -->
+ <integer name="config_lowBatteryCloseWarningBump">5</integer>
<!-- Default color for notification LED. -->
<color name="config_defaultNotificationColor">#ffffffff</color>
@@ -627,6 +628,9 @@
<!-- Default value for LED off time when the battery is low on charge in miliseconds -->
<integer name="config_notificationsBatteryLedOff">2875</integer>
+ <!-- Number of notifications to keep in the notification service historical archive -->
+ <integer name="config_notificationServiceArchiveSize">250</integer>
+
<!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
<bool name="config_disableMenuKeyInLockScreen">false</bool>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 16bba5b..2792c93 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2132,7 +2132,6 @@
<public type="attr" name="strokeLineJoin" />
<public type="attr" name="clipToPath" />
<public type="attr" name="requiredForProfile"/>
- <public type="attr" name="pinned" />
<public type="attr" name="colorControlNormal" />
<public type="attr" name="colorControlActivated" />
<public type="attr" name="colorButtonNormal" />
@@ -2186,6 +2185,9 @@
<public type="attr" name="translateY" />
<public type="attr" name="selectableItemBackgroundBorderless" />
<public type="attr" name="elegantTextHeight" />
+ <public type="attr" name="searchKeyphraseId" />
+ <public type="attr" name="searchKeyphrase" />
+ <public type="attr" name="searchKeyphraseSupportedLocales" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />
@@ -2197,6 +2199,8 @@
<public type="style" name="Widget.FastScroll" />
<public type="style" name="Widget.StackView" />
+ <public type="style" name="Widget.Toolbar" />
+ <public type="style" name="Widget.Toolbar.Button.Navigation" />
<public type="style" name="Widget.Holo.FastScroll" />
<public type="style" name="Widget.Holo.StackView" />
@@ -2343,6 +2347,8 @@
<public type="style" name="Widget.Material.TabWidget" />
<public type="style" name="Widget.Material.TextView" />
<public type="style" name="Widget.Material.TextView.SpinnerItem" />
+ <public type="style" name="Widget.Material.Toolbar" />
+ <public type="style" name="Widget.Material.Toolbar.Button.Navigation" />
<public type="style" name="Widget.Material.WebTextView" />
<public type="style" name="Widget.Material.WebView" />
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 23a117f..f1d9dc3 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1122,6 +1122,12 @@
interface of a voice interaction service. Should never be needed for normal apps.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_manageVoiceKeyphrases">manage voice keyphrases</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_manageVoiceKeyphrases">Allows the holder to manage the keyphrases for voice hotword detection.
+ Should never be needed for normal apps.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_bindRemoteDisplay">bind to a remote display</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_bindRemoteDisplay">Allows the holder to bind to the top-level
@@ -1261,10 +1267,10 @@
permission that an application must be granted by the user. Instead, it
is part of a mechanism that applications use to indicate to the system
that they want to do scheduled background work. -->
- <string name="permlab_bindTaskService">run the application\'s scheduled background work</string>
+ <string name="permlab_bindJobService">run the application\'s scheduled background work</string>
<!-- Description of an application permission, so that the user can understand
what is being done if they are curious. -->
- <string name="permdesc_bindTaskService">This permission allows the Android system to run the application in the background when requested.</string>
+ <string name="permdesc_bindJobService">This permission allows the Android system to run the application in the background when requested.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_diagnostic">read/write to resources owned by diag</string>
diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml
index 3d73995..a40835c 100644
--- a/core/res/res/values/styles_material.xml
+++ b/core/res/res/values/styles_material.xml
@@ -345,6 +345,9 @@ please see styles_device_defaults.xml.
</style>
<style name="Widget.StatusBar.Material.ProgressBar" parent="Widget.Material.Light.ProgressBar.Horizontal">
+ </style>
+
+ <style name="Widget.StatusBar.Material.ProgressBar.Media">
<item name="android:progressDrawable">@drawable/notification_material_media_progress</item>
</style>
@@ -646,6 +649,14 @@ please see styles_device_defaults.xml.
<item name="maxWidth">180dip</item>
</style>
+ <style name="Widget.Material.Toolbar" parent="Widget.Toolbar">
+ <item name="android:navigationButtonStyle">@android:style/Widget.Material.Toolbar.Button.Navigation</item>
+ </style>
+
+ <style name="Widget.Material.Toolbar.Button.Navigation" parent="Widget.Toolbar.Button.Navigation">
+ <item name="android:background">?attr/selectableItemBackgroundBorderless</item>
+ </style>
+
<style name="Widget.Material.WebTextView" parent="Widget.WebTextView"/>
<style name="Widget.Material.WebView" parent="Widget.WebView"/>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 2ea7421..f2550ab 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1509,7 +1509,7 @@
<java-symbol type="integer" name="config_defaultNotificationLedOn" />
<java-symbol type="integer" name="config_deskDockKeepsScreenOn" />
<java-symbol type="integer" name="config_lightSensorWarmupTime" />
- <java-symbol type="integer" name="config_lowBatteryCloseWarningLevel" />
+ <java-symbol type="integer" name="config_lowBatteryCloseWarningBump" />
<java-symbol type="integer" name="config_lowBatteryWarningLevel" />
<java-symbol type="integer" name="config_networkPolicyDefaultWarning" />
<java-symbol type="integer" name="config_networkTransitionTimeout" />
@@ -1518,6 +1518,7 @@
<java-symbol type="integer" name="config_notificationsBatteryLedOn" />
<java-symbol type="integer" name="config_notificationsBatteryLowARGB" />
<java-symbol type="integer" name="config_notificationsBatteryMediumARGB" />
+ <java-symbol type="integer" name="config_notificationServiceArchiveSize" />
<java-symbol type="integer" name="config_radioScanningTimeout" />
<java-symbol type="integer" name="config_screenBrightnessSettingMinimum" />
<java-symbol type="integer" name="config_screenBrightnessSettingMaximum" />
@@ -1678,7 +1679,6 @@
<java-symbol type="drawable" name="notification_material_bg" />
<java-symbol type="drawable" name="notification_material_media_progress" />
<java-symbol type="color" name="notification_media_action_bg" />
- <java-symbol type="color" name="notification_media_info_bg" />
<java-symbol type="color" name="notification_media_progress" />
<java-symbol type="id" name="media_action_area" />
diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml
index c14d7fc..1304d2b 100644
--- a/core/res/res/values/themes_material.xml
+++ b/core/res/res/values/themes_material.xml
@@ -321,6 +321,8 @@ please see themes_device_defaults.xml.
<item name="actionModeFindDrawable">@drawable/ic_menu_find_material</item>
<item name="actionModeWebSearchDrawable">@drawable/ic_menu_search_material</item>
+ <item name="toolbarStyle">@style/Widget.Material.Toolbar</item>
+
<item name="dividerVertical">?attr/listDivider</item>
<item name="dividerHorizontal">?attr/listDivider</item>
<item name="buttonBarStyle">@style/Widget.Material.ButtonBar</item>
@@ -667,6 +669,8 @@ please see themes_device_defaults.xml.
<item name="actionModeFindDrawable">@drawable/ic_menu_find_material</item>
<item name="actionModeWebSearchDrawable">@drawable/ic_menu_search_material</item>
+ <item name="toolbarStyle">@style/Widget.Material.Toolbar</item>
+
<item name="dividerVertical">?attr/listDivider</item>
<item name="dividerHorizontal">?attr/listDivider</item>
<item name="buttonBarStyle">@style/Widget.Material.Light.ButtonBar</item>
diff --git a/data/fonts/Android.mk b/data/fonts/Android.mk
index c6bccfe..abb960c 100644
--- a/data/fonts/Android.mk
+++ b/data/fonts/Android.mk
@@ -106,6 +106,7 @@ font_src_files := \
ifeq ($(MINIMAL_FONT_FOOTPRINT),true)
$(eval $(call create-font-symlink,Roboto-Black.ttf,Roboto-Bold.ttf))
+$(eval $(call create-font-symlink,Roboto-BlackItalic.ttf,Roboto-BoldItalic.ttf))
$(eval $(call create-font-symlink,Roboto-Light.ttf,Roboto-Regular.ttf))
$(eval $(call create-font-symlink,Roboto-LightItalic.ttf,Roboto-Italic.ttf))
$(eval $(call create-font-symlink,Roboto-Medium.ttf,Roboto-Regular.ttf))
@@ -120,6 +121,7 @@ $(eval $(call create-font-symlink,RobotoCondensed-BoldItalic.ttf,Roboto-BoldItal
else # !MINIMAL_FONT
font_src_files += \
Roboto-Black.ttf \
+ Roboto-BlackItalic.ttf \
Roboto-Light.ttf \
Roboto-LightItalic.ttf \
Roboto-Medium.ttf \
diff --git a/data/fonts/Roboto-BlackItalic.ttf b/data/fonts/Roboto-BlackItalic.ttf
new file mode 100644
index 0000000..3ebdc7d
--- /dev/null
+++ b/data/fonts/Roboto-BlackItalic.ttf
Binary files differ
diff --git a/data/fonts/fonts.mk b/data/fonts/fonts.mk
index e5573bb..70fc6a2 100644
--- a/data/fonts/fonts.mk
+++ b/data/fonts/fonts.mk
@@ -25,6 +25,7 @@ PRODUCT_PACKAGES := \
Roboto-Italic.ttf \
Roboto-BoldItalic.ttf \
Roboto-Black.ttf \
+ Roboto-BlackItalic.ttf \
Roboto-Light.ttf \
Roboto-LightItalic.ttf \
Roboto-Medium.ttf \
diff --git a/data/fonts/system_fonts.xml b/data/fonts/system_fonts.xml
index 646b33b..8c59fea 100644
--- a/data/fonts/system_fonts.xml
+++ b/data/fonts/system_fonts.xml
@@ -82,6 +82,7 @@
</nameset>
<fileset>
<file>Roboto-Black.ttf</file>
+ <file>Roboto-BlackItalic.ttf</file>
</fileset>
</family>
diff --git a/docs/html/distribute/engage/analytics.jd b/docs/html/distribute/engage/analytics.jd
new file mode 100644
index 0000000..5f7cade
--- /dev/null
+++ b/docs/html/distribute/engage/analytics.jd
@@ -0,0 +1,50 @@
+page.title=Understand User Behavior
+page.metaDescription=Use Google Analytics to learn what your users like and what keeps them coming back.
+page.tags="analytics, user behavior"
+page.image=/images/gp-analytics.jpg
+
+@jd:body
+
+<div class="figure">
+ <img src="{@docRoot}images/gp-analytics.jpg" style="width:320px">
+</div>
+
+
+<p>
+ Link your Google Play Developer Console with Google Analytics to learn much
+ more about how users interact with your app &mdash; before and after they
+ download it.
+</p>
+
+<p>
+ Start by discovering how many people visit your Google Play listing page,
+ where they come from, and how many go on to install your app. Once the app is
+ launched, use Google Analytics to see which of your features are most
+ popular, where power users spend their time, who tends to make in-app
+ purchases, and more.
+</p>
+
+<p>
+ Google Analytics delivers the numbers in real time, so you can act fast to
+ update your landing page and your app. <a href=
+ "http://www.google.com/analytics/mobile/">Learn more</a>.
+</p>
+
+<p>
+ If you have a Google Analytics account already, linking it to Google Play
+ takes just a few moments. You can also link your Google Analytics account to
+ Admob to start gaining more user insights to improve your in-app marketing.
+</p>
+
+ <div class="headerLine clearfloat">
+ <h2 id="related-resources">
+ Related Resources
+ </h2>
+</div>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/engage/analytics"
+ data-sortorder="-timestamp"
+ data-cardsizes="9x3"
+ data-maxresults="6">
+</div> \ No newline at end of file
diff --git a/docs/html/distribute/engage/deep-linking.jd b/docs/html/distribute/engage/deep-linking.jd
index 0417ba1..a25c3c6 100644
--- a/docs/html/distribute/engage/deep-linking.jd
+++ b/docs/html/distribute/engage/deep-linking.jd
@@ -1,13 +1,13 @@
page.title=Deep Link to Bring Users Back
-page.metaDescription=Use deep links to bring your users into your apps from social posts or search.
+page.metaDescription=Use deep links to bring your users into your apps from social posts, search, or ads.
page.tags="app indexing, google+ signin"
page.image=/images/gp-listing-4.jpg
@jd:body
<p>
- Use deep links to bring your users into your apps from social posts or
- search.
+ Use deep links to bring your users into your apps from social posts,
+ search, or ads.
</p>
<div class="headerLine">
@@ -47,6 +47,11 @@ page.image=/images/gp-listing-4.jpg
<h2>Deep Linking from Google Search &mdash; App Indexing</h2>
</div>
+
+<div style="float:right;">
+ <img src="/images/gp-listing-4.jpg" style="padding-top:1em;padding-left:2em;">
+</div>
+
<p>
Another way to bring users back to your apps is to apply for app indexing.
</p>
@@ -60,11 +65,29 @@ page.image=/images/gp-listing-4.jpg
content</a>.
</p>
-<div>
- <img src="{@docRoot}images/gp-listing-4.jpg" style="padding-top:1em;">
+<div class="clearfloat" style="margin-top:2em;"></div>
+
+<div style="float:right;width:340px;padding-left:2em;">
+ <img src="/images/gp-ads-linking2.jpg" style="padding-top:1em;">
</div>
-<div class="headerLine">
+<div class="headerLine ">
+<h2>Deep Linking from Google Ads</h2>
+</div>
+<p>
+ Ads can remind users about the apps they already have.
+</p>
+
+<p>
+ As with deep links from Google's organic search results, AdWords deep links
+ send users directly to the relevant pages in apps they already have on their
+ mobile device. A mobile search for "flights to London," for instance, could
+ take a user straight to the London page in a travel app. <a href=
+ "http://www.thinkwithgoogle.com/products/ads-apps.html"
+ class="external-link">Learn more</a>.
+</p>
+
+<div class="headerLine clearfloat">
<h2 id="related-resources">
Related Resources
</h2>
diff --git a/docs/html/distribute/engage/engage_toc.cs b/docs/html/distribute/engage/engage_toc.cs
index 0314f8c..596051a 100644
--- a/docs/html/distribute/engage/engage_toc.cs
+++ b/docs/html/distribute/engage/engage_toc.cs
@@ -37,6 +37,12 @@
</li>
<li class="nav-section">
<div class="nav-section empty" style="font-weight:normal"><a href="<?cs
+ var:toroot?>distribute/engage/analytics.html">
+ <span class="en">Understand User Behavior</span></a>
+ </div>
+ </li>
+ <li class="nav-section">
+ <div class="nav-section empty" style="font-weight:normal"><a href="<?cs
var:toroot?>distribute/engage/app-updates.html">
<span class="en">Update Regularly</span></a>
</div>
diff --git a/docs/html/distribute/engage/index.jd b/docs/html/distribute/engage/index.jd
index f8cd1ee..2b103c3 100644
--- a/docs/html/distribute/engage/index.jd
+++ b/docs/html/distribute/engage/index.jd
@@ -15,8 +15,8 @@ nonavpage=true
<div class="resource-widget resource-flow-layout landing col-16"
data-query="collection:distribute/engagelanding"
- data-cardSizes="6x6"
- data-maxResults="9">
+ data-cardSizes="9x6,9x6,6x6,6x6,6x6,9x6,9x6,6x6,6x6,6x6"
+ data-maxResults="10">
</div>
<h3>Related Resources</h3>
diff --git a/docs/html/distribute/engage/widgets.jd b/docs/html/distribute/engage/widgets.jd
index 286adea..6adb55c 100644
--- a/docs/html/distribute/engage/widgets.jd
+++ b/docs/html/distribute/engage/widgets.jd
@@ -1,5 +1,5 @@
page.title=Build Useful Widgets
-page.metaDescription=Use widgets to remind users about important information in your apps and games, even when your apps are closed.
+page.metaDescription=Use home screen widgets to remind users about important information in your apps and games, even when your apps are closed.
page.tags=""
page.image=/images/gp-engage-0.jpg
diff --git a/docs/html/distribute/monetize/ads.jd b/docs/html/distribute/monetize/ads.jd
index bcb1e52..9a847ff 100644
--- a/docs/html/distribute/monetize/ads.jd
+++ b/docs/html/distribute/monetize/ads.jd
@@ -10,17 +10,32 @@ page.image=/distribute/images/advertising.png
</div>
<p>
- In-app advertising offers a quick and easy way to incorporate a monetization
- option into both your <a href=
+ Ads can be a quick and easy way to earn more from your <a href=
"{@docRoot}distribute/monetize/freemium.html">freemium</a>, <a href=
"{@docRoot}distribute/monetize/premium.html">premium</a>, and <a href=
- "{@docRoot}distribute/monetize/subscriptions.html">subscription</a> apps. </p>
+ "{@docRoot}distribute/monetize/subscriptions.html">subscription</a> apps.
+ AdMob and the Google Mobile Ads SDK let you add advertising to your apps with
+ just a few lines of code.
+</p>
+
+<p>
+ The question is: which model gets the best results for your app? Google's ad
+ tools are made to help you figure out what combination works best for both
+ your audience and your bottom line. </p>
-<p>Using <a href=
+<p>Start by linking your AdMob and Google
+ Analytics accounts to get better insights and more earning power: for
+ instance, AdMob can promote in-app purchases to the people who buy them most
+ often, while showing income-generating ads to those less likely to buy right
+ now.
+</p>
+
+<p>
+ Using <a href=
"http://www.google.com/ads/admob/monetize.html#subid=us-en-et-dac">AdMob</a>
- and the <a href="{@docRoot}google/play-services/ads.html">Google
- Mobile Ads SDK</a> included in Google Play Services, you’re able to add
- advertising into your apps, with just a few lines of code.
+ and the <a href="{@docRoot}google/play-services/ads.html">Google Mobile Ads
+ SDK</a> included in Google Play Services, you’re able to add advertising into
+ your apps, with just a few lines of code.
</p>
<p>
@@ -30,36 +45,33 @@ page.image=/distribute/images/advertising.png
<ul>
<li>
<p>
- <strong>Placement within your apps</strong> &mdash; Well placed ads will
- optimize your revenue by making it more likely that users will ‘click
- through’. Poorly placed ads can result in low click-through rates, and in
- the worse cases poor rating and users rapidly abandoning your apps. You
- can get advice on how to best place ads from the developer training on
- <a href=
- "{@docRoot}training/monetization/ads-and-ux.html">using
- ads</a>.
+ <strong>Placement within your apps</strong> &mdash; Well-placed ads make
+ it more likely that users will click through and convert. Poorly-placed
+ ads lead to lower click-through rates, and even poor ratings and users
+ abandoning your apps. Our <a href=
+ "{@docRoot}training/monetization/ads-and-ux.html">developer training</a>
+ on using ads shows some of the best ways to place ads.
</p>
</li>
<li>
<p>
<strong>Ad formats</strong> &mdash; Every app offers a different type of
- experience for users, so it’s important to consider the format of ads
- you’re using to ensure it’s compatible with the experience. While banner
- ads may work well for a flashlight utility app, an immersive gaming app
- may benefit more from a video interstitial. Mismatched ad formats may
- negatively affect your users’ experience and ad revenue, so try to select
- formats that fit well with the content and flow of your apps.
+ experience for users, so it’s important that your ad formats match that
+ experience. While banner ads may work well for a flashlight utility app,
+ an immersive gaming app may benefit more from a video interstitial.
+ Mismatched ad formats can make users unhappy and leave money on the
+ table.
</p>
</li>
<li>
<p>
- <strong>Maximizing your performance</strong> &mdash; Ensure you’re optimizing
- your advertising revenue by maximizing your CPMs <em>and</em> fill rate.
- Often ad providers will cite very high CPMs but will have a low fill rate
- that can severely decrease your effective CPM, so look at both of these
- figures. Also consider using a <a href=
+ <strong>Maximizing your performance</strong> &mdash; Make sure you’re
+ optimizing your advertising revenue by maximizing your CPMs and fill
+ rate. Ad providers often cite their very high CPMs but don't mention low
+ fill rates that can severely decrease your effective CPM. Be sure to look
+ at both of these figures. Consider using a <a href=
"https://support.google.com/admob/v2/answer/3063564?hl=en&amp;ref_topic=3063091#subid=us-en-et-dac">
mediation</a> solution if you’d like to use multiple ad providers in your
apps. Look for solutions that offer yield management or <a href=
@@ -71,30 +83,43 @@ page.image=/distribute/images/advertising.png
<li>
<p>
- <strong>Exercising control options</strong> &mdash; A variety of ads promoting a
- broad selection of other services or apps may show up within you apps.
- Depending on your goals and the type of experience you want to provide
- your users, it may make sense to <a href=
+ <strong>Exercising control options</strong> &mdash; A variety of ads may
+ show up within your app. It may make sense to <a href=
"https://support.google.com/admob/v2/answer/3150235?hl=enl#subid=us-en-et-dac">
- block</a> certain advertisements from appearing. Some developers don’t
- want apps in a similar category showing to their users, but some don’t
- mind.
+ block</a> certain of those advertisements from appearing, depending on
+ your goals and the type of experience you want to provide. Some
+ developers, for instance, don’t want ads for apps in their same category
+ showing to their users, while others don’t mind at all.
</p>
</li>
<li>
<p>
- <strong>Cross promoting your other apps</strong> &mdash; Ads can be used for
- more than just earning revenue. Consider using <a href=
+ <strong>Cross promoting your other apps</strong> &mdash; Ads can do more
+ than earn revenue. Consider running <a href=
"https://support.google.com/admob/v2/answer/3210452?hl=en#subid=us-en-et-dac">
- house ads</a> within your apps to create awareness and promote your
- entire portfolio of apps. When launching new apps, an easy way to quickly
- attract users is to promote directly to your existing customers.
+ house ads</a> within your apps to promote other apps in your portfolio.
+ When you launch a new app, this kind of promotion is a free and easy way
+ to attract new users quickly.
</p>
</li>
</ul>
<p>
+ Don't forget that paid channels like AdWords and YouTube can help you cast a
+ wider net by reaching targeted audiences outside the app ecosystem. They're a
+ great way to find new users at a price that you control. <a href=
+ "https://support.google.com/adwords/answer/2549053">Learn more</a>.
+</p>
+
+<p>
+ To start monetizing with ads, sign up for AdMob and integrate the Google
+ Mobile Ads SDK into your apps. If you also need to manage direct deals with
+ advertisers, consider using DoubleClick for Publishers Small Business.
+</p>
+
+
+<p>
To start monetizing with ads sign up for <a href=
"http://www.google.com/ads/admob/#subid=us-en-et-dac">AdMob</a> and integrate
the <a href="https://developers.google.com/mobile-ads-sdk/download">Google
diff --git a/docs/html/distribute/users/index.jd b/docs/html/distribute/users/index.jd
index 77ef609..a810f36 100644
--- a/docs/html/distribute/users/index.jd
+++ b/docs/html/distribute/users/index.jd
@@ -14,8 +14,8 @@ nonavpage=true
<div class="resource-widget resource-flow-layout landing col-16"
data-query="collection:distribute/users"
- data-cardSizes="6x6, 6x6, 6x6, 9x6, 9x6, 6x6, 6x6, 6x6"
- data-maxResults="8">
+ data-cardSizes="6x6"
+ data-maxResults="6">
</div>
<h3>Related resources</h3>
diff --git a/docs/html/distribute/users/promote-with-ads.jd b/docs/html/distribute/users/promote-with-ads.jd
new file mode 100644
index 0000000..1e28ae1
--- /dev/null
+++ b/docs/html/distribute/users/promote-with-ads.jd
@@ -0,0 +1,45 @@
+page.title=Promote Your App with Ads
+page.metaDescription=Promote your app through AdMob, AdWords, and YouTube to find new users at the right moment.
+page.image=/images/gp-ads-console.jpg
+page.tags="users, ads, analytics"
+
+@jd:body
+
+<p>
+ AdMob is Google's advertising platform for mobile apps. You can use it to
+ monetize your app and promote your apps, and you can link your Google
+ Analytics account to AdMob so you can analyze your apps &mdash; all in one
+ place.
+</p>
+
+<p>
+ <a href="http://www.google.com/ads/admob/">AdMob</a> is the largest mobile ad
+ app network. But you get more than just massive scale: AdMob will soon help
+ you find the right users in related apps. If your app is for bicycling, AdMob
+ can promote your app on other fitness and cycling-related apps worldwide.
+ <a href=
+ "https://apps.admob.com/admob/signup?subid=us-en-et-dac&_adc=ww-ww-et-admob2&hl=en">
+ Sign up for AdMob</a>.
+</p>
+
+<p>
+ AdMob also offers new solutions to help you achieve app-related goals such as
+ downloads, re-engagement and in-app purchases using Google search and the
+ Google Display Network. These solutions include streamlined campaign creation
+ flows and tools to track performance across the entire app lifecycle.
+ <a href="https://support.google.com/adwords/answer/2549053?hl=en">Learn
+ More</a>.
+</p>
+<div style="margin-top:2em;">
+ <img src="{@docRoot}images/gp-ads-console.jpg">
+</div>
+
+<div class="headerLine">
+<h2 id="related-resources">Related Resources</h2>
+</div>
+
+<div class="resource-widget resource-flow-layout col-13"
+ data-query="collection:distribute/users/promotewithads"
+ data-sortOrder="-timestamp"
+ data-cardSizes="9x3"
+ data-maxResults="6"></div> \ No newline at end of file
diff --git a/docs/html/distribute/users/users_toc.cs b/docs/html/distribute/users/users_toc.cs
index a2437a6..1f173cb 100644
--- a/docs/html/distribute/users/users_toc.cs
+++ b/docs/html/distribute/users/users_toc.cs
@@ -28,7 +28,12 @@
</a>
</div>
</li>
-
+ <li class="nav-section">
+ <div class="nav-section empty" style="font-weight:normal"><a href="<?cs var:toroot?>distribute/users/promote-with-ads.html">
+ <span class="en">Promote with Ads</span>
+ </a>
+ </div>
+ </li>
</ul>
diff --git a/docs/html/images/gp-ads-console.jpg b/docs/html/images/gp-ads-console.jpg
new file mode 100644
index 0000000..158e31d
--- /dev/null
+++ b/docs/html/images/gp-ads-console.jpg
Binary files differ
diff --git a/docs/html/images/gp-ads-linking2.jpg b/docs/html/images/gp-ads-linking2.jpg
new file mode 100644
index 0000000..0c2f731
--- /dev/null
+++ b/docs/html/images/gp-ads-linking2.jpg
Binary files differ
diff --git a/docs/html/images/gp-analytics.jpg b/docs/html/images/gp-analytics.jpg
new file mode 100644
index 0000000..e1a92c7
--- /dev/null
+++ b/docs/html/images/gp-analytics.jpg
Binary files differ
diff --git a/docs/html/jd_collections.js b/docs/html/jd_collections.js
index 8a4ac47..5ee01f3 100644
--- a/docs/html/jd_collections.js
+++ b/docs/html/jd_collections.js
@@ -49,7 +49,8 @@ var RESOURCE_COLLECTIONS = {
"distribute/users/your-listing.html",
"distribute/users/build-buzz.html",
"distribute/users/build-community.html",
- "distribute/users/expand-to-new-markets.html"
+ "distribute/users/expand-to-new-markets.html",
+ "distribute/users/promote-with-ads.html"
]
},
"distribute/engagelanding": {
@@ -60,6 +61,7 @@ var RESOURCE_COLLECTIONS = {
"distribute/engage/easy-signin.html",
"distribute/engage/deep-linking.html",
"distribute/engage/game-services.html",
+ "distribute/engage/analytics.html",
"distribute/engage/app-updates.html",
"distribute/engage/community.html",
"distribute/engage/video.html"
@@ -214,6 +216,13 @@ var RESOURCE_COLLECTIONS = {
"distribute/stories/localization.html"
]
},
+ "distribute/users/promotewithads": {
+ "title": "",
+ "resources": [
+ "http://www.google.com/ads/admob/#subid=us-en-et-dac",
+ "distribute/essentials/optimizing-your-app.html"
+ ]
+ },
"distribute/users/buildbuzz": {
"title": "",
"resources": [
@@ -394,6 +403,14 @@ var RESOURCE_COLLECTIONS = {
"http://play.google.com/about/developer-content-policy.html"
]
},
+ "distribute/engage/analytics": {
+ "title": "",
+ "resources": [
+ "http://www.google.com/analytics/mobile/",
+ "http://android-developers.blogspot.com/2013/10/improved-app-insight-by-linking-google.html",
+ "https://developers.google.com/analytics/devguides/collection/android/"
+ ]
+ },
"distribute/engage/widgets": {
"title": "",
"resources": [
diff --git a/docs/html/jd_extras.js b/docs/html/jd_extras.js
index f26b747..d8db5bf 100644
--- a/docs/html/jd_extras.js
+++ b/docs/html/jd_extras.js
@@ -726,6 +726,21 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"tags": [
"#engagement",
],
+ "url": "http://www.google.com/analytics/mobile/",
+ "timestamp": 1383243492000,
+ "image": "http://www.google.com//analytics/images/heros/mobile-index.jpg",
+ "title": "Google Mobile App Analytics",
+ "summary": "Mobile App Analytics measures what matters most at all key stages: from first discovery and download to in-app purchases. ",
+ "keywords": ["analytics,user behavior"],
+ "type": "guide",
+ "titleFriendly": ""
+ },
+ {
+ "lang": "en",
+ "group": "",
+ "tags": [
+ "#engagement",
+ ],
"url": "https://developers.google.com/app-indexing/",
"timestamp": 1383243492000,
"image": "https://developers.google.com/app-indexing/images/allthecooks_srp.png",
@@ -1101,4 +1116,17 @@ DISTRIBUTE_RESOURCES = DISTRIBUTE_RESOURCES.concat([
"type": "Google+",
"titleFriendly": ""
},
+ {
+ "lang": "en",
+ "group": "",
+ "tags": ["analytics"],
+ "url": "https://developers.google.com/analytics/devguides/collection/android/",
+ "timestamp": null,
+ "image": "https://developers.google.com/analytics/images/home/gear-logo.png",
+ "title": "Google Mobile App Analytics SDK",
+ "summary": "The Google Analytics for Mobile Apps SDKs make it easy for you to implement Google Analytics in your mobile application.",
+ "keywords": ["analytics, user behavior"],
+ "type": "sdk",
+ "titleFriendly": ""
+ }
]); \ No newline at end of file
diff --git a/docs/html/training/articles/keystore.jd b/docs/html/training/articles/keystore.jd
new file mode 100644
index 0000000..bbbda67
--- /dev/null
+++ b/docs/html/training/articles/keystore.jd
@@ -0,0 +1,107 @@
+page.title=Android Keystore System
+@jd:body
+
+<div id="qv-wrapper">
+ <div id="qv">
+ <h2>In this document</h2>
+ <ol>
+ <li><a href="#WhichShouldIUse">Choosing Between a Keychain or the Android Keystore Provider</a></li>
+ <li><a href="#UsingAndroidKeyStore">Using Android Keystore Provider
+ </a></li>
+ <ol>
+ <li><a href="#GeneratingANewPrivateKey">Generating a New Private Key</a></li>
+ <li><a href="#WorkingWithKeyStoreEntries">Working with Keystore Entries</a></li>
+ <li><a href="#ListingEntries">Listing Entries</a></li>
+ <li><a href="#SigningAndVerifyingData">Signing and Verifying Data</a></li>
+ </ol>
+ </ol>
+
+ <h2>Blog articles</h2>
+ <ol>
+ <li><a
+ href="http://android-developers.blogspot.com/2012/03/unifying-key-store-access-in-ics.html">
+ <h4>Unifying Key Store Access in ICS</h4>
+ </a></li>
+ </ol>
+ </div>
+</div>
+
+<p>The Android Keystore system lets you store private keys
+ in a container to make it more difficult to extract from the
+ device. Once keys are in the keystore, they can be used for
+ cryptographic operations with the private key material remaining
+ non-exportable.</p>
+
+<p>The Keystore system is used by the {@link
+ android.security.KeyChain} API as well as the Android
+ Keystore provider feature that was introduced in Android 4.3
+ (API level 18). This document goes over when and how to use the
+ Android Keystore provider.</p>
+
+<h2 id="WhichShouldIUse">Choosing Between a Keychain or the
+Android Keystore Provider</h2>
+
+<p>Use the {@link android.security.KeyChain} API when you want
+ system-wide credentials. When an app requests the use of any credential
+ through the {@link android.security.KeyChain} API, users get to
+ choose, through a system-provided UI, which of the installed credentials
+ an app can access. This allows several apps to use the
+ same set of credentials with user consent.</p>
+
+<p>Use the Android Keystore provider to let an individual app store its own
+ credentials that only the app itself can access.
+ This provides a way for apps to manage credentials that are usable
+ only by itself while providing the same security benefits that the
+ {@link android.security.KeyChain} API provides for system-wide
+ credentials. This method requires no user interaction to select the credentials.</p>
+
+<h2 id="UsingAndroidKeyStore">Using Android Keystore Provider</h2>
+
+<p>
+To use this feature, you use the standard {@link java.security.KeyStore}
+and {@link java.security.KeyPairGenerator} classes along with the
+{@code AndroidKeyStore} provider introduced in Android 4.3 (API level 18).</p>
+
+<p>{@code AndroidKeyStore} is registered as a {@link
+ java.security.KeyStore} type for use with the {@link
+ java.security.KeyStore#getInstance(String) KeyStore.getInstance(type)}
+ method and as a provider for use with the {@link
+ java.security.KeyPairGenerator#getInstance(String, String)
+ KeyPairGenerator.getInstance(algorithm, provider)} method.</p>
+
+<h3 id="GeneratingANewPrivateKey">Generating a New Private Key</h3>
+
+<p>Generating a new {@link java.security.PrivateKey} requires that
+ you also specify the initial X.509 attributes that the self-signed
+ certificate will have. You can replace the certificate at a later
+ time with a certificate signed by a Certificate Authority.</p>
+
+<p>To generate the key, use a {@link java.security.KeyPairGenerator}
+ with {@link android.security.KeyPairGeneratorSpec}:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java generate}
+
+<h3 id="WorkingWithKeyStoreEntries">Working with Keystore Entries</h3>
+
+<p>Using the {@code AndroidKeyStore} provider takes place through
+ all the standard {@link java.security.KeyStore} APIs.</p>
+
+<h4 id="ListingEntries">Listing Entries</h4>
+
+<p>List entries in the keystore by calling the {@link
+ java.security.KeyStore#aliases()} method:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java list}
+
+<h4 id="SigningAndVerifyingData">Signing and Verifying Data</h4>
+
+<p>Sign data by fetching the {@link
+ java.security.KeyStore.Entry} from the keystore and using the
+ {@link java.security.Signature} APIs, such as {@link
+ java.security.Signature#sign()}:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java sign}
+
+<p>Similarly, verify data with the {@link java.security.Signature#verify(byte[])} method:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/security/KeyStoreUsage.java verify}
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 06cf253..ef0a411 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -194,6 +194,11 @@ public final class Bitmap implements Parcelable {
* while {@link #getAllocationByteCount()} will reflect that of the initial
* configuration.</p>
*
+ * <p>Note: This may change this result of hasAlpha(). When converting to 565,
+ * the new bitmap will always be considered opaque. When converting from 565,
+ * the new bitmap will be considered non-opaque, and will respect the value
+ * set by setPremultiplied().</p>
+ *
* <p>WARNING: This method should NOT be called on a bitmap currently used
* by the view system. It does not make guarantees about how the underlying
* pixel buffer is remapped to the new config, just that the allocation is
@@ -217,7 +222,8 @@ public final class Bitmap implements Parcelable {
throw new IllegalStateException("native-backed bitmaps may not be reconfigured");
}
- nativeReconfigure(mNativeBitmap, width, height, config.nativeInt, mBuffer.length);
+ nativeReconfigure(mNativeBitmap, width, height, config.nativeInt, mBuffer.length,
+ mIsPremultiplied);
mWidth = width;
mHeight = height;
}
@@ -1586,7 +1592,8 @@ public final class Bitmap implements Parcelable {
private static native void nativeDestructor(long nativeBitmap);
private static native boolean nativeRecycle(long nativeBitmap);
private static native void nativeReconfigure(long nativeBitmap, int width, int height,
- int config, int allocSize);
+ int config, int allocSize,
+ boolean isPremultiplied);
private static native boolean nativeCompress(long nativeBitmap, int format,
int quality, OutputStream stream,
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index de458af..a021165 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -53,7 +53,7 @@ public class Picture {
public Picture(Picture src) {
this(nativeConstructor(src != null ? src.mNativePicture : 0), false);
}
-
+
/**
* To record a picture, call beginRecording() and then draw into the Canvas
* that is returned. Nothing we appear on screen, but all of the draw
@@ -67,7 +67,7 @@ public class Picture {
mRecordingCanvas = new RecordingCanvas(this, ni);
return mRecordingCanvas;
}
-
+
/**
* Call endRecording when the picture is built. After this call, the picture
* may be drawn, but the canvas that was returned by beginRecording must not
@@ -92,16 +92,19 @@ public class Picture {
* does not reflect (per se) the content of the picture.
*/
public native int getHeight();
-
+
/**
- * Draw this picture on the canvas. The picture may have the side effect
- * of changing the matrix and clip of the canvas.
- *
+ * Draw this picture on the canvas.
+ * <p>
+ * Prior to {@link android.os.Build.VERSION_CODES#L}, this call could
+ * have the side effect of changing the matrix and clip of the canvas
+ * if this picture had imbalanced saves/restores.
+ *
* <p>
* <strong>Note:</strong> This forces the picture to internally call
* {@link Picture#endRecording()} in order to prepare for playback.
*
- * @param canvas The picture is drawn to this canvas
+ * @param canvas The picture is drawn to this canvas
*/
public void draw(Canvas canvas) {
if (mRecordingCanvas != null) {
@@ -119,7 +122,7 @@ public class Picture {
* <p>
* <strong>Note:</strong> a picture created from an input stream cannot be
* replayed on a hardware accelerated canvas.
- *
+ *
* @see #writeToStream(java.io.OutputStream)
* @deprecated The recommended alternative is to not use writeToStream and
* instead draw the picture into a Bitmap from which you can persist it as
@@ -167,7 +170,7 @@ public class Picture {
final long ni() {
return mNativePicture;
}
-
+
private Picture(long nativePicture, boolean fromStream) {
if (nativePicture == 0) {
throw new RuntimeException();
@@ -187,7 +190,7 @@ public class Picture {
private static native boolean nativeWriteToStream(long nativePicture,
OutputStream stream, byte[] storage);
private static native void nativeDestructor(long nativePicture);
-
+
private static class RecordingCanvas extends Canvas {
private final Picture mPicture;
@@ -195,7 +198,7 @@ public class Picture {
super(nativeCanvas);
mPicture = pict;
}
-
+
@Override
public void setBitmap(Bitmap bitmap) {
throw new RuntimeException(
diff --git a/graphics/java/android/graphics/drawable/Ripple.java b/graphics/java/android/graphics/drawable/Ripple.java
index 4623fa8..0d70e75 100644
--- a/graphics/java/android/graphics/drawable/Ripple.java
+++ b/graphics/java/android/graphics/drawable/Ripple.java
@@ -68,6 +68,8 @@ class Ripple {
private float mStartingX;
private float mStartingY;
+ private float mClampedStartingX;
+ private float mClampedStartingY;
// Hardware rendering properties.
private CanvasProperty<Paint> mPropPaint;
@@ -112,6 +114,7 @@ class Ripple {
public Ripple(RippleDrawable owner, Rect bounds, float startingX, float startingY) {
mOwner = owner;
mBounds = bounds;
+
mStartingX = startingX;
mStartingY = startingY;
}
@@ -131,6 +134,23 @@ class Ripple {
mOuterX = 0;
mOuterY = 0;
mDensity = density;
+
+ clampStartingPosition();
+ }
+
+ private void clampStartingPosition() {
+ final float dX = mStartingX - mBounds.exactCenterX();
+ final float dY = mStartingY - mBounds.exactCenterY();
+ final float r = mOuterRadius;
+ if (dX * dX + dY * dY > r * r) {
+ // Point is outside the circle, clamp to the circumference.
+ final double angle = Math.atan2(dY, dX);
+ mClampedStartingX = (float) (Math.cos(angle) * r);
+ mClampedStartingY = (float) (Math.sin(angle) * r);
+ } else {
+ mClampedStartingX = mStartingX;
+ mClampedStartingY = mStartingY;
+ }
}
public void onHotspotBoundsChanged() {
@@ -138,6 +158,8 @@ class Ripple {
final float halfWidth = mBounds.width() / 2.0f;
final float halfHeight = mBounds.height() / 2.0f;
mOuterRadius = (float) Math.sqrt(halfWidth * halfWidth + halfHeight * halfHeight);
+
+ clampStartingPosition();
}
}
@@ -247,8 +269,10 @@ class Ripple {
final int alpha = (int) (paintAlpha * mOpacity + 0.5f);
final float radius = MathUtils.lerp(0, mOuterRadius, mTweenRadius);
if (alpha > 0 && radius > 0) {
- final float x = MathUtils.lerp(mStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
- final float y = MathUtils.lerp(mStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
+ final float x = MathUtils.lerp(
+ mClampedStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
+ final float y = MathUtils.lerp(
+ mClampedStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
p.setAlpha(alpha);
p.setStyle(Style.FILL);
c.drawCircle(x, y, radius, p);
@@ -277,6 +301,8 @@ class Ripple {
public void move(float x, float y) {
mStartingX = x;
mStartingY = y;
+
+ clampStartingPosition();
}
/**
@@ -361,8 +387,10 @@ class Ripple {
int inflectionOpacity) {
mPendingAnimations.clear();
- final float startX = MathUtils.lerp(mStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
- final float startY = MathUtils.lerp(mStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
+ final float startX = MathUtils.lerp(
+ mClampedStartingX - mBounds.exactCenterX(), mOuterX, mTweenX);
+ final float startY = MathUtils.lerp(
+ mClampedStartingY - mBounds.exactCenterY(), mOuterY, mTweenY);
final Paint outerPaint = new Paint();
outerPaint.setAntiAlias(true);
outerPaint.setColor(mColor);
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index e37fbeb..0512ecc 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -48,22 +48,41 @@ import java.io.IOException;
* A touch feedback drawable may contain multiple child layers, including a
* special mask layer that is not drawn to the screen. A single layer may be set
* as the mask by specifying its android:id value as {@link android.R.id#mask}.
+ * <pre>
+ * <code>&lt!-- A red ripple masked against an opaque rectangle. --/>
+ * &ltripple android:color="#ffff0000">
+ * &ltitem android:id="@android:id/mask"
+ * android:drawable="#ffffffff" />
+ * &ltripple /></code>
+ * </pre>
* <p>
* If a mask layer is set, the ripple effect will be masked against that layer
- * before it is blended onto the composite of the remaining child layers.
+ * before it is drawn over the composite of the remaining child layers.
* <p>
- * If no mask layer is set, the ripple effect is simply blended onto the
- * composite of the child layers using the specified
- * {@link android.R.styleable#RippleDrawable_tintMode}.
+ * If no mask layer is set, the ripple effect is masked against the composite
+ * of the child layers.
+ * <pre>
+ * <code>&lt!-- A blue ripple drawn atop a green rectangle. --/>
+ * &ltripple android:color="#ff00ff00">
+ * &ltitem android:drawable="#ff0000ff" />
+ * &ltripple />
+ *
+ * &lt!-- A red ripple drawn atop a drawable resource. --/>
+ * &ltripple android:color="#ff00ff00">
+ * &ltitem android:drawable="@drawable/my_drawable" />
+ * &ltripple /></code>
+ * </pre>
* <p>
* If no child layers or mask is specified and the ripple is set as a View
- * background, the ripple will be blended onto the first available parent
- * background within the View's hierarchy using the specified
- * {@link android.R.styleable#RippleDrawable_tintMode}. In this case, the
- * drawing region may extend outside of the Drawable bounds.
+ * background, the ripple will be drawn atop the first available parent
+ * background within the View's hierarchy. In this case, the drawing region
+ * may extend outside of the Drawable bounds.
+ * <pre>
+ * <code>&lt!-- An unbounded green ripple. --/>
+ * &ltripple android:color="#ff0000ff" /></code>
+ * </pre>
*
- * @attr ref android.R.styleable#DrawableStates_state_focused
- * @attr ref android.R.styleable#DrawableStates_state_pressed
+ * @attr ref android.R.styleable#RippleDrawable_color
*/
public class RippleDrawable extends LayerDrawable {
private static final String LOG_TAG = RippleDrawable.class.getSimpleName();
@@ -188,8 +207,8 @@ public class RippleDrawable extends LayerDrawable {
setActive(active && enabled);
// Update the paint color. Only applicable when animated in software.
- if (mRipplePaint != null && mState.mTint != null) {
- final ColorStateList stateList = mState.mTint;
+ if (mRipplePaint != null && mState.mColor != null) {
+ final ColorStateList stateList = mState.mColor;
final int newColor = stateList.getColorForState(stateSet, 0);
final int oldColor = mRipplePaint.getColor();
if (oldColor != newColor) {
@@ -248,10 +267,8 @@ public class RippleDrawable extends LayerDrawable {
return true;
}
- @Override
- public void setTint(ColorStateList tint, Mode tintMode) {
- mState.mTint = tint;
- mState.setTintMode(tintMode);
+ public void setColor(ColorStateList color) {
+ mState.mColor = color;
invalidateSelf();
}
@@ -312,22 +329,15 @@ public class RippleDrawable extends LayerDrawable {
// Extract the theme attributes, if any.
state.mTouchThemeAttrs = a.extractThemeAttrs();
- final ColorStateList tint = a.getColorStateList(R.styleable.RippleDrawable_tint);
- if (tint != null) {
- mState.mTint = tint;
- }
-
- final int tintMode = a.getInt(R.styleable.RippleDrawable_tintMode, -1);
- if (tintMode != -1) {
- mState.setTintMode(Drawable.parseTintMode(tintMode, Mode.SRC_ATOP));
+ final ColorStateList color = a.getColorStateList(R.styleable.RippleDrawable_color);
+ if (color != null) {
+ mState.mColor = color;
}
- mState.mPinned = a.getBoolean(R.styleable.RippleDrawable_pinned, mState.mPinned);
-
// If we're not waiting on a theme, verify required attributes.
- if (state.mTouchThemeAttrs == null && mState.mTint == null) {
+ if (state.mTouchThemeAttrs == null && mState.mColor == null) {
throw new XmlPullParserException(a.getPositionDescription() +
- ": <ripple> requires a valid tint attribute");
+ ": <ripple> requires a valid color attribute");
}
}
@@ -372,11 +382,6 @@ public class RippleDrawable extends LayerDrawable {
@Override
public void setHotspot(float x, float y) {
- if (mState.mPinned && !circleContains(mHotspotBounds, x, y)) {
- x = mHotspotBounds.exactCenterX();
- y = mHotspotBounds.exactCenterY();
- }
-
if (mHotspot == null) {
mHotspot = new Ripple(this, mHotspotBounds, x, y);
@@ -388,18 +393,6 @@ public class RippleDrawable extends LayerDrawable {
}
}
- private boolean circleContains(Rect bounds, float x, float y) {
- final float pX = bounds.exactCenterX() - x;
- final float pY = bounds.exactCenterY() - y;
- final double pointRadius = Math.sqrt(pX * pX + pY * pY);
-
- final float bX = bounds.width() / 2.0f;
- final float bY = bounds.height() / 2.0f;
- final double boundsRadius = Math.sqrt(bX * bX + bY * bY);
-
- return pointRadius < boundsRadius;
- }
-
/**
* Creates an active hotspot at the specified location.
*/
@@ -417,7 +410,7 @@ public class RippleDrawable extends LayerDrawable {
mHotspot = new Ripple(this, mHotspotBounds, x, y);
}
- final int color = mState.mTint.getColorForState(getState(), Color.TRANSPARENT);
+ final int color = mState.mColor.getColorForState(getState(), Color.TRANSPARENT);
mHotspot.setup(mState.mMaxRadius, color, mDensity);
mHotspot.enter();
@@ -485,8 +478,10 @@ public class RippleDrawable extends LayerDrawable {
final int contentLayer = drawNonMaskContent ?
drawContentLayer(canvas, bounds, SRC_OVER) : -1;
- // Next, try to draw the ripples (into a layer if necessary).
- final int rippleLayer = drawRippleLayer(canvas, bounds, mState.mTintXfermode);
+ // Next, try to draw the ripples (into a layer if necessary). If we need
+ // to mask against the underlying content, set the xfermode to SRC_ATOP.
+ final PorterDuffXfermode xfermode = (hasMask || !drawNonMaskContent) ? SRC_OVER : SRC_ATOP;
+ final int rippleLayer = drawRippleLayer(canvas, bounds, xfermode);
// If we have ripples and a non-opaque mask, draw the masking layer.
if (rippleLayer >= 0 && drawMask) {
@@ -533,14 +528,27 @@ public class RippleDrawable extends LayerDrawable {
}
private int drawContentLayer(Canvas canvas, Rect bounds, PorterDuffXfermode mode) {
- // TODO: We don't need a layer if all the content is opaque.
+ final ChildDrawable[] array = mLayerState.mChildren;
+ final int count = mLayerState.mNum;
+
+ // We don't need a layer if we don't expect to draw any ripples, we have
+ // an explicit mask, or if the non-mask content is all opaque.
+ boolean needsLayer = false;
+ if (mAnimatingRipplesCount > 0 && mMask == null) {
+ for (int i = 0; i < count; i++) {
+ if (array[i].mId != R.id.mask
+ && array[i].mDrawable.getOpacity() != PixelFormat.OPAQUE) {
+ needsLayer = true;
+ break;
+ }
+ }
+ }
+
final Paint maskingPaint = getMaskingPaint(mode);
- final int restoreToCount = canvas.saveLayer(bounds.left, bounds.top,
- bounds.right, bounds.bottom, maskingPaint);
+ final int restoreToCount = needsLayer ? canvas.saveLayer(bounds.left, bounds.top,
+ bounds.right, bounds.bottom, maskingPaint) : -1;
// Draw everything except the mask.
- final ChildDrawable[] array = mLayerState.mChildren;
- final int count = mLayerState.mNum;
for (int i = 0; i < count; i++) {
if (array[i].mId != R.id.mask) {
array[i].mDrawable.draw(canvas);
@@ -559,8 +567,8 @@ public class RippleDrawable extends LayerDrawable {
// Separate the ripple color and alpha channel. The alpha will be
// applied when we merge the ripples down to the canvas.
final int rippleARGB;
- if (mState.mTint != null) {
- rippleARGB = mState.mTint.getColorForState(getState(), Color.TRANSPARENT);
+ if (mState.mColor != null) {
+ rippleARGB = mState.mColor.getColorForState(getState(), Color.TRANSPARENT);
} else {
rippleARGB = Color.TRANSPARENT;
}
@@ -665,31 +673,19 @@ public class RippleDrawable extends LayerDrawable {
static class RippleState extends LayerState {
int[] mTouchThemeAttrs;
- ColorStateList mTint = null;
- PorterDuffXfermode mTintXfermode = SRC_ATOP;
+ ColorStateList mColor = null;
int mMaxRadius = RADIUS_AUTO;
- boolean mPinned = false;
public RippleState(RippleState orig, RippleDrawable owner, Resources res) {
super(orig, owner, res);
if (orig != null) {
mTouchThemeAttrs = orig.mTouchThemeAttrs;
- mTint = orig.mTint;
- mTintXfermode = orig.mTintXfermode;
+ mColor = orig.mColor;
mMaxRadius = orig.mMaxRadius;
- mPinned = orig.mPinned;
}
}
- public void setTintMode(Mode mode) {
- mTintXfermode = new PorterDuffXfermode(mode);
- }
-
- public PorterDuffXfermode getTintXfermode() {
- return mTintXfermode;
- }
-
@Override
public boolean canApplyTheme() {
return mTouchThemeAttrs != null || super.canApplyTheme();
diff --git a/keystore/java/android/security/KeyPairGeneratorSpec.java b/keystore/java/android/security/KeyPairGeneratorSpec.java
index 21d6caa..4a823cc 100644
--- a/keystore/java/android/security/KeyPairGeneratorSpec.java
+++ b/keystore/java/android/security/KeyPairGeneratorSpec.java
@@ -35,7 +35,7 @@ import javax.security.auth.x500.X500Principal;
/**
* This provides the required parameters needed for initializing the
* {@code KeyPairGenerator} that works with
- * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore
* facility</a>. The Android KeyStore facility is accessed through a
* {@link java.security.KeyPairGenerator} API using the {@code AndroidKeyStore}
* provider. The {@code context} passed in may be used to pop up some UI to ask
@@ -306,7 +306,7 @@ public final class KeyPairGeneratorSpec implements AlgorithmParameterSpec {
* Builder class for {@link KeyPairGeneratorSpec} objects.
* <p>
* This will build a parameter spec for use with the <a href="{@docRoot}
- * guide/topics/security/keystore.html">Android KeyStore facility</a>.
+ * training/articles/keystore.html">Android KeyStore facility</a>.
* <p>
* The required fields must be filled in with the builder.
* <p>
diff --git a/keystore/java/android/security/KeyStoreParameter.java b/keystore/java/android/security/KeyStoreParameter.java
index b71efc4..2eeb6ad 100644
--- a/keystore/java/android/security/KeyStoreParameter.java
+++ b/keystore/java/android/security/KeyStoreParameter.java
@@ -24,7 +24,7 @@ import java.security.KeyStore.ProtectionParameter;
/**
* This provides the optional parameters that can be specified for
* {@code KeyStore} entries that work with
- * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore
* facility</a>. The Android KeyStore facility is accessed through a
* {@link java.security.KeyStore} API using the {@code AndroidKeyStore}
* provider. The {@code context} passed in may be used to pop up some UI to ask
@@ -67,7 +67,7 @@ public final class KeyStoreParameter implements ProtectionParameter {
* Builder class for {@link KeyStoreParameter} objects.
* <p>
* This will build protection parameters for use with the
- * <a href="{@docRoot}guide/topics/security/keystore.html">Android KeyStore
+ * <a href="{@docRoot}training/articles/keystore.html">Android KeyStore
* facility</a>.
* <p>
* This can be used to require that KeyStore entries be stored encrypted.
diff --git a/libs/hwui/TessellationCache.cpp b/libs/hwui/TessellationCache.cpp
index 41cc9d2..79fe4d3 100644
--- a/libs/hwui/TessellationCache.cpp
+++ b/libs/hwui/TessellationCache.cpp
@@ -165,12 +165,12 @@ public:
ShadowTask(const Matrix4* drawTransform, const Rect& localClip, bool opaque,
const SkPath* casterPerimeter, const Matrix4* transformXY, const Matrix4* transformZ,
const Vector3& lightCenter, float lightRadius)
- : drawTransform(drawTransform)
+ : drawTransform(*drawTransform)
, localClip(localClip)
, opaque(opaque)
- , casterPerimeter(casterPerimeter)
- , transformXY(transformXY)
- , transformZ(transformZ)
+ , casterPerimeter(*casterPerimeter)
+ , transformXY(*transformXY)
+ , transformZ(*transformZ)
, lightCenter(lightCenter)
, lightRadius(lightRadius) {
}
@@ -182,14 +182,19 @@ public:
delete bufferPair;
}
- // Note - only the localClip is deep copied, since other pointers point at Allocator controlled
- // objects, which are safe for the entire frame
- const Matrix4* drawTransform;
+ /* Note - we deep copy all task parameters, because *even though* pointers into Allocator
+ * controlled objects (like the SkPath and Matrix4s) should be safe for the entire frame,
+ * certain Allocators are destroyed before trim() is called to flush incomplete tasks.
+ *
+ * These deep copies could be avoided, long term, by cancelling or flushing outstanding tasks
+ * before tearning down single-frame LinearAllocators.
+ */
+ const Matrix4 drawTransform;
const Rect localClip;
bool opaque;
- const SkPath* casterPerimeter;
- const Matrix4* transformXY;
- const Matrix4* transformZ;
+ const SkPath casterPerimeter;
+ const Matrix4 transformXY;
+ const Matrix4 transformZ;
const Vector3 lightCenter;
const float lightRadius;
};
@@ -281,8 +286,8 @@ public:
VertexBuffer* ambientBuffer = new VertexBuffer;
VertexBuffer* spotBuffer = new VertexBuffer;
- tessellateShadows(t->drawTransform, &t->localClip, t->opaque, t->casterPerimeter,
- t->transformXY, t->transformZ, t->lightCenter, t->lightRadius,
+ tessellateShadows(&t->drawTransform, &t->localClip, t->opaque, &t->casterPerimeter,
+ &t->transformXY, &t->transformZ, t->lightCenter, t->lightRadius,
*ambientBuffer, *spotBuffer);
t->setResult(new TessellationCache::vertexBuffer_pair_t(ambientBuffer, spotBuffer));
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index ded10a1..4988f19 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -47,7 +47,7 @@ namespace renderthread {
#define SETUP_TASK(method) \
LOG_ALWAYS_FATAL_IF( METHOD_INVOKE_PAYLOAD_SIZE < sizeof(ARGS(method)), \
- "METHOD_INVOKE_PAYLOAD_SIZE %d is smaller than sizeof(" #method "Args) %d", \
+ "METHOD_INVOKE_PAYLOAD_SIZE %zu is smaller than sizeof(" #method "Args) %zu", \
METHOD_INVOKE_PAYLOAD_SIZE, sizeof(ARGS(method))); \
MethodInvokeRenderTask* task = new MethodInvokeRenderTask((RunnableMethod) Bridge_ ## method); \
ARGS(method) *args = (ARGS(method) *) task->payload()
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index c3d5d94..ba6b214 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1653,6 +1653,25 @@ public class AudioManager {
}
}
+
+ /**
+ * Return a new audio session identifier not associated with any player or effect.
+ * It can for instance be used to create one of the {@link android.media.audiofx.AudioEffect}
+ * objects.
+ * @return a new unclaimed and unused audio session identifier, or {@link #ERROR} when the
+ * system failed to allocate a new session.
+ */
+ public int allocateAudioSessionId() {
+ int session = AudioSystem.newAudioSessionId();
+ if (session > 0) {
+ return session;
+ } else {
+ Log.e(TAG, "Failure to allocate a new audio session ID");
+ return ERROR;
+ }
+ }
+
+
/*
* Sets a generic audio configuration parameter. The use of these parameters
* are platform dependant, see libaudio
@@ -2998,7 +3017,8 @@ public class AudioManager {
/** @hide
*/
public static final int SUCCESS = AudioSystem.SUCCESS;
- /** @hide
+ /**
+ * A default error code.
*/
public static final int ERROR = AudioSystem.ERROR;
/** @hide
diff --git a/media/java/android/media/AudioSystem.java b/media/java/android/media/AudioSystem.java
index c8d64ce..9fbcd18 100644
--- a/media/java/android/media/AudioSystem.java
+++ b/media/java/android/media/AudioSystem.java
@@ -130,6 +130,11 @@ public class AudioSystem
public static native boolean isSourceActive(int source);
/*
+ * Returns a new unused audio session ID
+ */
+ public static native int newAudioSessionId();
+
+ /*
* Sets a group generic audio configuration parameters. The use of these parameters
* are platform dependent, see libaudio
*
diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java
index 511111c..f9e49c1 100644
--- a/media/java/android/media/CamcorderProfile.java
+++ b/media/java/android/media/CamcorderProfile.java
@@ -90,9 +90,14 @@ public class CamcorderProfile
*/
public static final int QUALITY_QVGA = 7;
+ /**
+ * Quality level corresponding to the 2160p (3840x2160) resolution.
+ */
+ public static final int QUALITY_2160P = 8;
+
// Start and end of quality list
private static final int QUALITY_LIST_START = QUALITY_LOW;
- private static final int QUALITY_LIST_END = QUALITY_QVGA;
+ private static final int QUALITY_LIST_END = QUALITY_2160P;
/**
* Time lapse quality level corresponding to the lowest available resolution.
@@ -134,9 +139,14 @@ public class CamcorderProfile
*/
public static final int QUALITY_TIME_LAPSE_QVGA = 1007;
+ /**
+ * Time lapse quality level corresponding to the 2160p (3840 x 2160) resolution.
+ */
+ public static final int QUALITY_TIME_LAPSE_2160P = 1008;
+
// Start and end of timelapse quality list
private static final int QUALITY_TIME_LAPSE_LIST_START = QUALITY_TIME_LAPSE_LOW;
- private static final int QUALITY_TIME_LAPSE_LIST_END = QUALITY_TIME_LAPSE_QVGA;
+ private static final int QUALITY_TIME_LAPSE_LIST_END = QUALITY_TIME_LAPSE_2160P;
/**
* Default recording duration in seconds before the session is terminated.
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java
index 52045d3..7ff2c2e 100644
--- a/media/java/android/media/tv/TvContract.java
+++ b/media/java/android/media/tv/TvContract.java
@@ -272,6 +272,15 @@ public final class TvContract {
/** A generic channel type. */
public static final int TYPE_OTHER = 0x0;
+ /** The channel type for NTSC. */
+ public static final int TYPE_NTSC = 0x1;
+
+ /** The channel type for PAL. */
+ public static final int TYPE_PAL = 0x2;
+
+ /** The channel type for SECAM. */
+ public static final int TYPE_SECAM = 0x3;
+
/** The special channel type used for pass-through inputs such as HDMI. */
public static final int TYPE_PASSTHROUGH = 0x00010000;
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index 157dd49..fbe5340 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -24,6 +24,7 @@
#include <SkBitmap.h>
#include <media/IMediaHTTPService.h>
#include <media/mediametadataretriever.h>
+#include <media/mediascanner.h>
#include <private/media/VideoFrame.h>
#include "jni.h"
@@ -337,17 +338,13 @@ static jbyteArray android_media_MediaMetadataRetriever_getEmbeddedPicture(
return NULL;
}
- unsigned int len = mediaAlbumArt->mSize;
- char* data = (char*) mediaAlbumArt + sizeof(MediaAlbumArt);
- jbyteArray array = env->NewByteArray(len);
+ jbyteArray array = env->NewByteArray(mediaAlbumArt->size());
if (!array) { // OutOfMemoryError exception has already been thrown.
ALOGE("getEmbeddedPicture: OutOfMemoryError is thrown.");
} else {
- jbyte* bytes = env->GetByteArrayElements(array, NULL);
- if (bytes != NULL) {
- memcpy(bytes, data, len);
- env->ReleaseByteArrayElements(array, bytes, 0);
- }
+ const jbyte* data =
+ reinterpret_cast<const jbyte*>(mediaAlbumArt->data());
+ env->SetByteArrayRegion(array, 0, mediaAlbumArt->size(), data);
}
// No need to delete mediaAlbumArt here
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index b520440..321c2e3 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -348,17 +348,16 @@ android_media_MediaScanner_extractAlbumArt(
}
int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
- MediaAlbumArt* mediaAlbumArt =
- reinterpret_cast<MediaAlbumArt*>(mp->extractAlbumArt(fd));
+ MediaAlbumArt* mediaAlbumArt = mp->extractAlbumArt(fd);
if (mediaAlbumArt == NULL) {
return NULL;
}
- jbyteArray array = env->NewByteArray(mediaAlbumArt->mSize);
+ jbyteArray array = env->NewByteArray(mediaAlbumArt->size());
if (array != NULL) {
- jbyte* bytes = env->GetByteArrayElements(array, NULL);
- memcpy(bytes, &mediaAlbumArt->mData[0], mediaAlbumArt->mSize);
- env->ReleaseByteArrayElements(array, bytes, 0);
+ const jbyte* data =
+ reinterpret_cast<const jbyte*>(mediaAlbumArt->data());
+ env->SetByteArrayRegion(array, 0, mediaAlbumArt->size(), data);
}
done:
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
index 3f6ced6..bc159cb 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimpleHostView.java
@@ -25,6 +25,7 @@ public class KeyguardSimpleHostView extends KeyguardViewBase {
public KeyguardSimpleHostView(Context context, AttributeSet attrs) {
super(context, attrs);
+ KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateCallback);
}
@Override
@@ -62,4 +63,10 @@ public class KeyguardSimpleHostView extends KeyguardViewBase {
// TODO Auto-generated method stub
}
+ private KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
+ @Override
+ public void onUserSwitchComplete(int userId) {
+ getSecurityContainer().showPrimarySecurityScreen(false /* turning off */);
+ }
+ };
}
diff --git a/packages/PrintSpooler/res/drawable/print_button.xml b/packages/PrintSpooler/res/drawable/print_button.xml
index d4b6a82..b59afba 100644
--- a/packages/PrintSpooler/res/drawable/print_button.xml
+++ b/packages/PrintSpooler/res/drawable/print_button.xml
@@ -16,8 +16,7 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="@color/print_button_tint_color"
- android:pinned="true">
+ android:color="@color/print_button_tint_color">
<item
android:drawable="@drawable/print_button_background">
</item>
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png
new file mode 100644
index 0000000..d4fdbf3
--- /dev/null
+++ b/packages/SystemUI/res/drawable-hdpi/recents_lower_gradient.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png
deleted file mode 100644
index 6cd1176..0000000
--- a/packages/SystemUI/res/drawable-hdpi/recents_nav_bar_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-hdpi/stat_sys_no_sim.png b/packages/SystemUI/res/drawable-hdpi/stat_sys_no_sim.png
deleted file mode 100644
index 5ce8708..0000000
--- a/packages/SystemUI/res/drawable-hdpi/stat_sys_no_sim.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png
new file mode 100644
index 0000000..9fc1a3b
--- /dev/null
+++ b/packages/SystemUI/res/drawable-mdpi/recents_lower_gradient.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png
deleted file mode 100644
index 7237f09..0000000
--- a/packages/SystemUI/res/drawable-mdpi/recents_nav_bar_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-mdpi/stat_sys_no_sim.png b/packages/SystemUI/res/drawable-mdpi/stat_sys_no_sim.png
deleted file mode 100644
index bdf0f67..0000000
--- a/packages/SystemUI/res/drawable-mdpi/stat_sys_no_sim.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png
new file mode 100644
index 0000000..f38de93
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xhdpi/recents_lower_gradient.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png
deleted file mode 100644
index 8d56a1d..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/recents_nav_bar_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xhdpi/stat_sys_no_sim.png b/packages/SystemUI/res/drawable-xhdpi/stat_sys_no_sim.png
deleted file mode 100644
index 461535c..0000000
--- a/packages/SystemUI/res/drawable-xhdpi/stat_sys_no_sim.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png
new file mode 100644
index 0000000..8194605
--- /dev/null
+++ b/packages/SystemUI/res/drawable-xxhdpi/recents_lower_gradient.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png b/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png
deleted file mode 100644
index aed300b..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/recents_nav_bar_background.9.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_no_sim.png b/packages/SystemUI/res/drawable-xxhdpi/stat_sys_no_sim.png
deleted file mode 100644
index 7b03a11..0000000
--- a/packages/SystemUI/res/drawable-xxhdpi/stat_sys_no_sim.png
+++ /dev/null
Binary files differ
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_04.xml b/packages/SystemUI/res/drawable/ic_notify_zen.xml
index 0c0fb3b..c46455b 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_04.xml
+++ b/packages/SystemUI/res/drawable/ic_notify_zen.xml
@@ -15,14 +15,14 @@ Copyright (C) 2014 The Android Open Source Project
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" >
<size
- android:width="64dp"
- android:height="64dp"/>
+ android:width="24dp"
+ android:height="24dp"/>
<viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"/>
<path
android:fill="#FFFFFFFF"
- android:pathData="M12.0,10.0c-2.32,0.0 -4.2,1.88 -4.2,4.2C7.8,17.35 12.0,22.0 12.0,22.0s4.2,-4.65 4.2,-7.8C16.2,11.88 14.32,10.0 12.0,10.0zM12.0,15.7c-0.83,0.0 -1.5,-0.67 -1.5,-1.5s0.67,-1.5 1.5,-1.5c0.83,0.0 1.5,0.67 1.5,1.5S12.83,15.7 12.0,15.7z"/>
+ android:pathData="M4.0,24.0c0.0,11.0 9.0,20.0 20.0,20.0s20.0,-9.0 20.0,-20.0S35.0,4.0 24.0,4.0S4.0,13.0 4.0,24.0zM36.6,33.8L14.2,11.4C16.9,9.3 20.3,8.0 24.0,8.0c8.8,0.0 16.0,7.2 16.0,16.0C40.0,27.7 38.7,31.1 36.6,33.8zM8.0,24.0c0.0,-3.7 1.3,-7.1 3.4,-9.8L33.8,36.6C31.1,38.7 27.7,40.0 24.0,40.0C15.2,40.0 8.0,32.8 8.0,24.0z"/>
</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_color_inversion.xml b/packages/SystemUI/res/drawable/ic_qs_color_inversion.xml
deleted file mode 100644
index dc30a53..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_color_inversion.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:fill="#FFFFFFFF"
- android:pathData="M18.939,7.244c-5.887,-5.885 -6.214,-6.214 -6.222,-6.222l-0.707,-0.737L5.088,7.207c-2.914,2.915 -3.74,6.629 -2.266,10.19c1.541,3.719 5.312,6.316 9.174,6.317l0.0,0.0c3.861,-0.001 7.636,-2.603 9.179,-6.328C22.646,13.834 21.832,10.138 18.939,7.244zM4.67,16.632c-1.149,-2.776 -0.481,-5.696 1.832,-8.011l5.494,-5.492c0.0,0.002 0.002,0.003 0.003,0.004l0.0,18.582c-0.001,0.0 -0.002,0.0 -0.003,0.0C8.922,21.714 5.91,19.624 4.67,16.632z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_02.xml b/packages/SystemUI/res/drawable/ic_qs_inversion_off.xml
index bb4465f..b6a5cad 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_02.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_inversion_off.xml
@@ -19,10 +19,10 @@ Copyright (C) 2014 The Android Open Source Project
android:height="64dp"/>
<viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"/>
<path
- android:fill="#FFFFFFFF"
- android:pathData="M12.0,4.0c-3.48,0.0 -6.3,2.82 -6.3,6.3C5.7,15.02 12.0,22.0 12.0,22.0s6.3,-6.98 6.3,-11.7C18.3,6.82 15.48,4.0 12.0,4.0zM12.0,12.55c-1.24,0.0 -2.25,-1.01 -2.25,-2.25S10.76,8.05 12.0,8.05c1.24,0.0 2.25,1.01 2.25,2.25S13.24,12.55 12.0,12.55z"/>
+ android:fill="#4DFFFFFF"
+ android:pathData="M41.3,41.7L36.6,37.0L24.0,24.5l-7.1,-7.1L14.0,14.5L8.5,9.0L6.0,11.5l5.6,5.6c-5.1,6.3 -4.7,15.5 1.1,21.4c3.1,3.1 7.2,4.7 11.3,4.7c3.6,0.0 7.1,-1.2 10.1,-3.6l5.4,5.4l2.5,-2.5L41.3,41.7zM24.0,39.2c-3.2,0.0 -6.2,-1.2 -8.5,-3.5c-2.3,-2.3 -3.5,-5.3 -3.5,-8.5c0.0,-2.6 0.9,-5.1 2.4,-7.2l9.6,9.6L24.0,39.2zM24.0,10.2l0.0,9.2l14.5,14.5c2.7,-5.9 1.7,-13.1 -3.2,-18.0L24.0,4.5l0.0,0.0l0.0,0.0L16.6,12.0l2.8,2.8L24.0,10.2z"/>
</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_01.xml b/packages/SystemUI/res/drawable/ic_qs_inversion_on.xml
index ff37d9a..e8d59e0 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_01.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_inversion_on.xml
@@ -19,10 +19,10 @@ Copyright (C) 2014 The Android Open Source Project
android:height="64dp"/>
<viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"/>
<path
android:fill="#FFFFFFFF"
- android:pathData="M12.0,2.0C8.13,2.0 5.0,5.13 5.0,9.0c0.0,5.25 7.0,13.0 7.0,13.0s7.0,-7.75 7.0,-13.0C19.0,5.13 15.87,2.0 12.0,2.0zM12.0,11.5c-1.38,0.0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5c1.38,0.0 2.5,1.12 2.5,2.5S13.38,11.5 12.0,11.5z"/>
+ android:pathData="M35.3,15.9L24.0,4.5l0.0,0.0l0.0,0.0L12.7,15.9c-6.2,6.2 -6.2,16.4 0.0,22.6c3.1,3.1 7.2,4.7 11.3,4.7s8.2,-1.6 11.3,-4.7C41.6,32.2 41.6,22.1 35.3,15.9zM24.0,39.2L24.0,39.2c-3.2,0.0 -6.2,-1.2 -8.5,-3.5c-2.3,-2.3 -3.5,-5.3 -3.5,-8.5s1.2,-6.2 3.5,-8.5l8.5,-8.5L24.0,39.2z"/>
</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_03.xml b/packages/SystemUI/res/drawable/ic_qs_location_03.xml
deleted file mode 100644
index 956a8c3..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_03.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:fill="#FFFFFFFF"
- android:pathData="M12.0,7.0c-2.9,0.0 -5.25,2.35 -5.25,5.25C6.75,16.19 12.0,22.0 12.0,22.0s5.25,-5.81 5.25,-9.75C17.25,9.35 14.9,7.0 12.0,7.0zM12.0,14.12c-1.04,0.0 -1.88,-0.84 -1.88,-1.88s0.84,-1.88 1.88,-1.88c1.04,0.0 1.87,0.84 1.87,1.88S13.04,14.12 12.0,14.12z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_05.xml b/packages/SystemUI/res/drawable/ic_qs_location_05.xml
deleted file mode 100644
index 1a21e2f..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_05.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:fill="#FFFFFFFF"
- android:pathData="M12.0,13.0c-1.74,0.0 -3.15,1.41 -3.15,3.15C8.85,18.51 12.0,22.0 12.0,22.0s3.15,-3.49 3.15,-5.85C15.15,14.41 13.74,13.0 12.0,13.0zM12.0,17.27c-0.62,0.0 -1.13,-0.5 -1.13,-1.12c0.0,-0.62 0.5,-1.12 1.13,-1.12c0.62,0.0 1.12,0.5 1.12,1.12C13.12,16.77 12.62,17.27 12.0,17.27z"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_06.xml b/packages/SystemUI/res/drawable/ic_qs_location_06.xml
deleted file mode 100644
index 5642a8a..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_06.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:fill="#FFFFFFFF"
- android:pathData="M12.0,16.0c-1.16,0.0 -2.1,0.94 -2.1,2.1C9.9,19.67 12.0,22.0 12.0,22.0s2.1,-2.33 2.1,-3.9C14.1,16.94 13.16,16.0 12.0,16.0zM12.0,18.85c-0.41,0.0 -0.75,-0.34 -0.75,-0.75s0.34,-0.75 0.75,-0.75c0.41,0.0 0.75,0.34 0.75,0.75S12.41,18.85 12.0,18.85z"/>
- <path
- android:pathData="M11.99,15c-1.35,0,-2.45,1.1,-2.45,2.45 c0,1.84,2.45,4.55,2.45,4.55s2.45,-2.71,2.45,-4.55C14.44,16.1,13.34,15,11.99,15z M11.99,18.33c-0.48,0,-0.88,-0.39,-0.88,-0.88 s0.39,-0.88,0.88,-0.88c0.48,0,0.87,0.39,0.87,0.88S12.47,18.33,11.99,18.33z"
- android:fill="#4DFFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_07.xml b/packages/SystemUI/res/drawable/ic_qs_location_07.xml
deleted file mode 100644
index 1ad2ebc..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_07.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:pathData="M12,9c-2.51,0,-4.55,2.04,-4.55,4.55 C7.45,16.96,12,22,12,22s4.55,-5.04,4.55,-8.45C16.55,11.04,14.51,9,12,9z M12,15.18c-0.9,0,-1.63,-0.73,-1.63,-1.62 s0.73,-1.62,1.63,-1.62c0.9,0,1.62,0.73,1.62,1.62S12.9,15.18,12,15.18z"
- android:fill="#4DFFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_08.xml b/packages/SystemUI/res/drawable/ic_qs_location_08.xml
deleted file mode 100644
index 179bc66..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_08.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:pathData="M12,6c-3.09,0,-5.6,2.51,-5.6,5.6 C6.4,15.8,12,22,12,22s5.6,-6.2,5.6,-10.4C17.6,8.51,15.09,6,12,6z M12,13.6c-1.1,0,-2,-0.9,-2,-2s0.9,-2,2,-2c1.1,0,2,0.9,2,2 S13.1,13.6,12,13.6z"
- android:fill="#4DFFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_09.xml b/packages/SystemUI/res/drawable/ic_qs_location_09.xml
deleted file mode 100644
index 6169af5..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_09.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:pathData="M12,4c-3.48,0,-6.3,2.82,-6.3,6.3 C5.7,15.02,12,22,12,22s6.3,-6.98,6.3,-11.7C18.3,6.82,15.48,4,12,4z M12,12.55c-1.24,0,-2.25,-1.01,-2.25,-2.25S10.76,8.05,12,8.05 c1.24,0,2.25,1.01,2.25,2.25S13.24,12.55,12,12.55z"
- android:fill="#4DFFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_10.xml b/packages/SystemUI/res/drawable/ic_qs_location_10.xml
deleted file mode 100644
index 93e2eb4..0000000
--- a/packages/SystemUI/res/drawable/ic_qs_location_10.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
-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.
--->
-<vector xmlns:android="http://schemas.android.com/apk/res/android" >
- <size
- android:width="64dp"
- android:height="64dp"/>
-
- <viewport
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"/>
-
- <path
- android:pathData="M12,3C8.33,3,5.35,5.98,5.35,9.65 C5.35,14.64,12,22,12,22s6.65,-7.36,6.65,-12.35C18.65,5.98,15.67,3,12,3z M12,12.02c-1.31,0,-2.38,-1.06,-2.38,-2.38 S10.69,7.28,12,7.28c1.31,0,2.37,1.06,2.37,2.37S13.31,12.02,12,12.02z"
- android:fill="#4DFFFFFF"/>
-</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_off.xml b/packages/SystemUI/res/drawable/ic_qs_location_off.xml
index d28d347..26ebfbf 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_off.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_location_off.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
@@ -14,18 +13,19 @@ Copyright (C) 2014 The Android Open Source Project
See the License for the specific language governing permissions and
limitations under the License.
-->
-<animation-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:oneshot="true">
- <item android:drawable="@drawable/ic_qs_location_01" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_02" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_03" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_04" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_05" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_06" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_07" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_08" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_09" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_10" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_11" android:duration="16" />
-</animation-list>
+<vector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <size
+ android:width="64dp"
+ android:height="64dp"/>
+
+ <viewport
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"/>
+
+ <path
+ android:fill="#4DFFFFFF"
+ android:pathData="M24.0,13.0c2.8,0.0 5.0,2.2 5.0,5.0c0.0,1.5 -0.7,2.8 -1.7,3.7l7.3,7.3c2.0,-3.7 3.4,-7.6 3.4,-11.0c0.0,-7.7 -6.3,-14.0 -14.0,-14.0c-4.0,0.0 -7.5,1.6 -10.1,4.3l6.4,6.4C21.2,13.6 22.5,13.0 24.0,13.0zM32.7,32.2l-9.3,-9.3l-0.2,-0.2L6.5,6.0L4.0,8.5l6.4,6.4c-0.2,1.0 -0.4,2.0 -0.4,3.1c0.0,10.5 14.0,26.0 14.0,26.0s3.3,-3.7 6.8,-8.7l6.7,6.7l2.5,-2.5L32.7,32.2z"/>
+ <path
+ android:pathData="M23.5,22.9l0.0,0.0 -0.20000076,-0.19999886z"
+ android:fill="#4DFFFFFF"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_on.xml b/packages/SystemUI/res/drawable/ic_qs_location_on.xml
index 72512ac..bc73005 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_on.xml
+++ b/packages/SystemUI/res/drawable/ic_qs_location_on.xml
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
@@ -14,18 +13,16 @@ Copyright (C) 2014 The Android Open Source Project
See the License for the specific language governing permissions and
limitations under the License.
-->
-<animation-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:oneshot="true">
- <item android:drawable="@drawable/ic_qs_location_11" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_10" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_09" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_08" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_07" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_06" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_05" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_04" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_03" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_02" android:duration="16" />
- <item android:drawable="@drawable/ic_qs_location_01" android:duration="16" />
-</animation-list>
+<vector xmlns:android="http://schemas.android.com/apk/res/android" >
+ <size
+ android:width="64dp"
+ android:height="64dp"/>
+
+ <viewport
+ android:viewportWidth="48.0"
+ android:viewportHeight="48.0"/>
+
+ <path
+ android:fill="#FFFFFFFF"
+ android:pathData="M24.0,4.0c-7.7,0.0 -14.0,6.3 -14.0,14.0c0.0,10.5 14.0,26.0 14.0,26.0s14.0,-15.5 14.0,-26.0C38.0,10.3 31.7,4.0 24.0,4.0zM24.0,23.0c-2.8,0.0 -5.0,-2.2 -5.0,-5.0s2.2,-5.0 5.0,-5.0c2.8,0.0 5.0,2.2 5.0,5.0S26.8,23.0 24.0,23.0z"/>
+</vector>
diff --git a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml b/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
deleted file mode 100644
index ce3372e..0000000
--- a/packages/SystemUI/res/drawable/notification_row_legacy_bg.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
- android:exitFadeDuration="@android:integer/config_mediumAnimTime">
-
- <item android:state_pressed="true" android:drawable="@drawable/notification_item_background_color_pressed" />
- <item android:state_pressed="false" android:drawable="@drawable/notification_item_background_legacy_color" />
-</selector>
diff --git a/packages/SystemUI/res/drawable/ripple_drawable.xml b/packages/SystemUI/res/drawable/ripple_drawable.xml
index d2bff42..af7941f 100644
--- a/packages/SystemUI/res/drawable/ripple_drawable.xml
+++ b/packages/SystemUI/res/drawable/ripple_drawable.xml
@@ -16,6 +16,4 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:tint="?android:attr/colorControlHighlight"
- android:tintMode="src_over"
- android:pinned="true" />
+ android:color="?android:attr/colorControlHighlight" />
diff --git a/packages/SystemUI/res/drawable/ic_qs_location_11.xml b/packages/SystemUI/res/drawable/stat_sys_no_sim.xml
index 09a3e63..70948b7 100644
--- a/packages/SystemUI/res/drawable/ic_qs_location_11.xml
+++ b/packages/SystemUI/res/drawable/stat_sys_no_sim.xml
@@ -15,14 +15,14 @@ Copyright (C) 2014 The Android Open Source Project
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" >
<size
- android:width="64dp"
- android:height="64dp"/>
+ android:width="18dp"
+ android:height="18dp"/>
<viewport
android:viewportWidth="24.0"
android:viewportHeight="24.0"/>
<path
- android:pathData="M12,2C8.13,2,5,5.13,5,9c0,5.25,7,13,7,13s7,-7.75,7,-13 C19,5.13,15.87,2,12,2z M12,11.5c-1.38,0,-2.5,-1.12,-2.5,-2.5s1.12,-2.5,2.5,-2.5c1.38,0,2.5,1.12,2.5,2.5S13.38,11.5,12,11.5z"
- android:fill="#4DFFFFFF"/>
+ android:fill="#4DFFFFFF"
+ android:pathData="M19.0,5.0c0.0,-1.1 -0.9,-2.0 -2.0,-2.0l-7.0,0.0L7.7,5.3L19.0,16.7L19.0,5.0zM3.7,3.9L2.4,5.2L5.0,7.8L5.0,19.0c0.0,1.1 0.9,2.0 2.0,2.0l10.0,0.0c0.4,0.0 0.7,-0.1 1.0,-0.3l1.9,1.9l1.3,-1.3L3.7,3.9z"/>
</vector>
diff --git a/packages/SystemUI/res/drawable/status_bar_item_background.xml b/packages/SystemUI/res/drawable/status_bar_item_background.xml
deleted file mode 100644
index 3a50aa9..0000000
--- a/packages/SystemUI/res/drawable/status_bar_item_background.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 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.
--->
-
-<layer-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:opacity="translucent"
- >
- <item
- android:drawable="@drawable/notification_item_background_color"
- />
-</layer-list>
-
diff --git a/packages/SystemUI/res/drawable/ticker_background.xml b/packages/SystemUI/res/drawable/ticker_background.xml
deleted file mode 100644
index 7320fa0..0000000
--- a/packages/SystemUI/res/drawable/ticker_background.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2006 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.
--->
-
-<layer-list
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:opacity="translucent"
- >
- <!-- the large icon extends 12dp beyond the edge of the status bar -->
- <item
- android:drawable="@drawable/notification_item_background_color"
- android:top="12dp"
- />
-</layer-list>
-
diff --git a/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml b/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml
index 463fee8..4245d49 100644
--- a/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml
+++ b/packages/SystemUI/res/layout/recents_nav_bar_scrim.xml
@@ -20,4 +20,4 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:scaleType="fitXY"
- android:src="@drawable/recents_nav_bar_background" /> \ No newline at end of file
+ android:src="@drawable/recents_lower_gradient" /> \ No newline at end of file
diff --git a/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml b/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
index 84d64b9..e220a16 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
@@ -18,48 +18,13 @@
<com.android.systemui.statusbar.SpeedBumpView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:focusable="true"
- android:clickable="true"
+ android:layout_height="@dimen/speed_bump_height"
android:visibility="gone"
>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="@dimen/speed_bump_height_collapsed"
- android:layout_gravity="top"
- android:orientation="horizontal">
- <com.android.systemui.statusbar.AlphaOptimizedView
- android:id="@+id/speedbump_line_left"
- android:layout_width="0dp"
- android:layout_height="1dp"
- android:layout_weight="1"
- android:background="#6fdddddd"
- android:layout_gravity="center_vertical"/>
- <com.android.systemui.statusbar.SpeedBumpDotsLayout
- android:id="@+id/speed_bump_dots_layout"
- android:layout_width="34dp"
- android:layout_marginStart="8dp"
- android:layout_marginEnd="8dp"
- android:layout_height="match_parent"
- android:layout_weight="0"/>
- <com.android.systemui.statusbar.AlphaOptimizedView
- android:id="@+id/speedbump_line_right"
- android:layout_width="0dp"
- android:layout_height="1dp"
- android:layout_weight="1"
- android:background="#6fdddddd"
- android:layout_gravity="center_vertical"/>
- </LinearLayout>
- <TextView
- android:id="@+id/speed_bump_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="top|center_horizontal"
- android:fontFamily="sans-serif-condensed"
- android:textSize="15sp"
- android:singleLine="true"
- android:textColor="#eeeeee"
- android:visibility="invisible"
- android:text="@string/speed_bump_explanation"
- android:paddingTop="4dp" />
+ <com.android.systemui.statusbar.AlphaOptimizedView
+ android:id="@+id/speedbump_line"
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:background="#6fdddddd"
+ android:layout_gravity="center_vertical"/>
</com.android.systemui.statusbar.SpeedBumpView>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index bcd37bd..8c1a9c7 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -29,7 +29,6 @@
<drawable name="status_bar_notification_row_background_color">#ff090909</drawable>
<color name="notification_list_shadow_top">#80000000</color>
<drawable name="recents_callout_line">#99ffffff</drawable>
- <drawable name="notification_item_background_legacy_color">#ffaaaaaa</drawable>
<drawable name="heads_up_notification_bg_pressed">#ff33B5E5</drawable>
<color name="batterymeter_frame_color">#66FFFFFF</color><!-- 40% white -->
<color name="batterymeter_charge_color">#FFFFFFFF</color>
@@ -42,24 +41,10 @@
<color name="qs_tile_divider">#29ffffff</color><!-- 16% white -->
<color name="qs_tile_text">#FFFFFFFF</color>
<color name="status_bar_clock_color">#FFFFFFFF</color>
- <drawable name="notification_item_background_color">#ff111111</drawable>
- <drawable name="notification_item_background_color_pressed">#ff454545</drawable>
<!-- Tint color for the content on the notification overflow card. -->
<color name="keyguard_overflow_content_color">#ff686868</color>
- <!-- The color of the red speed bump dot -->
- <color name="speed_bump_dot_red">#ffd50000</color>
-
- <!-- The color of the blue speed bump dot -->
- <color name="speed_bump_dot_blue">#ff2962ff</color>
-
- <!-- The color of the yellow speed bump dot -->
- <color name="speed_bump_dot_yellow">#ffffd600</color>
-
- <!-- The color of the green speed bump dot -->
- <color name="speed_bump_dot_green">#ff00c853</color>
-
<!-- The default recents task bar background color. -->
<color name="recents_task_bar_default_background_color">#e6444444</color>
<!-- The default recents task bar text color. -->
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 35bc7e3..1664c8a 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -275,14 +275,8 @@
<!-- The minimum amount of top overscroll to go to the quick settings. -->
<dimen name="min_top_overscroll_to_qs">36dp</dimen>
- <!-- The height of the collapsed speed bump view. -->
- <dimen name="speed_bump_height_collapsed">24dp</dimen>
-
- <!-- The padding inset the explanation text needs compared to the collapsed height -->
- <dimen name="speed_bump_text_padding_inset">10dp</dimen>
-
- <!-- The height of the speed bump dots. -->
- <dimen name="speed_bump_dots_height">5dp</dimen>
+ <!-- The height of the speed bump view. -->
+ <dimen name="speed_bump_height">16dp</dimen>
<!-- The total height of the stack in its collapsed size (i.e. when quick settings is open) -->
<dimen name="collapsed_stack_height">94dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
index 0fb0f8b..192ba57 100644
--- a/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
+++ b/packages/SystemUI/src/com/android/systemui/power/PowerUI.java
@@ -17,13 +17,16 @@
package com.android.systemui.power;
import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.database.ContentObserver;
import android.os.BatteryManager;
import android.os.Handler;
import android.os.PowerManager;
import android.os.SystemClock;
+import android.os.UserHandle;
import android.provider.Settings;
import android.util.Slog;
@@ -54,17 +57,22 @@ public class PowerUI extends SystemUI {
public void start() {
- mLowBatteryAlertCloseLevel = mContext.getResources().getInteger(
- com.android.internal.R.integer.config_lowBatteryCloseWarningLevel);
- mLowBatteryReminderLevels[0] = mContext.getResources().getInteger(
- com.android.internal.R.integer.config_lowBatteryWarningLevel);
- mLowBatteryReminderLevels[1] = mContext.getResources().getInteger(
- com.android.internal.R.integer.config_criticalBatteryWarningLevel);
-
final PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mScreenOffTime = pm.isScreenOn() ? -1 : SystemClock.elapsedRealtime();
mWarnings = new PowerDialogWarnings(mContext);
+ ContentObserver obs = new ContentObserver(mHandler) {
+ @Override
+ public void onChange(boolean selfChange) {
+ updateBatteryWarningLevels();
+ }
+ };
+ final ContentResolver resolver = mContext.getContentResolver();
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
+ false, obs, UserHandle.USER_ALL);
+ updateBatteryWarningLevels();
+
// Register for Intent broadcasts for...
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
@@ -73,6 +81,29 @@ public class PowerUI extends SystemUI {
mContext.registerReceiver(mIntentReceiver, filter, null, mHandler);
}
+ void updateBatteryWarningLevels() {
+ int critLevel = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_criticalBatteryWarningLevel);
+
+ final ContentResolver resolver = mContext.getContentResolver();
+ int defWarnLevel = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryWarningLevel);
+ int warnLevel = Settings.Global.getInt(resolver,
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);
+ if (warnLevel == 0) {
+ warnLevel = defWarnLevel;
+ }
+ if (warnLevel < critLevel) {
+ warnLevel = critLevel;
+ }
+
+ mLowBatteryReminderLevels[0] = warnLevel;
+ mLowBatteryReminderLevels[1] = critLevel;
+ mLowBatteryAlertCloseLevel = mLowBatteryReminderLevels[0]
+ + mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryCloseWarningBump);
+ }
+
/**
* Buckets the battery level.
*
@@ -87,7 +118,7 @@ public class PowerUI extends SystemUI {
if (level >= mLowBatteryAlertCloseLevel) {
return 1;
}
- if (level >= mLowBatteryReminderLevels[0]) {
+ if (level > mLowBatteryReminderLevels[0]) {
return 0;
}
final int N = mLowBatteryReminderLevels.length;
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
index c76ee8c..786cd9e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTile.java
@@ -287,6 +287,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
public boolean activityIn;
public boolean activityOut;
public int overlayIconId;
+ public boolean filter;
@Override
public boolean copyTo(State other) {
@@ -300,6 +301,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
o.activityIn = activityIn;
o.activityOut = activityOut;
o.overlayIconId = overlayIconId;
+ o.filter = filter;
return super.copyTo(other) || changed;
}
@@ -311,6 +313,7 @@ public abstract class QSTile<TState extends State> implements Listenable {
rt.insert(rt.length() - 1, ",activityIn=" + activityIn);
rt.insert(rt.length() - 1, ",activityOut=" + activityOut);
rt.insert(rt.length() - 1, ",overlayIconId=" + overlayIconId);
+ rt.insert(rt.length() - 1, ",filter=" + filter);
return rt;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
index 901cc10..d5fe033 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/SignalTileView.java
@@ -93,12 +93,12 @@ public final class SignalTileView extends QSTileView {
final SignalState s = (SignalState) state;
mSignal.setImageDrawable(null); // force refresh
mSignal.setImageResource(s.iconId);
- mSignal.setColorFilter(FILTER);
+ mSignal.setColorFilter(s.filter ? FILTER : null);
if (s.overlayIconId > 0) {
mOverlay.setVisibility(VISIBLE);
mOverlay.setImageDrawable(null); // force refresh
mOverlay.setImageResource(s.overlayIconId);
- mOverlay.setColorFilter(FILTER);
+ mOverlay.setColorFilter(s.filter ? FILTER : null);
} else {
mOverlay.setVisibility(GONE);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
index 182a0ce..6d91d33 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/CellularTile.java
@@ -72,12 +72,15 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
if (cb == null) return;
final Resources r = mContext.getResources();
- state.iconId = cb.enabled && (cb.mobileSignalIconId > 0)
+ state.iconId = cb.noSim
+ ? R.drawable.stat_sys_no_sim
+ : cb.enabled && (cb.mobileSignalIconId > 0)
? cb.mobileSignalIconId
: R.drawable.ic_qs_signal_no_signal;
state.overlayIconId = cb.enabled && (cb.dataTypeIconId > 0) && !cb.wifiEnabled
? cb.dataTypeIconId
: 0;
+ state.filter = state.iconId != R.drawable.stat_sys_no_sim;
state.activityIn = cb.enabled && cb.activityIn;
state.activityOut = cb.enabled && cb.activityOut;
@@ -117,6 +120,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
boolean activityIn;
boolean activityOut;
String enabledDesc;
+ boolean noSim;
}
private final NetworkSignalChangedCallback mCallback = new NetworkSignalChangedCallback() {
@@ -134,7 +138,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description) {
+ String dataTypeContentDescriptionId, String description, boolean noSim) {
final CallbackInfo info = new CallbackInfo(); // TODO pool?
info.enabled = enabled;
info.wifiEnabled = mWifiEnabled;
@@ -145,6 +149,7 @@ public class CellularTile extends QSTile<QSTile.SignalState> {
info.activityIn = activityIn;
info.activityOut = activityOut;
info.enabledDesc = description;
+ info.noSim = noSim;
refreshState(info);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java
index 5301362..7c2c7c3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ColorInversionTile.java
@@ -71,6 +71,6 @@ public class ColorInversionTile extends QSTile<QSTile.BooleanState> {
state.visible = mVisible;
state.value = enabled;
state.label = mContext.getString(R.string.quick_settings_inversion_label);
- state.iconId = R.drawable.ic_qs_color_inversion;
+ state.iconId = enabled ? R.drawable.ic_qs_inversion_on : R.drawable.ic_qs_inversion_off;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
index db9b054..04f1eb5 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/LocationTile.java
@@ -16,9 +16,6 @@
package com.android.systemui.qs.tiles;
-import android.content.res.Resources;
-import android.graphics.drawable.AnimationDrawable;
-
import com.android.systemui.R;
import com.android.systemui.qs.QSTile;
import com.android.systemui.statusbar.policy.LocationController;
@@ -63,28 +60,15 @@ public class LocationTile extends QSTile<QSTile.BooleanState> {
protected void handleUpdateState(BooleanState state, Object arg) {
final boolean locationEnabled = mController.isLocationEnabled();
state.visible = true;
- if (state.value != locationEnabled) {
- state.value = locationEnabled;
- final Resources res = mContext.getResources();
- final AnimationDrawable d = (AnimationDrawable) res.getDrawable(locationEnabled
- ? R.drawable.ic_qs_location_on
- : R.drawable.ic_qs_location_off);
- state.icon = d;
- mUiHandler.post(new Runnable() {
- @Override
- public void run() {
- d.start();
- }
- });
- }
+ state.value = locationEnabled;
if (locationEnabled) {
- if (state.icon == null) state.iconId = R.drawable.ic_qs_location_01;
+ state.iconId = R.drawable.ic_qs_location_on;
state.label = mContext.getString(R.string.quick_settings_location_label);
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_location,
mContext.getString(R.string.accessibility_desc_on));
} else {
- if (state.icon == null) state.iconId = R.drawable.ic_qs_location_11;
+ state.iconId = R.drawable.ic_qs_location_off;
state.label = mContext.getString(R.string.quick_settings_location_label);
state.contentDescription = mContext.getString(
R.string.accessibility_quick_settings_location,
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
index 6b73002..a236497 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/WifiTile.java
@@ -87,6 +87,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
state.connected = wifiConnected;
state.activityIn = cb.enabled && cb.activityIn;
state.activityOut = cb.enabled && cb.activityOut;
+ state.filter = true;
final String signalContentDescription;
final Resources r = mContext.getResources();
if (wifiConnected) {
@@ -159,7 +160,7 @@ public class WifiTile extends QSTile<QSTile.SignalState> {
int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description) {
+ String dataTypeContentDescriptionId, String description, boolean noSim) {
// noop
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index 76e88a5..147ff62 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -106,7 +106,7 @@ public class Constants {
// The height of the peek space relative to the stack height
public static final float StackPeekHeightPct = 0.1f;
// The min scale of the last card in the peek area
- public static final float StackPeekMinScale = 0.9f;
+ public static final float StackPeekMinScale = 0.8f;
// The number of cards we see in the peek space
public static final int StackPeekNumCards = 3;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 8680786..96344d5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -41,6 +41,8 @@ import com.android.systemui.recents.model.SpaceNode;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.RecentsView;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Set;
@@ -79,6 +81,19 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
boolean mVisible;
boolean mTaskLaunched;
+ private static Method sPropertyMethod;
+ static {
+ try {
+ Class<?> c = Class.forName("android.view.GLES20Canvas");
+ sPropertyMethod = c.getDeclaredMethod("setProperty", String.class, String.class);
+ if (!sPropertyMethod.isAccessible()) sPropertyMethod.setAccessible(true);
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+
// Broadcast receiver to handle messages from our RecentsService
BroadcastReceiver mServiceBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -139,21 +154,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Add the default no-recents layout
if (stacks.size() == 1 && stacks.get(0).getTaskCount() == 0) {
mEmptyView.setVisibility(View.VISIBLE);
-
- // Dim the background even more
- WindowManager.LayoutParams wlp = getWindow().getAttributes();
- wlp.dimAmount = Constants.Values.Window.DarkBackgroundDim;
- getWindow().setAttributes(wlp);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
} else {
mEmptyView.setVisibility(View.GONE);
-
- // Un-dim the background
- WindowManager.LayoutParams wlp = getWindow().getAttributes();
- wlp.dimAmount = 0f;
- getWindow().setAttributes(wlp);
- getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
+
+ // Dim the background
+ mRecentsView.setBackgroundColor(0x80000000);
}
/** Attempts to allocate and bind the search bar app widget */
@@ -277,6 +283,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
LayoutInflater inflater = LayoutInflater.from(this);
mEmptyView = inflater.inflate(R.layout.recents_empty, mContainerView, false);
mNavBarScrimView = inflater.inflate(R.layout.recents_nav_bar_scrim, mContainerView, false);
+ mNavBarScrimView.setLayoutParams(new FrameLayout.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.BOTTOM));
mContainerView = new FrameLayout(this);
mContainerView.addView(mRecentsView);
@@ -296,6 +305,16 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
if (savedInstanceState != null) {
onConfigurationChange();
}
+
+ // XXX: Update the shadows
+ try {
+ sPropertyMethod.invoke(null, "ambientShadowStrength", String.valueOf(35f));
+ sPropertyMethod.invoke(null, "ambientRatio", String.valueOf(0.5f));
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ }
}
void onConfigurationChange() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 5830e37..8d9f8be 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -156,10 +156,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
float boundedT = Math.max(t, -(numPeekCards + 1));
// Set the scale relative to its position
+ int numFrontScaledCards = 3;
float minScale = Constants.Values.TaskStackView.StackPeekMinScale;
float scaleRange = 1f - minScale;
- float scaleInc = scaleRange / numPeekCards;
- float scale = Math.max(minScale, Math.min(1f, 1f + (boundedT * scaleInc)));
+ float scaleInc = scaleRange / (numPeekCards + numFrontScaledCards);
+ float scale = Math.max(minScale, Math.min(1f, minScale +
+ ((boundedT + (numPeekCards + 1)) * scaleInc)));
float scaleYOffset = ((1f - scale) * mTaskRect.height()) / 2;
transform.scale = scale;
@@ -171,6 +173,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
transform.translationY = (int) (boundedT * overlapHeight - scaleYOffset);
}
+ // Set the z translation
+ RecentsConfiguration config = RecentsConfiguration.getInstance();
+ int minZ = config.taskViewTranslationZMinPx;
+ int incZ = config.taskViewTranslationZIncrementPx;
+ transform.translationZ = (int) Math.max(minZ, minZ + ((boundedT + numPeekCards) * incZ));
+
// Set the alphas
transform.dismissAlpha = Math.max(-1f, Math.min(0f, t + 1)) + 1f;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 632c816..5df5e4d 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -142,8 +142,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
void updateViewPropertiesToTaskTransform(TaskViewTransform animateFromTransform,
TaskViewTransform toTransform, int duration) {
RecentsConfiguration config = RecentsConfiguration.getInstance();
- int minZ = config.taskViewTranslationZMinPx;
- int incZ = config.taskViewTranslationZIncrementPx;
// Update the bar view
mBarView.updateViewPropertiesToTaskTransform(animateFromTransform, toTransform, duration);
@@ -153,14 +151,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
if (animateFromTransform != null) {
setTranslationY(animateFromTransform.translationY);
if (Constants.DebugFlags.App.EnableShadows) {
- setTranslationZ(Math.max(minZ, minZ + (animateFromTransform.t * incZ)));
+ setTranslationZ(animateFromTransform.translationZ);
}
setScaleX(animateFromTransform.scale);
setScaleY(animateFromTransform.scale);
setAlpha(animateFromTransform.alpha);
}
if (Constants.DebugFlags.App.EnableShadows) {
- animate().translationZ(Math.max(minZ, minZ + (toTransform.t * incZ)));
+ animate().translationZ(toTransform.translationZ);
}
animate().translationY(toTransform.translationY)
.scaleX(toTransform.scale)
@@ -179,7 +177,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
} else {
setTranslationY(toTransform.translationY);
if (Constants.DebugFlags.App.EnableShadows) {
- setTranslationZ(Math.max(minZ, minZ + (toTransform.t * incZ)));
+ setTranslationZ(toTransform.translationZ);
}
setScaleX(toTransform.scale);
setScaleY(toTransform.scale);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
index e6391a8..3c3ebd7 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewTransform.java
@@ -22,6 +22,7 @@ import android.graphics.Rect;
/* The transform state for a task view */
public class TaskViewTransform {
public int translationY = 0;
+ public int translationZ = 0;
public float scale = 1f;
public float alpha = 1f;
public float dismissAlpha = 1f;
@@ -35,6 +36,7 @@ public class TaskViewTransform {
public TaskViewTransform(TaskViewTransform o) {
translationY = o.translationY;
+ translationZ = o.translationZ;
scale = o.scale;
alpha = o.alpha;
dismissAlpha = o.dismissAlpha;
diff --git a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
index a770f58..80e85f9 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/BrightnessController.java
@@ -34,6 +34,7 @@ import java.util.ArrayList;
public class BrightnessController implements ToggleSlider.Listener {
private static final String TAG = "StatusBar.BrightnessController";
+ private static final boolean SHOW_AUTOMATIC_ICON = false;
/**
* {@link android.provider.Settings.System#SCREEN_AUTO_BRIGHTNESS_ADJ} uses the range [-1, 1].
@@ -232,7 +233,7 @@ public class BrightnessController implements ToggleSlider.Listener {
private void updateIcon(boolean automatic) {
if (mIcon != null) {
- mIcon.setImageResource(automatic ?
+ mIcon.setImageResource(automatic && SHOW_AUTOMATIC_ICON ?
com.android.systemui.R.drawable.ic_qs_brightness_auto_on :
com.android.systemui.R.drawable.ic_qs_brightness_auto_off);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
index b91e129..8d19f50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ActivatableNotificationView.java
@@ -158,7 +158,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
private final Runnable mTapTimeoutRunnable = new Runnable() {
@Override
public void run() {
- makeInactive();
+ makeInactive(true /* animate */);
}
};
@@ -183,7 +183,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
break;
case MotionEvent.ACTION_MOVE:
if (!isWithinTouchSlop(event)) {
- makeInactive();
+ makeInactive(true /* animate */);
return false;
}
break;
@@ -193,14 +193,17 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
makeActive();
postDelayed(mTapTimeoutRunnable, DOUBLETAP_TIMEOUT_MS);
} else {
- performClick();
+ boolean performed = performClick();
+ if (performed) {
+ removeCallbacks(mTapTimeoutRunnable);
+ }
}
} else {
- makeInactive();
+ makeInactive(true /* animate */);
}
break;
case MotionEvent.ACTION_CANCEL:
- makeInactive();
+ makeInactive(true /* animate */);
break;
default:
break;
@@ -257,10 +260,14 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
/**
* Cancels the hotspot and makes the notification inactive.
*/
- private void makeInactive() {
+ public void makeInactive(boolean animate) {
if (mActivated) {
if (mDimmed) {
- startActivateAnimation(true /* reverse */);
+ if (animate) {
+ startActivateAnimation(true /* reverse */);
+ } else {
+ mBackgroundNormal.setVisibility(View.INVISIBLE);
+ }
}
mActivated = false;
}
@@ -351,6 +358,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
mBackgroundDimmed.setVisibility(View.INVISIBLE);
mBackgroundNormal.setVisibility(View.VISIBLE);
mBackgroundNormal.setAlpha(1f);
+ removeCallbacks(mTapTimeoutRunnable);
}
}
@@ -581,7 +589,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
}
public interface OnActivatedListener {
- void onActivated(View view);
- void onActivationReset(View view);
+ void onActivated(ActivatableNotificationView view);
+ void onActivationReset(ActivatableNotificationView view);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index a7af998..5a9fe91 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -48,7 +48,7 @@ import android.provider.Settings;
import android.service.dreams.DreamService;
import android.service.dreams.IDreamManager;
import android.service.notification.NotificationListenerService;
-import android.service.notification.NotificationListenerService.Ranking;
+import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.Log;
@@ -80,11 +80,10 @@ import com.android.systemui.SearchPanelView;
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.phone.KeyguardTouchDelegate;
+import com.android.systemui.statusbar.policy.HeadsUpNotificationView;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.Locale;
import static com.android.keyguard.KeyguardHostView.OnDismissAction;
@@ -106,6 +105,7 @@ public abstract class BaseStatusBar extends SystemUI implements
protected static final int MSG_SHOW_HEADS_UP = 1026;
protected static final int MSG_HIDE_HEADS_UP = 1027;
protected static final int MSG_ESCALATE_HEADS_UP = 1028;
+ protected static final int MSG_DECAY_HEADS_UP = 1029;
protected static final boolean ENABLE_HEADS_UP = true;
// scores above this threshold should be displayed in heads up mode.
@@ -129,7 +129,9 @@ public abstract class BaseStatusBar extends SystemUI implements
protected NotificationData mNotificationData = new NotificationData();
protected NotificationStackScrollLayout mStackScroller;
- protected NotificationData.Entry mInterruptingNotificationEntry;
+ // for heads up notifications
+ protected HeadsUpNotificationView mHeadsUpNotificationView;
+ protected int mHeadsUpNotificationDecay;
protected long mInterruptingNotificationTime;
// used to notify status bar for suppressing notification LED
@@ -291,7 +293,7 @@ public abstract class BaseStatusBar extends SystemUI implements
public void onListenerConnected() {
if (DEBUG) Log.d(TAG, "onListenerConnected");
final StatusBarNotification[] notifications = getActiveNotifications();
- final Ranking currentRanking = getCurrentRanking();
+ final RankingMap currentRanking = getCurrentRanking();
mHandler.post(new Runnable() {
@Override
public void run() {
@@ -303,41 +305,40 @@ public abstract class BaseStatusBar extends SystemUI implements
}
@Override
- public void onNotificationPosted(final StatusBarNotification sbn) {
+ public void onNotificationPosted(final StatusBarNotification sbn,
+ final RankingMap rankingMap) {
if (DEBUG) Log.d(TAG, "onNotificationPosted: " + sbn);
- final Ranking currentRanking = getCurrentRanking();
mHandler.post(new Runnable() {
@Override
public void run() {
if (mNotificationData.findByKey(sbn.getKey()) != null) {
- updateNotificationInternal(sbn, currentRanking);
+ updateNotificationInternal(sbn, rankingMap);
} else {
- addNotificationInternal(sbn, currentRanking);
+ addNotificationInternal(sbn, rankingMap);
}
}
});
}
@Override
- public void onNotificationRemoved(final StatusBarNotification sbn) {
+ public void onNotificationRemoved(final StatusBarNotification sbn,
+ final RankingMap rankingMap) {
if (DEBUG) Log.d(TAG, "onNotificationRemoved: " + sbn);
- final Ranking currentRanking = getCurrentRanking();
mHandler.post(new Runnable() {
@Override
public void run() {
- removeNotificationInternal(sbn.getKey(), currentRanking);
+ removeNotificationInternal(sbn.getKey(), rankingMap);
}
});
}
@Override
- public void onNotificationRankingUpdate() {
+ public void onNotificationRankingUpdate(final RankingMap rankingMap) {
if (DEBUG) Log.d(TAG, "onRankingUpdate");
- final Ranking currentRanking = getCurrentRanking();
mHandler.post(new Runnable() {
@Override
public void run() {
- updateRankingInternal(currentRanking);
+ updateRankingInternal(rankingMap);
}
});
}
@@ -505,8 +506,8 @@ public abstract class BaseStatusBar extends SystemUI implements
protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
View vetoButton = row.findViewById(R.id.veto);
- if (n.isClearable() || (mInterruptingNotificationEntry != null
- && mInterruptingNotificationEntry.row == row)) {
+ if (n.isClearable() || (mHeadsUpNotificationView.getEntry() != null
+ && mHeadsUpNotificationView.getEntry().row == row)) {
final String _pkg = n.getPackageName();
final String _tag = n.getTag();
final int _id = n.getId();
@@ -545,12 +546,11 @@ public abstract class BaseStatusBar extends SystemUI implements
if (entry.expanded.getId() != com.android.internal.R.id.status_bar_latest_event_content) {
// Using custom RemoteViews
- if (version > 0 && version < Build.VERSION_CODES.GINGERBREAD) {
- entry.row.setBackgroundResource(R.drawable.notification_row_legacy_bg);
- } else if (version < Build.VERSION_CODES.L) {
+ if (version >= Build.VERSION_CODES.GINGERBREAD && version < Build.VERSION_CODES.L) {
entry.row.setBackgroundResourceIds(
com.android.internal.R.drawable.notification_bg,
com.android.internal.R.drawable.notification_bg_dim);
+ entry.legacy = true;
}
} else {
// Using platform templates
@@ -766,6 +766,12 @@ public abstract class BaseStatusBar extends SystemUI implements
public abstract void resetHeadsUpDecayTimer();
+ public abstract void scheduleHeadsUpOpen();
+
+ public abstract void scheduleHeadsUpClose();
+
+ public abstract void scheduleHeadsUpEscalation();
+
/**
* Save the current "public" (locked and secure) state of the lockscreen.
*/
@@ -797,6 +803,18 @@ public abstract class BaseStatusBar extends SystemUI implements
return mUsersAllowingPrivateNotifications.get(userHandle);
}
+ public void onNotificationClear(StatusBarNotification notification) {
+ try {
+ mBarService.onNotificationClear(
+ notification.getPackageName(),
+ notification.getTag(),
+ notification.getId(),
+ notification.getUserId());
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+
protected class H extends Handler {
public void handleMessage(Message m) {
Intent intent;
@@ -1026,6 +1044,7 @@ public abstract class BaseStatusBar extends SystemUI implements
com.android.internal.R.id.text);
text.setText("Unlock your device to see this notification.");
+ entry.autoRedacted = true;
// TODO: fill out "time" as well
}
@@ -1101,7 +1120,7 @@ public abstract class BaseStatusBar extends SystemUI implements
try {
if (mIsHeadsUp) {
- mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
+ mHeadsUpNotificationView.clear();
}
mBarService.onNotificationClick(mNotificationKey);
} catch (RemoteException ex) {
@@ -1157,7 +1176,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- protected StatusBarNotification removeNotificationViews(String key, Ranking ranking) {
+ protected StatusBarNotification removeNotificationViews(String key, RankingMap ranking) {
NotificationData.Entry entry = mNotificationData.remove(key, ranking);
if (entry == null) {
Log.w(TAG, "removeNotification for unknown key: " + key);
@@ -1197,7 +1216,7 @@ public abstract class BaseStatusBar extends SystemUI implements
return entry;
}
- protected void addNotificationViews(Entry entry, Ranking ranking) {
+ protected void addNotificationViews(Entry entry, RankingMap ranking) {
if (entry == null) {
return;
}
@@ -1206,7 +1225,7 @@ public abstract class BaseStatusBar extends SystemUI implements
updateNotifications();
}
- private void addNotificationViews(StatusBarNotification notification, Ranking ranking) {
+ private void addNotificationViews(StatusBarNotification notification, RankingMap ranking) {
addNotificationViews(createNotificationViews(notification), ranking);
}
@@ -1292,9 +1311,9 @@ public abstract class BaseStatusBar extends SystemUI implements
}
public abstract void addNotificationInternal(StatusBarNotification notification,
- Ranking ranking);
+ RankingMap ranking);
- protected abstract void updateRankingInternal(Ranking ranking);
+ protected abstract void updateRankingInternal(RankingMap ranking);
@Override
public void removeNotification(String key) {
@@ -1303,7 +1322,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- public abstract void removeNotificationInternal(String key, Ranking ranking);
+ public abstract void removeNotificationInternal(String key, RankingMap ranking);
public void updateNotification(StatusBarNotification notification) {
if (!USE_NOTIFICATION_LISTENER) {
@@ -1311,7 +1330,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- public void updateNotificationInternal(StatusBarNotification notification, Ranking ranking) {
+ public void updateNotificationInternal(StatusBarNotification notification, RankingMap ranking) {
if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")");
final NotificationData.Entry oldEntry = mNotificationData.findByKey(notification.getKey());
@@ -1394,15 +1413,15 @@ public abstract class BaseStatusBar extends SystemUI implements
try {
updateNotificationViews(oldEntry, notification);
- if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null
- && oldNotification == mInterruptingNotificationEntry.notification) {
+ if (ENABLE_HEADS_UP && mHeadsUpNotificationView.getEntry() != null
+ && oldNotification == mHeadsUpNotificationView.getEntry().notification) {
if (!shouldInterrupt(notification)) {
if (DEBUG) Log.d(TAG, "no longer interrupts!");
- mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
+ scheduleHeadsUpClose();
} else {
if (DEBUG) Log.d(TAG, "updating the current heads up:" + notification);
- mInterruptingNotificationEntry.notification = notification;
- updateHeadsUpViews(mInterruptingNotificationEntry, notification);
+ mHeadsUpNotificationView.getEntry().notification = notification;
+ updateHeadsUpViews(mHeadsUpNotificationView.getEntry(), notification);
}
}
@@ -1511,8 +1530,8 @@ public abstract class BaseStatusBar extends SystemUI implements
}
protected void notifyHeadsUpScreenOn(boolean screenOn) {
- if (!screenOn && mInterruptingNotificationEntry != null) {
- mHandler.sendEmptyMessage(MSG_ESCALATE_HEADS_UP);
+ if (!screenOn) {
+ scheduleHeadsUpEscalation();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 84005d1..5bad602 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -209,7 +209,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
public int getMaxExpandHeight() {
- return mMaxExpandHeight;
+ return mShowingPublic ? mRowMinHeight : mMaxExpandHeight;
}
/**
@@ -221,30 +221,35 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
@Override
public boolean isContentExpandable() {
- return mPrivateLayout.isContentExpandable();
+ NotificationContentView showingLayout = getShowingLayout();
+ return showingLayout.isContentExpandable();
}
@Override
public void setActualHeight(int height, boolean notifyListeners) {
mPrivateLayout.setActualHeight(height);
+ mPublicLayout.setActualHeight(height);
invalidate();
super.setActualHeight(height, notifyListeners);
}
@Override
public int getMaxHeight() {
- return mPrivateLayout.getMaxHeight();
+ NotificationContentView showingLayout = getShowingLayout();
+ return showingLayout.getMaxHeight();
}
@Override
public int getMinHeight() {
- return mPrivateLayout.getMinHeight();
+ NotificationContentView showingLayout = getShowingLayout();
+ return showingLayout.getMinHeight();
}
@Override
public void setClipTopAmount(int clipTopAmount) {
super.setClipTopAmount(clipTopAmount);
mPrivateLayout.setClipTopAmount(clipTopAmount);
+ mPublicLayout.setClipTopAmount(clipTopAmount);
}
public boolean isBelowSpeedBump() {
@@ -256,6 +261,16 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
public void notifyContentUpdated() {
+ mPublicLayout.notifyContentUpdated();
mPrivateLayout.notifyContentUpdated();
}
+
+ public boolean isShowingLayoutLayouted() {
+ NotificationContentView showingLayout = getShowingLayout();
+ return showingLayout.getWidth() != 0;
+ }
+
+ private NotificationContentView getShowingLayout() {
+ return mShowingPublic ? mPublicLayout : mPrivateLayout;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
index 4233ab8..bfa74fa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
@@ -21,6 +21,7 @@ import android.content.Context;
import android.os.Process;
import android.provider.Settings;
import android.service.notification.NotificationListenerService.Ranking;
+import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.util.ArrayMap;
import android.util.ArraySet;
@@ -58,17 +59,18 @@ public class InterceptedNotifications {
updateSyntheticNotification();
}
- public boolean tryIntercept(StatusBarNotification notification, Ranking ranking) {
- if (ranking == null) return false;
+ public boolean tryIntercept(StatusBarNotification notification, RankingMap rankingMap) {
+ if (rankingMap == null) return false;
if (shouldDisplayIntercepted()) return false;
if (mReleased.contains(notification.getKey())) return false;
- if (!ranking.isInterceptedByDoNotDisturb(notification.getKey())) return false;
+ Ranking ranking = rankingMap.getRanking(notification.getKey());
+ if (!ranking.isInterceptedByDoNotDisturb()) return false;
mIntercepted.put(notification.getKey(), notification);
updateSyntheticNotification();
return true;
}
- public void retryIntercepts(Ranking ranking) {
+ public void retryIntercepts(RankingMap ranking) {
if (ranking == null) return;
final int N = mIntercepted.size();
@@ -111,7 +113,7 @@ public class InterceptedNotifications {
return;
}
final Notification n = new Notification.Builder(mContext)
- .setSmallIcon(R.drawable.ic_qs_zen_on)
+ .setSmallIcon(R.drawable.ic_notify_zen)
.setContentTitle(mContext.getResources().getQuantityString(
R.plurals.zen_mode_notification_title,
mIntercepted.size(), mIntercepted.size()))
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
index f9baecb..5cde979 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationContentView.java
@@ -106,7 +106,7 @@ public class NotificationContentView extends FrameLayout {
private void selectLayout() {
if (mActualHeight <= mSmallHeight || mExpandedChild == null) {
- if (mContractedChild.getVisibility() != View.VISIBLE) {
+ if (mContractedChild != null && mContractedChild.getVisibility() != View.VISIBLE) {
mContractedChild.setVisibility(View.VISIBLE);
}
if (mExpandedChild != null && mExpandedChild.getVisibility() != View.INVISIBLE) {
@@ -116,7 +116,7 @@ public class NotificationContentView extends FrameLayout {
if (mExpandedChild.getVisibility() != View.VISIBLE) {
mExpandedChild.setVisibility(View.VISIBLE);
}
- if (mContractedChild.getVisibility() != View.INVISIBLE) {
+ if (mContractedChild != null && mContractedChild.getVisibility() != View.INVISIBLE) {
mContractedChild.setVisibility(View.INVISIBLE);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index d829ac0..c313c58 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar;
import android.app.Notification;
import android.service.notification.NotificationListenerService.Ranking;
+import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.view.View;
@@ -40,6 +41,9 @@ public class NotificationData {
public View expandedPublic; // for insecure lockscreens
public View expandedBig;
private boolean interruption;
+ public boolean autoRedacted; // whether the redacted notification was generated by us
+ public boolean legacy; // whether the notification has a legacy, dark background
+
public Entry() {}
public Entry(StatusBarNotification n, StatusBarIconView ic) {
this.key = n.getKey();
@@ -67,12 +71,16 @@ public class NotificationData {
}
private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
- private Ranking mRanking;
+ private RankingMap mRanking;
private final Comparator<Entry> mRankingComparator = new Comparator<Entry>() {
@Override
public int compare(Entry a, Entry b) {
if (mRanking != null) {
- return mRanking.getRank(a.key) - mRanking.getRank(b.key);
+ Ranking aRanking = mRanking.getRanking(a.key);
+ Ranking bRanking = mRanking.getRanking(b.key);
+ int aRank = aRanking != null ? aRanking.getRank() : -1;
+ int bRank = bRanking != null ? bRanking.getRank() : -1;
+ return aRank - bRank;
}
final StatusBarNotification na = a.notification;
@@ -105,12 +113,12 @@ public class NotificationData {
return null;
}
- public void add(Entry entry, Ranking ranking) {
+ public void add(Entry entry, RankingMap ranking) {
mEntries.add(entry);
updateRankingAndSort(ranking);
}
- public Entry remove(String key, Ranking ranking) {
+ public Entry remove(String key, RankingMap ranking) {
Entry e = findByKey(key);
if (e == null) {
return null;
@@ -120,7 +128,7 @@ public class NotificationData {
return e;
}
- public void updateRanking(Ranking ranking) {
+ public void updateRanking(RankingMap ranking) {
updateRankingAndSort(ranking);
}
@@ -134,12 +142,13 @@ public class NotificationData {
}
}
} else {
- return mRanking.isAmbient(key);
+ Ranking ranking = mRanking.getRanking(key);
+ return ranking != null && ranking.isAmbient();
}
return false;
}
- private void updateRankingAndSort(Ranking ranking) {
+ private void updateRankingAndSort(RankingMap ranking) {
if (ranking != null) {
mRanking = ranking;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java
index 6819d9b..ce5ab5a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationOverflowIconsView.java
@@ -65,7 +65,7 @@ public class NotificationOverflowIconsView extends IconMerger {
}
private void applyColor(Notification notification, StatusBarIconView view) {
- if (notification.color != Notification.COLOR_DEFAULT) {
+ if (notification.color == Notification.COLOR_DEFAULT) {
if (mNotificationColorUtil.isGrayscale(view.getDrawable())) {
view.setColorFilter(mTintColor, PorterDuff.Mode.MULTIPLY);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java
deleted file mode 100644
index 1503072..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.systemui.statusbar;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Outline;
-import android.graphics.Paint;
-import android.util.AttributeSet;
-import android.view.View;
-
-/**
- * An single dot of the {@link com.android.systemui.statusbar.SpeedBumpDotsLayout}
- */
-public class SpeedBumpDotView extends View {
-
- private final Paint mPaint = new Paint();
-
- public SpeedBumpDotView(Context context, AttributeSet attrs) {
- super(context, attrs);
- mPaint.setAntiAlias(true);
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- float radius = getWidth() / 2.0f;
- canvas.drawCircle(radius, radius, radius, mPaint);
- }
-
- @Override
- public boolean hasOverlappingRendering() {
- return false;
- }
-
- public void setColor(int color) {
- mPaint.setColor(color);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsAlgorithm.java
deleted file mode 100644
index cac6327..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsAlgorithm.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.systemui.statusbar;
-
-import android.content.Context;
-import android.view.View;
-import com.android.systemui.R;
-
-/**
- * The Algorithm of the {@link com.android.systemui.statusbar.SpeedBumpDotsLayout} which can be
- * queried for {@link * com.android.systemui.statusbar.SpeedBumpDotsState}
- */
-public class SpeedBumpDotsAlgorithm {
-
- private final float mDotRadius;
-
- public SpeedBumpDotsAlgorithm(Context context) {
- mDotRadius = context.getResources().getDimensionPixelSize(R.dimen.speed_bump_dots_height)
- / 2.0f;
- }
-
- public void getState(SpeedBumpDotsState resultState) {
-
- // First reset the current state and ensure that every View has a ViewState
- resultState.resetViewStates();
-
- SpeedBumpDotsLayout hostView = resultState.getHostView();
- boolean currentlyVisible = hostView.isCurrentlyVisible();
- resultState.setActiveState(currentlyVisible
- ? SpeedBumpDotsState.SHOWN
- : SpeedBumpDotsState.HIDDEN);
- int hostWidth = hostView.getWidth();
- float layoutWidth = hostWidth - 2 * mDotRadius;
- int childCount = hostView.getChildCount();
- float paddingBetween = layoutWidth / (childCount - 1);
- float centerY = hostView.getHeight() / 2.0f;
- for (int i = 0; i < childCount; i++) {
- View child = hostView.getChildAt(i);
- SpeedBumpDotsState.ViewState viewState = resultState.getViewStateForView(child);
- if (currentlyVisible) {
- float xTranslation = i * paddingBetween;
- viewState.xTranslation = xTranslation;
- viewState.yTranslation = calculateYTranslation(hostView, centerY, xTranslation,
- layoutWidth);
- } else {
- viewState.xTranslation = layoutWidth / 2;
- viewState.yTranslation = centerY - mDotRadius;
- }
- viewState.alpha = currentlyVisible ? 1.0f : 0.0f;
- viewState.scale = currentlyVisible ? 1.0f : 0.5f;
- }
- }
-
- private float calculateYTranslation(SpeedBumpDotsLayout hostView, float centerY,
- float xTranslation, float layoutWidth) {
- float t = hostView.getAnimationProgress();
- if (t == 0.0f || t == 1.0f) {
- return centerY - mDotRadius;
- }
- float damping = (0.5f -Math.abs(0.5f - t)) * 1.3f;
- float partialOffset = xTranslation / layoutWidth;
- float indentFactor = (float) (Math.sin((t + partialOffset * 1.5f) * - Math.PI) * damping);
- return (1.0f - indentFactor) * centerY - mDotRadius;
- }
-
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsLayout.java
deleted file mode 100644
index ddf5215..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsLayout.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.systemui.statusbar;
-
-import android.animation.TimeAnimator;
-import android.animation.ValueAnimator;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.util.AttributeSet;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.AccelerateDecelerateInterpolator;
-import com.android.systemui.R;
-
-/**
- * A layout with a certain number of dots which are integrated in the
- * {@link com.android.systemui.statusbar.SpeedBumpView}
- */
-public class SpeedBumpDotsLayout extends ViewGroup {
-
- private static final float DOT_CLICK_ANIMATION_LENGTH = 300;
- private final int mDotSize;
- private final SpeedBumpDotsAlgorithm mAlgorithm = new SpeedBumpDotsAlgorithm(getContext());
- private final SpeedBumpDotsState mCurrentState = new SpeedBumpDotsState(this);
- private boolean mIsCurrentlyVisible = true;
- private final ValueAnimator mClickAnimator;
- private float mAnimationProgress;
- private ValueAnimator.AnimatorUpdateListener mClickUpdateListener
- = new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- mAnimationProgress = animation.getAnimatedFraction();
- updateChildren();
- }
- };
-
- public SpeedBumpDotsLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- mDotSize = getResources().getDimensionPixelSize(R.dimen.speed_bump_dots_height);
- createDots(context, attrs);
- mClickAnimator = TimeAnimator.ofFloat(0, DOT_CLICK_ANIMATION_LENGTH);
- mClickAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
- mClickAnimator.addUpdateListener(mClickUpdateListener);
- }
-
- private void createDots(Context context, AttributeSet attrs) {
- SpeedBumpDotView blueDot = new SpeedBumpDotView(context, attrs);
- blueDot.setColor(getResources().getColor(R.color.speed_bump_dot_blue));
- addView(blueDot);
-
- SpeedBumpDotView redDot = new SpeedBumpDotView(context, attrs);
- redDot.setColor(getResources().getColor(R.color.speed_bump_dot_red));
- addView(redDot);
-
- SpeedBumpDotView yellowDot = new SpeedBumpDotView(context, attrs);
- yellowDot.setColor(getResources().getColor(R.color.speed_bump_dot_yellow));
- addView(yellowDot);
-
- SpeedBumpDotView greenDot = new SpeedBumpDotView(context, attrs);
- greenDot.setColor(getResources().getColor(R.color.speed_bump_dot_green));
- addView(greenDot);
- }
-
- @Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- int childWidthSpec = MeasureSpec.makeMeasureSpec(mDotSize,
- MeasureSpec.getMode(widthMeasureSpec));
- int childHeightSpec = MeasureSpec.makeMeasureSpec(mDotSize,
- MeasureSpec.getMode(heightMeasureSpec));
- measureChildren(childWidthSpec, childHeightSpec);
- }
-
- @Override
- protected void onLayout(boolean changed, int l, int t, int r, int b) {
- int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- View child = getChildAt(i);
- child.layout(0, 0, mDotSize, mDotSize);
- }
- if (changed) {
- updateChildren();
- }
- }
-
- private void updateChildren() {
- mAlgorithm.getState(mCurrentState);
- mCurrentState.apply();
- }
-
- public void performVisibilityAnimation(boolean visible) {
- if (mClickAnimator.isRunning()) {
- mClickAnimator.cancel();
- }
- mIsCurrentlyVisible = visible;
- mAlgorithm.getState(mCurrentState);
- mCurrentState.animateToState();
- }
-
- public void setInvisible() {
- mIsCurrentlyVisible = false;
- mAlgorithm.getState(mCurrentState);
- mCurrentState.apply();
- }
-
- public boolean isCurrentlyVisible() {
- return mIsCurrentlyVisible;
- }
-
- public void performDotClickAnimation() {
- if (mClickAnimator.isRunning()) {
- // don't perform an animation if it's running already
- return;
- }
- mClickAnimator.start();
- }
-
-
- public float getAnimationProgress() {
- return mAnimationProgress;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java
deleted file mode 100644
index 4febab1..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.systemui.statusbar;
-
-import android.view.View;
-import android.view.ViewPropertyAnimator;
-import android.view.animation.AnimationUtils;
-import android.view.animation.Interpolator;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A state of a {@link com.android.systemui.statusbar.SpeedBumpDotsLayout}
- */
-public class SpeedBumpDotsState {
-
- public static final int HIDDEN = 1;
- public static final int SHOWN = 2;
- private static final int VISIBILITY_ANIMATION_DELAY_PER_ELEMENT = 80;
-
- private final SpeedBumpDotsLayout mHostView;
- private final HashMap<View, ViewState> mStateMap = new HashMap<View, ViewState>();
- private final Interpolator mFastOutSlowInInterpolator;
- private int mActiveState = 0;
-
- public SpeedBumpDotsState(SpeedBumpDotsLayout hostLayout) {
- mHostView = hostLayout;
- mFastOutSlowInInterpolator = AnimationUtils
- .loadInterpolator(hostLayout.getContext(),
- android.R.interpolator.fast_out_slow_in);
- }
-
- public SpeedBumpDotsLayout getHostView() {
- return mHostView;
- }
-
- public void resetViewStates() {
- int numChildren = mHostView.getChildCount();
- for (int i = 0; i < numChildren; i++) {
- View child = mHostView.getChildAt(i);
- ViewState viewState = mStateMap.get(child);
- if (viewState == null) {
- viewState = new ViewState();
- mStateMap.put(child, viewState);
- }
- }
- }
-
- public ViewState getViewStateForView(View requestedView) {
- return mStateMap.get(requestedView);
- }
-
- public void apply() {
- int childCount = mHostView.getChildCount();
- for (int i = 0; i < childCount; i++) {
- View child = mHostView.getChildAt(i);
- ViewState viewState = mStateMap.get(child);
-
- child.setTranslationX(viewState.xTranslation);
- child.setTranslationY(viewState.yTranslation);
- child.setScaleX(viewState.scale);
- child.setScaleY(viewState.scale);
- child.setAlpha(viewState.alpha);
- }
- }
-
- public void animateToState() {
- int childCount = mHostView.getChildCount();
- int middleIndex = (childCount - 1) / 2;
- long delayPerElement = VISIBILITY_ANIMATION_DELAY_PER_ELEMENT;
- boolean isAppearing = getActiveState() == SHOWN;
- boolean isDisappearing = getActiveState() == HIDDEN;
- for (int i = 0; i < childCount; i++) {
- int delayIndex;
- if (i <= middleIndex) {
- delayIndex = i * 2;
- } else {
- int distToMiddle = i - middleIndex;
- delayIndex = (childCount - 1) - (distToMiddle - 1) * 2;
- }
- long startDelay = 0;
- if (isAppearing || isDisappearing) {
- if (isDisappearing) {
- delayIndex = childCount - 1 - delayIndex;
- }
- startDelay = delayIndex * delayPerElement;
- }
- View child = mHostView.getChildAt(i);
- ViewState viewState = mStateMap.get(child);
- child.animate().setInterpolator(mFastOutSlowInInterpolator)
- .setStartDelay(startDelay)
- .alpha(viewState.alpha)
- .translationX(viewState.xTranslation)
- .translationY(viewState.yTranslation)
- .scaleX(viewState.scale).scaleY(viewState.scale);
- }
- }
-
- public int getActiveState() {
- return mActiveState;
- }
-
- public void setActiveState(int mActiveState) {
- this.mActiveState = mActiveState;
- }
-
- public static class ViewState {
- float xTranslation;
- float yTranslation;
- float alpha;
- float scale;
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
index 689d0e9..f80f0fd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
@@ -16,71 +16,26 @@
package com.android.systemui.statusbar;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
import android.content.Context;
-import android.graphics.Outline;
import android.util.AttributeSet;
-import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
-import android.widget.TextView;
import com.android.systemui.R;
/**
* The view representing the separation between important and less important notifications
*/
-public class SpeedBumpView extends ExpandableView implements View.OnClickListener {
+public class SpeedBumpView extends ExpandableView {
- private final int mCollapsedHeight;
- private final int mDotsHeight;
- private final int mTextPaddingInset;
- private SpeedBumpDotsLayout mDots;
- private AlphaOptimizedView mLineLeft;
- private AlphaOptimizedView mLineRight;
- private boolean mIsExpanded;
- private boolean mDividerVisible = true;
- private ValueAnimator mCurrentAnimator;
+ private final int mSpeedBumpHeight;
+ private AlphaOptimizedView mLine;
+ private boolean mIsVisible = true;
private final Interpolator mFastOutSlowInInterpolator;
- private float mCenterX;
- private TextView mExplanationText;
- private boolean mExplanationTextVisible = false;
- private AnimatorListenerAdapter mHideExplanationListener = new AnimatorListenerAdapter() {
- private boolean mCancelled;
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (!mCancelled) {
- mExplanationText.setVisibility(View.INVISIBLE);
- }
- }
-
- @Override
- public void onAnimationCancel(Animator animation) {
- mCancelled = true;
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- mCancelled = false;
- }
- };
- private Animator.AnimatorListener mAnimationFinishedListener = new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mCurrentAnimator = null;
- }
- };
public SpeedBumpView(Context context, AttributeSet attrs) {
super(context, attrs);
- mCollapsedHeight = getResources()
- .getDimensionPixelSize(R.dimen.speed_bump_height_collapsed);
- mTextPaddingInset = getResources().getDimensionPixelSize(
- R.dimen.speed_bump_text_padding_inset);
- mDotsHeight = getResources().getDimensionPixelSize(R.dimen.speed_bump_dots_height);
- setOnClickListener(this);
+ mSpeedBumpHeight = getResources()
+ .getDimensionPixelSize(R.dimen.speed_bump_height);
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(getContext(),
android.R.interpolator.fast_out_slow_in);
}
@@ -88,111 +43,41 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mDots = (SpeedBumpDotsLayout) findViewById(R.id.speed_bump_dots_layout);
- mLineLeft = (AlphaOptimizedView) findViewById(R.id.speedbump_line_left);
- mLineRight = (AlphaOptimizedView) findViewById(R.id.speedbump_line_right);
- mExplanationText = (TextView) findViewById(R.id.speed_bump_text);
- resetExplanationText();
-
+ mLine = (AlphaOptimizedView) findViewById(R.id.speedbump_line);
}
@Override
protected int getInitialHeight() {
- return mCollapsedHeight;
+ return mSpeedBumpHeight;
}
@Override
public int getIntrinsicHeight() {
- if (mCurrentAnimator != null) {
- // expand animation is running
- return getActualHeight();
- }
- return mIsExpanded ? getHeight() : mCollapsedHeight;
+ return mSpeedBumpHeight;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
- Outline outline = new Outline();
- mCenterX = getWidth() / 2;
- float centerY = getHeight() / 2;
- // TODO: hide outline better
- // Temporary workaround to hide outline on a transparent view
- int outlineLeft = (int) (mCenterX - getResources().getDisplayMetrics().densityDpi * 8);
- int outlineTop = (int) (centerY - mDotsHeight / 2);
- outline.setOval(outlineLeft, outlineTop, outlineLeft + mDotsHeight,
- outlineTop + mDotsHeight);
- setOutline(outline);
- mLineLeft.setPivotX(mLineLeft.getWidth());
- mLineLeft.setPivotY(mLineLeft.getHeight() / 2);
- mLineRight.setPivotX(0);
- mLineRight.setPivotY(mLineRight.getHeight() / 2);
+ mLine.setPivotX(mLine.getWidth() / 2);
+ mLine.setPivotY(mLine.getHeight() / 2);
+ setOutline(null);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
measureChildren(widthMeasureSpec, heightMeasureSpec);
- int height = mCollapsedHeight + mExplanationText.getMeasuredHeight() - mTextPaddingInset;
+ int height = mSpeedBumpHeight;
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), height);
}
@Override
- public void onClick(View v) {
- if (mCurrentAnimator != null) {
- return;
- }
- int startValue = mIsExpanded ? getMaxHeight() : mCollapsedHeight;
- int endValue = mIsExpanded ? mCollapsedHeight : getMaxHeight();
- mCurrentAnimator = ValueAnimator.ofInt(startValue, endValue);
- mCurrentAnimator.setInterpolator(mFastOutSlowInInterpolator);
- mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- setActualHeight((int) animation.getAnimatedValue());
- }
- });
- mCurrentAnimator.addListener(mAnimationFinishedListener);
- mCurrentAnimator.start();
- mIsExpanded = !mIsExpanded;
- mDots.performDotClickAnimation();
- animateExplanationTextInternal(mIsExpanded);
- }
-
- private void animateExplanationTextInternal(boolean visible) {
- if (mExplanationTextVisible != visible) {
- float translationY = 0.0f;
- float scale = 0.5f;
- float alpha = 0.0f;
- boolean needsHideListener = true;
- if (visible) {
- mExplanationText.setVisibility(VISIBLE);
- translationY = mDots.getBottom() - mTextPaddingInset;
- scale = 1.0f;
- alpha = 1.0f;
- needsHideListener = false;
- }
- mExplanationText.animate().setInterpolator(mFastOutSlowInInterpolator)
- .alpha(alpha)
- .scaleX(scale)
- .scaleY(scale)
- .translationY(translationY)
- .setListener(needsHideListener ? mHideExplanationListener : null);
- mExplanationTextVisible = visible;
- }
- }
-
- @Override
public boolean isTransparent() {
return true;
}
public void performVisibilityAnimation(boolean nowVisible) {
animateDivider(nowVisible, null /* onFinishedRunnable */);
-
- // Animate explanation Text
- if (mIsExpanded) {
- animateExplanationTextInternal(nowVisible);
- }
}
/**
@@ -203,28 +88,16 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
* finished.
*/
public void animateDivider(boolean nowVisible, Runnable onFinishedRunnable) {
- if (nowVisible != mDividerVisible) {
+ if (nowVisible != mIsVisible) {
// Animate dividers
float endValue = nowVisible ? 1.0f : 0.0f;
- float endTranslationXLeft = nowVisible ? 0.0f : mCenterX - mLineLeft.getRight();
- float endTranslationXRight = nowVisible ? 0.0f : mCenterX - mLineRight.getLeft();
- mLineLeft.animate()
+ mLine.animate()
.alpha(endValue)
.scaleX(endValue)
.scaleY(endValue)
- .translationX(endTranslationXLeft)
.setInterpolator(mFastOutSlowInInterpolator)
.withEndAction(onFinishedRunnable);
- mLineRight.animate()
- .alpha(endValue)
- .scaleX(endValue)
- .scaleY(endValue)
- .translationX(endTranslationXRight)
- .setInterpolator(mFastOutSlowInInterpolator);
-
- // Animate dots
- mDots.performVisibilityAnimation(nowVisible);
- mDividerVisible = nowVisible;
+ mIsVisible = nowVisible;
} else {
if (onFinishedRunnable != null) {
onFinishedRunnable.run();
@@ -233,34 +106,10 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
}
public void setInvisible() {
- float endTranslationXLeft = mCenterX - mLineLeft.getRight();
- float endTranslationXRight = mCenterX - mLineRight.getLeft();
- mLineLeft.setAlpha(0.0f);
- mLineLeft.setScaleX(0.0f);
- mLineLeft.setScaleY(0.0f);
- mLineLeft.setTranslationX(endTranslationXLeft);
- mLineRight.setAlpha(0.0f);
- mLineRight.setScaleX(0.0f);
- mLineRight.setScaleY(0.0f);
- mLineRight.setTranslationX(endTranslationXRight);
- mDots.setInvisible();
- resetExplanationText();
-
- mDividerVisible = false;
- }
-
- public void collapse() {
- if (mIsExpanded) {
- setActualHeight(mCollapsedHeight);
- mIsExpanded = false;
- }
- resetExplanationText();
- }
-
- public void animateExplanationText(boolean nowVisible) {
- if (mIsExpanded) {
- animateExplanationTextInternal(nowVisible);
- }
+ mLine.setAlpha(0.0f);
+ mLine.setScaleX(0.0f);
+ mLine.setScaleY(0.0f);
+ mIsVisible = false;
}
@Override
@@ -272,17 +121,4 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
public void performAddAnimation(long delay) {
performVisibilityAnimation(true);
}
-
- private void resetExplanationText() {
- mExplanationText.setTranslationY(0);
- mExplanationText.setVisibility(INVISIBLE);
- mExplanationText.setAlpha(0.0f);
- mExplanationText.setScaleX(0.5f);
- mExplanationText.setScaleY(0.5f);
- mExplanationTextVisible = false;
- }
-
- public boolean isExpanded() {
- return mIsExpanded;
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java
index 086a266..e312d58 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardPageSwipeHelper.java
@@ -423,6 +423,7 @@ public class KeyguardPageSwipeHelper {
return;
}
if (!animate) {
+ view.animate().cancel();
view.setAlpha(alpha);
view.setScaleX(scale);
view.setScaleY(scale);
@@ -465,6 +466,13 @@ public class KeyguardPageSwipeHelper {
}
public void reset() {
+ if (mSwipeAnimator != null) {
+ mSwipeAnimator.cancel();
+ }
+ ArrayList<View> targetViews = mCallback.getTranslationViews();
+ for (View view : targetViews) {
+ view.animate().cancel();
+ }
setTranslation(0.0f, true);
mSwipingInProgress = false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 772d0e7..1f3098d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -27,6 +27,7 @@ import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
+import android.view.ViewTreeObserver;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.FrameLayout;
@@ -67,6 +68,11 @@ public abstract class PanelView extends FrameLayout {
private VelocityTrackerInterface mVelocityTracker;
private FlingAnimationUtils mFlingAnimationUtils;
+ /**
+ * Whether an instant expand request is currently pending and we are just waiting for layout.
+ */
+ private boolean mInstantExpanding;
+
PanelBar mBar;
protected int mMaxPanelHeight = -1;
@@ -128,6 +134,9 @@ public abstract class PanelView extends FrameLayout {
@Override
public boolean onTouchEvent(MotionEvent event) {
+ if (mInstantExpanding) {
+ return false;
+ }
/*
* We capture touch events here and update the expand height here in case according to
@@ -263,6 +272,9 @@ public abstract class PanelView extends FrameLayout {
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
+ if (mInstantExpanding) {
+ return false;
+ }
/*
* If the user drags anywhere inside the panel we intercept it if he moves his finger
@@ -556,6 +568,41 @@ public abstract class PanelView extends FrameLayout {
}
}
+ public void instantExpand() {
+ mInstantExpanding = true;
+ abortAnimations();
+ if (mTracking) {
+ onTrackingStopped(true /* expands */); // The panel is expanded after this call.
+ onExpandingFinished();
+ }
+ setVisibility(VISIBLE);
+
+ // Wait for window manager to pickup the change, so we know the maximum height of the panel
+ // then.
+ getViewTreeObserver().addOnGlobalLayoutListener(
+ new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ if (mStatusBar.getStatusBarWindow().getHeight()
+ != mStatusBar.getStatusBarHeight()) {
+ getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ setExpandedFraction(1f);
+ mInstantExpanding = false;
+ }
+ }
+ });
+
+ // Make sure a layout really happens.
+ requestLayout();
+ }
+
+ private void abortAnimations() {
+ cancelPeek();
+ if (mHeightAnimator != null) {
+ mHeightAnimator.cancel();
+ }
+ }
+
protected void startUnlockHintAnimation() {
// We don't need to hint the user if an animation is already running or the user is changing
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index f86572d..4ed1888 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -64,7 +64,7 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
-import android.service.notification.NotificationListenerService.Ranking;
+import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.util.ArraySet;
import android.util.DisplayMetrics;
@@ -103,6 +103,7 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.qs.CircularClipper;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.qs.QSTile;
+import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.DragDownHelper;
@@ -277,10 +278,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// the date view
DateView mDateView;
- // for heads up notifications
- private HeadsUpNotificationView mHeadsUpNotificationView;
- private int mHeadsUpNotificationDecay;
-
// on-screen navigation buttons
private NavigationBarView mNavigationBarView = null;
private int mNavigationBarWindowState = WINDOW_STATE_SHOWING;
@@ -366,7 +363,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
if (!mUseHeadsUp) {
Log.d(TAG, "dismissing any existing heads up notification on disable event");
setHeadsUpVisibility(false);
- mHeadsUpNotificationView.setNotification(null);
+ mHeadsUpNotificationView.release();
removeHeadsUpView();
} else {
addHeadsUpView();
@@ -818,6 +815,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
return mStatusBarView;
}
+ public StatusBarWindowView getStatusBarWindow() {
+ return mStatusBarWindow;
+ }
+
@Override
protected WindowManager.LayoutParams getSearchLayoutParams(LayoutParams layoutParams) {
boolean opaque = false;
@@ -1050,7 +1051,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
- public void addNotificationInternal(StatusBarNotification notification, Ranking ranking) {
+ public void addNotificationInternal(StatusBarNotification notification, RankingMap ranking) {
if (DEBUG) Log.d(TAG, "addNotification key=" + notification.getKey());
if (mZenMode != Global.ZEN_MODE_OFF && mIntercepted.tryIntercept(notification, ranking)) {
// Forward the ranking so we can sort the new notification.
@@ -1061,31 +1062,28 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
displayNotification(notification, ranking);
}
- public void displayNotification(StatusBarNotification notification,
- Ranking ranking) {
- Entry shadeEntry = createNotificationViews(notification);
- if (shadeEntry == null) {
- return;
- }
+ public void displayNotification(StatusBarNotification notification, RankingMap ranking) {
if (mUseHeadsUp && shouldInterrupt(notification)) {
if (DEBUG) Log.d(TAG, "launching notification in heads up mode");
Entry interruptionCandidate = new Entry(notification, null);
ViewGroup holder = mHeadsUpNotificationView.getHolder();
if (inflateViewsForHeadsUp(interruptionCandidate, holder)) {
mInterruptingNotificationTime = System.currentTimeMillis();
- mInterruptingNotificationEntry = interruptionCandidate;
- shadeEntry.setInterruption();
// 1. Populate mHeadsUpNotificationView
- mHeadsUpNotificationView.setNotification(mInterruptingNotificationEntry);
+ mHeadsUpNotificationView.showNotification(interruptionCandidate);
- // 2. Animate mHeadsUpNotificationView in
- mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
-
- // 3. Set alarm to age the notification off
- resetHeadsUpDecayTimer();
+ // do not show the notification in the shade, yet.
+ return;
}
- } else if (notification.getNotification().fullScreenIntent != null) {
+ }
+
+ Entry shadeEntry = createNotificationViews(notification);
+ if (shadeEntry == null) {
+ return;
+ }
+
+ if (notification.getNotification().fullScreenIntent != null) {
// Stop screensaver if the notification has a full-screen intent.
// (like an incoming phone call)
awakenDreams();
@@ -1100,7 +1098,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// usual case: status bar visible & not immersive
// show the ticker if there isn't already a heads up
- if (mInterruptingNotificationEntry == null) {
+ if (mHeadsUpNotificationView.getEntry() == null) {
tick(notification, true);
}
}
@@ -1110,31 +1108,64 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
}
+ public void displayNotificationFromHeadsUp(StatusBarNotification notification) {
+ NotificationData.Entry shadeEntry = createNotificationViews(notification);
+ if (shadeEntry == null) {
+ return;
+ }
+ shadeEntry.setInterruption();
+
+ addNotificationViews(shadeEntry, null);
+ // Recalculate the position of the sliding windows and the titles.
+ setAreThereNotifications();
+ updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
+ }
+
@Override
public void resetHeadsUpDecayTimer() {
- mHandler.removeMessages(MSG_HIDE_HEADS_UP);
+ mHandler.removeMessages(MSG_DECAY_HEADS_UP);
if (mUseHeadsUp && mHeadsUpNotificationDecay > 0
&& mHeadsUpNotificationView.isClearable()) {
- mHandler.sendEmptyMessageDelayed(MSG_HIDE_HEADS_UP, mHeadsUpNotificationDecay);
+ mHandler.sendEmptyMessageDelayed(MSG_DECAY_HEADS_UP, mHeadsUpNotificationDecay);
}
}
@Override
- public void updateNotificationInternal(StatusBarNotification notification, Ranking ranking) {
+ public void scheduleHeadsUpOpen() {
+ mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
+ }
+
+ @Override
+ public void scheduleHeadsUpClose() {
+ mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
+ }
+
+ @Override
+ public void scheduleHeadsUpEscalation() {
+ mHandler.sendEmptyMessage(MSG_ESCALATE_HEADS_UP);
+ }
+
+ @Override
+ public void updateNotificationInternal(StatusBarNotification notification, RankingMap ranking) {
super.updateNotificationInternal(notification, ranking);
// if we're here, then the notification is already in the shade
mIntercepted.remove(notification.getKey());
}
@Override
- protected void updateRankingInternal(Ranking ranking) {
+ protected void updateRankingInternal(RankingMap ranking) {
mNotificationData.updateRanking(ranking);
mIntercepted.retryIntercepts(ranking);
updateNotifications();
}
@Override
- public void removeNotificationInternal(String key, Ranking ranking) {
+ public void removeNotificationInternal(String key, RankingMap ranking) {
+ if (ENABLE_HEADS_UP && mHeadsUpNotificationView.getEntry() != null
+ && key.equals(mHeadsUpNotificationView.getEntry().notification.getKey())) {
+ mHeadsUpNotificationView.clear();
+ }
+
StatusBarNotification old = removeNotificationViews(key, ranking);
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
@@ -1147,11 +1178,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// Recalculate the position of the sliding windows and the titles.
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
- if (ENABLE_HEADS_UP && mInterruptingNotificationEntry != null
- && old == mInterruptingNotificationEntry.notification) {
- mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
- }
-
if (CLOSE_PANEL_WHEN_EMPTIED && mNotificationData.size() == 0
&& !mNotificationPanel.isTracking() && mState != StatusBarState.KEYGUARD) {
animateCollapsePanels();
@@ -1192,9 +1218,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
final int vis = ent.notification.getNotification().visibility;
if (vis != Notification.VISIBILITY_SECRET) {
// when isLockscreenPublicMode() we show the public form of VISIBILITY_PRIVATE notifications
- ent.row.setShowingPublic(isLockscreenPublicMode()
+ boolean showingPublic = isLockscreenPublicMode()
&& vis == Notification.VISIBILITY_PRIVATE
- && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId()));
+ && !userAllowsPrivateNotificationsInPublic(ent.notification.getUserId());
+ ent.row.setShowingPublic(showingPublic);
+ if (ent.autoRedacted && ent.legacy) {
+ if (showingPublic) {
+ ent.row.setBackgroundResourceIds(
+ com.android.internal.R.drawable.notification_material_bg,
+ com.android.internal.R.drawable.notification_material_bg_dim);
+ } else {
+ ent.row.setBackgroundResourceIds(
+ com.android.internal.R.drawable.notification_bg,
+ com.android.internal.R.drawable.notification_bg_dim);
+ }
+ }
toShow.add(ent.row);
}
}
@@ -1562,7 +1600,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
case MSG_SHOW_HEADS_UP:
setHeadsUpVisibility(true);
break;
+ case MSG_DECAY_HEADS_UP:
+ mHeadsUpNotificationView.release();
+ setHeadsUpVisibility(false);
+ break;
case MSG_HIDE_HEADS_UP:
+ mHeadsUpNotificationView.release();
setHeadsUpVisibility(false);
break;
case MSG_ESCALATE_HEADS_UP:
@@ -1575,8 +1618,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
/** if the interrupting notification had a fullscreen intent, fire it now. */
private void escalateHeadsUp() {
- if (mInterruptingNotificationEntry != null) {
- final StatusBarNotification sbn = mInterruptingNotificationEntry.notification;
+ if (mHeadsUpNotificationView.getEntry() != null) {
+ final StatusBarNotification sbn = mHeadsUpNotificationView.getEntry().notification;
+ mHeadsUpNotificationView.release();
final Notification notification = sbn.getNotification();
if (notification.fullScreenIntent != null) {
if (DEBUG)
@@ -2231,7 +2275,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
pw.print(" mUseHeadsUp=");
pw.println(mUseHeadsUp);
pw.print(" interrupting package: ");
- pw.println(hunStateToString(mInterruptingNotificationEntry));
+ pw.println(hunStateToString(mHeadsUpNotificationView.getEntry()));
dumpBarTransitions(pw, "mStatusBarView", mStatusBarView.getBarTransitions());
if (mNavigationBarView != null) {
pw.print(" mNavigationBarWindowState=");
@@ -2505,26 +2549,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
if (!ENABLE_HEADS_UP) return;
if (DEBUG) Log.v(TAG, (vis ? "showing" : "hiding") + " heads up window");
mHeadsUpNotificationView.setVisibility(vis ? View.VISIBLE : View.GONE);
- if (!vis) {
- if (DEBUG) Log.d(TAG, "setting heads up entry to null");
- mInterruptingNotificationEntry = null;
- }
}
public void onHeadsUpDismissed() {
- if (mInterruptingNotificationEntry == null) return;
- mHandler.sendEmptyMessage(MSG_HIDE_HEADS_UP);
- if (mHeadsUpNotificationView.isClearable()) {
- try {
- mBarService.onNotificationClear(
- mInterruptingNotificationEntry.notification.getPackageName(),
- mInterruptingNotificationEntry.notification.getTag(),
- mInterruptingNotificationEntry.notification.getId(),
- mInterruptingNotificationEntry.notification.getUserId());
- } catch (android.os.RemoteException ex) {
- // oh well
- }
- }
+ mHeadsUpNotificationView.dismiss();
}
/**
@@ -2893,7 +2921,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mNotificationPanel.setKeyguardShowing(false);
mScrimController.setKeyguardShowing(false);
}
-
updateStackScrollerState();
updatePublicMode();
updateNotifications();
@@ -2909,6 +2936,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
? View.INVISIBLE : View.VISIBLE);
mStackScroller.setScrollingEnabled(!onKeyguard);
mStackScroller.setExpandingEnabled(!onKeyguard);
+ ActivatableNotificationView activatedChild = mStackScroller.getActivatedChild();
+ mStackScroller.setActivatedChild(null);
+ if (activatedChild != null) {
+ activatedChild.makeInactive(false /* animate */);
+ }
}
public void userActivity() {
@@ -2942,22 +2974,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
private void instantExpandNotificationsPanel() {
- // Make our window larger and the panel visible.
+ // Make our window larger and the panel expanded.
makeExpandedVisible(true);
- mNotificationPanel.setVisibility(View.VISIBLE);
-
- // Wait for window manager to pickup the change, so we know the maximum height of the panel
- // then.
- mNotificationPanel.getViewTreeObserver().addOnGlobalLayoutListener(
- new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- if (mStatusBarWindow.getHeight() != getStatusBarHeight()) {
- mNotificationPanel.getViewTreeObserver().removeOnGlobalLayoutListener(this);
- mNotificationPanel.setExpandedFraction(1);
- }
- }
- });
+ mNotificationPanel.instantExpand();
}
private void instantCollapseNotificationPanel() {
@@ -2965,9 +2984,13 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
- public void onActivated(View view) {
+ public void onActivated(ActivatableNotificationView view) {
userActivity();
mKeyguardIndicationController.showTransientIndication(R.string.notification_tap_again);
+ ActivatableNotificationView previousView = mStackScroller.getActivatedChild();
+ if (previousView != null) {
+ previousView.makeInactive(true /* animate */);
+ }
mStackScroller.setActivatedChild(view);
}
@@ -2980,7 +3003,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
@Override
- public void onActivationReset(View view) {
+ public void onActivationReset(ActivatableNotificationView view) {
if (view == mStackScroller.getActivatedChild()) {
mKeyguardIndicationController.hideTransientIndication();
mStackScroller.setActivatedChild(null);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
index 1916f13..c8ab027 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java
@@ -146,6 +146,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
updateBrightnessControllerState();
updateZTranslation();
updateClickTargets();
+ updateWidth();
if (mQSPanel != null) {
mQSPanel.setExpanded(expanded && !overscrolled);
}
@@ -181,7 +182,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
}
private void updateWidth() {
- int width = mKeyguardShowing ? mKeyguardWidth : mNormalWidth;
+ int width = (mKeyguardShowing && !mExpanded) ? mKeyguardWidth : mNormalWidth;
ViewGroup.LayoutParams lp = getLayoutParams();
if (width != lp.width) {
lp.width = width;
@@ -335,6 +336,11 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL
}
};
+ @Override
+ public boolean shouldDelayChildPressedState() {
+ return true;
+ }
+
public void setShowEmergencyCallsOnly(boolean show) {
mShowEmergencyCallsOnly = show;
if (mExpanded) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
index df01c12..d778ccb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpNotificationView.java
@@ -33,9 +33,9 @@ import com.android.systemui.ExpandHelper;
import com.android.systemui.Gefingerpoken;
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
-import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.NotificationData;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.Callback, ExpandHelper.Callback,
ViewTreeObserver.OnComputeInternalInsetsListener {
@@ -51,7 +51,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
private SwipeHelper mSwipeHelper;
private EdgeSwipeHelper mEdgeSwipeHelper;
- private BaseStatusBar mBar;
+ private PhoneStatusBar mBar;
private ExpandHelper mExpandHelper;
private long mStartTouchTime;
@@ -69,7 +69,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
if (DEBUG) Log.v(TAG, "create() " + mTouchSensitivityDelay);
}
- public void setBar(BaseStatusBar bar) {
+ public void setBar(PhoneStatusBar bar) {
mBar = bar;
}
@@ -77,7 +77,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
return mContentHolder;
}
- public boolean setNotification(NotificationData.Entry headsUp) {
+ public boolean showNotification(NotificationData.Entry headsUp) {
+ // bump any previous heads up back to the shade
+ release();
+
mHeadsUp = headsUp;
if (mContentHolder != null) {
mContentHolder.removeAllViews();
@@ -97,10 +100,46 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
mSwipeHelper.snapChild(mContentHolder, 1f);
mStartTouchTime = System.currentTimeMillis() + mTouchSensitivityDelay;
+
+ // 2. Animate mHeadsUpNotificationView in
+ mBar.scheduleHeadsUpOpen();
+
+ // 3. Set alarm to age the notification off
+ mBar.resetHeadsUpDecayTimer();
}
return true;
}
+ /** Discard the Heads Up notification. */
+ public void clear() {
+ mHeadsUp = null;
+ mBar.scheduleHeadsUpClose();
+ }
+
+ /** Respond to dismissal of the Heads Up window. */
+ public void dismiss() {
+ if (mHeadsUp == null) return;
+ if (mHeadsUp.notification.isClearable()) {
+ mBar.onNotificationClear(mHeadsUp.notification);
+ } else {
+ release();
+ }
+ mHeadsUp = null;
+ mBar.scheduleHeadsUpClose();
+ }
+
+ /** Push any current Heads Up notification down into the shade. */
+ public void release() {
+ if (mHeadsUp != null) {
+ mBar.displayNotificationFromHeadsUp(mHeadsUp.notification);
+ }
+ mHeadsUp = null;
+ }
+
+ public NotificationData.Entry getEntry() {
+ return mHeadsUp;
+ }
+
public boolean isClearable() {
return mHeadsUp == null || mHeadsUp.notification.isClearable();
}
@@ -125,7 +164,7 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
if (mHeadsUp != null) {
// whoops, we're on already!
- setNotification(mHeadsUp);
+ showNotification(mHeadsUp);
}
getViewTreeObserver().addOnComputeInternalInsetsListener(this);
@@ -282,6 +321,10 @@ public class HeadsUpNotificationView extends FrameLayout implements SwipeHelper.
mTmpTwoArray[1] + mContentHolder.getHeight());
}
+ public void escalate() {
+ mBar.scheduleHeadsUpEscalation();
+ }
+
private class EdgeSwipeHelper implements Gefingerpoken {
private static final boolean DEBUG_EDGE_SWIPE = false;
private final float mTouchSlop;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
index dc8f315..1f68860 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java
@@ -30,7 +30,7 @@ public interface NetworkController {
void onMobileDataSignalChanged(boolean enabled, int mobileSignalIconId,
String mobileSignalContentDescriptionId, int dataTypeIconId,
boolean activityIn, boolean activityOut,
- String dataTypeContentDescriptionId, String description);
+ String dataTypeContentDescriptionId, String description, boolean noSim);
void onAirplaneModeChanged(boolean enabled);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index bf908fe..4e54e41 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -88,6 +88,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
int mQSDataTypeIconId;
int mAirplaneIconId;
boolean mDataActive;
+ boolean mNoSim;
int mLastSignalLevel;
boolean mShowPhoneRSSIForData = false;
boolean mShowAtLeastThreeGees = false;
@@ -350,18 +351,18 @@ public class NetworkControllerImpl extends BroadcastReceiver
if (isEmergencyOnly()) {
cb.onMobileDataSignalChanged(false, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, null);
+ mContentDescriptionDataType, null, mNoSim);
} else {
if (mIsWimaxEnabled && mWimaxConnected) {
// Wimax is special
cb.onMobileDataSignalChanged(true, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, mNetworkName);
+ mContentDescriptionDataType, mNetworkName, mNoSim);
} else {
// Normal mobile data
cb.onMobileDataSignalChanged(mHasMobileDataFeature, mQSPhoneSignalIconId,
mContentDescriptionPhoneSignal, mQSDataTypeIconId, mobileIn, mobileOut,
- mContentDescriptionDataType, mNetworkName);
+ mContentDescriptionDataType, mNetworkName, mNoSim);
}
}
cb.onAirplaneModeChanged(mAirplaneMode);
@@ -737,6 +738,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
// GSM case, we have to check also the sim state
if (mSimState == IccCardConstants.State.READY ||
mSimState == IccCardConstants.State.UNKNOWN) {
+ mNoSim = false;
if (hasService() && mDataState == TelephonyManager.DATA_CONNECTED) {
switch (mDataActivity) {
case TelephonyManager.DATA_ACTIVITY_IN:
@@ -759,6 +761,7 @@ public class NetworkControllerImpl extends BroadcastReceiver
}
} else {
iconId = R.drawable.stat_sys_no_sim;
+ mNoSim = true;
visible = false; // no SIM? no data
}
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
index b21e12c..6d92b05 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.stack;
import android.view.View;
+import com.android.systemui.statusbar.ActivatableNotificationView;
import java.util.ArrayList;
@@ -27,7 +28,7 @@ public class AmbientState {
private ArrayList<View> mDraggedViews = new ArrayList<View>();
private int mScrollY;
private boolean mDimmed;
- private View mActivatedChild;
+ private ActivatableNotificationView mActivatedChild;
private float mOverScrollTopAmount;
private float mOverScrollBottomAmount;
private int mSpeedBumpIndex = -1;
@@ -64,7 +65,7 @@ public class AmbientState {
* In dimmed mode, a child can be activated, which happens on the first tap of the double-tap
* interaction. This child is then scaled normally and its background is fully opaque.
*/
- public void setActivatedChild(View activatedChild) {
+ public void setActivatedChild(ActivatableNotificationView activatedChild) {
mActivatedChild = activatedChild;
}
@@ -72,7 +73,7 @@ public class AmbientState {
return mDimmed;
}
- public View getActivatedChild() {
+ public ActivatableNotificationView getActivatedChild() {
return mActivatedChild;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 20caed8..94472a3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -33,6 +33,7 @@ import android.widget.OverScroller;
import com.android.systemui.ExpandHelper;
import com.android.systemui.R;
import com.android.systemui.SwipeHelper;
+import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
import com.android.systemui.statusbar.ExpandableView;
import com.android.systemui.statusbar.SpeedBumpView;
@@ -1722,7 +1723,6 @@ public class NotificationStackScrollLayout extends ViewGroup
mStackScrollAlgorithm.setIsExpanded(isExpanded);
if (!isExpanded) {
mOwnScrollY = 0;
- mSpeedBumpView.collapse();
}
}
@@ -1760,7 +1760,7 @@ public class NotificationStackScrollLayout extends ViewGroup
/**
* See {@link AmbientState#setActivatedChild}.
*/
- public void setActivatedChild(View activatedChild) {
+ public void setActivatedChild(ActivatableNotificationView activatedChild) {
mAmbientState.setActivatedChild(activatedChild);
if (mAnimationsEnabled) {
mActivateNeedsAnimation = true;
@@ -1769,7 +1769,7 @@ public class NotificationStackScrollLayout extends ViewGroup
requestChildrenUpdate();
}
- public View getActivatedChild() {
+ public ActivatableNotificationView getActivatedChild() {
return mAmbientState.getActivatedChild();
}
@@ -1791,7 +1791,6 @@ public class NotificationStackScrollLayout extends ViewGroup
int newVisibility = visible ? VISIBLE : GONE;
mSpeedBumpView.setVisibility(newVisibility);
if (visible) {
- mSpeedBumpView.collapse();
// Make invisible to ensure that the appear animation is played.
mSpeedBumpView.setInvisible();
if (!mIsExpansionChanging) {
@@ -1835,6 +1834,11 @@ public class NotificationStackScrollLayout extends ViewGroup
return super.dispatchTouchEvent(ev);
}
+ @Override
+ public boolean shouldDelayChildPressedState() {
+ return true;
+ }
+
/**
* A listener that is notified when some child locations might have changed.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
index b41f87b..d6ff4fc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
@@ -662,7 +662,7 @@ public class StackScrollAlgorithm {
} else {
// We are expanding the shade, expand it to its full height.
- if (mFirstChildWhileExpanding.getWidth() == 0) {
+ if (!isMaxSizeInitialized(mFirstChildWhileExpanding)) {
// This child was not layouted yet, wait for a layout pass
mFirstChildWhileExpanding
@@ -689,6 +689,14 @@ public class StackScrollAlgorithm {
}
}
+ private boolean isMaxSizeInitialized(ExpandableView child) {
+ if (child instanceof ExpandableNotificationRow) {
+ ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ return row.isShowingLayoutLayouted();
+ }
+ return child == null || child.getWidth() != 0;
+ }
+
private View findFirstVisibleChild(ViewGroup container) {
int childCount = container.getChildCount();
for (int i = 0; i < childCount; i++) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
index 94cb16d..1ad4acc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
@@ -160,9 +160,8 @@ public class StackScrollState {
}
if(child instanceof SpeedBumpView) {
- float speedBumpEnd = newYTranslation + newHeight;
- performSpeedBumpAnimation(i, (SpeedBumpView) child, speedBumpEnd,
- newYTranslation);
+ float lineEnd = newYTranslation + newHeight / 2;
+ performSpeedBumpAnimation(i, (SpeedBumpView) child, lineEnd);
}
}
}
@@ -183,20 +182,12 @@ public class StackScrollState {
child.setClipBounds(mClipRect);
}
- private void performSpeedBumpAnimation(int i, SpeedBumpView speedBump, float speedBumpEnd,
- float speedBumpStart) {
+ private void performSpeedBumpAnimation(int i, SpeedBumpView speedBump, float speedBumpEnd) {
View nextChild = getNextChildNotGone(i);
if (nextChild != null) {
ViewState nextState = getViewStateForView(nextChild);
- boolean startIsAboveNext = nextState.yTranslation > speedBumpStart;
+ boolean startIsAboveNext = nextState.yTranslation > speedBumpEnd;
speedBump.animateDivider(startIsAboveNext, null /* onFinishedRunnable */);
-
- // handle expanded case
- if (speedBump.isExpanded()) {
- boolean endIsAboveNext = nextState.yTranslation > speedBumpEnd;
- speedBump.animateExplanationText(endIsAboveNext);
- }
-
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index faea8de..9260aac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -17,14 +17,14 @@
package com.android.systemui.statusbar.tv;
import android.os.IBinder;
-import android.service.notification.NotificationListenerService;
-import android.service.notification.NotificationListenerService.Ranking;
+import android.service.notification.NotificationListenerService.RankingMap;
import android.service.notification.StatusBarNotification;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
import com.android.internal.statusbar.StatusBarIcon;
+import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.BaseStatusBar;
/*
@@ -51,11 +51,11 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
- public void addNotificationInternal(StatusBarNotification notification, Ranking ranking) {
+ public void addNotificationInternal(StatusBarNotification notification, RankingMap ranking) {
}
@Override
- protected void updateRankingInternal(Ranking ranking) {
+ protected void updateRankingInternal(RankingMap ranking) {
}
@Override
@@ -63,7 +63,7 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
- public void removeNotificationInternal(String key, Ranking ranking) {
+ public void removeNotificationInternal(String key, RankingMap ranking) {
}
@Override
@@ -147,6 +147,18 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
+ public void scheduleHeadsUpOpen() {
+ }
+
+ @Override
+ public void scheduleHeadsUpEscalation() {
+ }
+
+ @Override
+ public void scheduleHeadsUpClose() {
+ }
+
+ @Override
protected int getMaxKeyguardNotifications() {
return 0;
}
@@ -164,10 +176,10 @@ public class TvStatusBar extends BaseStatusBar {
}
@Override
- public void onActivated(View view) {
+ public void onActivated(ActivatableNotificationView view) {
}
@Override
- public void onActivationReset(View view) {
+ public void onActivationReset(ActivatableNotificationView view) {
}
}
diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
index eca1bc1..faa0c57 100644
--- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1640,6 +1640,17 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
pw.println("}]");
pw.println();
}
+ final int windowCount = mSecurityPolicy.mWindows.size();
+ for (int j = 0; j < windowCount; j++) {
+ if (j > 0) {
+ pw.append(',');
+ pw.println();
+ }
+ pw.append("Window[");
+ AccessibilityWindowInfo window = mSecurityPolicy.mWindows.get(j);
+ pw.append(window.toString());
+ pw.append(']');
+ }
}
}
@@ -3283,7 +3294,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
}
if (mTouchInteractionInProgress && activeWindowGone) {
- mActiveWindowId = INVALID_WINDOW_ID;
+ mActiveWindowId = mFocusedWindowId;
}
// Focused window may change the active one, so set the
@@ -3336,10 +3347,11 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
// The active window also determined events from which
// windows are delivered.
synchronized (mLock) {
- mFocusedWindowId = getFocusedWindowId();
- if (mWindowsForAccessibilityCallback == null
- && windowId == mFocusedWindowId) {
- mActiveWindowId = windowId;
+ if (mWindowsForAccessibilityCallback == null) {
+ mFocusedWindowId = getFocusedWindowId();
+ if (windowId == mFocusedWindowId) {
+ mActiveWindowId = windowId;
+ }
}
}
} break;
diff --git a/services/core/java/com/android/server/BatteryService.java b/services/core/java/com/android/server/BatteryService.java
index fe5c2ef..aeb195f 100644
--- a/services/core/java/com/android/server/BatteryService.java
+++ b/services/core/java/com/android/server/BatteryService.java
@@ -16,6 +16,7 @@
package com.android.server;
+import android.database.ContentObserver;
import android.os.BatteryStats;
import com.android.internal.app.IBatteryStats;
import com.android.server.am.BatteryStatsService;
@@ -149,8 +150,8 @@ public final class BatteryService extends Binder {
com.android.internal.R.integer.config_criticalBatteryWarningLevel);
mLowBatteryWarningLevel = mContext.getResources().getInteger(
com.android.internal.R.integer.config_lowBatteryWarningLevel);
- mLowBatteryCloseWarningLevel = mContext.getResources().getInteger(
- com.android.internal.R.integer.config_lowBatteryCloseWarningLevel);
+ mLowBatteryCloseWarningLevel = mLowBatteryWarningLevel + mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryCloseWarningBump);
mShutdownBatteryTemperature = mContext.getResources().getInteger(
com.android.internal.R.integer.config_shutdownBatteryTemperature);
@@ -173,9 +174,37 @@ public final class BatteryService extends Binder {
void systemReady() {
// check our power situation now that it is safe to display the shutdown dialog.
synchronized (mLock) {
- shutdownIfNoPowerLocked();
- shutdownIfOverTempLocked();
+ ContentObserver obs = new ContentObserver(mHandler) {
+ @Override
+ public void onChange(boolean selfChange) {
+ synchronized (mLock) {
+ updateBatteryWarningLevelLocked();
+ }
+ }
+ };
+ final ContentResolver resolver = mContext.getContentResolver();
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
+ false, obs, UserHandle.USER_ALL);
+ updateBatteryWarningLevelLocked();
+ }
+ }
+
+ void updateBatteryWarningLevelLocked() {
+ final ContentResolver resolver = mContext.getContentResolver();
+ int defWarnLevel = mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryWarningLevel);
+ mLowBatteryWarningLevel = Settings.Global.getInt(resolver,
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, defWarnLevel);
+ if (mLowBatteryWarningLevel == 0) {
+ mLowBatteryWarningLevel = defWarnLevel;
+ }
+ if (mLowBatteryWarningLevel < mCriticalBatteryLevel) {
+ mLowBatteryWarningLevel = mCriticalBatteryLevel;
}
+ mLowBatteryCloseWarningLevel = mLowBatteryWarningLevel + mContext.getResources().getInteger(
+ com.android.internal.R.integer.config_lowBatteryCloseWarningBump);
+ processValuesLocked(true);
}
/**
@@ -232,7 +261,7 @@ public final class BatteryService extends Binder {
}
}
- public boolean isBatteryLowLocked() {
+ public boolean shouldSendBatteryLowLocked() {
final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE;
final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE;
@@ -299,14 +328,14 @@ public final class BatteryService extends Binder {
if (!mUpdatesStopped) {
mBatteryProps = props;
// Process the new values.
- processValuesLocked();
+ processValuesLocked(false);
} else {
mLastBatteryProps.set(props);
}
}
}
- private void processValuesLocked() {
+ private void processValuesLocked(boolean force) {
boolean logOutlier = false;
long dischargeDuration = 0;
@@ -349,14 +378,14 @@ public final class BatteryService extends Binder {
shutdownIfNoPowerLocked();
shutdownIfOverTempLocked();
- if (mBatteryProps.batteryStatus != mLastBatteryStatus ||
+ if (force || (mBatteryProps.batteryStatus != mLastBatteryStatus ||
mBatteryProps.batteryHealth != mLastBatteryHealth ||
mBatteryProps.batteryPresent != mLastBatteryPresent ||
mBatteryProps.batteryLevel != mLastBatteryLevel ||
mPlugType != mLastPlugType ||
mBatteryProps.batteryVoltage != mLastBatteryVoltage ||
mBatteryProps.batteryTemperature != mLastBatteryTemperature ||
- mInvalidCharger != mLastInvalidCharger) {
+ mInvalidCharger != mLastInvalidCharger)) {
if (mPlugType != mLastPlugType) {
if (mLastPlugType == BATTERY_PLUGGED_NONE) {
@@ -400,7 +429,24 @@ public final class BatteryService extends Binder {
logOutlier = true;
}
- mBatteryLevelLow = isBatteryLowLocked();
+ if (!mBatteryLevelLow) {
+ // Should we now switch in to low battery mode?
+ if (mPlugType == BATTERY_PLUGGED_NONE
+ && mBatteryProps.batteryLevel <= mLowBatteryWarningLevel) {
+ mBatteryLevelLow = true;
+ }
+ } else {
+ // Should we now switch out of low battery mode?
+ if (mPlugType != BATTERY_PLUGGED_NONE) {
+ mBatteryLevelLow = false;
+ } else if (mBatteryProps.batteryLevel >= mLowBatteryCloseWarningLevel) {
+ mBatteryLevelLow = false;
+ } else if (force && mBatteryProps.batteryLevel >= mLowBatteryWarningLevel) {
+ // If being forced, the previous state doesn't matter, we will just
+ // absolutely check to see if we are now above the warning level.
+ mBatteryLevelLow = false;
+ }
+ }
sendIntentLocked();
@@ -428,7 +474,7 @@ public final class BatteryService extends Binder {
});
}
- if (mBatteryLevelLow) {
+ if (shouldSendBatteryLowLocked()) {
mSentLowBatteryBroadcast = true;
mHandler.post(new Runnable() {
@Override
@@ -650,7 +696,7 @@ public final class BatteryService extends Binder {
long ident = Binder.clearCallingIdentity();
try {
mUpdatesStopped = true;
- processValuesLocked();
+ processValuesLocked(false);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -664,7 +710,7 @@ public final class BatteryService extends Binder {
if (mUpdatesStopped) {
mUpdatesStopped = false;
mBatteryProps.set(mLastBatteryProps);
- processValuesLocked();
+ processValuesLocked(false);
}
} finally {
Binder.restoreCallingIdentity(ident);
diff --git a/services/core/java/com/android/server/MountServiceIdler.java b/services/core/java/com/android/server/MountServiceIdler.java
index 6179082..bcb6e9e 100644
--- a/services/core/java/com/android/server/MountServiceIdler.java
+++ b/services/core/java/com/android/server/MountServiceIdler.java
@@ -18,32 +18,32 @@ package com.android.server;
import java.util.Calendar;
-import android.app.task.Task;
-import android.app.task.TaskManager;
-import android.app.task.TaskParams;
-import android.app.task.TaskService;
+import android.app.job.JobInfo;
+import android.app.job.JobParameters;
+import android.app.job.JobScheduler;
+import android.app.job.JobService;
import android.content.ComponentName;
import android.content.Context;
import android.util.Slog;
-public class MountServiceIdler extends TaskService {
+public class MountServiceIdler extends JobService {
private static final String TAG = "MountServiceIdler";
private static ComponentName sIdleService =
new ComponentName(MountServiceIdler.class.getPackage().getName(),
MountServiceIdler.class.getName());
- private static int MOUNT_TASK_ID = 808;
+ private static int MOUNT_JOB_ID = 808;
private boolean mStarted;
- private TaskParams mTaskParams;
+ private JobParameters mJobParams;
private Runnable mFinishCallback = new Runnable() {
@Override
public void run() {
Slog.i(TAG, "Got mount service completion callback");
synchronized (mFinishCallback) {
if (mStarted) {
- taskFinished(mTaskParams, false);
+ jobFinished(mJobParams, false);
mStarted = false;
}
}
@@ -53,12 +53,12 @@ public class MountServiceIdler extends TaskService {
};
@Override
- public boolean onStartTask(TaskParams params) {
+ public boolean onStartJob(JobParameters params) {
// The mount service will run an fstrim operation asynchronously
// on a designated separate thread, so we provide it with a callback
// that lets us cleanly end our idle timeslice. It's safe to call
// finishIdle() from any thread.
- mTaskParams = params;
+ mJobParams = params;
MountService ms = MountService.sSelf;
if (ms != null) {
synchronized (mFinishCallback) {
@@ -70,9 +70,9 @@ public class MountServiceIdler extends TaskService {
}
@Override
- public boolean onStopTask(TaskParams params) {
+ public boolean onStopJob(JobParameters params) {
// Once we kick off the fstrim we aren't actually interruptible; just note
- // that we don't need to call taskFinished(), and let everything happen in
+ // that we don't need to call jobFinished(), and let everything happen in
// the callback from the mount service.
synchronized (mFinishCallback) {
mStarted = false;
@@ -84,12 +84,12 @@ public class MountServiceIdler extends TaskService {
* Schedule the idle job that will ping the mount service
*/
public static void scheduleIdlePass(Context context) {
- TaskManager tm = (TaskManager) context.getSystemService(Context.TASK_SERVICE);
+ JobScheduler tm = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE);
Calendar calendar = tomorrowMidnight();
final long timeToMidnight = calendar.getTimeInMillis() - System.currentTimeMillis();
- Task.Builder builder = new Task.Builder(MOUNT_TASK_ID, sIdleService);
+ JobInfo.Builder builder = new JobInfo.Builder(MOUNT_JOB_ID, sIdleService);
builder.setRequiresDeviceIdle(true);
builder.setRequiresCharging(true);
builder.setMinimumLatency(timeToMidnight);
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 32722bc..11f855e 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -906,6 +906,9 @@ final class ActivityRecord {
}
startTime = 0;
finishLaunchTickingLocked();
+ if (task != null) {
+ task.hasBeenVisible = true;
+ }
}
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 39800f2..03ce530 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -32,12 +32,12 @@ import static com.android.server.am.ActivityManagerService.VALIDATE_TOKENS;
import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE;
import static com.android.server.am.ActivityStackSupervisor.DEBUG_APP;
+import static com.android.server.am.ActivityStackSupervisor.DEBUG_CONTAINERS;
import static com.android.server.am.ActivityStackSupervisor.DEBUG_SAVED_STATE;
import static com.android.server.am.ActivityStackSupervisor.DEBUG_SCREENSHOTS;
import static com.android.server.am.ActivityStackSupervisor.DEBUG_STATES;
import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
-import android.service.voice.IVoiceInteractionSession;
import com.android.internal.app.IVoiceInteractor;
import com.android.internal.os.BatteryStatsImpl;
import com.android.server.Watchdog;
@@ -74,6 +74,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserHandle;
+import android.service.voice.IVoiceInteractionSession;
import android.util.EventLog;
import android.util.Slog;
import android.view.Display;
@@ -1405,7 +1406,7 @@ final class ActivityStack {
ActivityRecord parent = mActivityContainer.mParentActivity;
if ((parent != null && parent.state != ActivityState.RESUMED) ||
- !mActivityContainer.isAttached()) {
+ !mActivityContainer.isAttachedLocked()) {
// Do not resume this stack if its parent is not resumed.
// TODO: If in a loop, make sure that parent stack resumeTopActivity is called 1st.
return false;
@@ -2677,11 +2678,14 @@ final class ActivityStack {
|| prevState == ActivityState.INITIALIZING) {
// If this activity is already stopped, we can just finish
// it right now.
- boolean activityRemoved = destroyActivityLocked(r, true,
- oomAdj, "finish-imm");
+ r.makeFinishing();
+ boolean activityRemoved = destroyActivityLocked(r, true, oomAdj, "finish-imm");
if (activityRemoved) {
mStackSupervisor.resumeTopActivitiesLocked();
}
+ if (DEBUG_CONTAINERS) Slog.d(TAG,
+ "destroyActivityLocked: finishCurrentActivityLocked r=" + r +
+ " destroy returned removed=" + activityRemoved);
return activityRemoved ? null : r;
}
@@ -3044,6 +3048,7 @@ final class ActivityStack {
if (r != null) {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
}
+ if (DEBUG_CONTAINERS) Slog.d(TAG, "activityDestroyedLocked: r=" + r);
if (isInStackLocked(token) != null) {
if (r.state == ActivityState.DESTROYING) {
@@ -3803,7 +3808,7 @@ final class ActivityStack {
mStacks.remove(this);
mStacks.add(0, this);
}
- mActivityContainer.onTaskListEmpty();
+ mActivityContainer.onTaskListEmptyLocked();
}
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index dcdc610..545a9f7 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -111,6 +111,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
static final boolean DEBUG_STATES = DEBUG || false;
static final boolean DEBUG_IDLE = DEBUG || false;
static final boolean DEBUG_SCREENSHOTS = DEBUG || false;
+ static final boolean DEBUG_CONTAINERS = DEBUG || false;
public static final int HOME_STACK_ID = 0;
@@ -135,6 +136,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
static final int LOCK_TASK_START_MSG = FIRST_SUPERVISOR_STACK_MSG + 9;
static final int LOCK_TASK_END_MSG = FIRST_SUPERVISOR_STACK_MSG + 10;
static final int CONTAINER_CALLBACK_TASK_LIST_EMPTY = FIRST_SUPERVISOR_STACK_MSG + 11;
+ static final int CONTAINER_TASK_LIST_EMPTY_TIMEOUT = FIRST_SUPERVISOR_STACK_MSG + 12;
private final static String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay";
@@ -239,7 +241,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// TODO: Add listener for removal of references.
/** Mapping from (ActivityStack/TaskStack).mStackId to their current state */
- SparseArray<ActivityContainer> mActivityContainers = new SparseArray<ActivityContainer>();
+ private SparseArray<ActivityContainer> mActivityContainers = new SparseArray<ActivityContainer>();
/** Mapping from displayId to display current state */
private final SparseArray<ActivityDisplay> mActivityDisplays =
@@ -2255,8 +2257,10 @@ public final class ActivityStackSupervisor implements DisplayListener {
ActivityContainer createActivityContainer(ActivityRecord parentActivity,
IActivityContainerCallback callback) {
- ActivityContainer activityContainer = new VirtualActivityContainer(parentActivity, callback);
+ ActivityContainer activityContainer =
+ new VirtualActivityContainer(parentActivity, callback);
mActivityContainers.put(activityContainer.mStackId, activityContainer);
+ if (DEBUG_CONTAINERS) Slog.d(TAG, "createActivityContainer: " + activityContainer);
parentActivity.mChildContainers.add(activityContainer);
return activityContainer;
}
@@ -2265,6 +2269,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
final ArrayList<ActivityContainer> childStacks = parentActivity.mChildContainers;
for (int containerNdx = childStacks.size() - 1; containerNdx >= 0; --containerNdx) {
ActivityContainer container = childStacks.remove(containerNdx);
+ if (DEBUG_CONTAINERS) Slog.d(TAG, "removeChildActivityContainers: removing " +
+ container);
container.release();
}
}
@@ -2272,11 +2278,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
void deleteActivityContainer(IActivityContainer container) {
ActivityContainer activityContainer = (ActivityContainer)container;
if (activityContainer != null) {
- activityContainer.mStack.finishAllActivitiesLocked();
- final ActivityRecord parent = activityContainer.mParentActivity;
- if (parent != null) {
- parent.mChildContainers.remove(activityContainer);
- }
+ if (DEBUG_CONTAINERS) Slog.d(TAG, "deleteActivityContainer: ",
+ new RuntimeException("here").fillInStackTrace());
final int stackId = activityContainer.mStackId;
mActivityContainers.remove(stackId);
mWindowManager.removeStack(stackId);
@@ -3128,13 +3131,20 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
} break;
+ case CONTAINER_TASK_LIST_EMPTY_TIMEOUT: {
+ synchronized (mService) {
+ Slog.w(TAG, "Timeout waiting for all activities in task to finish. " +
+ msg.obj);
+ ((ActivityContainer) msg.obj).onTaskListEmptyLocked();
+ }
+ } break;
}
}
}
class ActivityContainer extends android.app.IActivityContainer.Stub {
final static int FORCE_NEW_TASK_FLAGS = Intent.FLAG_ACTIVITY_NEW_TASK |
- Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
+ Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION;
final int mStackId;
IActivityContainerCallback mCallback = null;
final ActivityStack mStack;
@@ -3184,8 +3194,10 @@ public final class ActivityStackSupervisor implements DisplayListener {
@Override
public int getDisplayId() {
- if (mActivityDisplay != null) {
- return mActivityDisplay.mDisplayId;
+ synchronized (mService) {
+ if (mActivityDisplay != null) {
+ return mActivityDisplay.mDisplayId;
+ }
}
return -1;
}
@@ -3194,10 +3206,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
public boolean injectEvent(InputEvent event) {
final long origId = Binder.clearCallingIdentity();
try {
- if (mActivityDisplay != null) {
- return mInputManagerInternal.injectInputEvent(event,
- mActivityDisplay.mDisplayId,
- InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
+ synchronized (mService) {
+ if (mActivityDisplay != null) {
+ return mInputManagerInternal.injectInputEvent(event,
+ mActivityDisplay.mDisplayId,
+ InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
+ }
}
return false;
} finally {
@@ -3207,10 +3221,16 @@ public final class ActivityStackSupervisor implements DisplayListener {
@Override
public void release() {
- mContainerState = CONTAINER_STATE_FINISHING;
- mStack.finishAllActivitiesLocked();
- detachLocked();
- mWindowManager.removeStack(mStackId);
+ synchronized (mService) {
+ if (mContainerState == CONTAINER_STATE_FINISHING) {
+ return;
+ }
+ mContainerState = CONTAINER_STATE_FINISHING;
+ final Message msg =
+ mHandler.obtainMessage(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
+ mHandler.sendMessageDelayed(msg, 1000);
+ mStack.finishAllActivitiesLocked();
+ }
}
private void detachLocked() {
@@ -3301,15 +3321,17 @@ public final class ActivityStackSupervisor implements DisplayListener {
return ActivityStackSupervisor.this;
}
- boolean isAttached() {
+ boolean isAttachedLocked() {
return mActivityDisplay != null;
}
void getBounds(Point outBounds) {
- if (mActivityDisplay != null) {
- mActivityDisplay.getBounds(outBounds);
- } else {
- outBounds.set(0, 0);
+ synchronized (mService) {
+ if (mActivityDisplay != null) {
+ mActivityDisplay.getBounds(outBounds);
+ } else {
+ outBounds.set(0, 0);
+ }
}
}
@@ -3332,7 +3354,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
return true;
}
- void onTaskListEmpty() {
+ void onTaskListEmptyLocked() {
+ mHandler.removeMessages(CONTAINER_TASK_LIST_EMPTY_TIMEOUT, this);
+ if (!mStack.isHomeStack()) {
+ detachLocked();
+ deleteActivityContainer(this);
+ }
mHandler.obtainMessage(CONTAINER_CALLBACK_TASK_LIST_EMPTY, this).sendToTarget();
}
@@ -3351,7 +3378,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
mParentActivity = parent;
mCallback = callback;
mContainerState = CONTAINER_STATE_NO_SURFACE;
- mIdString = "VirtualActivtyContainer{" + mStackId + ", parent=" + mParentActivity + "}";
+ mIdString = "VirtualActivityContainer{" + mStackId + ", parent=" + mParentActivity + "}";
}
@Override
@@ -3397,22 +3424,22 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
- setSurfaceIfReady();
+ setSurfaceIfReadyLocked();
if (DEBUG_STACK) Slog.d(TAG, "setSurface: " + this + " to display="
+ virtualActivityDisplay);
}
@Override
- boolean isAttached() {
- return mSurface != null && super.isAttached();
+ boolean isAttachedLocked() {
+ return mSurface != null && super.isAttachedLocked();
}
@Override
void setDrawn() {
synchronized (mService) {
mDrawn = true;
- setSurfaceIfReady();
+ setSurfaceIfReadyLocked();
}
}
@@ -3422,8 +3449,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
return false;
}
- private void setSurfaceIfReady() {
- if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReady: mDrawn=" + mDrawn +
+ private void setSurfaceIfReadyLocked() {
+ if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn +
" mContainerState=" + mContainerState + " mSurface=" + mSurface);
if (mDrawn && mSurface != null && mContainerState == CONTAINER_STATE_NO_SURFACE) {
((VirtualActivityDisplay) mActivityDisplay).setSurface(mSurface);
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 79e2d9d..81a0b36 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -73,6 +73,7 @@ final class TaskRecord extends ThumbnailHolder {
boolean rootWasReset; // True if the intent at the root of the task had
// the FLAG_ACTIVITY_RESET_TASK_IF_NEEDED flag.
boolean askedCompatMode;// Have asked the user about compat mode for this task.
+ boolean hasBeenVisible; // Set if any activities in the task have been visible to the user.
String stringName; // caching of toString() result.
int userId; // user for which this task was created
@@ -328,8 +329,12 @@ final class TaskRecord extends ThumbnailHolder {
}
boolean autoRemoveFromRecents() {
- return intent != null &&
- (intent.getFlags() & Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS) != 0;
+ // We will automatically remove the task either if it has explicitly asked for
+ // this, or it is empty and has never contained an activity that got shown to
+ // the user.
+ return (intent != null &&
+ (intent.getFlags() & Intent.FLAG_ACTIVITY_AUTO_REMOVE_FROM_RECENTS) != 0) ||
+ (mActivities.isEmpty() && !hasBeenVisible);
}
/**
@@ -800,7 +805,8 @@ final class TaskRecord extends ThumbnailHolder {
}
pw.print(prefix); pw.print("lastThumbnail="); pw.print(lastThumbnail);
pw.print(" lastDescription="); pw.println(lastDescription);
- pw.print(prefix); pw.print("lastActiveTime="); pw.print(lastActiveTime);
+ pw.print(prefix); pw.print("hasBeenVisible="); pw.print(hasBeenVisible);
+ pw.print(" lastActiveTime="); pw.print(lastActiveTime);
pw.print(" (inactive for ");
pw.print((getInactiveDuration()/1000)); pw.println("s)");
}
diff --git a/services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java b/services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java
index 6f42c8b..d36fc2c 100644
--- a/services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java
+++ b/services/core/java/com/android/server/hdmi/DeviceDiscoveryAction.java
@@ -259,7 +259,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
byte params[] = cmd.getParams();
if (params.length == 3) {
- current.mPhysicalAddress = ((params[0] & 0xFF) << 8) | (params[1] & 0xFF);
+ current.mPhysicalAddress = HdmiUtils.twoBytesToInt(params);
current.mDeviceType = params[2] & 0xFF;
increaseProcessedDeviceCount();
@@ -307,9 +307,7 @@ final class DeviceDiscoveryAction extends FeatureAction {
byte[] params = cmd.getParams();
if (params.length == 3) {
- int vendorId = ((params[0] & 0xFF) << 16)
- | ((params[1] & 0xFF) << 8)
- | (params[2] & 0xFF);
+ int vendorId = HdmiUtils.threeBytesToInt(params);
current.mVendorId = vendorId;
} else {
Slog.w(TAG, "Invalid vendor id: " + cmd.toString());
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecController.java b/services/core/java/com/android/server/hdmi/HdmiCecController.java
index 5c420d7..f869424 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecController.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecController.java
@@ -387,6 +387,41 @@ final class HdmiCecController {
}
/**
+ * Pass a option to CEC HAL.
+ *
+ * @param flag a key of option. For more details, look at
+ * {@link HdmiConstants#FLAG_HDMI_OPTION_WAKEUP} to
+ * {@link HdmiConstants#FLAG_HDMI_OPTION_SYSTEM_CEC_CONTROL}
+ * @param value a value of option. Actual value varies flag. For more
+ * details, look at description of flags
+ */
+ void setOption(int flag, int value) {
+ assertRunOnServiceThread();
+ nativeSetOption(mNativePtr, flag, value);
+ }
+
+ /**
+ * Configure ARC circuit in the hardware logic to start or stop the feature.
+ *
+ * @param enabled whether to enable/disable ARC
+ */
+ void setAudioReturnChannel(boolean enabled) {
+ assertRunOnServiceThread();
+ nativeSetAudioReturnChannel(mNativePtr, enabled);
+ }
+
+ /**
+ * Return the connection status of the specified port
+ *
+ * @param port port number to check connection status
+ * @return true if connected; otherwise, return false
+ */
+ boolean isConnected(int port) {
+ assertRunOnServiceThread();
+ return nativeIsConnected(mNativePtr, port);
+ }
+
+ /**
* Poll all remote devices. It sends &lt;Polling Message&gt; to all remote
* devices.
*
@@ -606,4 +641,8 @@ final class HdmiCecController {
private static native int nativeGetPhysicalAddress(long controllerPtr);
private static native int nativeGetVersion(long controllerPtr);
private static native int nativeGetVendorId(long controllerPtr);
+ private static native void nativeSetOption(long controllerPtr, int flag, int value);
+ private static native void nativeSetAudioReturnChannel(long controllerPtr, boolean flag);
+ private static native boolean nativeIsConnected(long controllerPtr, int port);
+
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecKeycodeTranslator.java b/services/core/java/com/android/server/hdmi/HdmiCecKeycodeTranslator.java
new file mode 100644
index 0000000..ebb6f50
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/HdmiCecKeycodeTranslator.java
@@ -0,0 +1,349 @@
+/*
+ * 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.server.hdmi;
+
+import android.view.KeyEvent;
+
+/**
+ * Helper class to translate android keycode to hdmi cec keycode and vice versa.
+ */
+public class HdmiCecKeycodeTranslator {
+ public static final int UNSUPPORTED_KEYCODE = -1;
+ public static final int NO_PARAM = -1;
+
+ // =========================================================================
+ // Hdmi CEC keycodes
+ public static final int CEC_KEYCODE_SELECT = 0x00;
+ public static final int CEC_KEYCODE_UP = 0x01;
+ public static final int CEC_KEYCODE_DOWN = 0x02;
+ public static final int CEC_KEYCODE_LEFT = 0x03;
+ public static final int CEC_KEYCODE_RIGHT = 0x04;
+ public static final int CEC_KEYCODE_RIGHT_UP = 0x05;
+ public static final int CEC_KEYCODE_RIGHT_DOWN = 0x06;
+ public static final int CEC_KEYCODE_LEFT_UP = 0x07;
+ public static final int CEC_KEYCODE_LEFT_DOWN = 0x08;
+ public static final int CEC_KEYCODE_ROOT_MENU = 0x09;
+ public static final int CEC_KEYCODE_SETUP_MENU = 0x0A;
+ public static final int CEC_KEYCODE_CONTENTS_MENU = 0x0B;
+ public static final int CEC_KEYCODE_FAVORITE_MENU = 0x0C;
+ public static final int CEC_KEYCODE_EXIT = 0x0D;
+ // RESERVED = 0x0E - 0x0F
+ public static final int CEC_KEYCODE_MEDIA_TOP_MENU = 0x10;
+ public static final int CEC_KEYCODE_MEDIA_CONTEXT_SENSITIVE_MENU = 0x11;
+ // RESERVED = 0x12 – 0x1C
+ public static final int CEC_KEYCODE_NUMBER_ENTRY_MODE = 0x1D;
+ public static final int CEC_KEYCODE_NUMBER_11 = 0x1E;
+ public static final int CEC_KEYCODE_NUMBER_12 = 0x1F;
+ public static final int CEC_KEYCODE_NUMBER_0_OR_NUMBER_10 = 0x20;
+ public static final int CEC_KEYCODE_NUMBERS_1 = 0x21;
+ public static final int CEC_KEYCODE_NUMBERS_2 = 0x22;
+ public static final int CEC_KEYCODE_NUMBERS_3 = 0x23;
+ public static final int CEC_KEYCODE_NUMBERS_4 = 0x24;
+ public static final int CEC_KEYCODE_NUMBERS_5 = 0x25;
+ public static final int CEC_KEYCODE_NUMBERS_6 = 0x26;
+ public static final int CEC_KEYCODE_NUMBERS_7 = 0x27;
+ public static final int CEC_KEYCODE_NUMBERS_8 = 0x28;
+ public static final int CEC_KEYCODE_NUMBERS_9 = 0x29;
+ public static final int CEC_KEYCODE_DOT = 0x2A;
+ public static final int CEC_KEYCODE_ENTER = 0x2B;
+ public static final int CEC_KEYCODE_CLEAR = 0x2C;
+ // RESERVED = 0x2D - 0x2E
+ public static final int CEC_KEYCODE_NEXT_FAVORITE = 0x2F;
+ public static final int CEC_KEYCODE_CHANNEL_UP = 0x30;
+ public static final int CEC_KEYCODE_CHANNEL_DOWN = 0x31;
+ public static final int CEC_KEYCODE_PREVIOUS_CHANNEL = 0x32;
+ public static final int CEC_KEYCODE_SOUND_SELECT = 0x33;
+ public static final int CEC_KEYCODE_INPUT_SELECT = 0x34;
+ public static final int CEC_KEYCODE_DISPLAY_INFORMATION = 0x35;
+ public static final int CEC_KEYCODE_HELP = 0x36;
+ public static final int CEC_KEYCODE_PAGE_UP = 0x37;
+ public static final int CEC_KEYCODE_PAGE_DOWN = 0x38;
+ // RESERVED = 0x39 - 0x3F
+ public static final int CEC_KEYCODE_POWER = 0x40;
+ public static final int CEC_KEYCODE_VOLUME_UP = 0x41;
+ public static final int CEC_KEYCODE_VOLUME_DOWN = 0x42;
+ public static final int CEC_KEYCODE_MUTE = 0x43;
+ public static final int CEC_KEYCODE_PLAY = 0x44;
+ public static final int CEC_KEYCODE_STOP = 0x45;
+ public static final int CEC_KEYCODE_PAUSE = 0x46;
+ public static final int CEC_KEYCODE_RECORD = 0x47;
+ public static final int CEC_KEYCODE_REWIND = 0x48;
+ public static final int CEC_KEYCODE_FAST_FORWARD = 0x49;
+ public static final int CEC_KEYCODE_EJECT = 0x4A;
+ public static final int CEC_KEYCODE_FORWARD = 0x4B;
+ public static final int CEC_KEYCODE_BACKWARD = 0x4C;
+ public static final int CEC_KEYCODE_STOP_RECORD = 0x4D;
+ public static final int CEC_KEYCODE_PAUSE_RECORD = 0x4E;
+ public static final int CEC_KEYCODE_RESERVED = 0x4F;
+ public static final int CEC_KEYCODE_ANGLE = 0x50;
+ public static final int CEC_KEYCODE_SUB_PICTURE = 0x51;
+ public static final int CEC_KEYCODE_VIDEO_ON_DEMAND = 0x52;
+ public static final int CEC_KEYCODE_ELECTRONIC_PROGRAM_GUIDE = 0x53;
+ public static final int CEC_KEYCODE_TIMER_PROGRAMMING = 0x54;
+ public static final int CEC_KEYCODE_INITIAL_CONFIGURATION = 0x55;
+ public static final int CEC_KEYCODE_SELECT_BROADCAST_TYPE = 0x56;
+ public static final int CEC_KEYCODE_SELECT_SOUND_PRESENTATION = 0x57;
+ // RESERVED = 0x58-0x5F
+ public static final int CEC_KEYCODE_PLAY_FUNCTION = 0x60;
+ public static final int CEC_KEYCODE_PAUSE_PLAY_FUNCTION = 0x61;
+ public static final int CEC_KEYCODE_RECORD_FUNCTION = 0x62;
+ public static final int CEC_KEYCODE_PAUSE_RECORD_FUNCTION = 0x63;
+ public static final int CEC_KEYCODE_STOP_FUNCTION = 0x64;
+ public static final int CEC_KEYCODE_MUTE_FUNCTION = 0x65;
+ public static final int CEC_KEYCODE_RESTORE_VOLUME_FUNCTION = 0x66;
+ public static final int CEC_KEYCODE_TUNE_FUNCTION = 0x67;
+ public static final int CEC_KEYCODE_SELECT_MEDIA_FUNCTION = 0x68;
+ public static final int CEC_KEYCODE_SELECT_AV_INPUT_FUNCTION = 0x69;
+ public static final int CEC_KEYCODE_SELECT_AUDIO_INPUT_FUNCTION = 0x6A;
+ public static final int CEC_KEYCODE_POWER_TOGGLE_FUNCTION = 0x6B;
+ public static final int CEC_KEYCODE_POWER_OFF_FUNCTION = 0x6C;
+ public static final int CEC_KEYCODE_POWER_ON_FUNCTION = 0x6D;
+ // RESERVED = 0x6E-0x70
+ public static final int CEC_KEYCODE_F1_BLUE = 0x71;
+ public static final int CEC_KEYCODE_F2_RED = 0x72;
+ public static final int CEC_KEYCODE_F3_GREEN = 0x73;
+ public static final int CEC_KEYCODE_F4_YELLOW = 0x74;
+ public static final int CEC_KEYCODE_F5 = 0x75;
+ public static final int CEC_KEYCODE_DATA = 0x76;
+ // RESERVED = 0x77-0xFF
+
+ // =========================================================================
+ // UI Broadcast Type
+ public static final int UI_BROADCAST_TOGGLE_ALL = 0x00;
+ public static final int UI_BROADCAST_TOGGLE_ANALOGUE_DIGITAL = 0x01;
+ public static final int UI_BROADCAST_ANALOGUE = 0x10;
+ public static final int UI_BROADCAST_ANALOGUE_TERRESTRIAL = 0x20;
+ public static final int UI_BROADCAST_ANALOGUE_CABLE = 0x30;
+ public static final int UI_BROADCAST_ANALOGUE_SATELLITE = 0x40;
+ public static final int UI_BROADCAST_DIGITAL = 0x50;
+ public static final int UI_BROADCAST_DIGITAL_TERRESTRIAL = 0x60;
+ public static final int UI_BROADCAST_DIGITAL_CABLE = 0x70;
+ public static final int UI_BROADCAST_DIGITAL_SATELLITE = 0x80;
+ public static final int UI_BROADCAST_DIGITAL_COMMNICATIONS_SATELLITE = 0x90;
+ public static final int UI_BROADCAST_DIGITAL_COMMNICATIONS_SATELLITE_2 = 0x91;
+ public static final int UI_BROADCAST_IP = 0xA0;
+
+ // =========================================================================
+ // UI Sound Presentation Control
+ public static final int UI_SOUND_PRESENTATION_SOUND_MIX_DUAL_MONO = 0x20;
+ public static final int UI_SOUND_PRESENTATION_SOUND_MIX_KARAOKE = 0x30;
+ public static final int UI_SOUND_PRESENTATION_SELECT_AUDIO_DOWN_MIX = 0x80;
+ public static final int UI_SOUND_PRESENTATION_SELECT_AUDIO_AUTO_REVERBERATION = 0x90;
+ public static final int UI_SOUND_PRESENTATION_SELECT_AUDIO_AUTO_EQUALIZER = 0xA0;
+ public static final int UI_SOUND_PRESENTATION_BASS_STEP_PLUS = 0xB1;
+ public static final int UI_SOUND_PRESENTATION_BASS_NEUTRAL = 0xB2;
+ public static final int UI_SOUND_PRESENTATION_BASS_STEP_MINUS = 0xB3;
+ public static final int UI_SOUND_PRESENTATION_TREBLE_STEP_PLUS = 0xC1;
+ public static final int UI_SOUND_PRESENTATION_TREBLE_NEUTRAL = 0xC2;
+ public static final int UI_SOUND_PRESENTATION_TREBLE_STEP_MINUS = 0xC3;
+
+ private HdmiCecKeycodeTranslator() {
+ }
+
+ /**
+ * A mapping between andorid and cec keycode.
+ *
+ * <p>Normal implementation of this looks like
+ * <pre>
+ * new KeycodeEntry(KeyEvent.KEYCODE_DPAD_CENTER, CEC_KEYCODE_SELECT);
+ * </pre>
+ * <p>However, some keys in CEC requires additional parameter.
+ * In order to use parameterized cec key, add unique android keycode (existing or custom)
+ * corresponding to a pair of cec keycode and and its param.
+ * <pre>
+ * new KeycodeEntry(CUSTOME_ANDORID_KEY_1, CEC_KEYCODE_SELECT_BROADCAST_TYPE,
+ * UI_BROADCAST_TOGGLE_ALL);
+ * new KeycodeEntry(CUSTOME_ANDORID_KEY_2, CEC_KEYCODE_SELECT_BROADCAST_TYPE,
+ * UI_BROADCAST_ANALOGUE);
+ * </pre>
+ */
+ private static class KeycodeEntry {
+ private final int mAndroidKeycode;
+ private final int mCecKeycode;
+ private final int mParam;
+
+ private KeycodeEntry(int androidKeycode, int cecKeycode, int param) {
+ this.mAndroidKeycode = androidKeycode;
+ this.mCecKeycode = cecKeycode;
+ this.mParam = param;
+ }
+
+ private KeycodeEntry(int androidKeycode, int cecKeycode) {
+ this(androidKeycode, cecKeycode, NO_PARAM);
+ }
+
+ private byte[] toCecKeycodeIfMatched(int androidKeycode) {
+ if (mAndroidKeycode == androidKeycode) {
+ if (mParam == NO_PARAM) {
+ return new byte[] {
+ (byte) (mCecKeycode & 0xFF)
+ };
+ } else {
+ return new byte[] {
+ (byte) (mCecKeycode & 0xFF),
+ (byte) (mParam & 0xFF)
+ };
+ }
+ } else {
+ return null;
+ }
+ }
+
+ private int toAndroidKeycodeIfMatched(int cecKeycode, int param) {
+ if (cecKeycode == mCecKeycode && mParam == param) {
+ return mAndroidKeycode;
+ } else {
+ return UNSUPPORTED_KEYCODE;
+ }
+ }
+ }
+
+ // Keycode entry container for all mappings.
+ // Note that order of entry is the same as above cec keycode definition.
+ private static final KeycodeEntry[] KEYCODE_ENTRIES = new KeycodeEntry[] {
+ new KeycodeEntry(KeyEvent.KEYCODE_DPAD_CENTER, CEC_KEYCODE_SELECT),
+ new KeycodeEntry(KeyEvent.KEYCODE_DPAD_UP, CEC_KEYCODE_UP),
+ new KeycodeEntry(KeyEvent.KEYCODE_DPAD_DOWN, CEC_KEYCODE_DOWN),
+ new KeycodeEntry(KeyEvent.KEYCODE_DPAD_LEFT, CEC_KEYCODE_LEFT),
+ new KeycodeEntry(KeyEvent.KEYCODE_DPAD_RIGHT, CEC_KEYCODE_RIGHT),
+ // No Android keycode defined for CEC_KEYCODE_RIGHT_UP
+ // No Android keycode defined for CEC_KEYCODE_RIGHT_DOWN
+ // No Android keycode defined for CEC_KEYCODE_LEFT_UP
+ // No Android keycode defined for CEC_KEYCODE_LEFT_DOWN
+ new KeycodeEntry(KeyEvent.KEYCODE_HOME, CEC_KEYCODE_ROOT_MENU),
+ new KeycodeEntry(KeyEvent.KEYCODE_SETTINGS, CEC_KEYCODE_SETUP_MENU),
+ new KeycodeEntry(KeyEvent.KEYCODE_MENU, CEC_KEYCODE_CONTENTS_MENU),
+ // No Android keycode defined for CEC_KEYCODE_FAVORITE_MENU
+ new KeycodeEntry(KeyEvent.KEYCODE_BACK, CEC_KEYCODE_EXIT),
+ // RESERVED
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_TOP_MENU, CEC_KEYCODE_MEDIA_TOP_MENU),
+ // No Android keycode defined for CEC_KEYCODE_MEDIA_CONTEXT_SENSITIVE_MENU
+ // RESERVED
+ // No Android keycode defined for CEC_KEYCODE_NUMBER_ENTRY_MODE
+ new KeycodeEntry(KeyEvent.KEYCODE_11, CEC_KEYCODE_NUMBER_11),
+ new KeycodeEntry(KeyEvent.KEYCODE_12, CEC_KEYCODE_NUMBER_12),
+ new KeycodeEntry(KeyEvent.KEYCODE_0, CEC_KEYCODE_NUMBER_0_OR_NUMBER_10),
+ new KeycodeEntry(KeyEvent.KEYCODE_1, CEC_KEYCODE_NUMBERS_1),
+ new KeycodeEntry(KeyEvent.KEYCODE_2, CEC_KEYCODE_NUMBERS_2),
+ new KeycodeEntry(KeyEvent.KEYCODE_3, CEC_KEYCODE_NUMBERS_3),
+ new KeycodeEntry(KeyEvent.KEYCODE_4, CEC_KEYCODE_NUMBERS_4),
+ new KeycodeEntry(KeyEvent.KEYCODE_5, CEC_KEYCODE_NUMBERS_5),
+ new KeycodeEntry(KeyEvent.KEYCODE_6, CEC_KEYCODE_NUMBERS_6),
+ new KeycodeEntry(KeyEvent.KEYCODE_7, CEC_KEYCODE_NUMBERS_7),
+ new KeycodeEntry(KeyEvent.KEYCODE_8, CEC_KEYCODE_NUMBERS_8),
+ new KeycodeEntry(KeyEvent.KEYCODE_9, CEC_KEYCODE_NUMBERS_9),
+ new KeycodeEntry(KeyEvent.KEYCODE_PERIOD, CEC_KEYCODE_DOT),
+ new KeycodeEntry(KeyEvent.KEYCODE_NUMPAD_ENTER, CEC_KEYCODE_ENTER),
+ new KeycodeEntry(KeyEvent.KEYCODE_CLEAR, CEC_KEYCODE_CLEAR),
+ // RESERVED
+ // No Android keycode defined for CEC_KEYCODE_NEXT_FAVORITE
+ new KeycodeEntry(KeyEvent.KEYCODE_CHANNEL_UP, CEC_KEYCODE_CHANNEL_UP),
+ new KeycodeEntry(KeyEvent.KEYCODE_CHANNEL_DOWN, CEC_KEYCODE_CHANNEL_DOWN),
+ new KeycodeEntry(KeyEvent.KEYCODE_LAST_CHANNEL, CEC_KEYCODE_PREVIOUS_CHANNEL),
+ // No Android keycode defined for CEC_KEYCODE_SOUND_SELECT
+ new KeycodeEntry(KeyEvent.KEYCODE_TV_INPUT, CEC_KEYCODE_INPUT_SELECT),
+ new KeycodeEntry(KeyEvent.KEYCODE_INFO, CEC_KEYCODE_DISPLAY_INFORMATION),
+ // No Android keycode defined for CEC_KEYCODE_HELP
+ new KeycodeEntry(KeyEvent.KEYCODE_PAGE_UP, CEC_KEYCODE_PAGE_UP),
+ new KeycodeEntry(KeyEvent.KEYCODE_PAGE_DOWN, CEC_KEYCODE_PAGE_DOWN),
+ // RESERVED
+ new KeycodeEntry(KeyEvent.KEYCODE_POWER, CEC_KEYCODE_POWER),
+ new KeycodeEntry(KeyEvent.KEYCODE_VOLUME_UP, CEC_KEYCODE_VOLUME_UP),
+ new KeycodeEntry(KeyEvent.KEYCODE_VOLUME_DOWN, CEC_KEYCODE_VOLUME_DOWN),
+ new KeycodeEntry(KeyEvent.KEYCODE_VOLUME_MUTE, CEC_KEYCODE_MUTE),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PLAY, CEC_KEYCODE_PLAY),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_STOP, CEC_KEYCODE_STOP),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PAUSE, CEC_KEYCODE_PAUSE),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_RECORD, CEC_KEYCODE_RECORD),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_REWIND, CEC_KEYCODE_REWIND),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, CEC_KEYCODE_FAST_FORWARD),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_EJECT, CEC_KEYCODE_EJECT),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_NEXT, CEC_KEYCODE_FORWARD),
+ new KeycodeEntry(KeyEvent.KEYCODE_MEDIA_PREVIOUS, CEC_KEYCODE_BACKWARD),
+ // No Android keycode defined for CEC_KEYCODE_STOP_RECORD
+ // No Android keycode defined for CEC_KEYCODE_PAUSE_RECORD
+ // No Android keycode defined for CEC_KEYCODE_RESERVED
+ // No Android keycode defined for CEC_KEYCODE_ANGLE
+ // No Android keycode defined for CEC_KEYCODE_SUB_PICTURE
+ // No Android keycode defined for CEC_KEYCODE_VIDEO_ON_DEMAND
+ new KeycodeEntry(KeyEvent.KEYCODE_GUIDE, CEC_KEYCODE_ELECTRONIC_PROGRAM_GUIDE),
+ // No Android keycode defined for CEC_KEYCODE_TIMER_PROGRAMMING
+ // No Android keycode defined for CEC_KEYCODE_INITIAL_CONFIGURATION
+ // No Android keycode defined for CEC_KEYCODE_SELECT_BROADCAST_TYPE
+ // No Android keycode defined for CEC_KEYCODE_SELECT_SOUND_PRESENTATION
+ // RESERVED
+ // The following deterministic key definitions do not need key mapping
+ // since they are supposed to be generated programmatically only.
+ // No Android keycode defined for CEC_KEYCODE_PLAY_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_PAUSE_PLAY_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_RECORD_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_PAUSE_RECORD_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_STOP_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_MUTE_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_RESTORE_VOLUME_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_TUNE_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_SELECT_MEDIA_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_SELECT_AV_INPUT_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_SELECT_AUDIO_INPUT_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_POWER_TOGGLE_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_POWER_OFF_FUNCTION
+ // No Android keycode defined for CEC_KEYCODE_POWER_ON_FUNCTION
+ // RESERVED
+ new KeycodeEntry(KeyEvent.KEYCODE_PROG_BLUE, CEC_KEYCODE_F1_BLUE),
+ new KeycodeEntry(KeyEvent.KEYCODE_PROG_RED, CEC_KEYCODE_F2_RED),
+ new KeycodeEntry(KeyEvent.KEYCODE_PROG_GREEN, CEC_KEYCODE_F3_GREEN),
+ new KeycodeEntry(KeyEvent.KEYCODE_PROG_YELLOW, CEC_KEYCODE_F4_YELLOW),
+ new KeycodeEntry(KeyEvent.KEYCODE_F5, CEC_KEYCODE_F5),
+ new KeycodeEntry(KeyEvent.KEYCODE_TV_DATA_SERVICE, CEC_KEYCODE_DATA),
+ // RESERVED
+ // Add a new key mapping here if new keycode is introduced.
+ };
+
+ /**
+ * Translate Android keycode to Hdmi Cec keycode.
+ *
+ * @param keycode Android keycode. For details, refer {@link KeyEvent}
+ * @return array of byte which contains cec keycode and param if it has;
+ * return null if failed to find matched cec keycode
+ */
+ static byte[] androidKeyToCecKey(int keycode) {
+ for (int i = 0; i < KEYCODE_ENTRIES.length; ++i) {
+ byte[] cecKeycode = KEYCODE_ENTRIES[i].toCecKeycodeIfMatched(keycode);
+ if (cecKeycode != null) {
+ return cecKeycode;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Translate Hdmi CEC keycode to Android keycode.
+ *
+ * @param keycode Cec keycode. If has no param, put {@link #NO_PARAM}
+ * @return cec keycode corresponding to the given android keycode.
+ * If finds no matched keycode, return {@link #UNSUPPORTED_KEYCODE}
+ */
+ static int cecKeyToAndroidKey(int keycode, int param) {
+ for (int i = 0; i < KEYCODE_ENTRIES.length; ++i) {
+ int androidKey = KEYCODE_ENTRIES[i].toAndroidKeycodeIfMatched(keycode, param);
+ if (androidKey != UNSUPPORTED_KEYCODE) {
+ return androidKey;
+ }
+ }
+ return UNSUPPORTED_KEYCODE;
+ }
+}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
index 23454ad..6697a53 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
@@ -18,12 +18,15 @@ package com.android.server.hdmi;
import android.hardware.hdmi.HdmiCec;
import android.hardware.hdmi.HdmiCecDeviceInfo;
+import android.hardware.hdmi.HdmiCecMessage;
+import android.util.Slog;
/**
* Class that models a logical CEC device hosted in this system. Handles initialization,
* CEC commands that call for actions customized per device type.
*/
abstract class HdmiCecLocalDevice {
+ private static final String TAG = "HdmiCecLocalDevice";
protected final HdmiControlService mService;
protected final int mDeviceType;
@@ -59,6 +62,83 @@ abstract class HdmiCecLocalDevice {
*/
protected abstract void onAddressAllocated(int logicalAddress);
+ /**
+ * Dispatch incoming message.
+ *
+ * @param message incoming message
+ * @return true if consumed a message; otherwise, return false.
+ */
+ final boolean dispatchMessage(HdmiCecMessage message) {
+ int dest = message.getDestination();
+ if (dest != mAddress && dest != HdmiCec.ADDR_BROADCAST) {
+ return false;
+ }
+ return onMessage(message);
+ }
+
+ protected boolean onMessage(HdmiCecMessage message) {
+ switch (message.getOpcode()) {
+ case HdmiCec.MESSAGE_GET_MENU_LANGUAGE:
+ return handleGetMenuLanguage(message);
+ case HdmiCec.MESSAGE_GIVE_PHYSICAL_ADDRESS:
+ return handleGivePhysicalAddress();
+ case HdmiCec.MESSAGE_GIVE_OSD_NAME:
+ return handleGiveOsdName(message);
+ case HdmiCec.MESSAGE_GIVE_DEVICE_VENDOR_ID:
+ return handleGiveDeviceVendorId();
+ case HdmiCec.MESSAGE_GET_CEC_VERSION:
+ return handleGetCecVersion(message);
+ default:
+ return false;
+ }
+ }
+
+ protected boolean handleGivePhysicalAddress() {
+ int physicalAddress = mService.getPhysicalAddress();
+ HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
+ mAddress, physicalAddress, mDeviceType);
+ mService.sendCecCommand(cecMessage);
+ return true;
+ }
+
+ protected boolean handleGiveDeviceVendorId() {
+ int vendorId = mService.getVendorId();
+ HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
+ mAddress, vendorId);
+ mService.sendCecCommand(cecMessage);
+ return true;
+ }
+
+ protected boolean handleGetCecVersion(HdmiCecMessage message) {
+ int version = mService.getCecVersion();
+ HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildCecVersion(message.getDestination(),
+ message.getSource(), version);
+ mService.sendCecCommand(cecMessage);
+ return true;
+ }
+
+ protected boolean handleGetMenuLanguage(HdmiCecMessage message) {
+ Slog.w(TAG, "Only TV can handle <Get Menu Language>:" + message.toString());
+ mService.sendCecCommand(
+ HdmiCecMessageBuilder.buildFeatureAbortCommand(mAddress,
+ message.getSource(), HdmiCec.MESSAGE_GET_MENU_LANGUAGE,
+ HdmiConstants.ABORT_UNRECOGNIZED_MODE));
+ return true;
+ }
+
+ protected boolean handleGiveOsdName(HdmiCecMessage message) {
+ // Note that since this method is called after logical address allocation is done,
+ // mDeviceInfo should not be null.
+ HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildSetOsdNameCommand(
+ mAddress, message.getSource(), mDeviceInfo.getDisplayName());
+ if (cecMessage != null) {
+ mService.sendCecCommand(cecMessage);
+ } else {
+ Slog.w(TAG, "Failed to build <Get Osd Name>:" + mDeviceInfo.getDisplayName());
+ }
+ return true;
+ }
+
final void handleAddressAllocated(int logicalAddress) {
mAddress = mPreferredAddress = logicalAddress;
onAddressAllocated(logicalAddress);
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
index 72d7f2d..8bd81ea 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
@@ -17,11 +17,16 @@
package com.android.server.hdmi;
import android.hardware.hdmi.HdmiCec;
+import android.hardware.hdmi.HdmiCecMessage;
+import android.util.Slog;
+
+import java.util.Locale;
/**
* Represent a logical device of type TV residing in Android system.
*/
final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
+ private static final String TAG = "HdmiCecLocalDeviceTv";
HdmiCecLocalDeviceTv(HdmiControlService service) {
super(service, HdmiCec.DEVICE_TV);
@@ -39,4 +44,42 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
mService.launchDeviceDiscovery(mAddress);
// TODO: Start routing control action, device discovery action.
}
+
+ @Override
+ protected boolean onMessage(HdmiCecMessage message) {
+ switch (message.getOpcode()) {
+ case HdmiCec.MESSAGE_REPORT_PHYSICAL_ADDRESS:
+ return handleReportPhysicalAddress(message);
+ default:
+ return super.onMessage(message);
+ }
+ }
+
+ @Override
+ protected boolean handleGetMenuLanguage(HdmiCecMessage message) {
+ HdmiCecMessage command = HdmiCecMessageBuilder.buildSetMenuLanguageCommand(
+ mAddress, Locale.getDefault().getISO3Language());
+ // TODO: figure out how to handle failed to get language code.
+ if (command != null) {
+ mService.sendCecCommand(command);
+ } else {
+ Slog.w(TAG, "Failed to respond to <Get Menu Language>: " + message.toString());
+ }
+ return true;
+ }
+
+ private boolean handleReportPhysicalAddress(HdmiCecMessage message) {
+ // Ignore if [Device Discovery Action] is going on.
+ if (mService.hasAction(DeviceDiscoveryAction.class)) {
+ Slog.i(TAG, "Ignore unrecognizable <Report Physical Address> "
+ + "because Device Discovery Action is on-going:" + message);
+ return true;
+ }
+
+ int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
+ mService.addAndStartAction(new NewDeviceAction(mService,
+ mAddress, message.getSource(), physicalAddress));
+
+ return true;
+ }
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java b/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
index 6c2be34..1fcb32f 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
@@ -319,10 +319,19 @@ public class HdmiCecMessageBuilder {
* @return newly created {@link HdmiCecMessage}
*/
static HdmiCecMessage buildUserControlPressed(int src, int dest, int uiCommand) {
- byte[] params = new byte[] {
- (byte) uiCommand
- };
- return buildCommand(src, dest, HdmiCec.MESSAGE_USER_CONTROL_PRESSED, params);
+ return buildUserControlPressed(src, dest, new byte[] { (byte) uiCommand });
+ }
+
+ /**
+ * Build &lt;User Control Pressed&gt; command.
+ *
+ * @param src source address of command
+ * @param dest destination address of command
+ * @param commandParam uiCommand and the additional parameter
+ * @return newly created {@link HdmiCecMessage}
+ */
+ static HdmiCecMessage buildUserControlPressed(int src, int dest, byte[] commandParam) {
+ return buildCommand(src, dest, HdmiCec.MESSAGE_USER_CONTROL_PRESSED, commandParam);
}
/**
diff --git a/services/core/java/com/android/server/hdmi/HdmiConstants.java b/services/core/java/com/android/server/hdmi/HdmiConstants.java
index a83d1ed..54b5dcb 100644
--- a/services/core/java/com/android/server/hdmi/HdmiConstants.java
+++ b/services/core/java/com/android/server/hdmi/HdmiConstants.java
@@ -43,5 +43,31 @@ final class HdmiConstants {
static final int UI_COMMAND_MUTE_FUNCTION = 0x65;
static final int UI_COMMAND_RESTORE_VOLUME_FUNCTION = 0x66;
+ // Flags used for setOption to CEC HAL.
+ /**
+ * When set to false, HAL does not wake up the system upon receiving
+ * <Image View On> or <Text View On>. Used when user changes the TV
+ * settings to disable the auto TV on functionality.
+ * True by default.
+ */
+ static final int FLAG_HDMI_OPTION_WAKEUP = 1;
+ /**
+ * When set to false, all the CEC commands are discarded. Used when
+ * user changes the TV settings to disable CEC functionality.
+ * True by default.
+ */
+ static final int FLAG_HDMI_OPTION_ENABLE_CEC = 2;
+ /**
+ * Setting this flag to false means Android system will stop handling
+ * CEC service and yield the control over to the microprocessor that is
+ * powered on through the standby mode. When set to true, the system
+ * will gain the control over, hence telling the microprocessor to stop
+ * handling the cec commands. This is called when system goes
+ * in and out of standby mode to notify the microprocessor that it should
+ * start/stop handling CEC commands on behalf of the system.
+ * False by default.
+ */
+ static final int FLAG_HDMI_OPTION_SYSTEM_CEC_CONTROL = 3;
+
private HdmiConstants() { /* cannot be instantiated */ }
}
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 42cd654..d41da30 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -24,6 +24,7 @@ import android.hardware.hdmi.HdmiCecMessage;
import android.hardware.hdmi.IHdmiControlCallback;
import android.hardware.hdmi.IHdmiControlService;
import android.hardware.hdmi.IHdmiHotplugEventListener;
+import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -42,7 +43,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Locale;
/**
* Provides a service for sending and processing HDMI control messages,
@@ -239,6 +239,13 @@ public final class HdmiControlService extends SystemService {
}
/**
+ * Returns version of CEC.
+ */
+ int getCecVersion() {
+ return mCecController.getVersion();
+ }
+
+ /**
* Returns a list of {@link HdmiCecDeviceInfo}.
*
* @param includeLocalDevice whether to include local devices
@@ -277,7 +284,7 @@ public final class HdmiControlService extends SystemService {
}
// See if we have an action of a given type in progress.
- private <T extends FeatureAction> boolean hasAction(final Class<T> clazz) {
+ <T extends FeatureAction> boolean hasAction(final Class<T> clazz) {
for (FeatureAction action : mActions) {
if (action.getClass().equals(clazz)) {
return true;
@@ -335,10 +342,13 @@ public final class HdmiControlService extends SystemService {
* @return {@code true} if ARC was in "Enabled" status
*/
boolean setArcStatus(boolean enabled) {
+ assertRunOnServiceThread();
synchronized (mLock) {
boolean oldStatus = mArcStatusEnabled;
// 1. Enable/disable ARC circuit.
- // TODO: call set_audio_return_channel of hal interface.
+ mCecController.setAudioReturnChannel(enabled);
+
+ // TODO: notify arc mode change to AudioManager.
// 2. Update arc status;
mArcStatusEnabled = enabled;
@@ -360,46 +370,20 @@ public final class HdmiControlService extends SystemService {
mCecController.sendCommand(command, null);
}
- /**
- * Add a new {@link HdmiCecDeviceInfo} to controller.
- *
- * @param deviceInfo new device information object to add
- */
- void addDeviceInfo(HdmiCecDeviceInfo deviceInfo) {
- // TODO: Implement this.
- }
-
boolean handleCecCommand(HdmiCecMessage message) {
// Cache incoming message. Note that it caches only white-listed one.
mCecMessageCache.cacheMessage(message);
// Commands that queries system information replies directly instead
// of creating FeatureAction because they are state-less.
+ // TODO: move the leftover message to local device.
switch (message.getOpcode()) {
- case HdmiCec.MESSAGE_GET_MENU_LANGUAGE:
- handleGetMenuLanguage(message);
- return true;
- case HdmiCec.MESSAGE_GIVE_OSD_NAME:
- handleGiveOsdName(message);
- return true;
- case HdmiCec.MESSAGE_GIVE_PHYSICAL_ADDRESS:
- handleGivePhysicalAddress(message);
- return true;
- case HdmiCec.MESSAGE_GIVE_DEVICE_VENDOR_ID:
- handleGiveDeviceVendorId(message);
- return true;
- case HdmiCec.MESSAGE_GET_CEC_VERSION:
- handleGetCecVersion(message);
- return true;
case HdmiCec.MESSAGE_INITIATE_ARC:
handleInitiateArc(message);
return true;
case HdmiCec.MESSAGE_TERMINATE_ARC:
handleTerminateArc(message);
return true;
- case HdmiCec.MESSAGE_REPORT_PHYSICAL_ADDRESS:
- handleReportPhysicalAddress(message);
- return true;
case HdmiCec.MESSAGE_SET_SYSTEM_AUDIO_MODE:
handleSetSystemAudioMode(message);
return true;
@@ -407,8 +391,22 @@ public final class HdmiControlService extends SystemService {
handleSystemAudioModeStatus(message);
return true;
default:
- return dispatchMessageToAction(message);
+ if (dispatchMessageToAction(message)) {
+ return true;
+ }
+ break;
}
+
+ return dispatchMessageToLocalDevice(message);
+ }
+
+ private boolean dispatchMessageToLocalDevice(HdmiCecMessage message) {
+ for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) {
+ if (device.dispatchMessage(message)) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -455,20 +453,19 @@ public final class HdmiControlService extends SystemService {
void launchDeviceDiscovery(final int sourceAddress) {
// At first, clear all existing device infos.
mCecController.clearDeviceInfoList();
- mCecMessageCache.flushAll();
+ // TODO: flush cec message cache when CEC is turned off.
- // TODO: check whether TV is one of local devices.
DeviceDiscoveryAction action = new DeviceDiscoveryAction(this, sourceAddress,
new DeviceDiscoveryCallback() {
@Override
public void onDeviceDiscoveryDone(List<HdmiCecDeviceInfo> deviceInfos) {
for (HdmiCecDeviceInfo info : deviceInfos) {
- mCecController.addDeviceInfo(info);
+ addCecDevice(info);
}
// Add device info of all local devices.
for (HdmiCecLocalDevice device : mCecController.getLocalDeviceList()) {
- mCecController.addDeviceInfo(device.getDeviceInfo());
+ addCecDevice(device.getDeviceInfo());
}
addAndStartAction(new HotplugDetectionAction(HdmiControlService.this,
@@ -479,28 +476,12 @@ public final class HdmiControlService extends SystemService {
}
private HdmiCecDeviceInfo createDeviceInfo(int logicalAddress, int deviceType) {
- // TODO: get device name read from system configuration.
- String displayName = HdmiCec.getDefaultDeviceName(logicalAddress);
+ // TODO: find better name instead of model name.
+ String displayName = Build.MODEL;
return new HdmiCecDeviceInfo(logicalAddress,
getPhysicalAddress(), deviceType, getVendorId(), displayName);
}
- private void handleReportPhysicalAddress(HdmiCecMessage message) {
- // At first, try to consume it.
- if (dispatchMessageToAction(message)) {
- return;
- }
-
- // Ignore if [Device Discovery Action] is going on.
- if (hasAction(DeviceDiscoveryAction.class)) {
- Slog.i(TAG, "Ignore unrecognizable <Report Physical Address> "
- + "because Device Discovery Action is on-going:" + message);
- return;
- }
-
- // TODO: start new device action.
- }
-
private void handleInitiateArc(HdmiCecMessage message){
// In case where <Initiate Arc> is started by <Request ARC Initiation>
// need to clean up RequestArcInitiationAction.
@@ -521,64 +502,6 @@ public final class HdmiControlService extends SystemService {
addAndStartAction(action);
}
- private void handleGetCecVersion(HdmiCecMessage message) {
- int version = mCecController.getVersion();
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildCecVersion(message.getDestination(),
- message.getSource(),
- version);
- sendCecCommand(cecMessage);
- }
-
- private void handleGiveDeviceVendorId(HdmiCecMessage message) {
- int vendorId = mCecController.getVendorId();
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
- message.getDestination(), vendorId);
- sendCecCommand(cecMessage);
- }
-
- private void handleGivePhysicalAddress(HdmiCecMessage message) {
- int physicalAddress = mCecController.getPhysicalAddress();
- int deviceType = HdmiCec.getTypeFromAddress(message.getDestination());
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
- message.getDestination(), physicalAddress, deviceType);
- sendCecCommand(cecMessage);
- }
-
- private void handleGiveOsdName(HdmiCecMessage message) {
- // TODO: read device name from settings or property.
- String name = HdmiCec.getDefaultDeviceName(message.getDestination());
- HdmiCecMessage cecMessage = HdmiCecMessageBuilder.buildSetOsdNameCommand(
- message.getDestination(), message.getSource(), name);
- if (cecMessage != null) {
- sendCecCommand(cecMessage);
- } else {
- Slog.w(TAG, "Failed to build <Get Osd Name>:" + name);
- }
- }
-
- private void handleGetMenuLanguage(HdmiCecMessage message) {
- // Only 0 (TV), 14 (specific use) can answer.
- if (message.getDestination() != HdmiCec.ADDR_TV
- && message.getDestination() != HdmiCec.ADDR_SPECIFIC_USE) {
- Slog.w(TAG, "Only TV can handle <Get Menu Language>:" + message.toString());
- sendCecCommand(
- HdmiCecMessageBuilder.buildFeatureAbortCommand(message.getDestination(),
- message.getSource(), HdmiCec.MESSAGE_GET_MENU_LANGUAGE,
- HdmiConstants.ABORT_UNRECOGNIZED_MODE));
- return;
- }
-
- HdmiCecMessage command = HdmiCecMessageBuilder.buildSetMenuLanguageCommand(
- message.getDestination(),
- Locale.getDefault().getISO3Language());
- // TODO: figure out how to handle failed to get language code.
- if (command != null) {
- sendCecCommand(command);
- } else {
- Slog.w(TAG, "Failed to respond to <Get Menu Language>: " + message.toString());
- }
- }
-
private boolean dispatchMessageToAction(HdmiCecMessage message) {
for (FeatureAction action : mActions) {
if (action.processCommand(message)) {
diff --git a/services/core/java/com/android/server/hdmi/HdmiUtils.java b/services/core/java/com/android/server/hdmi/HdmiUtils.java
index ef128ed1..ca09fe6 100644
--- a/services/core/java/com/android/server/hdmi/HdmiUtils.java
+++ b/services/core/java/com/android/server/hdmi/HdmiUtils.java
@@ -71,4 +71,24 @@ final class HdmiUtils {
return cmd.getParams().length > 0
&& cmd.getParams()[0] == HdmiConstants.SYSTEM_AUDIO_STATUS_ON;
}
+
+ /**
+ * Assemble two bytes into single integer value.
+ *
+ * @param data to be assembled
+ * @return assembled value
+ */
+ static int twoBytesToInt(byte[] data) {
+ return ((data[0] & 0xFF) << 8) | (data[1] & 0xFF);
+ }
+
+ /**
+ * Assemble three bytes into single integer value.
+ *
+ * @param data to be assembled
+ * @return assembled value
+ */
+ static int threeBytesToInt(byte[] data) {
+ return ((data[0] & 0xFF) << 16) | ((data[1] & 0xFF) << 8) | (data[2] & 0xFF);
+ }
}
diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
index 3e518ea..c7a813d 100644
--- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
+++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java
@@ -122,7 +122,7 @@ final class HotplugDetectionAction extends FeatureAction {
mService.pollDevices(new DevicePollingCallback() {
@Override
public void onPollingFinished(List<Integer> ackedAddress) {
- checkHotplug(ackedAddress, false);
+ checkHotplug(ackedAddress, true);
}
}, HdmiControlService.POLL_ITERATION_IN_ORDER
| HdmiControlService.POLL_STRATEGY_SYSTEM_AUDIO, POLL_RETRY_COUNT);
diff --git a/services/core/java/com/android/server/hdmi/NewDeviceAction.java b/services/core/java/com/android/server/hdmi/NewDeviceAction.java
index 156bbbe..c284d10 100644
--- a/services/core/java/com/android/server/hdmi/NewDeviceAction.java
+++ b/services/core/java/com/android/server/hdmi/NewDeviceAction.java
@@ -70,10 +70,13 @@ final class NewDeviceAction extends FeatureAction {
@Override
public boolean start() {
- sendCommand(
- HdmiCecMessageBuilder.buildGiveOsdNameCommand(mSourceAddress,
- mDeviceLogicalAddress));
mState = STATE_WAITING_FOR_SET_OSD_NAME;
+ if (mayProcessCommandIfCached(mDeviceLogicalAddress, HdmiCec.MESSAGE_SET_OSD_NAME)) {
+ return true;
+ }
+
+ sendCommand(HdmiCecMessageBuilder.buildGiveOsdNameCommand(mSourceAddress,
+ mDeviceLogicalAddress));
addTimer(mState, TIMEOUT_MS);
return true;
}
@@ -99,13 +102,11 @@ final class NewDeviceAction extends FeatureAction {
} catch (UnsupportedEncodingException e) {
Slog.e(TAG, "Failed to get OSD name: " + e.getMessage());
}
- mState = STATE_WAITING_FOR_DEVICE_VENDOR_ID;
requestVendorId();
return true;
} else if (opcode == HdmiCec.MESSAGE_FEATURE_ABORT) {
- int requestOpcode = params[1] & 0xff;
+ int requestOpcode = params[1] & 0xFF;
if (requestOpcode == HdmiCec.MESSAGE_SET_OSD_NAME) {
- mState = STATE_WAITING_FOR_DEVICE_VENDOR_ID;
requestVendorId();
return true;
}
@@ -113,8 +114,7 @@ final class NewDeviceAction extends FeatureAction {
} else if (mState == STATE_WAITING_FOR_DEVICE_VENDOR_ID) {
if (opcode == HdmiCec.MESSAGE_DEVICE_VENDOR_ID) {
if (params.length == 3) {
- mVendorId = ((params[0] & 0xff) << 16) + ((params[1] & 0xff) << 8)
- + (params[2] & 0xff);
+ mVendorId = HdmiUtils.threeBytesToInt(params);
} else {
Slog.e(TAG, "Failed to get device vendor ID: ");
}
@@ -122,7 +122,7 @@ final class NewDeviceAction extends FeatureAction {
finish();
return true;
} else if (opcode == HdmiCec.MESSAGE_FEATURE_ABORT) {
- int requestOpcode = params[1] & 0xff;
+ int requestOpcode = params[1] & 0xFF;
if (requestOpcode == HdmiCec.MESSAGE_DEVICE_VENDOR_ID) {
addDeviceInfo();
finish();
@@ -133,7 +133,21 @@ final class NewDeviceAction extends FeatureAction {
return false;
}
+ private boolean mayProcessCommandIfCached(int destAddress, int opcode) {
+ HdmiCecMessage message = mService.getCecMessageCache().getMessage(destAddress, opcode);
+ if (message != null) {
+ return processCommand(message);
+ }
+ return false;
+ }
+
private void requestVendorId() {
+ // At first, transit to waiting status for <Device Vendor Id>.
+ mState = STATE_WAITING_FOR_DEVICE_VENDOR_ID;
+ // If the message is already in cache, process it.
+ if (mayProcessCommandIfCached(mDeviceLogicalAddress, HdmiCec.MESSAGE_DEVICE_VENDOR_ID)) {
+ return;
+ }
sendCommand(HdmiCecMessageBuilder.buildGiveDeviceVendorIdCommand(mSourceAddress,
mDeviceLogicalAddress));
addTimer(mState, TIMEOUT_MS);
@@ -143,7 +157,7 @@ final class NewDeviceAction extends FeatureAction {
if (mDisplayName == null) {
mDisplayName = HdmiCec.getDefaultDeviceName(mDeviceLogicalAddress);
}
- mService.addDeviceInfo(new HdmiCecDeviceInfo(
+ mService.addCecDevice(new HdmiCecDeviceInfo(
mDeviceLogicalAddress, mDevicePhysicalAddress,
HdmiCec.getTypeFromAddress(mDeviceLogicalAddress),
mVendorId, mDisplayName));
@@ -156,7 +170,6 @@ final class NewDeviceAction extends FeatureAction {
}
if (state == STATE_WAITING_FOR_SET_OSD_NAME) {
// Osd name request timed out. Try vendor id
- mState = STATE_WAITING_FOR_DEVICE_VENDOR_ID;
requestVendorId();
} else if (state == STATE_WAITING_FOR_DEVICE_VENDOR_ID) {
// vendor id timed out. Go ahead creating the device info what we've got so far.
diff --git a/services/core/java/com/android/server/hdmi/SendKeyAction.java b/services/core/java/com/android/server/hdmi/SendKeyAction.java
new file mode 100644
index 0000000..5eb9315
--- /dev/null
+++ b/services/core/java/com/android/server/hdmi/SendKeyAction.java
@@ -0,0 +1,153 @@
+/*
+ * 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.server.hdmi;
+
+import android.hardware.hdmi.HdmiCecMessage;
+import android.view.KeyEvent;
+import android.util.Slog;
+
+import libcore.util.EmptyArray;
+
+/**
+ * Feature action that transmits remote control key command (User Control Press/
+ * User Control Release) to CEC bus.
+ *
+ * <p>This action is created when a new key event is passed to CEC service. It optionally
+ * does key repeat (a.k.a. press-and-hold) operation until it receives a key release event.
+ * If another key press event is received before the key in use is released, CEC service
+ * does not create a new action but recycles the current one by updating the key used
+ * for press-and-hold operation.
+ *
+ * <p>Package-private, accessed by {@link HdmiControlService} only.
+ */
+final class SendKeyAction extends FeatureAction {
+ private static final String TAG = "SendKeyAction";
+
+ // State in which the action is at work. The state is set in {@link #start()} and
+ // persists throughout the process till it is set back to {@code STATE_NONE} at the end.
+ private static final int STATE_PROCESSING_KEYCODE = 1;
+
+ // IRT(Initiator Repetition Time) in millisecond as recommended in the standard.
+ // Outgoing UCP commands, when in 'Press and Hold' mode, should be this much apart
+ // from the adjacent one so as not to place unnecessarily heavy load on the CEC line.
+ // TODO: This value might need tweaking per product basis. Consider putting it
+ // in config.xml to allow customization.
+ private static final int IRT_MS = 450;
+
+ // Logical address of the device to which the UCP/UCP commands are sent.
+ private final int mTargetAddress;
+
+ // The key code of the last key press event the action is passed via processKeyEvent.
+ private int mLastKeyCode;
+
+ /**
+ * Constructor.
+ *
+ * @param service {@link HdmiControlService} instance
+ * @param sourceAddress logical address to be used as source address
+ * @param targetAddress logical address of the device to send the keys to
+ * @param keyCode remote control key code as defined in {@link KeyEvent}
+ */
+ SendKeyAction(HdmiControlService service, int sourceAddress, int targetAddress, int keyCode) {
+ super(service, sourceAddress);
+ mTargetAddress = targetAddress;
+ mLastKeyCode = keyCode;
+ }
+
+ @Override
+ public boolean start() {
+ sendKeyDown(mLastKeyCode);
+ mState = STATE_PROCESSING_KEYCODE;
+ addTimer(mState, IRT_MS);
+ return true;
+ }
+
+ /**
+ * Called when a key event should be handled for the action.
+ *
+ * @param keyCode key code of {@link KeyEvent} object
+ * @param isPressed true if the key event is of {@link KeyEvent#ACTION_DOWN}
+ * @param param additional parameter that comes with the key event
+ */
+ void processKeyEvent(int keyCode, boolean isPressed) {
+ if (mState != STATE_PROCESSING_KEYCODE) {
+ Slog.w(TAG, "Not in a valid state");
+ return;
+ }
+ // A new key press event that comes in with a key code different from the last
+ // one sets becomes a new key code to be used for press-and-hold operation.
+ // Removes any pending timer and starts a new timer for itself.
+ // Key release event indicates that the action shall be finished. Send UCR
+ // command and terminate the action. Other release events are ignored.
+ if (isPressed) {
+ if (keyCode != mLastKeyCode) {
+ mActionTimer.clearTimerMessage();
+ sendKeyDown(keyCode);
+ addTimer(mState, IRT_MS);
+ mLastKeyCode = keyCode;
+ }
+ } else {
+ if (keyCode == mLastKeyCode) {
+ sendKeyUp();
+ finish();
+ }
+ }
+ }
+
+ private void sendKeyDown(int keyCode) {
+ byte[] keyCodeAndParam = getCecKeyCodeAndParam(keyCode);
+ if (keyCodeAndParam == null) {
+ return;
+ }
+ sendCommand(HdmiCecMessageBuilder.buildUserControlPressed(mSourceAddress, mTargetAddress,
+ keyCodeAndParam));
+ }
+
+ private void sendKeyUp() {
+ sendCommand(HdmiCecMessageBuilder.buildUserControlReleased(mSourceAddress, mTargetAddress));
+ }
+
+ @Override
+ public boolean processCommand(HdmiCecMessage cmd) {
+ // Send key action doesn't need any incoming CEC command, hence does not consume it.
+ return false;
+ }
+
+ @Override
+ public void handleTimerEvent(int state) {
+ // Timer event occurs every IRT_MS milliseconds to perform key-repeat (or press-and-hold)
+ // operation. If the last received key code is as same as the one with which the action
+ // is started, plus there was no key release event in last IRT_MS timeframe, send a UCP
+ // command and start another timer to schedule the next press-and-hold command.
+ if (mState != STATE_PROCESSING_KEYCODE) {
+ Slog.w(TAG, "Not in a valid state");
+ return;
+ }
+ sendKeyDown(mLastKeyCode);
+ addTimer(mState, IRT_MS);
+ }
+
+ // Converts the Android key code to corresponding CEC key code definition. Those CEC keys
+ // with additional parameters should be mapped from individual Android key code. 'Select
+ // Broadcast' with the parameter 'cable', for instance, shall have its counterpart such as
+ // KeyEvent.KEYCODE_TV_BROADCAST_CABLE.
+ // The return byte array contains both UI command (keycode) and optional parameter.
+ private byte[] getCecKeyCodeAndParam(int keyCode) {
+ // TODO: Convert to CEC keycode and (optionally) parameter.
+ // return androidKeyToCecKey(keyCode);
+ return EmptyArray.BYTE;
+ }
+}
diff --git a/services/core/java/com/android/server/task/TaskCompletedListener.java b/services/core/java/com/android/server/job/JobCompletedListener.java
index c53f5ca..a7af9cd 100644
--- a/services/core/java/com/android/server/task/TaskCompletedListener.java
+++ b/services/core/java/com/android/server/job/JobCompletedListener.java
@@ -14,19 +14,19 @@
* limitations under the License
*/
-package com.android.server.task;
+package com.android.server.job;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.controllers.JobStatus;
/**
- * Used for communication between {@link com.android.server.task.TaskServiceContext} and the
- * {@link com.android.server.task.TaskManagerService}.
+ * Used for communication between {@link com.android.server.job.JobServiceContext} and the
+ * {@link com.android.server.job.JobSchedulerService}.
*/
-public interface TaskCompletedListener {
+public interface JobCompletedListener {
/**
- * Callback for when a task is completed.
- * @param needsReschedule Whether the implementing class should reschedule this task.
+ * Callback for when a job is completed.
+ * @param needsReschedule Whether the implementing class should reschedule this job.
*/
- public void onTaskCompleted(TaskStatus taskStatus, boolean needsReschedule);
+ public void onJobCompleted(JobStatus jobStatus, boolean needsReschedule);
}
diff --git a/services/core/java/com/android/server/task/TaskMapReadFinishedListener.java b/services/core/java/com/android/server/job/JobMapReadFinishedListener.java
index c68d8db..f3e77e6 100644
--- a/services/core/java/com/android/server/task/TaskMapReadFinishedListener.java
+++ b/services/core/java/com/android/server/job/JobMapReadFinishedListener.java
@@ -14,21 +14,21 @@
* limitations under the License
*/
-package com.android.server.task;
+package com.android.server.job;
import java.util.List;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.controllers.JobStatus;
/**
- * Callback definition for I/O thread to let the TaskManagerService know when
+ * Callback definition for I/O thread to let the JobManagerService know when
* I/O read has completed. Done this way so we don't stall the main thread on
* boot.
*/
-public interface TaskMapReadFinishedListener {
+public interface JobMapReadFinishedListener {
/**
- * Called by the {@link TaskStore} at boot, when the disk read is finished.
+ * Called by the {@link JobStore} at boot, when the disk read is finished.
*/
- public void onTaskMapReadFinished(List<TaskStatus> tasks);
+ public void onJobMapReadFinished(List<JobStatus> jobs);
}
diff --git a/services/core/java/com/android/server/job/JobSchedulerService.java b/services/core/java/com/android/server/job/JobSchedulerService.java
new file mode 100644
index 0000000..0e9a9cc
--- /dev/null
+++ b/services/core/java/com/android/server/job/JobSchedulerService.java
@@ -0,0 +1,764 @@
+/*
+ * 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.server.job;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import android.app.job.JobInfo;
+import android.app.job.JobScheduler;
+import android.app.job.JobService;
+import android.app.job.IJobScheduler;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ServiceInfo;
+import android.os.Binder;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.os.RemoteException;
+import android.os.SystemClock;
+import android.os.UserHandle;
+import android.util.Slog;
+import android.util.SparseArray;
+
+import com.android.server.job.controllers.BatteryController;
+import com.android.server.job.controllers.ConnectivityController;
+import com.android.server.job.controllers.IdleController;
+import com.android.server.job.controllers.JobStatus;
+import com.android.server.job.controllers.StateController;
+import com.android.server.job.controllers.TimeController;
+
+import java.util.LinkedList;
+
+/**
+ * Responsible for taking jobs representing work to be performed by a client app, and determining
+ * based on the criteria specified when that job should be run against the client application's
+ * endpoint.
+ * Implements logic for scheduling, and rescheduling jobs. The JobSchedulerService knows nothing
+ * about constraints, or the state of active jobs. It receives callbacks from the various
+ * controllers and completed jobs and operates accordingly.
+ *
+ * Note on locking: Any operations that manipulate {@link #mJobs} need to lock on that object.
+ * Any function with the suffix 'Locked' also needs to lock on {@link #mJobs}.
+ * @hide
+ */
+public class JobSchedulerService extends com.android.server.SystemService
+ implements StateChangedListener, JobCompletedListener, JobMapReadFinishedListener {
+ // TODO: Switch this off for final version.
+ static final boolean DEBUG = true;
+ /** The number of concurrent jobs we run at one time. */
+ private static final int MAX_JOB_CONTEXTS_COUNT = 3;
+ static final String TAG = "JobManagerService";
+ /** Master list of jobs. */
+ private final JobStore mJobs;
+
+ static final int MSG_JOB_EXPIRED = 0;
+ static final int MSG_CHECK_JOB = 1;
+
+ // Policy constants
+ /**
+ * Minimum # of idle jobs that must be ready in order to force the JMS to schedule things
+ * early.
+ */
+ private static final int MIN_IDLE_COUNT = 1;
+ /**
+ * Minimum # of connectivity jobs that must be ready in order to force the JMS to schedule
+ * things early.
+ */
+ private static final int MIN_CONNECTIVITY_COUNT = 2;
+ /**
+ * Minimum # of jobs (with no particular constraints) for which the JMS will be happy running
+ * some work early.
+ */
+ private static final int MIN_READY_JOBS_COUNT = 4;
+
+ /**
+ * Track Services that have currently active or pending jobs. The index is provided by
+ * {@link JobStatus#getServiceToken()}
+ */
+ private final List<JobServiceContext> mActiveServices = new LinkedList<JobServiceContext>();
+ /** List of controllers that will notify this service of updates to jobs. */
+ private List<StateController> mControllers;
+ /**
+ * Queue of pending jobs. The JobServiceContext class will receive jobs from this list
+ * when ready to execute them.
+ */
+ private final LinkedList<JobStatus> mPendingJobs = new LinkedList<JobStatus>();
+
+ private final JobHandler mHandler;
+ private final JobSchedulerStub mJobSchedulerStub;
+ /**
+ * Cleans up outstanding jobs when a package is removed. Even if it's being replaced later we
+ * still clean up. On reinstall the package will have a new uid.
+ */
+ private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Slog.d(TAG, "Receieved: " + intent.getAction());
+ if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
+ int uidRemoved = intent.getIntExtra(Intent.EXTRA_UID, -1);
+ if (DEBUG) {
+ Slog.d(TAG, "Removing jobs for uid: " + uidRemoved);
+ }
+ cancelJobsForUid(uidRemoved);
+ } else if (Intent.ACTION_USER_REMOVED.equals(intent.getAction())) {
+ final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
+ if (DEBUG) {
+ Slog.d(TAG, "Removing jobs for user: " + userId);
+ }
+ cancelJobsForUser(userId);
+ }
+ }
+ };
+
+ /**
+ * Entry point from client to schedule the provided job.
+ * This cancels the job if it's already been scheduled, and replaces it with the one provided.
+ * @param job JobInfo object containing execution parameters
+ * @param uId The package identifier of the application this job is for.
+ * @param canPersistJob Whether or not the client has the appropriate permissions for
+ * persisting this job.
+ * @return Result of this operation. See <code>JobScheduler#RESULT_*</code> return codes.
+ */
+ public int schedule(JobInfo job, int uId, boolean canPersistJob) {
+ JobStatus jobStatus = new JobStatus(job, uId, canPersistJob);
+ cancelJob(uId, job.getId());
+ startTrackingJob(jobStatus);
+ return JobScheduler.RESULT_SUCCESS;
+ }
+
+ public List<JobInfo> getPendingJobs(int uid) {
+ ArrayList<JobInfo> outList = new ArrayList<JobInfo>();
+ synchronized (mJobs) {
+ for (JobStatus job : mJobs.getJobs()) {
+ if (job.getUid() == uid) {
+ outList.add(job.getJob());
+ }
+ }
+ }
+ return outList;
+ }
+
+ private void cancelJobsForUser(int userHandle) {
+ synchronized (mJobs) {
+ List<JobStatus> jobsForUser = mJobs.getJobsByUser(userHandle);
+ for (JobStatus toRemove : jobsForUser) {
+ if (DEBUG) {
+ Slog.d(TAG, "Cancelling: " + toRemove);
+ }
+ cancelJobLocked(toRemove);
+ }
+ }
+ }
+
+ /**
+ * Entry point from client to cancel all jobs originating from their uid.
+ * This will remove the job from the master list, and cancel the job if it was staged for
+ * execution or being executed.
+ * @param uid To check against for removal of a job.
+ */
+ public void cancelJobsForUid(int uid) {
+ // Remove from master list.
+ synchronized (mJobs) {
+ List<JobStatus> jobsForUid = mJobs.getJobsByUid(uid);
+ for (JobStatus toRemove : jobsForUid) {
+ if (DEBUG) {
+ Slog.d(TAG, "Cancelling: " + toRemove);
+ }
+ cancelJobLocked(toRemove);
+ }
+ }
+ }
+
+ /**
+ * Entry point from client to cancel the job corresponding to the jobId provided.
+ * This will remove the job from the master list, and cancel the job if it was staged for
+ * execution or being executed.
+ * @param uid Uid of the calling client.
+ * @param jobId Id of the job, provided at schedule-time.
+ */
+ public void cancelJob(int uid, int jobId) {
+ JobStatus toCancel;
+ synchronized (mJobs) {
+ toCancel = mJobs.getJobByUidAndJobId(uid, jobId);
+ if (toCancel != null) {
+ cancelJobLocked(toCancel);
+ }
+ }
+ }
+
+ private void cancelJobLocked(JobStatus cancelled) {
+ // Remove from store.
+ stopTrackingJob(cancelled);
+ // Remove from pending queue.
+ mPendingJobs.remove(cancelled);
+ // Cancel if running.
+ stopJobOnServiceContextLocked(cancelled);
+ }
+
+ /**
+ * Initializes the system service.
+ * <p>
+ * Subclasses must define a single argument constructor that accepts the context
+ * and passes it to super.
+ * </p>
+ *
+ * @param context The system server context.
+ */
+ public JobSchedulerService(Context context) {
+ super(context);
+ // Create the controllers.
+ mControllers = new LinkedList<StateController>();
+ mControllers.add(ConnectivityController.get(this));
+ mControllers.add(TimeController.get(this));
+ mControllers.add(IdleController.get(this));
+ mControllers.add(BatteryController.get(this));
+
+ mHandler = new JobHandler(context.getMainLooper());
+ mJobSchedulerStub = new JobSchedulerStub();
+ // Create the "runners".
+ for (int i = 0; i < MAX_JOB_CONTEXTS_COUNT; i++) {
+ mActiveServices.add(
+ new JobServiceContext(this, context.getMainLooper()));
+ }
+ mJobs = JobStore.initAndGet(this);
+ }
+
+ @Override
+ public void onStart() {
+ publishBinderService(Context.JOB_SCHEDULER_SERVICE, mJobSchedulerStub);
+ }
+
+ @Override
+ public void onBootPhase(int phase) {
+ if (PHASE_SYSTEM_SERVICES_READY == phase) {
+ // Register br for package removals and user removals.
+ final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_REMOVED);
+ filter.addDataScheme("package");
+ getContext().registerReceiverAsUser(
+ mBroadcastReceiver, UserHandle.ALL, filter, null, null);
+ final IntentFilter userFilter = new IntentFilter(Intent.ACTION_USER_REMOVED);
+ getContext().registerReceiverAsUser(
+ mBroadcastReceiver, UserHandle.ALL, userFilter, null, null);
+ }
+ }
+
+ /**
+ * Called when we have a job status object that we need to insert in our
+ * {@link com.android.server.job.JobStore}, and make sure all the relevant controllers know
+ * about.
+ */
+ private void startTrackingJob(JobStatus jobStatus) {
+ boolean update;
+ synchronized (mJobs) {
+ update = mJobs.add(jobStatus);
+ }
+ for (StateController controller : mControllers) {
+ if (update) {
+ controller.maybeStopTrackingJob(jobStatus);
+ }
+ controller.maybeStartTrackingJob(jobStatus);
+ }
+ }
+
+ /**
+ * Called when we want to remove a JobStatus object that we've finished executing. Returns the
+ * object removed.
+ */
+ private boolean stopTrackingJob(JobStatus jobStatus) {
+ boolean removed;
+ synchronized (mJobs) {
+ // Remove from store as well as controllers.
+ removed = mJobs.remove(jobStatus);
+ }
+ if (removed) {
+ for (StateController controller : mControllers) {
+ controller.maybeStopTrackingJob(jobStatus);
+ }
+ }
+ return removed;
+ }
+
+ private boolean stopJobOnServiceContextLocked(JobStatus job) {
+ for (JobServiceContext jsc : mActiveServices) {
+ final JobStatus executing = jsc.getRunningJob();
+ if (executing != null && executing.matches(job.getUid(), job.getJobId())) {
+ jsc.cancelExecutingJob();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @param job JobStatus we are querying against.
+ * @return Whether or not the job represented by the status object is currently being run or
+ * is pending.
+ */
+ private boolean isCurrentlyActiveLocked(JobStatus job) {
+ for (JobServiceContext serviceContext : mActiveServices) {
+ final JobStatus running = serviceContext.getRunningJob();
+ if (running != null && running.matches(job.getUid(), job.getJobId())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A job is rescheduled with exponential back-off if the client requests this from their
+ * execution logic.
+ * A caveat is for idle-mode jobs, for which the idle-mode constraint will usurp the
+ * timeliness of the reschedule. For an idle-mode job, no deadline is given.
+ * @param failureToReschedule Provided job status that we will reschedule.
+ * @return A newly instantiated JobStatus with the same constraints as the last job except
+ * with adjusted timing constraints.
+ */
+ private JobStatus getRescheduleJobForFailure(JobStatus failureToReschedule) {
+ final long elapsedNowMillis = SystemClock.elapsedRealtime();
+ final JobInfo job = failureToReschedule.getJob();
+
+ final long initialBackoffMillis = job.getInitialBackoffMillis();
+ final int backoffAttempt = failureToReschedule.getNumFailures() + 1;
+ long newEarliestRuntimeElapsed = elapsedNowMillis;
+
+ switch (job.getBackoffPolicy()) {
+ case JobInfo.BackoffPolicy.LINEAR:
+ newEarliestRuntimeElapsed += initialBackoffMillis * backoffAttempt;
+ break;
+ default:
+ if (DEBUG) {
+ Slog.v(TAG, "Unrecognised back-off policy, defaulting to exponential.");
+ }
+ case JobInfo.BackoffPolicy.EXPONENTIAL:
+ newEarliestRuntimeElapsed +=
+ Math.pow(initialBackoffMillis * 0.001, backoffAttempt) * 1000;
+ break;
+ }
+ newEarliestRuntimeElapsed =
+ Math.min(newEarliestRuntimeElapsed, JobInfo.MAX_BACKOFF_DELAY_MILLIS);
+ return new JobStatus(failureToReschedule, newEarliestRuntimeElapsed,
+ JobStatus.NO_LATEST_RUNTIME, backoffAttempt);
+ }
+
+ /**
+ * Called after a periodic has executed so we can to re-add it. We take the last execution time
+ * of the job to be the time of completion (i.e. the time at which this function is called).
+ * This could be inaccurate b/c the job can run for as long as
+ * {@link com.android.server.job.JobServiceContext#EXECUTING_TIMESLICE_MILLIS}, but will lead
+ * to underscheduling at least, rather than if we had taken the last execution time to be the
+ * start of the execution.
+ * @return A new job representing the execution criteria for this instantiation of the
+ * recurring job.
+ */
+ private JobStatus getRescheduleJobForPeriodic(JobStatus periodicToReschedule) {
+ final long elapsedNow = SystemClock.elapsedRealtime();
+ // Compute how much of the period is remaining.
+ long runEarly = Math.max(periodicToReschedule.getLatestRunTimeElapsed() - elapsedNow, 0);
+ long newEarliestRunTimeElapsed = elapsedNow + runEarly;
+ long period = periodicToReschedule.getJob().getIntervalMillis();
+ long newLatestRuntimeElapsed = newEarliestRunTimeElapsed + period;
+
+ if (DEBUG) {
+ Slog.v(TAG, "Rescheduling executed periodic. New execution window [" +
+ newEarliestRunTimeElapsed/1000 + ", " + newLatestRuntimeElapsed/1000 + "]s");
+ }
+ return new JobStatus(periodicToReschedule, newEarliestRunTimeElapsed,
+ newLatestRuntimeElapsed, 0 /* backoffAttempt */);
+ }
+
+ // JobCompletedListener implementations.
+
+ /**
+ * A job just finished executing. We fetch the
+ * {@link com.android.server.job.controllers.JobStatus} from the store and depending on
+ * whether we want to reschedule we readd it to the controllers.
+ * @param jobStatus Completed job.
+ * @param needsReschedule Whether the implementing class should reschedule this job.
+ */
+ @Override
+ public void onJobCompleted(JobStatus jobStatus, boolean needsReschedule) {
+ if (DEBUG) {
+ Slog.d(TAG, "Completed " + jobStatus + ", reschedule=" + needsReschedule);
+ }
+ if (!stopTrackingJob(jobStatus)) {
+ if (DEBUG) {
+ Slog.e(TAG, "Error removing job: could not find job to remove. Was job " +
+ "removed while executing?");
+ }
+ return;
+ }
+ if (needsReschedule) {
+ JobStatus rescheduled = getRescheduleJobForFailure(jobStatus);
+ startTrackingJob(rescheduled);
+ } else if (jobStatus.getJob().isPeriodic()) {
+ JobStatus rescheduledPeriodic = getRescheduleJobForPeriodic(jobStatus);
+ startTrackingJob(rescheduledPeriodic);
+ }
+ mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget();
+ }
+
+ // StateChangedListener implementations.
+
+ /**
+ * Off-board work to our handler thread as quickly as possible, b/c this call is probably being
+ * made on the main thread.
+ * For now this takes the job and if it's ready to run it will run it. In future we might not
+ * provide the job, so that the StateChangedListener has to run through its list of jobs to
+ * see which are ready. This will further decouple the controllers from the execution logic.
+ */
+ @Override
+ public void onControllerStateChanged() {
+ // Post a message to to run through the list of jobs and start/stop any that are eligible.
+ mHandler.obtainMessage(MSG_CHECK_JOB).sendToTarget();
+ }
+
+ @Override
+ public void onRunJobNow(JobStatus jobStatus) {
+ mHandler.obtainMessage(MSG_JOB_EXPIRED, jobStatus).sendToTarget();
+ }
+
+ /**
+ * Disk I/O is finished, take the list of jobs we read from disk and add them to our
+ * {@link JobStore}.
+ * This is run on the {@link com.android.server.IoThread} instance, which is a separate thread,
+ * and is called once at boot.
+ */
+ @Override
+ public void onJobMapReadFinished(List<JobStatus> jobs) {
+ synchronized (mJobs) {
+ for (JobStatus js : jobs) {
+ if (mJobs.containsJobIdForUid(js.getJobId(), js.getUid())) {
+ // An app with BOOT_COMPLETED *might* have decided to reschedule their job, in
+ // the same amount of time it took us to read it from disk. If this is the case
+ // we leave it be.
+ continue;
+ }
+ startTrackingJob(js);
+ }
+ }
+ }
+
+ private class JobHandler extends Handler {
+
+ public JobHandler(Looper looper) {
+ super(looper);
+ }
+
+ @Override
+ public void handleMessage(Message message) {
+ switch (message.what) {
+ case MSG_JOB_EXPIRED:
+ synchronized (mJobs) {
+ JobStatus runNow = (JobStatus) message.obj;
+ if (!mPendingJobs.contains(runNow)) {
+ mPendingJobs.add(runNow);
+ }
+ }
+ queueReadyJobsForExecutionH();
+ break;
+ case MSG_CHECK_JOB:
+ // Check the list of jobs and run some of them if we feel inclined.
+ maybeQueueReadyJobsForExecutionH();
+ break;
+ }
+ maybeRunPendingJobsH();
+ // Don't remove JOB_EXPIRED in case one came along while processing the queue.
+ removeMessages(MSG_CHECK_JOB);
+ }
+
+ /**
+ * Run through list of jobs and execute all possible - at least one is expired so we do
+ * as many as we can.
+ */
+ private void queueReadyJobsForExecutionH() {
+ synchronized (mJobs) {
+ for (JobStatus job : mJobs.getJobs()) {
+ if (isReadyToBeExecutedLocked(job)) {
+ mPendingJobs.add(job);
+ } else if (isReadyToBeCancelledLocked(job)) {
+ stopJobOnServiceContextLocked(job);
+ }
+ }
+ }
+ }
+
+ /**
+ * The state of at least one job has changed. Here is where we could enforce various
+ * policies on when we want to execute jobs.
+ * Right now the policy is such:
+ * If >1 of the ready jobs is idle mode we send all of them off
+ * if more than 2 network connectivity jobs are ready we send them all off.
+ * If more than 4 jobs total are ready we send them all off.
+ * TODO: It would be nice to consolidate these sort of high-level policies somewhere.
+ */
+ private void maybeQueueReadyJobsForExecutionH() {
+ synchronized (mJobs) {
+ int idleCount = 0;
+ int backoffCount = 0;
+ int connectivityCount = 0;
+ List<JobStatus> runnableJobs = new ArrayList<JobStatus>();
+ for (JobStatus job : mJobs.getJobs()) {
+ if (isReadyToBeExecutedLocked(job)) {
+ if (job.getNumFailures() > 0) {
+ backoffCount++;
+ }
+ if (job.hasIdleConstraint()) {
+ idleCount++;
+ }
+ if (job.hasConnectivityConstraint() || job.hasUnmeteredConstraint()) {
+ connectivityCount++;
+ }
+ runnableJobs.add(job);
+ } else if (isReadyToBeCancelledLocked(job)) {
+ stopJobOnServiceContextLocked(job);
+ }
+ }
+ if (backoffCount > 0 || idleCount >= MIN_IDLE_COUNT ||
+ connectivityCount >= MIN_CONNECTIVITY_COUNT ||
+ runnableJobs.size() >= MIN_READY_JOBS_COUNT) {
+ for (JobStatus job : runnableJobs) {
+ mPendingJobs.add(job);
+ }
+ }
+ }
+ }
+
+ /**
+ * Criteria for moving a job into the pending queue:
+ * - It's ready.
+ * - It's not pending.
+ * - It's not already running on a JSC.
+ */
+ private boolean isReadyToBeExecutedLocked(JobStatus job) {
+ return job.isReady() && !mPendingJobs.contains(job) && !isCurrentlyActiveLocked(job);
+ }
+
+ /**
+ * Criteria for cancelling an active job:
+ * - It's not ready
+ * - It's running on a JSC.
+ */
+ private boolean isReadyToBeCancelledLocked(JobStatus job) {
+ return !job.isReady() && isCurrentlyActiveLocked(job);
+ }
+
+ /**
+ * Reconcile jobs in the pending queue against available execution contexts.
+ * A controller can force a job into the pending queue even if it's already running, but
+ * here is where we decide whether to actually execute it.
+ */
+ private void maybeRunPendingJobsH() {
+ synchronized (mJobs) {
+ Iterator<JobStatus> it = mPendingJobs.iterator();
+ while (it.hasNext()) {
+ JobStatus nextPending = it.next();
+ JobServiceContext availableContext = null;
+ for (JobServiceContext jsc : mActiveServices) {
+ final JobStatus running = jsc.getRunningJob();
+ if (running != null && running.matches(nextPending.getUid(),
+ nextPending.getJobId())) {
+ // Already running this tId for this uId, skip.
+ availableContext = null;
+ break;
+ }
+ if (jsc.isAvailable()) {
+ availableContext = jsc;
+ }
+ }
+ if (availableContext != null) {
+ if (!availableContext.executeRunnableJob(nextPending)) {
+ if (DEBUG) {
+ Slog.d(TAG, "Error executing " + nextPending);
+ }
+ mJobs.remove(nextPending);
+ }
+ it.remove();
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Binder stub trampoline implementation
+ */
+ final class JobSchedulerStub extends IJobScheduler.Stub {
+ /** Cache determination of whether a given app can persist jobs
+ * key is uid of the calling app; value is undetermined/true/false
+ */
+ private final SparseArray<Boolean> mPersistCache = new SparseArray<Boolean>();
+
+ // Enforce that only the app itself (or shared uid participant) can schedule a
+ // job that runs one of the app's services, as well as verifying that the
+ // named service properly requires the BIND_JOB_SERVICE permission
+ private void enforceValidJobRequest(int uid, JobInfo job) {
+ final PackageManager pm = getContext().getPackageManager();
+ final ComponentName service = job.getService();
+ try {
+ ServiceInfo si = pm.getServiceInfo(service, 0);
+ if (si.applicationInfo.uid != uid) {
+ throw new IllegalArgumentException("uid " + uid +
+ " cannot schedule job in " + service.getPackageName());
+ }
+ if (!JobService.PERMISSION_BIND.equals(si.permission)) {
+ throw new IllegalArgumentException("Scheduled service " + service
+ + " does not require android.permission.BIND_JOB_SERVICE permission");
+ }
+ } catch (NameNotFoundException e) {
+ throw new IllegalArgumentException("No such service: " + service);
+ }
+ }
+
+ private boolean canPersistJobs(int pid, int uid) {
+ // If we get this far we're good to go; all we need to do now is check
+ // whether the app is allowed to persist its scheduled work.
+ final boolean canPersist;
+ synchronized (mPersistCache) {
+ Boolean cached = mPersistCache.get(uid);
+ if (cached != null) {
+ canPersist = cached.booleanValue();
+ } else {
+ // Persisting jobs is tantamount to running at boot, so we permit
+ // it when the app has declared that it uses the RECEIVE_BOOT_COMPLETED
+ // permission
+ int result = getContext().checkPermission(
+ android.Manifest.permission.RECEIVE_BOOT_COMPLETED, pid, uid);
+ canPersist = (result == PackageManager.PERMISSION_GRANTED);
+ mPersistCache.put(uid, canPersist);
+ }
+ }
+ return canPersist;
+ }
+
+ // IJobScheduler implementation
+ @Override
+ public int schedule(JobInfo job) throws RemoteException {
+ if (DEBUG) {
+ Slog.d(TAG, "Scheduling job: " + job);
+ }
+ final int pid = Binder.getCallingPid();
+ final int uid = Binder.getCallingUid();
+
+ enforceValidJobRequest(uid, job);
+ final boolean canPersist = canPersistJobs(pid, uid);
+
+ long ident = Binder.clearCallingIdentity();
+ try {
+ return JobSchedulerService.this.schedule(job, uid, canPersist);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override
+ public List<JobInfo> getAllPendingJobs() throws RemoteException {
+ final int uid = Binder.getCallingUid();
+
+ long ident = Binder.clearCallingIdentity();
+ try {
+ return JobSchedulerService.this.getPendingJobs(uid);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override
+ public void cancelAll() throws RemoteException {
+ final int uid = Binder.getCallingUid();
+
+ long ident = Binder.clearCallingIdentity();
+ try {
+ JobSchedulerService.this.cancelJobsForUid(uid);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ @Override
+ public void cancel(int jobId) throws RemoteException {
+ final int uid = Binder.getCallingUid();
+
+ long ident = Binder.clearCallingIdentity();
+ try {
+ JobSchedulerService.this.cancelJob(uid, jobId);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
+ }
+ }
+
+ /**
+ * "dumpsys" infrastructure
+ */
+ @Override
+ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
+
+ long identityToken = Binder.clearCallingIdentity();
+ try {
+ JobSchedulerService.this.dumpInternal(pw);
+ } finally {
+ Binder.restoreCallingIdentity(identityToken);
+ }
+ }
+ };
+
+ void dumpInternal(PrintWriter pw) {
+ synchronized (mJobs) {
+ pw.println("Registered jobs:");
+ if (mJobs.size() > 0) {
+ for (JobStatus job : mJobs.getJobs()) {
+ job.dump(pw, " ");
+ }
+ } else {
+ pw.println();
+ pw.println("No jobs scheduled.");
+ }
+ for (StateController controller : mControllers) {
+ pw.println();
+ controller.dumpControllerState(pw);
+ }
+ pw.println();
+ pw.println("Pending");
+ for (JobStatus jobStatus : mPendingJobs) {
+ pw.println(jobStatus.hashCode());
+ }
+ pw.println();
+ pw.println("Active jobs:");
+ for (JobServiceContext jsc : mActiveServices) {
+ if (jsc.isAvailable()) {
+ continue;
+ } else {
+ pw.println(jsc.getRunningJob().hashCode() + " for: " +
+ (SystemClock.elapsedRealtime()
+ - jsc.getExecutionStartTimeElapsed())/1000 + "s " +
+ "timeout: " + jsc.getTimeoutElapsed());
+ }
+ }
+ }
+ pw.println();
+ }
+}
diff --git a/services/core/java/com/android/server/task/TaskServiceContext.java b/services/core/java/com/android/server/job/JobServiceContext.java
index a21de88..92b643c 100644
--- a/services/core/java/com/android/server/task/TaskServiceContext.java
+++ b/services/core/java/com/android/server/job/JobServiceContext.java
@@ -14,12 +14,12 @@
* limitations under the License
*/
-package com.android.server.task;
+package com.android.server.job;
import android.app.ActivityManager;
-import android.app.task.ITaskCallback;
-import android.app.task.ITaskService;
-import android.app.task.TaskParams;
+import android.app.job.JobParameters;
+import android.app.job.IJobCallback;
+import android.app.job.IJobService;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -39,32 +39,32 @@ import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.controllers.JobStatus;
import java.util.concurrent.atomic.AtomicBoolean;
/**
- * Handles client binding and lifecycle of a task. A task will only execute one at a time on an
+ * Handles client binding and lifecycle of a job. A job will only execute one at a time on an
* instance of this class.
*/
-public class TaskServiceContext extends ITaskCallback.Stub implements ServiceConnection {
+public class JobServiceContext extends IJobCallback.Stub implements ServiceConnection {
private static final boolean DEBUG = true;
- private static final String TAG = "TaskServiceContext";
- /** Define the maximum # of tasks allowed to run on a service at once. */
- private static final int defaultMaxActiveTasksPerService =
+ private static final String TAG = "JobServiceContext";
+ /** Define the maximum # of jobs allowed to run on a service at once. */
+ private static final int defaultMaxActiveJobsPerService =
ActivityManager.isLowRamDeviceStatic() ? 1 : 3;
- /** Amount of time a task is allowed to execute for before being considered timed-out. */
+ /** Amount of time a job is allowed to execute for before being considered timed-out. */
private static final long EXECUTING_TIMESLICE_MILLIS = 60 * 1000;
- /** Amount of time the TaskManager will wait for a response from an app for a message. */
+ /** Amount of time the JobScheduler will wait for a response from an app for a message. */
private static final long OP_TIMEOUT_MILLIS = 8 * 1000;
/** String prefix for all wakelock names. */
- private static final String TM_WAKELOCK_PREFIX = "*task*/";
+ private static final String JS_WAKELOCK_PREFIX = "*job*/";
private static final String[] VERB_STRINGS = {
"VERB_STARTING", "VERB_EXECUTING", "VERB_STOPPING", "VERB_PENDING"
};
- // States that a task occupies while interacting with the client.
+ // States that a job occupies while interacting with the client.
static final int VERB_BINDING = 0;
static final int VERB_STARTING = 1;
static final int VERB_EXECUTING = 2;
@@ -75,30 +75,30 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
private static final int MSG_TIMEOUT = 0;
/** Received a callback from client. */
private static final int MSG_CALLBACK = 1;
- /** Run through list and start any ready tasks.*/
+ /** Run through list and start any ready jobs.*/
private static final int MSG_SERVICE_BOUND = 2;
- /** Cancel a task. */
+ /** Cancel a job. */
private static final int MSG_CANCEL = 3;
- /** Shutdown the Task. Used when the client crashes and we can't die gracefully.*/
+ /** Shutdown the job. Used when the client crashes and we can't die gracefully.*/
private static final int MSG_SHUTDOWN_EXECUTION = 4;
private final Handler mCallbackHandler;
- /** Make callbacks to {@link TaskManagerService} to inform on task completion status. */
- private final TaskCompletedListener mCompletedListener;
+ /** Make callbacks to {@link JobSchedulerService} to inform on job completion status. */
+ private final JobCompletedListener mCompletedListener;
/** Used for service binding, etc. */
private final Context mContext;
private PowerManager.WakeLock mWakeLock;
// Execution state.
- private TaskParams mParams;
+ private JobParameters mParams;
@VisibleForTesting
int mVerb;
private AtomicBoolean mCancelled = new AtomicBoolean();
- /** All the information maintained about the task currently being executed. */
- private TaskStatus mRunningTask;
+ /** All the information maintained about the job currently being executed. */
+ private JobStatus mRunningJob;
/** Binder to the client service. */
- ITaskService service;
+ IJobService service;
private final Object mLock = new Object();
/** Whether this context is free. */
@@ -109,45 +109,45 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
/** Track when job will timeout. */
private long mTimeoutElapsed;
- TaskServiceContext(TaskManagerService service, Looper looper) {
+ JobServiceContext(JobSchedulerService service, Looper looper) {
this(service.getContext(), service, looper);
}
@VisibleForTesting
- TaskServiceContext(Context context, TaskCompletedListener completedListener, Looper looper) {
+ JobServiceContext(Context context, JobCompletedListener completedListener, Looper looper) {
mContext = context;
- mCallbackHandler = new TaskServiceHandler(looper);
+ mCallbackHandler = new JobServiceHandler(looper);
mCompletedListener = completedListener;
mAvailable = true;
}
/**
- * Give a task to this context for execution. Callers must first check {@link #isAvailable()}
+ * Give a job to this context for execution. Callers must first check {@link #isAvailable()}
* to make sure this is a valid context.
- * @param ts The status of the task that we are going to run.
- * @return True if the task is valid and is running. False if the task cannot be executed.
+ * @param job The status of the job that we are going to run.
+ * @return True if the job is valid and is running. False if the job cannot be executed.
*/
- boolean executeRunnableTask(TaskStatus ts) {
+ boolean executeRunnableJob(JobStatus job) {
synchronized (mLock) {
if (!mAvailable) {
Slog.e(TAG, "Starting new runnable but context is unavailable > Error.");
return false;
}
- mRunningTask = ts;
- mParams = new TaskParams(ts.getTaskId(), ts.getExtras(), this);
+ mRunningJob = job;
+ mParams = new JobParameters(job.getJobId(), job.getExtras(), this);
mExecutionStartTimeElapsed = SystemClock.elapsedRealtime();
mVerb = VERB_BINDING;
- final Intent intent = new Intent().setComponent(ts.getServiceComponent());
+ final Intent intent = new Intent().setComponent(job.getServiceComponent());
boolean binding = mContext.bindServiceAsUser(intent, this,
Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND,
- new UserHandle(ts.getUserId()));
+ new UserHandle(job.getUserId()));
if (!binding) {
if (DEBUG) {
- Slog.d(TAG, ts.getServiceComponent().getShortClassName() + " unavailable.");
+ Slog.d(TAG, job.getServiceComponent().getShortClassName() + " unavailable.");
}
- mRunningTask = null;
+ mRunningJob = null;
mParams = null;
mExecutionStartTimeElapsed = 0L;
return false;
@@ -157,13 +157,13 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
}
}
- /** Used externally to query the running task. Will return null if there is no task running. */
- TaskStatus getRunningTask() {
- return mRunningTask;
+ /** Used externally to query the running job. Will return null if there is no job running. */
+ JobStatus getRunningJob() {
+ return mRunningJob;
}
- /** Called externally when a task that was scheduled for execution should be cancelled. */
- void cancelExecutingTask() {
+ /** Called externally when a job that was scheduled for execution should be cancelled. */
+ void cancelExecutingJob() {
mCallbackHandler.obtainMessage(MSG_CANCEL).sendToTarget();
}
@@ -185,29 +185,29 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
}
@Override
- public void taskFinished(int taskId, boolean reschedule) {
+ public void jobFinished(int jobId, boolean reschedule) {
if (!verifyCallingUid()) {
return;
}
- mCallbackHandler.obtainMessage(MSG_CALLBACK, taskId, reschedule ? 1 : 0)
+ mCallbackHandler.obtainMessage(MSG_CALLBACK, jobId, reschedule ? 1 : 0)
.sendToTarget();
}
@Override
- public void acknowledgeStopMessage(int taskId, boolean reschedule) {
+ public void acknowledgeStopMessage(int jobId, boolean reschedule) {
if (!verifyCallingUid()) {
return;
}
- mCallbackHandler.obtainMessage(MSG_CALLBACK, taskId, reschedule ? 1 : 0)
+ mCallbackHandler.obtainMessage(MSG_CALLBACK, jobId, reschedule ? 1 : 0)
.sendToTarget();
}
@Override
- public void acknowledgeStartMessage(int taskId, boolean ongoing) {
+ public void acknowledgeStartMessage(int jobId, boolean ongoing) {
if (!verifyCallingUid()) {
return;
}
- mCallbackHandler.obtainMessage(MSG_CALLBACK, taskId, ongoing ? 1 : 0).sendToTarget();
+ mCallbackHandler.obtainMessage(MSG_CALLBACK, jobId, ongoing ? 1 : 0).sendToTarget();
}
/**
@@ -219,25 +219,25 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
*/
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- if (!name.equals(mRunningTask.getServiceComponent())) {
+ if (!name.equals(mRunningJob.getServiceComponent())) {
mCallbackHandler.obtainMessage(MSG_SHUTDOWN_EXECUTION).sendToTarget();
return;
}
- this.service = ITaskService.Stub.asInterface(service);
+ this.service = IJobService.Stub.asInterface(service);
// Remove all timeouts.
mCallbackHandler.removeMessages(MSG_TIMEOUT);
final PowerManager pm =
(PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
- TM_WAKELOCK_PREFIX + mRunningTask.getServiceComponent().getPackageName());
- mWakeLock.setWorkSource(new WorkSource(mRunningTask.getUid()));
+ JS_WAKELOCK_PREFIX + mRunningJob.getServiceComponent().getPackageName());
+ mWakeLock.setWorkSource(new WorkSource(mRunningJob.getUid()));
mWakeLock.setReferenceCounted(false);
mWakeLock.acquire();
mCallbackHandler.obtainMessage(MSG_SERVICE_BOUND).sendToTarget();
}
/**
- * If the client service crashes we reschedule this task and clean up.
+ * If the client service crashes we reschedule this job and clean up.
* @param name The concrete component name of the service whose
*/
@Override
@@ -251,7 +251,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
* @return True if the binder calling is coming from the client we expect.
*/
private boolean verifyCallingUid() {
- if (mRunningTask == null || Binder.getCallingUid() != mRunningTask.getUid()) {
+ if (mRunningJob == null || Binder.getCallingUid() != mRunningJob.getUid()) {
if (DEBUG) {
Slog.d(TAG, "Stale callback received, ignoring.");
}
@@ -261,12 +261,12 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
}
/**
- * Handles the lifecycle of the TaskService binding/callbacks, etc. The convention within this
+ * Handles the lifecycle of the JobService binding/callbacks, etc. The convention within this
* class is to append 'H' to each function name that can only be called on this handler. This
* isn't strictly necessary because all of these functions are private, but helps clarity.
*/
- private class TaskServiceHandler extends Handler {
- TaskServiceHandler(Looper looper) {
+ private class JobServiceHandler extends Handler {
+ JobServiceHandler(Looper looper) {
super(looper);
}
@@ -278,7 +278,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
break;
case MSG_CALLBACK:
if (DEBUG) {
- Slog.d(TAG, "MSG_CALLBACK of : " + mRunningTask + " v:" +
+ Slog.d(TAG, "MSG_CALLBACK of : " + mRunningJob + " v:" +
VERB_STRINGS[mVerb]);
}
removeMessages(MSG_TIMEOUT);
@@ -292,7 +292,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
handleFinishedH(reschedule);
} else {
if (DEBUG) {
- Slog.d(TAG, "Unrecognised callback: " + mRunningTask);
+ Slog.d(TAG, "Unrecognised callback: " + mRunningJob);
}
}
break;
@@ -303,42 +303,42 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
handleOpTimeoutH();
break;
case MSG_SHUTDOWN_EXECUTION:
- closeAndCleanupTaskH(true /* needsReschedule */);
+ closeAndCleanupJobH(true /* needsReschedule */);
break;
default:
Log.e(TAG, "Unrecognised message: " + message);
}
}
- /** Start the task on the service. */
+ /** Start the job on the service. */
private void handleServiceBoundH() {
if (mVerb != VERB_BINDING) {
- Slog.e(TAG, "Sending onStartTask for a task that isn't pending. "
+ Slog.e(TAG, "Sending onStartJob for a job that isn't pending. "
+ VERB_STRINGS[mVerb]);
- closeAndCleanupTaskH(false /* reschedule */);
+ closeAndCleanupJobH(false /* reschedule */);
return;
}
if (mCancelled.get()) {
if (DEBUG) {
- Slog.d(TAG, "Task cancelled while waiting for bind to complete. "
- + mRunningTask);
+ Slog.d(TAG, "Job cancelled while waiting for bind to complete. "
+ + mRunningJob);
}
- closeAndCleanupTaskH(true /* reschedule */);
+ closeAndCleanupJobH(true /* reschedule */);
return;
}
try {
mVerb = VERB_STARTING;
scheduleOpTimeOut();
- service.startTask(mParams);
+ service.startJob(mParams);
} catch (RemoteException e) {
Log.e(TAG, "Error sending onStart message to '" +
- mRunningTask.getServiceComponent().getShortClassName() + "' ", e);
+ mRunningJob.getServiceComponent().getShortClassName() + "' ", e);
}
}
/**
* State behaviours.
- * VERB_STARTING -> Successful start, change task to VERB_EXECUTING and post timeout.
+ * VERB_STARTING -> Successful start, change job to VERB_EXECUTING and post timeout.
* _PENDING -> Error
* _EXECUTING -> Error
* _STOPPING -> Error
@@ -348,7 +348,7 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
case VERB_STARTING:
mVerb = VERB_EXECUTING;
if (!workOngoing) {
- // Task is finished already so fast-forward to handleFinished.
+ // Job is finished already so fast-forward to handleFinished.
handleFinishedH(false);
return;
}
@@ -360,14 +360,14 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
scheduleOpTimeOut();
break;
default:
- Log.e(TAG, "Handling started task but task wasn't starting! Was "
+ Log.e(TAG, "Handling started job but job wasn't starting! Was "
+ VERB_STRINGS[mVerb] + ".");
return;
}
}
/**
- * VERB_EXECUTING -> Client called taskFinished(), clean up and notify done.
+ * VERB_EXECUTING -> Client called jobFinished(), clean up and notify done.
* _STOPPING -> Successful finish, clean up and notify done.
* _STARTING -> Error
* _PENDING -> Error
@@ -376,20 +376,20 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
switch (mVerb) {
case VERB_EXECUTING:
case VERB_STOPPING:
- closeAndCleanupTaskH(reschedule);
+ closeAndCleanupJobH(reschedule);
break;
default:
- Slog.e(TAG, "Got an execution complete message for a task that wasn't being" +
+ Slog.e(TAG, "Got an execution complete message for a job that wasn't being" +
"executed. Was " + VERB_STRINGS[mVerb] + ".");
}
}
/**
- * A task can be in various states when a cancel request comes in:
+ * A job can be in various states when a cancel request comes in:
* VERB_BINDING -> Cancelled before bind completed. Mark as cancelled and wait for
* {@link #onServiceConnected(android.content.ComponentName, android.os.IBinder)}
* _STARTING -> Mark as cancelled and wait for
- * {@link TaskServiceContext#acknowledgeStartMessage(int, boolean)}
+ * {@link JobServiceContext#acknowledgeStartMessage(int, boolean)}
* _EXECUTING -> call {@link #sendStopMessageH}}.
* _ENDING -> No point in doing anything here, so we ignore.
*/
@@ -406,48 +406,48 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
// Nada.
break;
default:
- Slog.e(TAG, "Cancelling a task without a valid verb: " + mVerb);
+ Slog.e(TAG, "Cancelling a job without a valid verb: " + mVerb);
break;
}
}
/** Process MSG_TIMEOUT here. */
private void handleOpTimeoutH() {
- if (Log.isLoggable(TaskManagerService.TAG, Log.DEBUG)) {
+ if (Log.isLoggable(JobSchedulerService.TAG, Log.DEBUG)) {
Log.d(TAG, "MSG_TIMEOUT of " +
- mRunningTask.getServiceComponent().getShortClassName() + " : "
- + mParams.getTaskId());
+ mRunningJob.getServiceComponent().getShortClassName() + " : "
+ + mParams.getJobId());
}
- final int taskId = mParams.getTaskId();
+ final int jobId = mParams.getJobId();
switch (mVerb) {
case VERB_STARTING:
// Client unresponsive - wedged or failed to respond in time. We don't really
- // know what happened so let's log it and notify the TaskManager
+ // know what happened so let's log it and notify the JobScheduler
// FINISHED/NO-RETRY.
- Log.e(TAG, "No response from client for onStartTask '" +
- mRunningTask.getServiceComponent().getShortClassName() + "' tId: "
- + taskId);
- closeAndCleanupTaskH(false /* needsReschedule */);
+ Log.e(TAG, "No response from client for onStartJob '" +
+ mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ + jobId);
+ closeAndCleanupJobH(false /* needsReschedule */);
break;
case VERB_STOPPING:
- // At least we got somewhere, so fail but ask the TaskManager to reschedule.
- Log.e(TAG, "No response from client for onStopTask, '" +
- mRunningTask.getServiceComponent().getShortClassName() + "' tId: "
- + taskId);
- closeAndCleanupTaskH(true /* needsReschedule */);
+ // At least we got somewhere, so fail but ask the JobScheduler to reschedule.
+ Log.e(TAG, "No response from client for onStopJob, '" +
+ mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ + jobId);
+ closeAndCleanupJobH(true /* needsReschedule */);
break;
case VERB_EXECUTING:
// Not an error - client ran out of time.
- Log.i(TAG, "Client timed out while executing (no taskFinished received)." +
+ Log.i(TAG, "Client timed out while executing (no jobFinished received)." +
" sending onStop. " +
- mRunningTask.getServiceComponent().getShortClassName() + "' tId: "
- + taskId);
+ mRunningJob.getServiceComponent().getShortClassName() + "' tId: "
+ + jobId);
sendStopMessageH();
break;
default:
- Log.e(TAG, "Handling timeout for an unknown active task state: "
- + mRunningTask);
+ Log.e(TAG, "Handling timeout for an unknown active job state: "
+ + mRunningJob);
return;
}
}
@@ -459,35 +459,35 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
private void sendStopMessageH() {
mCallbackHandler.removeMessages(MSG_TIMEOUT);
if (mVerb != VERB_EXECUTING) {
- Log.e(TAG, "Sending onStopTask for a task that isn't started. " + mRunningTask);
- closeAndCleanupTaskH(false /* reschedule */);
+ Log.e(TAG, "Sending onStopJob for a job that isn't started. " + mRunningJob);
+ closeAndCleanupJobH(false /* reschedule */);
return;
}
try {
mVerb = VERB_STOPPING;
scheduleOpTimeOut();
- service.stopTask(mParams);
+ service.stopJob(mParams);
} catch (RemoteException e) {
- Log.e(TAG, "Error sending onStopTask to client.", e);
- closeAndCleanupTaskH(false /* reschedule */);
+ Log.e(TAG, "Error sending onStopJob to client.", e);
+ closeAndCleanupJobH(false /* reschedule */);
}
}
/**
- * The provided task has finished, either by calling
- * {@link android.app.task.TaskService#taskFinished(android.app.task.TaskParams, boolean)}
+ * The provided job has finished, either by calling
+ * {@link android.app.job.JobService#jobFinished(android.app.job.JobParameters, boolean)}
* or from acknowledging the stop message we sent. Either way, we're done tracking it and
* we want to clean up internally.
*/
- private void closeAndCleanupTaskH(boolean reschedule) {
+ private void closeAndCleanupJobH(boolean reschedule) {
removeMessages(MSG_TIMEOUT);
synchronized (mLock) {
mWakeLock.release();
- mContext.unbindService(TaskServiceContext.this);
- mCompletedListener.onTaskCompleted(mRunningTask, reschedule);
+ mContext.unbindService(JobServiceContext.this);
+ mCompletedListener.onJobCompleted(mRunningJob, reschedule);
mWakeLock = null;
- mRunningTask = null;
+ mRunningJob = null;
mParams = null;
mVerb = -1;
mCancelled.set(false);
@@ -508,8 +508,8 @@ public class TaskServiceContext extends ITaskCallback.Stub implements ServiceCon
EXECUTING_TIMESLICE_MILLIS : OP_TIMEOUT_MILLIS;
if (DEBUG) {
Slog.d(TAG, "Scheduling time out for '" +
- mRunningTask.getServiceComponent().getShortClassName() + "' tId: " +
- mParams.getTaskId() + ", in " + (timeoutMillis / 1000) + " s");
+ mRunningJob.getServiceComponent().getShortClassName() + "' tId: " +
+ mParams.getJobId() + ", in " + (timeoutMillis / 1000) + " s");
}
Message m = mCallbackHandler.obtainMessage(MSG_TIMEOUT);
mCallbackHandler.sendMessageDelayed(m, timeoutMillis);
diff --git a/services/core/java/com/android/server/task/TaskStore.java b/services/core/java/com/android/server/job/JobStore.java
index 9e095e7..5f22b34 100644
--- a/services/core/java/com/android/server/task/TaskStore.java
+++ b/services/core/java/com/android/server/job/JobStore.java
@@ -14,10 +14,10 @@
* limitations under the License
*/
-package com.android.server.task;
+package com.android.server.job;
import android.content.ComponentName;
-import android.app.task.Task;
+import android.app.job.JobInfo;
import android.content.Context;
import android.os.Environment;
import android.os.Handler;
@@ -33,7 +33,7 @@ import android.util.Xml;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.FastXmlSerializer;
import com.android.server.IoThread;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.controllers.JobStatus;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -50,94 +50,94 @@ import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
/**
- * Maintain a list of classes, and accessor methods/logic for these tasks.
+ * Maintain a list of classes, and accessor methods/logic for these jobs.
* This class offers the following functionality:
- * - When a task is added, it will determine if the task requirements have changed (update) and
+ * - When a job is added, it will determine if the job requirements have changed (update) and
* whether the controllers need to be updated.
- * - Persists Tasks, figures out when to to rewrite the Task to disk.
- * - Handles rescheduling of tasks.
- * - When a periodic task is executed and must be re-added.
- * - When a task fails and the client requests that it be retried with backoff.
+ * - Persists JobInfos, figures out when to to rewrite the JobInfo to disk.
+ * - Handles rescheduling of jobs.
+ * - When a periodic job is executed and must be re-added.
+ * - When a job fails and the client requests that it be retried with backoff.
* - This class <strong>is not</strong> thread-safe.
*
* Note on locking:
* All callers to this class must <strong>lock on the class object they are calling</strong>.
- * This is important b/c {@link com.android.server.task.TaskStore.WriteTasksMapToDiskRunnable}
- * and {@link com.android.server.task.TaskStore.ReadTaskMapFromDiskRunnable} lock on that
+ * This is important b/c {@link com.android.server.job.JobStore.WriteJobsMapToDiskRunnable}
+ * and {@link com.android.server.job.JobStore.ReadJobMapFromDiskRunnable} lock on that
* object.
*/
-public class TaskStore {
- private static final String TAG = "TaskManagerStore";
- private static final boolean DEBUG = TaskManagerService.DEBUG;
+public class JobStore {
+ private static final String TAG = "JobStore";
+ private static final boolean DEBUG = JobSchedulerService.DEBUG;
/** Threshold to adjust how often we want to write to the db. */
private static final int MAX_OPS_BEFORE_WRITE = 1;
- final ArraySet<TaskStatus> mTasksSet;
+ final ArraySet<JobStatus> mJobSet;
final Context mContext;
private int mDirtyOperations;
private static final Object sSingletonLock = new Object();
- private final AtomicFile mTasksFile;
+ private final AtomicFile mJobsFile;
/** Handler backed by IoThread for writing to disk. */
private final Handler mIoHandler = IoThread.getHandler();
- private static TaskStore sSingleton;
+ private static JobStore sSingleton;
- /** Used by the {@Link TaskManagerService} to instantiate the TaskStore. */
- static TaskStore initAndGet(TaskManagerService taskManagerService) {
+ /** Used by the {@link JobSchedulerService} to instantiate the JobStore. */
+ static JobStore initAndGet(JobSchedulerService jobManagerService) {
synchronized (sSingletonLock) {
if (sSingleton == null) {
- sSingleton = new TaskStore(taskManagerService.getContext(),
- Environment.getDataDirectory(), taskManagerService);
+ sSingleton = new JobStore(jobManagerService.getContext(),
+ Environment.getDataDirectory(), jobManagerService);
}
return sSingleton;
}
}
@VisibleForTesting
- public static TaskStore initAndGetForTesting(Context context, File dataDir,
- TaskMapReadFinishedListener callback) {
- return new TaskStore(context, dataDir, callback);
+ public static JobStore initAndGetForTesting(Context context, File dataDir,
+ JobMapReadFinishedListener callback) {
+ return new JobStore(context, dataDir, callback);
}
- private TaskStore(Context context, File dataDir, TaskMapReadFinishedListener callback) {
+ private JobStore(Context context, File dataDir, JobMapReadFinishedListener callback) {
mContext = context;
mDirtyOperations = 0;
File systemDir = new File(dataDir, "system");
- File taskDir = new File(systemDir, "task");
- taskDir.mkdirs();
- mTasksFile = new AtomicFile(new File(taskDir, "tasks.xml"));
+ File jobDir = new File(systemDir, "job");
+ jobDir.mkdirs();
+ mJobsFile = new AtomicFile(new File(jobDir, "jobs.xml"));
- mTasksSet = new ArraySet<TaskStatus>();
+ mJobSet = new ArraySet<JobStatus>();
- readTaskMapFromDiskAsync(callback);
+ readJobMapFromDiskAsync(callback);
}
/**
- * Add a task to the master list, persisting it if necessary. If the TaskStatus already exists,
+ * Add a job to the master list, persisting it if necessary. If the JobStatus already exists,
* it will be replaced.
- * @param taskStatus Task to add.
- * @return Whether or not an equivalent TaskStatus was replaced by this operation.
+ * @param jobStatus Job to add.
+ * @return Whether or not an equivalent JobStatus was replaced by this operation.
*/
- public boolean add(TaskStatus taskStatus) {
- boolean replaced = mTasksSet.remove(taskStatus);
- mTasksSet.add(taskStatus);
- if (taskStatus.isPersisted()) {
+ public boolean add(JobStatus jobStatus) {
+ boolean replaced = mJobSet.remove(jobStatus);
+ mJobSet.add(jobStatus);
+ if (jobStatus.isPersisted()) {
maybeWriteStatusToDiskAsync();
}
if (DEBUG) {
- Slog.d(TAG, "Added task status to store: " + taskStatus);
+ Slog.d(TAG, "Added job status to store: " + jobStatus);
}
return replaced;
}
/**
- * Whether this taskStatus object already exists in the TaskStore.
+ * Whether this jobStatus object already exists in the JobStore.
*/
- public boolean containsTaskIdForUid(int taskId, int uId) {
- for (TaskStatus ts : mTasksSet) {
- if (ts.getUid() == uId && ts.getTaskId() == taskId) {
+ public boolean containsJobIdForUid(int jobId, int uId) {
+ for (JobStatus ts : mJobSet) {
+ if (ts.getUid() == uId && ts.getJobId() == jobId) {
return true;
}
}
@@ -145,18 +145,18 @@ public class TaskStore {
}
public int size() {
- return mTasksSet.size();
+ return mJobSet.size();
}
/**
- * Remove the provided task. Will also delete the task if it was persisted.
- * @return Whether or not the task existed to be removed.
+ * Remove the provided job. Will also delete the job if it was persisted.
+ * @return Whether or not the job existed to be removed.
*/
- public boolean remove(TaskStatus taskStatus) {
- boolean removed = mTasksSet.remove(taskStatus);
+ public boolean remove(JobStatus jobStatus) {
+ boolean removed = mJobSet.remove(jobStatus);
if (!removed) {
if (DEBUG) {
- Slog.d(TAG, "Couldn't remove task: didn't exist: " + taskStatus);
+ Slog.d(TAG, "Couldn't remove job: didn't exist: " + jobStatus);
}
return false;
}
@@ -166,48 +166,48 @@ public class TaskStore {
@VisibleForTesting
public void clear() {
- mTasksSet.clear();
+ mJobSet.clear();
maybeWriteStatusToDiskAsync();
}
- public List<TaskStatus> getTasksByUser(int userHandle) {
- List<TaskStatus> matchingTasks = new ArrayList<TaskStatus>();
- Iterator<TaskStatus> it = mTasksSet.iterator();
+ public List<JobStatus> getJobsByUser(int userHandle) {
+ List<JobStatus> matchingJobs = new ArrayList<JobStatus>();
+ Iterator<JobStatus> it = mJobSet.iterator();
while (it.hasNext()) {
- TaskStatus ts = it.next();
+ JobStatus ts = it.next();
if (UserHandle.getUserId(ts.getUid()) == userHandle) {
- matchingTasks.add(ts);
+ matchingJobs.add(ts);
}
}
- return matchingTasks;
+ return matchingJobs;
}
/**
* @param uid Uid of the requesting app.
- * @return All TaskStatus objects for a given uid from the master list.
+ * @return All JobStatus objects for a given uid from the master list.
*/
- public List<TaskStatus> getTasksByUid(int uid) {
- List<TaskStatus> matchingTasks = new ArrayList<TaskStatus>();
- Iterator<TaskStatus> it = mTasksSet.iterator();
+ public List<JobStatus> getJobsByUid(int uid) {
+ List<JobStatus> matchingJobs = new ArrayList<JobStatus>();
+ Iterator<JobStatus> it = mJobSet.iterator();
while (it.hasNext()) {
- TaskStatus ts = it.next();
+ JobStatus ts = it.next();
if (ts.getUid() == uid) {
- matchingTasks.add(ts);
+ matchingJobs.add(ts);
}
}
- return matchingTasks;
+ return matchingJobs;
}
/**
* @param uid Uid of the requesting app.
- * @param taskId Task id, specified at schedule-time.
- * @return the TaskStatus that matches the provided uId and taskId, or null if none found.
+ * @param jobId Job id, specified at schedule-time.
+ * @return the JobStatus that matches the provided uId and jobId, or null if none found.
*/
- public TaskStatus getTaskByUidAndTaskId(int uid, int taskId) {
- Iterator<TaskStatus> it = mTasksSet.iterator();
+ public JobStatus getJobByUidAndJobId(int uid, int jobId) {
+ Iterator<JobStatus> it = mJobSet.iterator();
while (it.hasNext()) {
- TaskStatus ts = it.next();
- if (ts.getUid() == uid && ts.getTaskId() == taskId) {
+ JobStatus ts = it.next();
+ if (ts.getUid() == uid && ts.getJobId() == jobId) {
return ts;
}
}
@@ -215,15 +215,15 @@ public class TaskStore {
}
/**
- * @return The live array of TaskStatus objects.
+ * @return The live array of JobStatus objects.
*/
- public ArraySet<TaskStatus> getTasks() {
- return mTasksSet;
+ public ArraySet<JobStatus> getJobs() {
+ return mJobSet;
}
/** Version of the db schema. */
- private static final int TASKS_FILE_VERSION = 0;
- /** Tag corresponds to constraints this task needs. */
+ private static final int JOBS_FILE_VERSION = 0;
+ /** Tag corresponds to constraints this job needs. */
private static final String XML_TAG_PARAMS_CONSTRAINTS = "constraints";
/** Tag corresponds to execution parameters. */
private static final String XML_TAG_PERIODIC = "periodic";
@@ -231,7 +231,7 @@ public class TaskStore {
private static final String XML_TAG_EXTRAS = "extras";
/**
- * Every time the state changes we write all the tasks in one swathe, instead of trying to
+ * Every time the state changes we write all the jobs in one swath, instead of trying to
* track incremental changes.
* @return Whether the operation was successful. This will only fail for e.g. if the system is
* low on storage. If this happens, we continue as normal
@@ -240,38 +240,38 @@ public class TaskStore {
mDirtyOperations++;
if (mDirtyOperations >= MAX_OPS_BEFORE_WRITE) {
if (DEBUG) {
- Slog.v(TAG, "Writing tasks to disk.");
+ Slog.v(TAG, "Writing jobs to disk.");
}
- mIoHandler.post(new WriteTasksMapToDiskRunnable());
+ mIoHandler.post(new WriteJobsMapToDiskRunnable());
}
}
- private void readTaskMapFromDiskAsync(TaskMapReadFinishedListener callback) {
- mIoHandler.post(new ReadTaskMapFromDiskRunnable(callback));
+ private void readJobMapFromDiskAsync(JobMapReadFinishedListener callback) {
+ mIoHandler.post(new ReadJobMapFromDiskRunnable(callback));
}
- public void readTaskMapFromDisk(TaskMapReadFinishedListener callback) {
- new ReadTaskMapFromDiskRunnable(callback).run();
+ public void readJobMapFromDisk(JobMapReadFinishedListener callback) {
+ new ReadJobMapFromDiskRunnable(callback).run();
}
/**
- * Runnable that writes {@link #mTasksSet} out to xml.
- * NOTE: This Runnable locks on TaskStore.this
+ * Runnable that writes {@link #mJobSet} out to xml.
+ * NOTE: This Runnable locks on JobStore.this
*/
- private class WriteTasksMapToDiskRunnable implements Runnable {
+ private class WriteJobsMapToDiskRunnable implements Runnable {
@Override
public void run() {
final long startElapsed = SystemClock.elapsedRealtime();
- synchronized (TaskStore.this) {
- writeTasksMapImpl();
+ synchronized (JobStore.this) {
+ writeJobsMapImpl();
}
- if (TaskManagerService.DEBUG) {
+ if (JobSchedulerService.DEBUG) {
Slog.v(TAG, "Finished writing, took " + (SystemClock.elapsedRealtime()
- startElapsed) + "ms");
}
}
- private void writeTasksMapImpl() {
+ private void writeJobsMapImpl() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmlSerializer out = new FastXmlSerializer();
@@ -279,31 +279,31 @@ public class TaskStore {
out.startDocument(null, true);
out.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
- out.startTag(null, "task-info");
- out.attribute(null, "version", Integer.toString(TASKS_FILE_VERSION));
- for (int i = 0; i < mTasksSet.size(); i++) {
- final TaskStatus taskStatus = mTasksSet.valueAt(i);
+ out.startTag(null, "job-info");
+ out.attribute(null, "version", Integer.toString(JOBS_FILE_VERSION));
+ for (int i = 0; i < mJobSet.size(); i++) {
+ final JobStatus jobStatus = mJobSet.valueAt(i);
if (DEBUG) {
- Slog.d(TAG, "Saving task " + taskStatus.getTaskId());
+ Slog.d(TAG, "Saving job " + jobStatus.getJobId());
}
- out.startTag(null, "task");
- addIdentifierAttributesToTaskTag(out, taskStatus);
- writeConstraintsToXml(out, taskStatus);
- writeExecutionCriteriaToXml(out, taskStatus);
- writeBundleToXml(taskStatus.getExtras(), out);
- out.endTag(null, "task");
+ out.startTag(null, "job");
+ addIdentifierAttributesToJobTag(out, jobStatus);
+ writeConstraintsToXml(out, jobStatus);
+ writeExecutionCriteriaToXml(out, jobStatus);
+ writeBundleToXml(jobStatus.getExtras(), out);
+ out.endTag(null, "job");
}
- out.endTag(null, "task-info");
+ out.endTag(null, "job-info");
out.endDocument();
// Write out to disk in one fell sweep.
- FileOutputStream fos = mTasksFile.startWrite();
+ FileOutputStream fos = mJobsFile.startWrite();
fos.write(baos.toByteArray());
- mTasksFile.finishWrite(fos);
+ mJobsFile.finishWrite(fos);
mDirtyOperations = 0;
} catch (IOException e) {
if (DEBUG) {
- Slog.v(TAG, "Error writing out task data.", e);
+ Slog.v(TAG, "Error writing out job data.", e);
}
} catch (XmlPullParserException e) {
if (DEBUG) {
@@ -312,13 +312,13 @@ public class TaskStore {
}
}
- /** Write out a tag with data comprising the required fields of this task and its client. */
- private void addIdentifierAttributesToTaskTag(XmlSerializer out, TaskStatus taskStatus)
+ /** Write out a tag with data comprising the required fields of this job and its client. */
+ private void addIdentifierAttributesToJobTag(XmlSerializer out, JobStatus jobStatus)
throws IOException {
- out.attribute(null, "taskid", Integer.toString(taskStatus.getTaskId()));
- out.attribute(null, "package", taskStatus.getServiceComponent().getPackageName());
- out.attribute(null, "class", taskStatus.getServiceComponent().getClassName());
- out.attribute(null, "uid", Integer.toString(taskStatus.getUid()));
+ out.attribute(null, "jobid", Integer.toString(jobStatus.getJobId()));
+ out.attribute(null, "package", jobStatus.getServiceComponent().getPackageName());
+ out.attribute(null, "class", jobStatus.getServiceComponent().getClassName());
+ out.attribute(null, "uid", Integer.toString(jobStatus.getUid()));
}
private void writeBundleToXml(PersistableBundle extras, XmlSerializer out)
@@ -328,57 +328,57 @@ public class TaskStore {
out.endTag(null, XML_TAG_EXTRAS);
}
/**
- * Write out a tag with data identifying this tasks constraints. If the constraint isn't here
+ * Write out a tag with data identifying this job's constraints. If the constraint isn't here
* it doesn't apply.
*/
- private void writeConstraintsToXml(XmlSerializer out, TaskStatus taskStatus) throws IOException {
+ private void writeConstraintsToXml(XmlSerializer out, JobStatus jobStatus) throws IOException {
out.startTag(null, XML_TAG_PARAMS_CONSTRAINTS);
- if (taskStatus.hasUnmeteredConstraint()) {
+ if (jobStatus.hasUnmeteredConstraint()) {
out.attribute(null, "unmetered", Boolean.toString(true));
}
- if (taskStatus.hasConnectivityConstraint()) {
+ if (jobStatus.hasConnectivityConstraint()) {
out.attribute(null, "connectivity", Boolean.toString(true));
}
- if (taskStatus.hasIdleConstraint()) {
+ if (jobStatus.hasIdleConstraint()) {
out.attribute(null, "idle", Boolean.toString(true));
}
- if (taskStatus.hasChargingConstraint()) {
+ if (jobStatus.hasChargingConstraint()) {
out.attribute(null, "charging", Boolean.toString(true));
}
out.endTag(null, XML_TAG_PARAMS_CONSTRAINTS);
}
- private void writeExecutionCriteriaToXml(XmlSerializer out, TaskStatus taskStatus)
+ private void writeExecutionCriteriaToXml(XmlSerializer out, JobStatus jobStatus)
throws IOException {
- final Task task = taskStatus.getTask();
- if (taskStatus.getTask().isPeriodic()) {
+ final JobInfo job = jobStatus.getJob();
+ if (jobStatus.getJob().isPeriodic()) {
out.startTag(null, XML_TAG_PERIODIC);
- out.attribute(null, "period", Long.toString(task.getIntervalMillis()));
+ out.attribute(null, "period", Long.toString(job.getIntervalMillis()));
} else {
out.startTag(null, XML_TAG_ONEOFF);
}
- if (taskStatus.hasDeadlineConstraint()) {
+ if (jobStatus.hasDeadlineConstraint()) {
// Wall clock deadline.
final long deadlineWallclock = System.currentTimeMillis() +
- (taskStatus.getLatestRunTimeElapsed() - SystemClock.elapsedRealtime());
+ (jobStatus.getLatestRunTimeElapsed() - SystemClock.elapsedRealtime());
out.attribute(null, "deadline", Long.toString(deadlineWallclock));
}
- if (taskStatus.hasTimingDelayConstraint()) {
+ if (jobStatus.hasTimingDelayConstraint()) {
final long delayWallclock = System.currentTimeMillis() +
- (taskStatus.getEarliestRunTime() - SystemClock.elapsedRealtime());
+ (jobStatus.getEarliestRunTime() - SystemClock.elapsedRealtime());
out.attribute(null, "delay", Long.toString(delayWallclock));
}
// Only write out back-off policy if it differs from the default.
- // This also helps the case where the task is idle -> these aren't allowed to specify
+ // This also helps the case where the job is idle -> these aren't allowed to specify
// back-off.
- if (taskStatus.getTask().getInitialBackoffMillis() != Task.DEFAULT_INITIAL_BACKOFF_MILLIS
- || taskStatus.getTask().getBackoffPolicy() != Task.DEFAULT_BACKOFF_POLICY) {
- out.attribute(null, "backoff-policy", Integer.toString(task.getBackoffPolicy()));
- out.attribute(null, "initial-backoff", Long.toString(task.getInitialBackoffMillis()));
+ if (jobStatus.getJob().getInitialBackoffMillis() != JobInfo.DEFAULT_INITIAL_BACKOFF_MILLIS
+ || jobStatus.getJob().getBackoffPolicy() != JobInfo.DEFAULT_BACKOFF_POLICY) {
+ out.attribute(null, "backoff-policy", Integer.toString(job.getBackoffPolicy()));
+ out.attribute(null, "initial-backoff", Long.toString(job.getInitialBackoffMillis()));
}
- if (task.isPeriodic()) {
+ if (job.isPeriodic()) {
out.endTag(null, XML_TAG_PERIODIC);
} else {
out.endTag(null, XML_TAG_ONEOFF);
@@ -387,43 +387,43 @@ public class TaskStore {
}
/**
- * Runnable that reads list of persisted task from xml.
- * NOTE: This Runnable locks on TaskStore.this
+ * Runnable that reads list of persisted job from xml.
+ * NOTE: This Runnable locks on JobStore.this
*/
- private class ReadTaskMapFromDiskRunnable implements Runnable {
- private TaskMapReadFinishedListener mCallback;
- public ReadTaskMapFromDiskRunnable(TaskMapReadFinishedListener callback) {
+ private class ReadJobMapFromDiskRunnable implements Runnable {
+ private JobMapReadFinishedListener mCallback;
+ public ReadJobMapFromDiskRunnable(JobMapReadFinishedListener callback) {
mCallback = callback;
}
@Override
public void run() {
try {
- List<TaskStatus> tasks;
- FileInputStream fis = mTasksFile.openRead();
- synchronized (TaskStore.this) {
- tasks = readTaskMapImpl(fis);
+ List<JobStatus> jobs;
+ FileInputStream fis = mJobsFile.openRead();
+ synchronized (JobStore.this) {
+ jobs = readJobMapImpl(fis);
}
fis.close();
- if (tasks != null) {
- mCallback.onTaskMapReadFinished(tasks);
+ if (jobs != null) {
+ mCallback.onJobMapReadFinished(jobs);
}
} catch (FileNotFoundException e) {
- if (TaskManagerService.DEBUG) {
- Slog.d(TAG, "Could not find tasks file, probably there was nothing to load.");
+ if (JobSchedulerService.DEBUG) {
+ Slog.d(TAG, "Could not find jobs file, probably there was nothing to load.");
}
} catch (XmlPullParserException e) {
- if (TaskManagerService.DEBUG) {
+ if (JobSchedulerService.DEBUG) {
Slog.d(TAG, "Error parsing xml.", e);
}
} catch (IOException e) {
- if (TaskManagerService.DEBUG) {
+ if (JobSchedulerService.DEBUG) {
Slog.d(TAG, "Error parsing xml.", e);
}
}
}
- private List<TaskStatus> readTaskMapImpl(FileInputStream fis) throws XmlPullParserException, IOException {
+ private List<JobStatus> readJobMapImpl(FileInputStream fis) throws XmlPullParserException, IOException {
XmlPullParser parser = Xml.newPullParser();
parser.setInput(fis, null);
@@ -435,66 +435,66 @@ public class TaskStore {
}
if (eventType == XmlPullParser.END_DOCUMENT) {
if (DEBUG) {
- Slog.d(TAG, "No persisted tasks.");
+ Slog.d(TAG, "No persisted jobs.");
}
return null;
}
String tagName = parser.getName();
- if ("task-info".equals(tagName)) {
- final List<TaskStatus> tasks = new ArrayList<TaskStatus>();
+ if ("job-info".equals(tagName)) {
+ final List<JobStatus> jobs = new ArrayList<JobStatus>();
// Read in version info.
try {
int version = Integer.valueOf(parser.getAttributeValue(null, "version"));
- if (version != TASKS_FILE_VERSION) {
- Slog.d(TAG, "Invalid version number, aborting tasks file read.");
+ if (version != JOBS_FILE_VERSION) {
+ Slog.d(TAG, "Invalid version number, aborting jobs file read.");
return null;
}
} catch (NumberFormatException e) {
- Slog.e(TAG, "Invalid version number, aborting tasks file read.");
+ Slog.e(TAG, "Invalid version number, aborting jobs file read.");
return null;
}
eventType = parser.next();
do {
- // Read each <task/>
+ // Read each <job/>
if (eventType == XmlPullParser.START_TAG) {
tagName = parser.getName();
- // Start reading task.
- if ("task".equals(tagName)) {
- TaskStatus persistedTask = restoreTaskFromXml(parser);
- if (persistedTask != null) {
+ // Start reading job.
+ if ("job".equals(tagName)) {
+ JobStatus persistedJob = restoreJobFromXml(parser);
+ if (persistedJob != null) {
if (DEBUG) {
- Slog.d(TAG, "Read out " + persistedTask);
+ Slog.d(TAG, "Read out " + persistedJob);
}
- tasks.add(persistedTask);
+ jobs.add(persistedJob);
} else {
- Slog.d(TAG, "Error reading task from file.");
+ Slog.d(TAG, "Error reading job from file.");
}
}
}
eventType = parser.next();
} while (eventType != XmlPullParser.END_DOCUMENT);
- return tasks;
+ return jobs;
}
return null;
}
/**
- * @param parser Xml parser at the beginning of a "<task/>" tag. The next "parser.next()" call
- * will take the parser into the body of the task tag.
- * @return Newly instantiated task holding all the information we just read out of the xml tag.
+ * @param parser Xml parser at the beginning of a "<job/>" tag. The next "parser.next()" call
+ * will take the parser into the body of the job tag.
+ * @return Newly instantiated job holding all the information we just read out of the xml tag.
*/
- private TaskStatus restoreTaskFromXml(XmlPullParser parser) throws XmlPullParserException,
+ private JobStatus restoreJobFromXml(XmlPullParser parser) throws XmlPullParserException,
IOException {
- Task.Builder taskBuilder;
+ JobInfo.Builder jobBuilder;
int uid;
- // Read out task identifier attributes.
+ // Read out job identifier attributes.
try {
- taskBuilder = buildBuilderFromXml(parser);
+ jobBuilder = buildBuilderFromXml(parser);
uid = Integer.valueOf(parser.getAttributeValue(null, "uid"));
} catch (NumberFormatException e) {
- Slog.e(TAG, "Error parsing task's required fields, skipping");
+ Slog.e(TAG, "Error parsing job's required fields, skipping");
return null;
}
@@ -510,7 +510,7 @@ public class TaskStore {
return null;
}
try {
- buildConstraintsFromXml(taskBuilder, parser);
+ buildConstraintsFromXml(jobBuilder, parser);
} catch (NumberFormatException e) {
Slog.d(TAG, "Error reading constraints, skipping.");
return null;
@@ -538,22 +538,22 @@ public class TaskStore {
if (XML_TAG_PERIODIC.equals(parser.getName())) {
try {
String val = parser.getAttributeValue(null, "period");
- taskBuilder.setPeriodic(Long.valueOf(val));
+ jobBuilder.setPeriodic(Long.valueOf(val));
} catch (NumberFormatException e) {
Slog.d(TAG, "Error reading periodic execution criteria, skipping.");
return null;
}
} else if (XML_TAG_ONEOFF.equals(parser.getName())) {
try {
- if (runtimes.first != TaskStatus.NO_EARLIEST_RUNTIME) {
- taskBuilder.setMinimumLatency(runtimes.first - SystemClock.elapsedRealtime());
+ if (runtimes.first != JobStatus.NO_EARLIEST_RUNTIME) {
+ jobBuilder.setMinimumLatency(runtimes.first - SystemClock.elapsedRealtime());
}
- if (runtimes.second != TaskStatus.NO_LATEST_RUNTIME) {
- taskBuilder.setOverrideDeadline(
+ if (runtimes.second != JobStatus.NO_LATEST_RUNTIME) {
+ jobBuilder.setOverrideDeadline(
runtimes.second - SystemClock.elapsedRealtime());
}
} catch (NumberFormatException e) {
- Slog.d(TAG, "Error reading task execution criteria, skipping.");
+ Slog.d(TAG, "Error reading job execution criteria, skipping.");
return null;
}
} else {
@@ -563,7 +563,7 @@ public class TaskStore {
// Expecting a parameters start tag.
return null;
}
- maybeBuildBackoffPolicyFromXml(taskBuilder, parser);
+ maybeBuildBackoffPolicyFromXml(jobBuilder, parser);
parser.nextTag(); // Consume parameters end tag.
@@ -579,52 +579,52 @@ public class TaskStore {
}
PersistableBundle extras = PersistableBundle.restoreFromXml(parser);
- taskBuilder.setExtras(extras);
+ jobBuilder.setExtras(extras);
parser.nextTag(); // Consume </extras>
- return new TaskStatus(taskBuilder.build(), uid, runtimes.first, runtimes.second);
+ return new JobStatus(jobBuilder.build(), uid, runtimes.first, runtimes.second);
}
- private Task.Builder buildBuilderFromXml(XmlPullParser parser) throws NumberFormatException {
- // Pull out required fields from <task> attributes.
- int taskId = Integer.valueOf(parser.getAttributeValue(null, "taskid"));
+ private JobInfo.Builder buildBuilderFromXml(XmlPullParser parser) throws NumberFormatException {
+ // Pull out required fields from <job> attributes.
+ int jobId = Integer.valueOf(parser.getAttributeValue(null, "jobid"));
String packageName = parser.getAttributeValue(null, "package");
String className = parser.getAttributeValue(null, "class");
ComponentName cname = new ComponentName(packageName, className);
- return new Task.Builder(taskId, cname);
+ return new JobInfo.Builder(jobId, cname);
}
- private void buildConstraintsFromXml(Task.Builder taskBuilder, XmlPullParser parser) {
+ private void buildConstraintsFromXml(JobInfo.Builder jobBuilder, XmlPullParser parser) {
String val = parser.getAttributeValue(null, "unmetered");
if (val != null) {
- taskBuilder.setRequiredNetworkCapabilities(Task.NetworkType.UNMETERED);
+ jobBuilder.setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED);
}
val = parser.getAttributeValue(null, "connectivity");
if (val != null) {
- taskBuilder.setRequiredNetworkCapabilities(Task.NetworkType.ANY);
+ jobBuilder.setRequiredNetworkCapabilities(JobInfo.NetworkType.ANY);
}
val = parser.getAttributeValue(null, "idle");
if (val != null) {
- taskBuilder.setRequiresDeviceIdle(true);
+ jobBuilder.setRequiresDeviceIdle(true);
}
val = parser.getAttributeValue(null, "charging");
if (val != null) {
- taskBuilder.setRequiresCharging(true);
+ jobBuilder.setRequiresCharging(true);
}
}
/**
* Builds the back-off policy out of the params tag. These attributes may not exist, depending
- * on whether the back-off was set when the task was first scheduled.
+ * on whether the back-off was set when the job was first scheduled.
*/
- private void maybeBuildBackoffPolicyFromXml(Task.Builder taskBuilder, XmlPullParser parser) {
+ private void maybeBuildBackoffPolicyFromXml(JobInfo.Builder jobBuilder, XmlPullParser parser) {
String val = parser.getAttributeValue(null, "initial-backoff");
if (val != null) {
long initialBackoff = Long.valueOf(val);
val = parser.getAttributeValue(null, "backoff-policy");
int backoffPolicy = Integer.valueOf(val); // Will throw NFE which we catch higher up.
- taskBuilder.setBackoffCriteria(initialBackoff, backoffPolicy);
+ jobBuilder.setBackoffCriteria(initialBackoff, backoffPolicy);
}
}
@@ -640,8 +640,8 @@ public class TaskStore {
final long nowWallclock = System.currentTimeMillis();
final long nowElapsed = SystemClock.elapsedRealtime();
- long earliestRunTimeElapsed = TaskStatus.NO_EARLIEST_RUNTIME;
- long latestRunTimeElapsed = TaskStatus.NO_LATEST_RUNTIME;
+ long earliestRunTimeElapsed = JobStatus.NO_EARLIEST_RUNTIME;
+ long latestRunTimeElapsed = JobStatus.NO_LATEST_RUNTIME;
String val = parser.getAttributeValue(null, "deadline");
if (val != null) {
long latestRuntimeWallclock = Long.valueOf(val);
diff --git a/services/core/java/com/android/server/task/StateChangedListener.java b/services/core/java/com/android/server/job/StateChangedListener.java
index ab5cc7c..90c203a 100644
--- a/services/core/java/com/android/server/task/StateChangedListener.java
+++ b/services/core/java/com/android/server/job/StateChangedListener.java
@@ -14,26 +14,26 @@
* limitations under the License
*/
-package com.android.server.task;
+package com.android.server.job;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.controllers.JobStatus;
/**
- * Interface through which a {@link com.android.server.task.controllers.StateController} informs
- * the {@link com.android.server.task.TaskManagerService} that there are some tasks potentially
+ * Interface through which a {@link com.android.server.job.controllers.StateController} informs
+ * the {@link com.android.server.job.JobSchedulerService} that there are some tasks potentially
* ready to be run.
*/
public interface StateChangedListener {
/**
- * Called by the controller to notify the TaskManager that it should check on the state of a
+ * Called by the controller to notify the JobManager that it should check on the state of a
* task.
*/
public void onControllerStateChanged();
/**
- * Called by the controller to notify the TaskManager that regardless of the state of the task,
+ * Called by the controller to notify the JobManager that regardless of the state of the task,
* it must be run immediately.
- * @param taskStatus The state of the task which is to be run immediately.
+ * @param jobStatus The state of the task which is to be run immediately.
*/
- public void onRunTaskNow(TaskStatus taskStatus);
+ public void onRunJobNow(JobStatus jobStatus);
}
diff --git a/services/core/java/com/android/server/task/controllers/BatteryController.java b/services/core/java/com/android/server/job/controllers/BatteryController.java
index 443527f..4aef2d3 100644
--- a/services/core/java/com/android/server/task/controllers/BatteryController.java
+++ b/services/core/java/com/android/server/job/controllers/BatteryController.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
import android.app.AlarmManager;
import android.app.PendingIntent;
@@ -32,11 +32,12 @@ import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.BatteryService;
-import com.android.server.task.StateChangedListener;
-import com.android.server.task.TaskManagerService;
+import com.android.server.job.JobSchedulerService;
+import com.android.server.job.StateChangedListener;
import java.io.PrintWriter;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
/**
@@ -45,7 +46,7 @@ import java.util.List;
* ACTION_BATTERY_OK.
*/
public class BatteryController extends StateController {
- private static final String TAG = "BatteryController";
+ private static final String TAG = "JobScheduler.Batt";
private static final Object sCreationLock = new Object();
private static volatile BatteryController sController;
@@ -54,10 +55,10 @@ public class BatteryController extends StateController {
/** Wait this long after phone is plugged in before doing any work. */
private static final long STABLE_CHARGING_THRESHOLD_MILLIS = 2 * 60 * 1000; // 2 minutes.
- private List<TaskStatus> mTrackedTasks = new ArrayList<TaskStatus>();
+ private List<JobStatus> mTrackedTasks = new ArrayList<JobStatus>();
private ChargingTracker mChargeTracker;
- public static BatteryController get(TaskManagerService taskManagerService) {
+ public static BatteryController get(JobSchedulerService taskManagerService) {
synchronized (sCreationLock) {
if (sController == null) {
sController = new BatteryController(taskManagerService,
@@ -85,18 +86,21 @@ public class BatteryController extends StateController {
}
@Override
- public void maybeStartTrackingTask(TaskStatus taskStatus) {
+ public void maybeStartTrackingJob(JobStatus taskStatus) {
if (taskStatus.hasChargingConstraint()) {
+ final boolean isOnStablePower = mChargeTracker.isOnStablePower();
synchronized (mTrackedTasks) {
mTrackedTasks.add(taskStatus);
- taskStatus.chargingConstraintSatisfied.set(mChargeTracker.isOnStablePower());
+ taskStatus.chargingConstraintSatisfied.set(isOnStablePower);
+ }
+ if (isOnStablePower) {
+ mStateChangedListener.onControllerStateChanged();
}
}
-
}
@Override
- public void maybeStopTrackingTask(TaskStatus taskStatus) {
+ public void maybeStopTrackingJob(JobStatus taskStatus) {
if (taskStatus.hasChargingConstraint()) {
synchronized (mTrackedTasks) {
mTrackedTasks.remove(taskStatus);
@@ -106,9 +110,12 @@ public class BatteryController extends StateController {
private void maybeReportNewChargingState() {
final boolean stablePower = mChargeTracker.isOnStablePower();
+ if (DEBUG) {
+ Slog.d(TAG, "maybeReportNewChargingState: " + stablePower);
+ }
boolean reportChange = false;
synchronized (mTrackedTasks) {
- for (TaskStatus ts : mTrackedTasks) {
+ for (JobStatus ts : mTrackedTasks) {
boolean previous = ts.chargingConstraintSatisfied.getAndSet(stablePower);
if (previous != stablePower) {
reportChange = true;
@@ -133,8 +140,7 @@ public class BatteryController extends StateController {
public ChargingTracker() {
mAlarm = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
- Intent intent = new Intent(ACTION_CHARGING_STABLE)
- .setComponent(new ComponentName(mContext, this.getClass()));
+ Intent intent = new Intent(ACTION_CHARGING_STABLE);
mStableChargingTriggerIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
}
@@ -147,6 +153,8 @@ public class BatteryController extends StateController {
// Charging/not charging.
filter.addAction(Intent.ACTION_POWER_CONNECTED);
filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
+ // Charging stable.
+ filter.addAction(ACTION_CHARGING_STABLE);
mContext.registerReceiver(this, filter);
// Initialise tracker state.
@@ -189,6 +197,10 @@ public class BatteryController extends StateController {
mBatteryHealthy = true;
maybeReportNewChargingState();
} else if (Intent.ACTION_POWER_CONNECTED.equals(action)) {
+ if (DEBUG) {
+ Slog.d(TAG, "Received charging intent, setting alarm for "
+ + STABLE_CHARGING_THRESHOLD_MILLIS);
+ }
// Set up an alarm for ACTION_CHARGING_STABLE - we don't want to kick off tasks
// here if the user unplugs the phone immediately.
mAlarm.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
@@ -196,6 +208,9 @@ public class BatteryController extends StateController {
mStableChargingTriggerIntent);
mCharging = true;
} else if (Intent.ACTION_POWER_DISCONNECTED.equals(action)) {
+ if (DEBUG) {
+ Slog.d(TAG, "Disconnected from power, cancelling any set alarms.");
+ }
// If an alarm is set, breathe a sigh of relief and cancel it - crisis averted.
mAlarm.cancel(mStableChargingTriggerIntent);
mCharging = false;
@@ -203,7 +218,8 @@ public class BatteryController extends StateController {
}else if (ACTION_CHARGING_STABLE.equals(action)) {
// Here's where we actually do the notify for a task being ready.
if (DEBUG) {
- Slog.d(TAG, "Battery connected fired @ " + SystemClock.elapsedRealtime());
+ Slog.d(TAG, "Battery connected fired @ " + SystemClock.elapsedRealtime()
+ + " charging: " + mCharging);
}
if (mCharging) { // Should never receive this intent if mCharging is false.
maybeReportNewChargingState();
@@ -214,6 +230,17 @@ public class BatteryController extends StateController {
@Override
public void dumpControllerState(PrintWriter pw) {
-
+ pw.println("Batt.");
+ pw.println("Stable power: " + mChargeTracker.isOnStablePower());
+ synchronized (mTrackedTasks) {
+ Iterator<JobStatus> it = mTrackedTasks.iterator();
+ if (it.hasNext()) {
+ pw.print(String.valueOf(it.next().hashCode()));
+ }
+ while (it.hasNext()) {
+ pw.print("," + String.valueOf(it.next().hashCode()));
+ }
+ pw.println();
+ }
}
}
diff --git a/services/core/java/com/android/server/task/controllers/ConnectivityController.java b/services/core/java/com/android/server/job/controllers/ConnectivityController.java
index c1ab0f0..7e79ff7 100644
--- a/services/core/java/com/android/server/task/controllers/ConnectivityController.java
+++ b/services/core/java/com/android/server/job/controllers/ConnectivityController.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
import android.content.BroadcastReceiver;
@@ -28,8 +28,8 @@ import android.os.UserHandle;
import android.util.Slog;
import com.android.server.ConnectivityService;
-import com.android.server.task.StateChangedListener;
-import com.android.server.task.TaskManagerService;
+import com.android.server.job.JobSchedulerService;
+import com.android.server.job.StateChangedListener;
import java.io.PrintWriter;
import java.util.LinkedList;
@@ -42,9 +42,9 @@ import java.util.List;
*/
public class ConnectivityController extends StateController implements
ConnectivityManager.OnNetworkActiveListener {
- private static final String TAG = "TaskManager.Conn";
+ private static final String TAG = "JobScheduler.Conn";
- private final List<TaskStatus> mTrackedTasks = new LinkedList<TaskStatus>();
+ private final List<JobStatus> mTrackedJobs = new LinkedList<JobStatus>();
private final BroadcastReceiver mConnectivityChangedReceiver =
new ConnectivityChangedReceiver();
/** Singleton. */
@@ -55,10 +55,10 @@ public class ConnectivityController extends StateController implements
/** Track whether the latest active network is connected. */
private boolean mNetworkConnected;
- public static ConnectivityController get(TaskManagerService taskManager) {
+ public static ConnectivityController get(JobSchedulerService jms) {
synchronized (sCreationLock) {
if (mSingleton == null) {
- mSingleton = new ConnectivityController(taskManager, taskManager.getContext());
+ mSingleton = new ConnectivityController(jms, jms.getContext());
}
return mSingleton;
}
@@ -82,21 +82,21 @@ public class ConnectivityController extends StateController implements
}
@Override
- public void maybeStartTrackingTask(TaskStatus taskStatus) {
- if (taskStatus.hasConnectivityConstraint() || taskStatus.hasUnmeteredConstraint()) {
- synchronized (mTrackedTasks) {
- taskStatus.connectivityConstraintSatisfied.set(mNetworkConnected);
- taskStatus.unmeteredConstraintSatisfied.set(mNetworkUnmetered);
- mTrackedTasks.add(taskStatus);
+ public void maybeStartTrackingJob(JobStatus jobStatus) {
+ if (jobStatus.hasConnectivityConstraint() || jobStatus.hasUnmeteredConstraint()) {
+ synchronized (mTrackedJobs) {
+ jobStatus.connectivityConstraintSatisfied.set(mNetworkConnected);
+ jobStatus.unmeteredConstraintSatisfied.set(mNetworkUnmetered);
+ mTrackedJobs.add(jobStatus);
}
}
}
@Override
- public void maybeStopTrackingTask(TaskStatus taskStatus) {
- if (taskStatus.hasConnectivityConstraint() || taskStatus.hasUnmeteredConstraint()) {
- synchronized (mTrackedTasks) {
- mTrackedTasks.remove(taskStatus);
+ public void maybeStopTrackingJob(JobStatus jobStatus) {
+ if (jobStatus.hasConnectivityConstraint() || jobStatus.hasUnmeteredConstraint()) {
+ synchronized (mTrackedJobs) {
+ mTrackedJobs.remove(jobStatus);
}
}
}
@@ -104,16 +104,16 @@ public class ConnectivityController extends StateController implements
/**
* @param userId Id of the user for whom we are updating the connectivity state.
*/
- private void updateTrackedTasks(int userId) {
- synchronized (mTrackedTasks) {
+ private void updateTrackedJobs(int userId) {
+ synchronized (mTrackedJobs) {
boolean changed = false;
- for (TaskStatus ts : mTrackedTasks) {
- if (ts.getUserId() != userId) {
+ for (JobStatus js : mTrackedJobs) {
+ if (js.getUserId() != userId) {
continue;
}
boolean prevIsConnected =
- ts.connectivityConstraintSatisfied.getAndSet(mNetworkConnected);
- boolean prevIsMetered = ts.unmeteredConstraintSatisfied.getAndSet(mNetworkUnmetered);
+ js.connectivityConstraintSatisfied.getAndSet(mNetworkConnected);
+ boolean prevIsMetered = js.unmeteredConstraintSatisfied.getAndSet(mNetworkUnmetered);
if (prevIsConnected != mNetworkConnected || prevIsMetered != mNetworkUnmetered) {
changed = true;
}
@@ -125,16 +125,16 @@ public class ConnectivityController extends StateController implements
}
/**
- * We know the network has just come up. We want to run any tasks that are ready.
+ * We know the network has just come up. We want to run any jobs that are ready.
*/
public synchronized void onNetworkActive() {
- synchronized (mTrackedTasks) {
- for (TaskStatus ts : mTrackedTasks) {
- if (ts.isReady()) {
+ synchronized (mTrackedJobs) {
+ for (JobStatus js : mTrackedJobs) {
+ if (js.isReady()) {
if (DEBUG) {
- Slog.d(TAG, "Running " + ts + " due to network activity.");
+ Slog.d(TAG, "Running " + js + " due to network activity.");
}
- mStateChangedListener.onRunTaskNow(ts);
+ mStateChangedListener.onRunJobNow(js);
}
}
}
@@ -169,7 +169,7 @@ public class ConnectivityController extends StateController implements
if (activeNetwork == null) {
mNetworkUnmetered = false;
mNetworkConnected = false;
- updateTrackedTasks(userid);
+ updateTrackedJobs(userid);
} else if (activeNetwork.getType() == networkType) {
mNetworkUnmetered = false;
mNetworkConnected = !intent.getBooleanExtra(
@@ -177,7 +177,7 @@ public class ConnectivityController extends StateController implements
if (mNetworkConnected) { // No point making the call if we know there's no conn.
mNetworkUnmetered = !connManager.isActiveNetworkMetered();
}
- updateTrackedTasks(userid);
+ updateTrackedJobs(userid);
}
} else {
if (DEBUG) {
@@ -191,10 +191,10 @@ public class ConnectivityController extends StateController implements
public void dumpControllerState(PrintWriter pw) {
pw.println("Conn.");
pw.println("connected: " + mNetworkConnected + " unmetered: " + mNetworkUnmetered);
- for (TaskStatus ts: mTrackedTasks) {
- pw.println(String.valueOf(ts.hashCode()).substring(0, 3) + ".."
- + ": C=" + ts.hasConnectivityConstraint()
- + ", UM=" + ts.hasUnmeteredConstraint());
+ for (JobStatus js: mTrackedJobs) {
+ pw.println(String.valueOf(js.hashCode()).substring(0, 3) + ".."
+ + ": C=" + js.hasConnectivityConstraint()
+ + ", UM=" + js.hasUnmeteredConstraint());
}
}
} \ No newline at end of file
diff --git a/services/core/java/com/android/server/task/controllers/IdleController.java b/services/core/java/com/android/server/job/controllers/IdleController.java
index e749b00..07ffe4d 100644
--- a/services/core/java/com/android/server/task/controllers/IdleController.java
+++ b/services/core/java/com/android/server/job/controllers/IdleController.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -29,8 +29,8 @@ import android.content.IntentFilter;
import android.os.SystemClock;
import android.util.Slog;
-import com.android.server.task.StateChangedListener;
-import com.android.server.task.TaskManagerService;
+import com.android.server.job.JobSchedulerService;
+import com.android.server.job.StateChangedListener;
public class IdleController extends StateController {
private static final String TAG = "IdleController";
@@ -43,14 +43,14 @@ public class IdleController extends StateController {
private static final String ACTION_TRIGGER_IDLE =
"com.android.server.task.controllers.IdleController.ACTION_TRIGGER_IDLE";
- final ArrayList<TaskStatus> mTrackedTasks = new ArrayList<TaskStatus>();
+ final ArrayList<JobStatus> mTrackedTasks = new ArrayList<JobStatus>();
IdlenessTracker mIdleTracker;
// Singleton factory
private static Object sCreationLock = new Object();
private static volatile IdleController sController;
- public static IdleController get(TaskManagerService service) {
+ public static IdleController get(JobSchedulerService service) {
synchronized (sCreationLock) {
if (sController == null) {
sController = new IdleController(service, service.getContext());
@@ -68,7 +68,7 @@ public class IdleController extends StateController {
* StateController interface
*/
@Override
- public void maybeStartTrackingTask(TaskStatus taskStatus) {
+ public void maybeStartTrackingJob(JobStatus taskStatus) {
if (taskStatus.hasIdleConstraint()) {
synchronized (mTrackedTasks) {
mTrackedTasks.add(taskStatus);
@@ -78,7 +78,7 @@ public class IdleController extends StateController {
}
@Override
- public void maybeStopTrackingTask(TaskStatus taskStatus) {
+ public void maybeStopTrackingJob(JobStatus taskStatus) {
synchronized (mTrackedTasks) {
mTrackedTasks.remove(taskStatus);
}
@@ -89,7 +89,7 @@ public class IdleController extends StateController {
*/
void reportNewIdleState(boolean isIdle) {
synchronized (mTrackedTasks) {
- for (TaskStatus task : mTrackedTasks) {
+ for (JobStatus task : mTrackedTasks) {
task.idleConstraintSatisfied.set(isIdle);
}
}
diff --git a/services/core/java/com/android/server/task/controllers/TaskStatus.java b/services/core/java/com/android/server/job/controllers/JobStatus.java
index a286737..15a6b25 100644
--- a/services/core/java/com/android/server/task/controllers/TaskStatus.java
+++ b/services/core/java/com/android/server/job/controllers/JobStatus.java
@@ -14,9 +14,9 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
-import android.app.task.Task;
+import android.app.job.JobInfo;
import android.content.ComponentName;
import android.os.PersistableBundle;
import android.os.SystemClock;
@@ -26,9 +26,9 @@ import java.io.PrintWriter;
import java.util.concurrent.atomic.AtomicBoolean;
/**
- * Uniquely identifies a task internally.
- * Created from the public {@link android.app.task.Task} object when it lands on the scheduler.
- * Contains current state of the requirements of the task, as well as a function to evaluate
+ * Uniquely identifies a job internally.
+ * Created from the public {@link android.app.job.JobInfo} object when it lands on the scheduler.
+ * Contains current state of the requirements of the job, as well as a function to evaluate
* whether it's ready to run.
* This object is shared among the various controllers - hence why the different fields are atomic.
* This isn't strictly necessary because each controller is only interested in a specific field,
@@ -36,14 +36,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
* but we don't enforce that so this is safer.
* @hide
*/
-public class TaskStatus {
+public class JobStatus {
public static final long NO_LATEST_RUNTIME = Long.MAX_VALUE;
public static final long NO_EARLIEST_RUNTIME = 0L;
- final Task task;
+ final JobInfo job;
final int uId;
- /** At reschedule time we need to know whether to update task on disk. */
+ /** At reschedule time we need to know whether to update job on disk. */
final boolean persisted;
// Constraints.
@@ -55,77 +55,77 @@ public class TaskStatus {
final AtomicBoolean connectivityConstraintSatisfied = new AtomicBoolean();
/**
- * Earliest point in the future at which this task will be eligible to run. A value of 0
+ * Earliest point in the future at which this job will be eligible to run. A value of 0
* indicates there is no delay constraint. See {@link #hasTimingDelayConstraint()}.
*/
private long earliestRunTimeElapsedMillis;
/**
- * Latest point in the future at which this task must be run. A value of {@link Long#MAX_VALUE}
+ * Latest point in the future at which this job must be run. A value of {@link Long#MAX_VALUE}
* indicates there is no deadline constraint. See {@link #hasDeadlineConstraint()}.
*/
private long latestRunTimeElapsedMillis;
- /** How many times this task has failed, used to compute back-off. */
+ /** How many times this job has failed, used to compute back-off. */
private final int numFailures;
- /** Provide a handle to the service that this task will be run on. */
+ /** Provide a handle to the service that this job will be run on. */
public int getServiceToken() {
return uId;
}
- private TaskStatus(Task task, int uId, boolean persisted, int numFailures) {
- this.task = task;
+ private JobStatus(JobInfo job, int uId, boolean persisted, int numFailures) {
+ this.job = job;
this.uId = uId;
this.numFailures = numFailures;
this.persisted = persisted;
}
- /** Create a newly scheduled task. */
- public TaskStatus(Task task, int uId, boolean persisted) {
- this(task, uId, persisted, 0);
+ /** Create a newly scheduled job. */
+ public JobStatus(JobInfo job, int uId, boolean persisted) {
+ this(job, uId, persisted, 0);
final long elapsedNow = SystemClock.elapsedRealtime();
- if (task.isPeriodic()) {
+ if (job.isPeriodic()) {
earliestRunTimeElapsedMillis = elapsedNow;
- latestRunTimeElapsedMillis = elapsedNow + task.getIntervalMillis();
+ latestRunTimeElapsedMillis = elapsedNow + job.getIntervalMillis();
} else {
- earliestRunTimeElapsedMillis = task.hasEarlyConstraint() ?
- elapsedNow + task.getMinLatencyMillis() : NO_EARLIEST_RUNTIME;
- latestRunTimeElapsedMillis = task.hasLateConstraint() ?
- elapsedNow + task.getMaxExecutionDelayMillis() : NO_LATEST_RUNTIME;
+ earliestRunTimeElapsedMillis = job.hasEarlyConstraint() ?
+ elapsedNow + job.getMinLatencyMillis() : NO_EARLIEST_RUNTIME;
+ latestRunTimeElapsedMillis = job.hasLateConstraint() ?
+ elapsedNow + job.getMaxExecutionDelayMillis() : NO_LATEST_RUNTIME;
}
}
/**
- * Create a new TaskStatus that was loaded from disk. We ignore the provided
- * {@link android.app.task.Task} time criteria because we can load a persisted periodic task
- * from the {@link com.android.server.task.TaskStore} and still want to respect its
+ * Create a new JobStatus that was loaded from disk. We ignore the provided
+ * {@link android.app.job.JobInfo} time criteria because we can load a persisted periodic job
+ * from the {@link com.android.server.job.JobStore} and still want to respect its
* wallclock runtime rather than resetting it on every boot.
- * We consider a freshly loaded task to no longer be in back-off.
+ * We consider a freshly loaded job to no longer be in back-off.
*/
- public TaskStatus(Task task, int uId, long earliestRunTimeElapsedMillis,
+ public JobStatus(JobInfo job, int uId, long earliestRunTimeElapsedMillis,
long latestRunTimeElapsedMillis) {
- this(task, uId, true, 0);
+ this(job, uId, true, 0);
this.earliestRunTimeElapsedMillis = earliestRunTimeElapsedMillis;
this.latestRunTimeElapsedMillis = latestRunTimeElapsedMillis;
}
- /** Create a new task to be rescheduled with the provided parameters. */
- public TaskStatus(TaskStatus rescheduling, long newEarliestRuntimeElapsedMillis,
+ /** Create a new job to be rescheduled with the provided parameters. */
+ public JobStatus(JobStatus rescheduling, long newEarliestRuntimeElapsedMillis,
long newLatestRuntimeElapsedMillis, int backoffAttempt) {
- this(rescheduling.task, rescheduling.getUid(), rescheduling.isPersisted(), backoffAttempt);
+ this(rescheduling.job, rescheduling.getUid(), rescheduling.isPersisted(), backoffAttempt);
earliestRunTimeElapsedMillis = newEarliestRuntimeElapsedMillis;
latestRunTimeElapsedMillis = newLatestRuntimeElapsedMillis;
}
- public Task getTask() {
- return task;
+ public JobInfo getJob() {
+ return job;
}
- public int getTaskId() {
- return task.getId();
+ public int getJobId() {
+ return job.getId();
}
public int getNumFailures() {
@@ -133,7 +133,7 @@ public class TaskStatus {
}
public ComponentName getServiceComponent() {
- return task.getService();
+ return job.getService();
}
public int getUserId() {
@@ -145,19 +145,19 @@ public class TaskStatus {
}
public PersistableBundle getExtras() {
- return task.getExtras();
+ return job.getExtras();
}
public boolean hasConnectivityConstraint() {
- return task.getNetworkCapabilities() == Task.NetworkType.ANY;
+ return job.getNetworkCapabilities() == JobInfo.NetworkType.ANY;
}
public boolean hasUnmeteredConstraint() {
- return task.getNetworkCapabilities() == Task.NetworkType.UNMETERED;
+ return job.getNetworkCapabilities() == JobInfo.NetworkType.UNMETERED;
}
public boolean hasChargingConstraint() {
- return task.isRequireCharging();
+ return job.isRequireCharging();
}
public boolean hasTimingDelayConstraint() {
@@ -169,7 +169,7 @@ public class TaskStatus {
}
public boolean hasIdleConstraint() {
- return task.isRequireDeviceIdle();
+ return job.isRequireDeviceIdle();
}
public long getEarliestRunTime() {
@@ -184,7 +184,7 @@ public class TaskStatus {
return persisted;
}
/**
- * @return Whether or not this task is ready to run, based on its requirements.
+ * @return Whether or not this job is ready to run, based on its requirements.
*/
public synchronized boolean isReady() {
return (!hasChargingConstraint() || chargingConstraintSatisfied.get())
@@ -196,36 +196,17 @@ public class TaskStatus {
|| (hasDeadlineConstraint() && deadlineConstraintSatisfied.get());
}
- /*@Override
- public int hashCode() {
- int result = getServiceComponent().hashCode();
- result = 31 * result + task.getId();
- result = 31 * result + uId;
- return result;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof TaskStatus)) return false;
-
- TaskStatus that = (TaskStatus) o;
- return ((task.getId() == that.task.getId())
- && (uId == that.uId)
- && (getServiceComponent().equals(that.getServiceComponent())));
- }*/
-
- public boolean matches(int uid, int taskId) {
- return this.task.getId() == taskId && this.uId == uid;
+ public boolean matches(int uid, int jobId) {
+ return this.job.getId() == jobId && this.uId == uid;
}
@Override
public String toString() {
return String.valueOf(hashCode()).substring(0, 3) + ".."
- + ":[" + task.getService().getPackageName() + ",tId=" + task.getId()
+ + ":[" + job.getService().getPackageName() + ",jId=" + job.getId()
+ ",R=(" + earliestRunTimeElapsedMillis + "," + latestRunTimeElapsedMillis + ")"
- + ",N=" + task.getNetworkCapabilities() + ",C=" + task.isRequireCharging()
- + ",I=" + task.isRequireDeviceIdle() + ",F=" + numFailures
+ + ",N=" + job.getNetworkCapabilities() + ",C=" + job.isRequireCharging()
+ + ",I=" + job.isRequireDeviceIdle() + ",F=" + numFailures
+ (isReady() ? "(READY)" : "")
+ "]";
}
diff --git a/services/core/java/com/android/server/task/controllers/StateController.java b/services/core/java/com/android/server/job/controllers/StateController.java
index a7f52f5..81658bf 100644
--- a/services/core/java/com/android/server/task/controllers/StateController.java
+++ b/services/core/java/com/android/server/job/controllers/StateController.java
@@ -14,18 +14,18 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
import android.content.Context;
-import com.android.server.task.StateChangedListener;
-import com.android.server.task.TaskManagerService;
+import com.android.server.job.JobSchedulerService;
+import com.android.server.job.StateChangedListener;
import java.io.PrintWriter;
/**
- * Incorporates shared controller logic between the various controllers of the TaskManager.
- * These are solely responsible for tracking a list of tasks, and notifying the TM when these
+ * Incorporates shared controller logic between the various controllers of the JobManager.
+ * These are solely responsible for tracking a list of jobs, and notifying the JM when these
* are ready to run, or whether they must be stopped.
*/
public abstract class StateController {
@@ -39,16 +39,16 @@ public abstract class StateController {
}
/**
- * Implement the logic here to decide whether a task should be tracked by this controller.
- * This logic is put here so the TaskManger can be completely agnostic of Controller logic.
+ * Implement the logic here to decide whether a job should be tracked by this controller.
+ * This logic is put here so the JobManger can be completely agnostic of Controller logic.
* Also called when updating a task, so implementing controllers have to be aware of
* preexisting tasks.
*/
- public abstract void maybeStartTrackingTask(TaskStatus taskStatus);
+ public abstract void maybeStartTrackingJob(JobStatus jobStatus);
/**
* Remove task - this will happen if the task is cancelled, completed, etc.
*/
- public abstract void maybeStopTrackingTask(TaskStatus taskStatus);
+ public abstract void maybeStopTrackingJob(JobStatus jobStatus);
public abstract void dumpControllerState(PrintWriter pw);
diff --git a/services/core/java/com/android/server/task/controllers/TimeController.java b/services/core/java/com/android/server/job/controllers/TimeController.java
index b75036c..e46226c 100644
--- a/services/core/java/com/android/server/task/controllers/TimeController.java
+++ b/services/core/java/com/android/server/job/controllers/TimeController.java
@@ -14,7 +14,7 @@
* limitations under the License
*/
-package com.android.server.task.controllers;
+package com.android.server.job.controllers;
import android.app.AlarmManager;
import android.app.PendingIntent;
@@ -25,8 +25,8 @@ import android.content.IntentFilter;
import android.os.SystemClock;
import android.util.Slog;
-import com.android.server.task.StateChangedListener;
-import com.android.server.task.TaskManagerService;
+import com.android.server.job.JobSchedulerService;
+import com.android.server.job.StateChangedListener;
import java.io.PrintWriter;
import java.util.Iterator;
@@ -35,35 +35,35 @@ import java.util.List;
import java.util.ListIterator;
/**
- * This class sets an alarm for the next expiring task, and determines whether a task's minimum
+ * This class sets an alarm for the next expiring job, and determines whether a job's minimum
* delay has been satisfied.
*/
public class TimeController extends StateController {
- private static final String TAG = "TaskManager.Time";
- private static final String ACTION_TASK_EXPIRED =
- "android.content.taskmanager.TASK_DEADLINE_EXPIRED";
- private static final String ACTION_TASK_DELAY_EXPIRED =
- "android.content.taskmanager.TASK_DELAY_EXPIRED";
+ private static final String TAG = "JobScheduler.Time";
+ private static final String ACTION_JOB_EXPIRED =
+ "android.content.jobscheduler.JOB_DEADLINE_EXPIRED";
+ private static final String ACTION_JOB_DELAY_EXPIRED =
+ "android.content.jobscheduler.JOB_DELAY_EXPIRED";
- /** Set an alarm for the next task expiry. */
+ /** Set an alarm for the next job expiry. */
private final PendingIntent mDeadlineExpiredAlarmIntent;
- /** Set an alarm for the next task delay expiry. This*/
+ /** Set an alarm for the next job delay expiry. This*/
private final PendingIntent mNextDelayExpiredAlarmIntent;
/** Constant time determining how near in the future we'll set an alarm for. */
private static final long MIN_WAKEUP_INTERVAL_MILLIS = 15 * 1000;
- private long mNextTaskExpiredElapsedMillis;
+ private long mNextJobExpiredElapsedMillis;
private long mNextDelayExpiredElapsedMillis;
private AlarmManager mAlarmService = null;
- /** List of tracked tasks, sorted asc. by deadline */
- private final List<TaskStatus> mTrackedTasks = new LinkedList<TaskStatus>();
+ /** List of tracked jobs, sorted asc. by deadline */
+ private final List<JobStatus> mTrackedJobs = new LinkedList<JobStatus>();
/** Singleton. */
private static TimeController mSingleton;
- public static synchronized TimeController get(TaskManagerService taskManager) {
+ public static synchronized TimeController get(JobSchedulerService jms) {
if (mSingleton == null) {
- mSingleton = new TimeController(taskManager, taskManager.getContext());
+ mSingleton = new TimeController(jms, jms.getContext());
}
return mSingleton;
}
@@ -72,66 +72,66 @@ public class TimeController extends StateController {
super(stateChangedListener, context);
mDeadlineExpiredAlarmIntent =
PendingIntent.getBroadcast(mContext, 0 /* ignored */,
- new Intent(ACTION_TASK_EXPIRED), 0);
+ new Intent(ACTION_JOB_EXPIRED), 0);
mNextDelayExpiredAlarmIntent =
PendingIntent.getBroadcast(mContext, 0 /* ignored */,
- new Intent(ACTION_TASK_DELAY_EXPIRED), 0);
- mNextTaskExpiredElapsedMillis = Long.MAX_VALUE;
+ new Intent(ACTION_JOB_DELAY_EXPIRED), 0);
+ mNextJobExpiredElapsedMillis = Long.MAX_VALUE;
mNextDelayExpiredElapsedMillis = Long.MAX_VALUE;
// Register BR for these intents.
- IntentFilter intentFilter = new IntentFilter(ACTION_TASK_EXPIRED);
- intentFilter.addAction(ACTION_TASK_DELAY_EXPIRED);
+ IntentFilter intentFilter = new IntentFilter(ACTION_JOB_EXPIRED);
+ intentFilter.addAction(ACTION_JOB_DELAY_EXPIRED);
mContext.registerReceiver(mAlarmExpiredReceiver, intentFilter);
}
/**
- * Check if the task has a timing constraint, and if so determine where to insert it in our
+ * Check if the job has a timing constraint, and if so determine where to insert it in our
* list.
*/
@Override
- public synchronized void maybeStartTrackingTask(TaskStatus task) {
- if (task.hasTimingDelayConstraint() || task.hasDeadlineConstraint()) {
- maybeStopTrackingTask(task);
- ListIterator<TaskStatus> it = mTrackedTasks.listIterator(mTrackedTasks.size());
+ public synchronized void maybeStartTrackingJob(JobStatus job) {
+ if (job.hasTimingDelayConstraint() || job.hasDeadlineConstraint()) {
+ maybeStopTrackingJob(job);
+ ListIterator<JobStatus> it = mTrackedJobs.listIterator(mTrackedJobs.size());
while (it.hasPrevious()) {
- TaskStatus ts = it.previous();
- if (ts.getLatestRunTimeElapsed() < task.getLatestRunTimeElapsed()) {
+ JobStatus ts = it.previous();
+ if (ts.getLatestRunTimeElapsed() < job.getLatestRunTimeElapsed()) {
// Insert
break;
}
}
- it.add(task);
+ it.add(job);
maybeUpdateAlarms(
- task.hasTimingDelayConstraint() ? task.getEarliestRunTime() : Long.MAX_VALUE,
- task.hasDeadlineConstraint() ? task.getLatestRunTimeElapsed() : Long.MAX_VALUE);
+ job.hasTimingDelayConstraint() ? job.getEarliestRunTime() : Long.MAX_VALUE,
+ job.hasDeadlineConstraint() ? job.getLatestRunTimeElapsed() : Long.MAX_VALUE);
}
}
/**
- * When we stop tracking a task, we only need to update our alarms if the task we're no longer
+ * When we stop tracking a job, we only need to update our alarms if the job we're no longer
* tracking was the one our alarms were based off of.
* Really an == comparison should be enough, but why play with fate? We'll do <=.
*/
@Override
- public synchronized void maybeStopTrackingTask(TaskStatus taskStatus) {
- if (mTrackedTasks.remove(taskStatus)) {
+ public synchronized void maybeStopTrackingJob(JobStatus job) {
+ if (mTrackedJobs.remove(job)) {
checkExpiredDelaysAndResetAlarm();
checkExpiredDeadlinesAndResetAlarm();
}
}
/**
- * Determines whether this controller can stop tracking the given task.
- * The controller is no longer interested in a task once its time constraint is satisfied, and
- * the task's deadline is fulfilled - unlike other controllers a time constraint can't toggle
+ * Determines whether this controller can stop tracking the given job.
+ * The controller is no longer interested in a job once its time constraint is satisfied, and
+ * the job's deadline is fulfilled - unlike other controllers a time constraint can't toggle
* back and forth.
*/
- private boolean canStopTrackingTask(TaskStatus taskStatus) {
- return (!taskStatus.hasTimingDelayConstraint() ||
- taskStatus.timeDelayConstraintSatisfied.get()) &&
- (!taskStatus.hasDeadlineConstraint() ||
- taskStatus.deadlineConstraintSatisfied.get());
+ private boolean canStopTrackingJob(JobStatus job) {
+ return (!job.hasTimingDelayConstraint() ||
+ job.timeDelayConstraintSatisfied.get()) &&
+ (!job.hasDeadlineConstraint() ||
+ job.deadlineConstraintSatisfied.get());
}
private void ensureAlarmService() {
@@ -141,27 +141,27 @@ public class TimeController extends StateController {
}
/**
- * Checks list of tasks for ones that have an expired deadline, sending them to the TaskManager
+ * Checks list of jobs for ones that have an expired deadline, sending them to the JobScheduler
* if so, removing them from this list, and updating the alarm for the next expiry time.
*/
private synchronized void checkExpiredDeadlinesAndResetAlarm() {
long nextExpiryTime = Long.MAX_VALUE;
final long nowElapsedMillis = SystemClock.elapsedRealtime();
- Iterator<TaskStatus> it = mTrackedTasks.iterator();
+ Iterator<JobStatus> it = mTrackedJobs.iterator();
while (it.hasNext()) {
- TaskStatus ts = it.next();
- if (!ts.hasDeadlineConstraint()) {
+ JobStatus job = it.next();
+ if (!job.hasDeadlineConstraint()) {
continue;
}
- final long taskDeadline = ts.getLatestRunTimeElapsed();
+ final long jobDeadline = job.getLatestRunTimeElapsed();
- if (taskDeadline <= nowElapsedMillis) {
- ts.deadlineConstraintSatisfied.set(true);
- mStateChangedListener.onRunTaskNow(ts);
+ if (jobDeadline <= nowElapsedMillis) {
+ job.deadlineConstraintSatisfied.set(true);
+ mStateChangedListener.onRunJobNow(job);
it.remove();
} else { // Sorted by expiry time, so take the next one and stop.
- nextExpiryTime = taskDeadline;
+ nextExpiryTime = jobDeadline;
break;
}
}
@@ -169,31 +169,31 @@ public class TimeController extends StateController {
}
/**
- * Handles alarm that notifies us that a task's delay has expired. Iterates through the list of
- * tracked tasks and marks them as ready as appropriate.
+ * Handles alarm that notifies us that a job's delay has expired. Iterates through the list of
+ * tracked jobs and marks them as ready as appropriate.
*/
private synchronized void checkExpiredDelaysAndResetAlarm() {
final long nowElapsedMillis = SystemClock.elapsedRealtime();
long nextDelayTime = Long.MAX_VALUE;
boolean ready = false;
- Iterator<TaskStatus> it = mTrackedTasks.iterator();
+ Iterator<JobStatus> it = mTrackedJobs.iterator();
while (it.hasNext()) {
- final TaskStatus ts = it.next();
- if (!ts.hasTimingDelayConstraint()) {
+ final JobStatus job = it.next();
+ if (!job.hasTimingDelayConstraint()) {
continue;
}
- final long taskDelayTime = ts.getEarliestRunTime();
- if (taskDelayTime <= nowElapsedMillis) {
- ts.timeDelayConstraintSatisfied.set(true);
- if (canStopTrackingTask(ts)) {
+ final long jobDelayTime = job.getEarliestRunTime();
+ if (jobDelayTime <= nowElapsedMillis) {
+ job.timeDelayConstraintSatisfied.set(true);
+ if (canStopTrackingJob(job)) {
it.remove();
}
- if (ts.isReady()) {
+ if (job.isReady()) {
ready = true;
}
} else { // Keep going through list to get next delay time.
- if (nextDelayTime > taskDelayTime) {
- nextDelayTime = taskDelayTime;
+ if (nextDelayTime > jobDelayTime) {
+ nextDelayTime = jobDelayTime;
}
}
}
@@ -207,13 +207,13 @@ public class TimeController extends StateController {
if (delayExpiredElapsed < mNextDelayExpiredElapsedMillis) {
setDelayExpiredAlarm(delayExpiredElapsed);
}
- if (deadlineExpiredElapsed < mNextTaskExpiredElapsedMillis) {
+ if (deadlineExpiredElapsed < mNextJobExpiredElapsedMillis) {
setDeadlineExpiredAlarm(deadlineExpiredElapsed);
}
}
/**
- * Set an alarm with the {@link android.app.AlarmManager} for the next time at which a task's
+ * Set an alarm with the {@link android.app.AlarmManager} for the next time at which a job's
* delay will expire.
* This alarm <b>will not</b> wake up the phone.
*/
@@ -228,7 +228,7 @@ public class TimeController extends StateController {
}
/**
- * Set an alarm with the {@link android.app.AlarmManager} for the next time at which a task's
+ * Set an alarm with the {@link android.app.AlarmManager} for the next time at which a job's
* deadline will expire.
* This alarm <b>will</b> wake up the phone.
*/
@@ -238,8 +238,8 @@ public class TimeController extends StateController {
if (alarmTimeElapsedMillis < earliestWakeupTimeElapsed) {
alarmTimeElapsedMillis = earliestWakeupTimeElapsed;
}
- mNextTaskExpiredElapsedMillis = alarmTimeElapsedMillis;
- updateAlarmWithPendingIntent(mDeadlineExpiredAlarmIntent, mNextTaskExpiredElapsedMillis);
+ mNextJobExpiredElapsedMillis = alarmTimeElapsedMillis;
+ updateAlarmWithPendingIntent(mDeadlineExpiredAlarmIntent, mNextJobExpiredElapsedMillis);
}
private void updateAlarmWithPendingIntent(PendingIntent pi, long alarmTimeElapsed) {
@@ -260,11 +260,11 @@ public class TimeController extends StateController {
if (DEBUG) {
Slog.d(TAG, "Just received alarm: " + intent.getAction());
}
- // An task has just expired, so we run through the list of tasks that we have and
+ // A job has just expired, so we run through the list of jobs that we have and
// notify our StateChangedListener.
- if (ACTION_TASK_EXPIRED.equals(intent.getAction())) {
+ if (ACTION_JOB_EXPIRED.equals(intent.getAction())) {
checkExpiredDeadlinesAndResetAlarm();
- } else if (ACTION_TASK_DELAY_EXPIRED.equals(intent.getAction())) {
+ } else if (ACTION_JOB_DELAY_EXPIRED.equals(intent.getAction())) {
checkExpiredDelaysAndResetAlarm();
}
}
@@ -276,10 +276,10 @@ public class TimeController extends StateController {
pw.println("Alarms (" + SystemClock.elapsedRealtime() + ")");
pw.println(
"Next delay alarm in " + (mNextDelayExpiredElapsedMillis - nowElapsed)/1000 + "s");
- pw.println("Next deadline alarm in " + (mNextTaskExpiredElapsedMillis - nowElapsed)/1000
+ pw.println("Next deadline alarm in " + (mNextJobExpiredElapsedMillis - nowElapsed)/1000
+ "s");
pw.println("Tracking:");
- for (TaskStatus ts : mTrackedTasks) {
+ for (JobStatus ts : mTrackedJobs) {
pw.println(String.valueOf(ts.hashCode()).substring(0, 3) + ".."
+ ": (" + (ts.hasTimingDelayConstraint() ? ts.getEarliestRunTime() : "N/A")
+ ", " + (ts.hasDeadlineConstraint() ?ts.getLatestRunTimeElapsed() : "N/A")
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 386402b..06732ca 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -188,6 +188,8 @@ public class NotificationManagerService extends SystemService {
private AppOpsManager mAppOps;
+ private Archive mArchive;
+
// Notification control database. For now just contains disabled packages.
private AtomicFile mPolicyFile;
private HashSet<String> mBlockedPackages = new HashSet<String>();
@@ -223,10 +225,12 @@ public class NotificationManagerService extends SystemService {
private static final int REASON_LISTENER_CANCEL_ALL = 11;
private static class Archive {
- static final int BUFFER_SIZE = 250;
- ArrayDeque<StatusBarNotification> mBuffer = new ArrayDeque<StatusBarNotification>(BUFFER_SIZE);
+ final int mBufferSize;
+ final ArrayDeque<StatusBarNotification> mBuffer;
- public Archive() {
+ public Archive(int size) {
+ mBufferSize = size;
+ mBuffer = new ArrayDeque<StatusBarNotification>(mBufferSize);
}
public String toString() {
@@ -240,7 +244,7 @@ public class NotificationManagerService extends SystemService {
}
public void record(StatusBarNotification nr) {
- if (mBuffer.size() == BUFFER_SIZE) {
+ if (mBuffer.size() == mBufferSize) {
mBuffer.removeFirst();
}
@@ -250,7 +254,6 @@ public class NotificationManagerService extends SystemService {
mBuffer.addLast(nr.cloneLight());
}
-
public void clear() {
mBuffer.clear();
}
@@ -300,7 +303,7 @@ public class NotificationManagerService extends SystemService {
}
public StatusBarNotification[] getArray(int count) {
- if (count == 0) count = Archive.BUFFER_SIZE;
+ if (count == 0) count = mBufferSize;
final StatusBarNotification[] a
= new StatusBarNotification[Math.min(count, mBuffer.size())];
Iterator<StatusBarNotification> iter = descendingIterator();
@@ -312,7 +315,7 @@ public class NotificationManagerService extends SystemService {
}
public StatusBarNotification[] getArray(int count, String pkg, int userId) {
- if (count == 0) count = Archive.BUFFER_SIZE;
+ if (count == 0) count = mBufferSize;
final StatusBarNotification[] a
= new StatusBarNotification[Math.min(count, mBuffer.size())];
Iterator<StatusBarNotification> iter = filter(descendingIterator(), pkg, userId);
@@ -325,8 +328,6 @@ public class NotificationManagerService extends SystemService {
}
- Archive mArchive = new Archive();
-
private void loadPolicyFile() {
synchronized(mPolicyFile) {
mBlockedPackages.clear();
@@ -854,6 +855,9 @@ public class NotificationManagerService extends SystemService {
}
}
+ mArchive = new Archive(resources.getInteger(
+ R.integer.config_notificationServiceArchiveSize));
+
publishBinderService(Context.NOTIFICATION_SERVICE, mService);
publishLocalService(NotificationManagerInternal.class, mInternalService);
}
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 8585b4e..6cfcbdc 100755
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -4991,6 +4991,7 @@ public class PackageManagerService extends IPackageManager.Stub {
mResolveActivity.packageName = mAndroidApplication.packageName;
mResolveActivity.processName = "system:ui";
mResolveActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
+ mResolveActivity.documentLaunchMode = ActivityInfo.DOCUMENT_LAUNCH_NEVER;
mResolveActivity.flags = ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
mResolveActivity.theme = R.style.Theme_Holo_Dialog_Alert;
mResolveActivity.exported = true;
diff --git a/services/core/java/com/android/server/power/PowerManagerService.java b/services/core/java/com/android/server/power/PowerManagerService.java
index d8671d9..fb4b8f0 100644
--- a/services/core/java/com/android/server/power/PowerManagerService.java
+++ b/services/core/java/com/android/server/power/PowerManagerService.java
@@ -409,6 +409,9 @@ public final class PowerManagerService extends com.android.server.SystemService
// Current state of the low power mode setting.
private boolean mLowPowerModeSetting;
+ // Current state of whether the settings are allowing auto low power mode.
+ private boolean mAutoLowPowerModeEnabled;
+
// True if the battery level is currently considered low.
private boolean mBatteryLevelLow;
@@ -558,6 +561,9 @@ public final class PowerManagerService extends com.android.server.SystemService
resolver.registerContentObserver(Settings.Global.getUriFor(
Settings.Global.LOW_POWER_MODE),
false, mSettingsObserver, UserHandle.USER_ALL);
+ resolver.registerContentObserver(Settings.Global.getUriFor(
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL),
+ false, mSettingsObserver, UserHandle.USER_ALL);
// Go.
readConfigurationLocked();
updateSettingsLocked();
@@ -645,8 +651,12 @@ public final class PowerManagerService extends com.android.server.SystemService
final boolean lowPowerModeEnabled = Settings.Global.getInt(resolver,
Settings.Global.LOW_POWER_MODE, 0) != 0;
- if (lowPowerModeEnabled != mLowPowerModeSetting) {
+ final boolean autoLowPowerModeEnabled = Settings.Global.getInt(resolver,
+ Settings.Global.LOW_POWER_MODE_TRIGGER_LEVEL, 15) != 0;
+ if (lowPowerModeEnabled != mLowPowerModeSetting
+ || autoLowPowerModeEnabled != mAutoLowPowerModeEnabled) {
mLowPowerModeSetting = lowPowerModeEnabled;
+ mAutoLowPowerModeEnabled = autoLowPowerModeEnabled;
updateLowPowerModeLocked();
}
@@ -654,7 +664,8 @@ public final class PowerManagerService extends com.android.server.SystemService
}
void updateLowPowerModeLocked() {
- final boolean lowPowerModeEnabled = mLowPowerModeSetting || mBatteryLevelLow;
+ final boolean lowPowerModeEnabled = !mIsPowered
+ && (mLowPowerModeSetting || (mAutoLowPowerModeEnabled && mBatteryLevelLow));
if (mLowPowerModeEnabled != lowPowerModeEnabled) {
mLowPowerModeEnabled = lowPowerModeEnabled;
powerHintInternal(POWER_HINT_LOW_POWER_MODE, lowPowerModeEnabled ? 1 : 0);
@@ -1197,7 +1208,7 @@ public final class PowerManagerService extends com.android.server.SystemService
}
}
- if (oldLevelLow != mBatteryLevelLow) {
+ if (wasPowered != mIsPowered || oldLevelLow != mBatteryLevelLow) {
updateLowPowerModeLocked();
}
}
@@ -2168,6 +2179,8 @@ public final class PowerManagerService extends com.android.server.SystemService
pw.println(" mRequestWaitForNegativeProximity=" + mRequestWaitForNegativeProximity);
pw.println(" mSandmanScheduled=" + mSandmanScheduled);
pw.println(" mSandmanSummoned=" + mSandmanSummoned);
+ pw.println(" mLowPowerModeEnabled=" + mLowPowerModeEnabled);
+ pw.println(" mBatteryLevelLow=" + mBatteryLevelLow);
pw.println(" mLastWakeTime=" + TimeUtils.formatUptime(mLastWakeTime));
pw.println(" mLastSleepTime=" + TimeUtils.formatUptime(mLastSleepTime));
pw.println(" mLastUserActivityTime=" + TimeUtils.formatUptime(mLastUserActivityTime));
@@ -2204,6 +2217,8 @@ public final class PowerManagerService extends com.android.server.SystemService
pw.println(" mDreamsEnabledSetting=" + mDreamsEnabledSetting);
pw.println(" mDreamsActivateOnSleepSetting=" + mDreamsActivateOnSleepSetting);
pw.println(" mDreamsActivateOnDockSetting=" + mDreamsActivateOnDockSetting);
+ pw.println(" mLowPowerModeSetting=" + mLowPowerModeSetting);
+ pw.println(" mAutoLowPowerModeEnabled=" + mAutoLowPowerModeEnabled);
pw.println(" mMinimumScreenOffTimeoutConfig=" + mMinimumScreenOffTimeoutConfig);
pw.println(" mMaximumScreenDimDurationConfig=" + mMaximumScreenDimDurationConfig);
pw.println(" mMaximumScreenDimRatioConfig=" + mMaximumScreenDimRatioConfig);
diff --git a/services/core/java/com/android/server/task/TaskManagerService.java b/services/core/java/com/android/server/task/TaskManagerService.java
deleted file mode 100644
index 0c55a1d..0000000
--- a/services/core/java/com/android/server/task/TaskManagerService.java
+++ /dev/null
@@ -1,764 +0,0 @@
-/*
- * 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.server.task;
-
-import java.io.FileDescriptor;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import android.app.task.ITaskManager;
-import android.app.task.Task;
-import android.app.task.TaskManager;
-import android.content.BroadcastReceiver;
-import android.app.task.TaskService;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.ServiceInfo;
-import android.os.Binder;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.os.RemoteException;
-import android.os.SystemClock;
-import android.os.UserHandle;
-import android.util.Slog;
-import android.util.SparseArray;
-
-import com.android.server.task.controllers.BatteryController;
-import com.android.server.task.controllers.ConnectivityController;
-import com.android.server.task.controllers.IdleController;
-import com.android.server.task.controllers.StateController;
-import com.android.server.task.controllers.TaskStatus;
-import com.android.server.task.controllers.TimeController;
-
-import java.util.LinkedList;
-
-/**
- * Responsible for taking tasks representing work to be performed by a client app, and determining
- * based on the criteria specified when that task should be run against the client application's
- * endpoint.
- * Implements logic for scheduling, and rescheduling tasks. The TaskManagerService knows nothing
- * about constraints, or the state of active tasks. It receives callbacks from the various
- * controllers and completed tasks and operates accordingly.
- *
- * Note on locking: Any operations that manipulate {@link #mTasks} need to lock on that object.
- * Any function with the suffix 'Locked' also needs to lock on {@link #mTasks}.
- * @hide
- */
-public class TaskManagerService extends com.android.server.SystemService
- implements StateChangedListener, TaskCompletedListener, TaskMapReadFinishedListener {
- // TODO: Switch this off for final version.
- static final boolean DEBUG = true;
- /** The number of concurrent tasks we run at one time. */
- private static final int MAX_TASK_CONTEXTS_COUNT = 3;
- static final String TAG = "TaskManager";
- /** Master list of tasks. */
- private final TaskStore mTasks;
-
- static final int MSG_TASK_EXPIRED = 0;
- static final int MSG_CHECK_TASKS = 1;
-
- // Policy constants
- /**
- * Minimum # of idle tasks that must be ready in order to force the TM to schedule things
- * early.
- */
- private static final int MIN_IDLE_COUNT = 1;
- /**
- * Minimum # of connectivity tasks that must be ready in order to force the TM to schedule
- * things early.
- */
- private static final int MIN_CONNECTIVITY_COUNT = 2;
- /**
- * Minimum # of tasks (with no particular constraints) for which the TM will be happy running
- * some work early.
- */
- private static final int MIN_READY_TASKS_COUNT = 4;
-
- /**
- * Track Services that have currently active or pending tasks. The index is provided by
- * {@link TaskStatus#getServiceToken()}
- */
- private final List<TaskServiceContext> mActiveServices = new LinkedList<TaskServiceContext>();
- /** List of controllers that will notify this service of updates to tasks. */
- private List<StateController> mControllers;
- /**
- * Queue of pending tasks. The TaskServiceContext class will receive tasks from this list
- * when ready to execute them.
- */
- private final LinkedList<TaskStatus> mPendingTasks = new LinkedList<TaskStatus>();
-
- private final TaskHandler mHandler;
- private final TaskManagerStub mTaskManagerStub;
- /**
- * Cleans up outstanding jobs when a package is removed. Even if it's being replaced later we
- * still clean up. On reinstall the package will have a new uid.
- */
- private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- Slog.d(TAG, "Receieved: " + intent.getAction());
- if (Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
- int uidRemoved = intent.getIntExtra(Intent.EXTRA_UID, -1);
- if (DEBUG) {
- Slog.d(TAG, "Removing jobs for uid: " + uidRemoved);
- }
- cancelTasksForUid(uidRemoved);
- } else if (Intent.ACTION_USER_REMOVED.equals(intent.getAction())) {
- final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, 0);
- if (DEBUG) {
- Slog.d(TAG, "Removing jobs for user: " + userId);
- }
- cancelTasksForUser(userId);
- }
- }
- };
-
- /**
- * Entry point from client to schedule the provided task.
- * This cancels the task if it's already been scheduled, and replaces it with the one provided.
- * @param task Task object containing execution parameters
- * @param uId The package identifier of the application this task is for.
- * @param canPersistTask Whether or not the client has the appropriate permissions for
- * persisting this task.
- * @return Result of this operation. See <code>TaskManager#RESULT_*</code> return codes.
- */
- public int schedule(Task task, int uId, boolean canPersistTask) {
- TaskStatus taskStatus = new TaskStatus(task, uId, canPersistTask);
- cancelTask(uId, task.getId());
- startTrackingTask(taskStatus);
- return TaskManager.RESULT_SUCCESS;
- }
-
- public List<Task> getPendingTasks(int uid) {
- ArrayList<Task> outList = new ArrayList<Task>();
- synchronized (mTasks) {
- for (TaskStatus ts : mTasks.getTasks()) {
- if (ts.getUid() == uid) {
- outList.add(ts.getTask());
- }
- }
- }
- return outList;
- }
-
- private void cancelTasksForUser(int userHandle) {
- synchronized (mTasks) {
- List<TaskStatus> tasksForUser = mTasks.getTasksByUser(userHandle);
- for (TaskStatus toRemove : tasksForUser) {
- if (DEBUG) {
- Slog.d(TAG, "Cancelling: " + toRemove);
- }
- cancelTaskLocked(toRemove);
- }
- }
- }
-
- /**
- * Entry point from client to cancel all tasks originating from their uid.
- * This will remove the task from the master list, and cancel the task if it was staged for
- * execution or being executed.
- * @param uid To check against for removal of a task.
- */
- public void cancelTasksForUid(int uid) {
- // Remove from master list.
- synchronized (mTasks) {
- List<TaskStatus> tasksForUid = mTasks.getTasksByUid(uid);
- for (TaskStatus toRemove : tasksForUid) {
- if (DEBUG) {
- Slog.d(TAG, "Cancelling: " + toRemove);
- }
- cancelTaskLocked(toRemove);
- }
- }
- }
-
- /**
- * Entry point from client to cancel the task corresponding to the taskId provided.
- * This will remove the task from the master list, and cancel the task if it was staged for
- * execution or being executed.
- * @param uid Uid of the calling client.
- * @param taskId Id of the task, provided at schedule-time.
- */
- public void cancelTask(int uid, int taskId) {
- TaskStatus toCancel;
- synchronized (mTasks) {
- toCancel = mTasks.getTaskByUidAndTaskId(uid, taskId);
- if (toCancel != null) {
- cancelTaskLocked(toCancel);
- }
- }
- }
-
- private void cancelTaskLocked(TaskStatus cancelled) {
- // Remove from store.
- stopTrackingTask(cancelled);
- // Remove from pending queue.
- mPendingTasks.remove(cancelled);
- // Cancel if running.
- stopTaskOnServiceContextLocked(cancelled);
- }
-
- /**
- * Initializes the system service.
- * <p>
- * Subclasses must define a single argument constructor that accepts the context
- * and passes it to super.
- * </p>
- *
- * @param context The system server context.
- */
- public TaskManagerService(Context context) {
- super(context);
- // Create the controllers.
- mControllers = new LinkedList<StateController>();
- mControllers.add(ConnectivityController.get(this));
- mControllers.add(TimeController.get(this));
- mControllers.add(IdleController.get(this));
- mControllers.add(BatteryController.get(this));
-
- mHandler = new TaskHandler(context.getMainLooper());
- mTaskManagerStub = new TaskManagerStub();
- // Create the "runners".
- for (int i = 0; i < MAX_TASK_CONTEXTS_COUNT; i++) {
- mActiveServices.add(
- new TaskServiceContext(this, context.getMainLooper()));
- }
- mTasks = TaskStore.initAndGet(this);
- }
-
- @Override
- public void onStart() {
- publishBinderService(Context.TASK_SERVICE, mTaskManagerStub);
- }
-
- @Override
- public void onBootPhase(int phase) {
- if (PHASE_SYSTEM_SERVICES_READY == phase) {
- // Register br for package removals and user removals.
- final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_REMOVED);
- filter.addDataScheme("package");
- getContext().registerReceiverAsUser(
- mBroadcastReceiver, UserHandle.ALL, filter, null, null);
- final IntentFilter userFilter = new IntentFilter(Intent.ACTION_USER_REMOVED);
- getContext().registerReceiverAsUser(
- mBroadcastReceiver, UserHandle.ALL, userFilter, null, null);
- }
- }
-
- /**
- * Called when we have a task status object that we need to insert in our
- * {@link com.android.server.task.TaskStore}, and make sure all the relevant controllers know
- * about.
- */
- private void startTrackingTask(TaskStatus taskStatus) {
- boolean update;
- synchronized (mTasks) {
- update = mTasks.add(taskStatus);
- }
- for (StateController controller : mControllers) {
- if (update) {
- controller.maybeStopTrackingTask(taskStatus);
- }
- controller.maybeStartTrackingTask(taskStatus);
- }
- }
-
- /**
- * Called when we want to remove a TaskStatus object that we've finished executing. Returns the
- * object removed.
- */
- private boolean stopTrackingTask(TaskStatus taskStatus) {
- boolean removed;
- synchronized (mTasks) {
- // Remove from store as well as controllers.
- removed = mTasks.remove(taskStatus);
- }
- if (removed) {
- for (StateController controller : mControllers) {
- controller.maybeStopTrackingTask(taskStatus);
- }
- }
- return removed;
- }
-
- private boolean stopTaskOnServiceContextLocked(TaskStatus ts) {
- for (TaskServiceContext tsc : mActiveServices) {
- final TaskStatus executing = tsc.getRunningTask();
- if (executing != null && executing.matches(ts.getUid(), ts.getTaskId())) {
- tsc.cancelExecutingTask();
- return true;
- }
- }
- return false;
- }
-
- /**
- * @param ts TaskStatus we are querying against.
- * @return Whether or not the task represented by the status object is currently being run or
- * is pending.
- */
- private boolean isCurrentlyActiveLocked(TaskStatus ts) {
- for (TaskServiceContext serviceContext : mActiveServices) {
- final TaskStatus running = serviceContext.getRunningTask();
- if (running != null && running.matches(ts.getUid(), ts.getTaskId())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * A task is rescheduled with exponential back-off if the client requests this from their
- * execution logic.
- * A caveat is for idle-mode tasks, for which the idle-mode constraint will usurp the
- * timeliness of the reschedule. For an idle-mode task, no deadline is given.
- * @param failureToReschedule Provided task status that we will reschedule.
- * @return A newly instantiated TaskStatus with the same constraints as the last task except
- * with adjusted timing constraints.
- */
- private TaskStatus getRescheduleTaskForFailure(TaskStatus failureToReschedule) {
- final long elapsedNowMillis = SystemClock.elapsedRealtime();
- final Task task = failureToReschedule.getTask();
-
- final long initialBackoffMillis = task.getInitialBackoffMillis();
- final int backoffAttempt = failureToReschedule.getNumFailures() + 1;
- long newEarliestRuntimeElapsed = elapsedNowMillis;
-
- switch (task.getBackoffPolicy()) {
- case Task.BackoffPolicy.LINEAR:
- newEarliestRuntimeElapsed += initialBackoffMillis * backoffAttempt;
- break;
- default:
- if (DEBUG) {
- Slog.v(TAG, "Unrecognised back-off policy, defaulting to exponential.");
- }
- case Task.BackoffPolicy.EXPONENTIAL:
- newEarliestRuntimeElapsed +=
- Math.pow(initialBackoffMillis * 0.001, backoffAttempt) * 1000;
- break;
- }
- newEarliestRuntimeElapsed =
- Math.min(newEarliestRuntimeElapsed, Task.MAX_BACKOFF_DELAY_MILLIS);
- return new TaskStatus(failureToReschedule, newEarliestRuntimeElapsed,
- TaskStatus.NO_LATEST_RUNTIME, backoffAttempt);
- }
-
- /**
- * Called after a periodic has executed so we can to re-add it. We take the last execution time
- * of the task to be the time of completion (i.e. the time at which this function is called).
- * This could be inaccurate b/c the task can run for as long as
- * {@link com.android.server.task.TaskServiceContext#EXECUTING_TIMESLICE_MILLIS}, but will lead
- * to underscheduling at least, rather than if we had taken the last execution time to be the
- * start of the execution.
- * @return A new task representing the execution criteria for this instantiation of the
- * recurring task.
- */
- private TaskStatus getRescheduleTaskForPeriodic(TaskStatus periodicToReschedule) {
- final long elapsedNow = SystemClock.elapsedRealtime();
- // Compute how much of the period is remaining.
- long runEarly = Math.max(periodicToReschedule.getLatestRunTimeElapsed() - elapsedNow, 0);
- long newEarliestRunTimeElapsed = elapsedNow + runEarly;
- long period = periodicToReschedule.getTask().getIntervalMillis();
- long newLatestRuntimeElapsed = newEarliestRunTimeElapsed + period;
-
- if (DEBUG) {
- Slog.v(TAG, "Rescheduling executed periodic. New execution window [" +
- newEarliestRunTimeElapsed/1000 + ", " + newLatestRuntimeElapsed/1000 + "]s");
- }
- return new TaskStatus(periodicToReschedule, newEarliestRunTimeElapsed,
- newLatestRuntimeElapsed, 0 /* backoffAttempt */);
- }
-
- // TaskCompletedListener implementations.
-
- /**
- * A task just finished executing. We fetch the
- * {@link com.android.server.task.controllers.TaskStatus} from the store and depending on
- * whether we want to reschedule we readd it to the controllers.
- * @param taskStatus Completed task.
- * @param needsReschedule Whether the implementing class should reschedule this task.
- */
- @Override
- public void onTaskCompleted(TaskStatus taskStatus, boolean needsReschedule) {
- if (DEBUG) {
- Slog.d(TAG, "Completed " + taskStatus + ", reschedule=" + needsReschedule);
- }
- if (!stopTrackingTask(taskStatus)) {
- if (DEBUG) {
- Slog.e(TAG, "Error removing task: could not find task to remove. Was task " +
- "removed while executing?");
- }
- return;
- }
- if (needsReschedule) {
- TaskStatus rescheduled = getRescheduleTaskForFailure(taskStatus);
- startTrackingTask(rescheduled);
- } else if (taskStatus.getTask().isPeriodic()) {
- TaskStatus rescheduledPeriodic = getRescheduleTaskForPeriodic(taskStatus);
- startTrackingTask(rescheduledPeriodic);
- }
- mHandler.obtainMessage(MSG_CHECK_TASKS).sendToTarget();
- }
-
- // StateChangedListener implementations.
-
- /**
- * Off-board work to our handler thread as quickly as possible, b/c this call is probably being
- * made on the main thread.
- * For now this takes the task and if it's ready to run it will run it. In future we might not
- * provide the task, so that the StateChangedListener has to run through its list of tasks to
- * see which are ready. This will further decouple the controllers from the execution logic.
- */
- @Override
- public void onControllerStateChanged() {
- // Post a message to to run through the list of tasks and start/stop any that are eligible.
- mHandler.obtainMessage(MSG_CHECK_TASKS).sendToTarget();
- }
-
- @Override
- public void onRunTaskNow(TaskStatus taskStatus) {
- mHandler.obtainMessage(MSG_TASK_EXPIRED, taskStatus).sendToTarget();
- }
-
- /**
- * Disk I/O is finished, take the list of tasks we read from disk and add them to our
- * {@link TaskStore}.
- * This is run on the {@link com.android.server.IoThread} instance, which is a separate thread,
- * and is called once at boot.
- */
- @Override
- public void onTaskMapReadFinished(List<TaskStatus> tasks) {
- synchronized (mTasks) {
- for (TaskStatus ts : tasks) {
- if (mTasks.containsTaskIdForUid(ts.getTaskId(), ts.getUid())) {
- // An app with BOOT_COMPLETED *might* have decided to reschedule their task, in
- // the same amount of time it took us to read it from disk. If this is the case
- // we leave it be.
- continue;
- }
- startTrackingTask(ts);
- }
- }
- }
-
- private class TaskHandler extends Handler {
-
- public TaskHandler(Looper looper) {
- super(looper);
- }
-
- @Override
- public void handleMessage(Message message) {
- switch (message.what) {
- case MSG_TASK_EXPIRED:
- synchronized (mTasks) {
- TaskStatus runNow = (TaskStatus) message.obj;
- if (!mPendingTasks.contains(runNow)) {
- mPendingTasks.add(runNow);
- }
- }
- queueReadyTasksForExecutionH();
- break;
- case MSG_CHECK_TASKS:
- // Check the list of tasks and run some of them if we feel inclined.
- maybeQueueReadyTasksForExecutionH();
- break;
- }
- maybeRunPendingTasksH();
- // Don't remove TASK_EXPIRED in case one came along while processing the queue.
- removeMessages(MSG_CHECK_TASKS);
- }
-
- /**
- * Run through list of tasks and execute all possible - at least one is expired so we do
- * as many as we can.
- */
- private void queueReadyTasksForExecutionH() {
- synchronized (mTasks) {
- for (TaskStatus ts : mTasks.getTasks()) {
- if (isReadyToBeExecutedLocked(ts)) {
- mPendingTasks.add(ts);
- } else if (isReadyToBeCancelledLocked(ts)) {
- stopTaskOnServiceContextLocked(ts);
- }
- }
- }
- }
-
- /**
- * The state of at least one task has changed. Here is where we could enforce various
- * policies on when we want to execute tasks.
- * Right now the policy is such:
- * If >1 of the ready tasks is idle mode we send all of them off
- * if more than 2 network connectivity tasks are ready we send them all off.
- * If more than 4 tasks total are ready we send them all off.
- * TODO: It would be nice to consolidate these sort of high-level policies somewhere.
- */
- private void maybeQueueReadyTasksForExecutionH() {
- synchronized (mTasks) {
- int idleCount = 0;
- int backoffCount = 0;
- int connectivityCount = 0;
- List<TaskStatus> runnableTasks = new ArrayList<TaskStatus>();
- for (TaskStatus ts : mTasks.getTasks()) {
- if (isReadyToBeExecutedLocked(ts)) {
- if (ts.getNumFailures() > 0) {
- backoffCount++;
- }
- if (ts.hasIdleConstraint()) {
- idleCount++;
- }
- if (ts.hasConnectivityConstraint() || ts.hasUnmeteredConstraint()) {
- connectivityCount++;
- }
- runnableTasks.add(ts);
- } else if (isReadyToBeCancelledLocked(ts)) {
- stopTaskOnServiceContextLocked(ts);
- }
- }
- if (backoffCount > 0 || idleCount >= MIN_IDLE_COUNT ||
- connectivityCount >= MIN_CONNECTIVITY_COUNT ||
- runnableTasks.size() >= MIN_READY_TASKS_COUNT) {
- for (TaskStatus ts : runnableTasks) {
- mPendingTasks.add(ts);
- }
- }
- }
- }
-
- /**
- * Criteria for moving a job into the pending queue:
- * - It's ready.
- * - It's not pending.
- * - It's not already running on a TSC.
- */
- private boolean isReadyToBeExecutedLocked(TaskStatus ts) {
- return ts.isReady() && !mPendingTasks.contains(ts) && !isCurrentlyActiveLocked(ts);
- }
-
- /**
- * Criteria for cancelling an active job:
- * - It's not ready
- * - It's running on a TSC.
- */
- private boolean isReadyToBeCancelledLocked(TaskStatus ts) {
- return !ts.isReady() && isCurrentlyActiveLocked(ts);
- }
-
- /**
- * Reconcile jobs in the pending queue against available execution contexts.
- * A controller can force a task into the pending queue even if it's already running, but
- * here is where we decide whether to actually execute it.
- */
- private void maybeRunPendingTasksH() {
- synchronized (mTasks) {
- Iterator<TaskStatus> it = mPendingTasks.iterator();
- while (it.hasNext()) {
- TaskStatus nextPending = it.next();
- TaskServiceContext availableContext = null;
- for (TaskServiceContext tsc : mActiveServices) {
- final TaskStatus running = tsc.getRunningTask();
- if (running != null && running.matches(nextPending.getUid(),
- nextPending.getTaskId())) {
- // Already running this tId for this uId, skip.
- availableContext = null;
- break;
- }
- if (tsc.isAvailable()) {
- availableContext = tsc;
- }
- }
- if (availableContext != null) {
- if (!availableContext.executeRunnableTask(nextPending)) {
- if (DEBUG) {
- Slog.d(TAG, "Error executing " + nextPending);
- }
- mTasks.remove(nextPending);
- }
- it.remove();
- }
- }
- }
- }
- }
-
- /**
- * Binder stub trampoline implementation
- */
- final class TaskManagerStub extends ITaskManager.Stub {
- /** Cache determination of whether a given app can persist tasks
- * key is uid of the calling app; value is undetermined/true/false
- */
- private final SparseArray<Boolean> mPersistCache = new SparseArray<Boolean>();
-
- // Enforce that only the app itself (or shared uid participant) can schedule a
- // task that runs one of the app's services, as well as verifying that the
- // named service properly requires the BIND_TASK_SERVICE permission
- private void enforceValidJobRequest(int uid, Task job) {
- final PackageManager pm = getContext().getPackageManager();
- final ComponentName service = job.getService();
- try {
- ServiceInfo si = pm.getServiceInfo(service, 0);
- if (si.applicationInfo.uid != uid) {
- throw new IllegalArgumentException("uid " + uid +
- " cannot schedule job in " + service.getPackageName());
- }
- if (!TaskService.PERMISSION_BIND.equals(si.permission)) {
- throw new IllegalArgumentException("Scheduled service " + service
- + " does not require android.permission.BIND_TASK_SERVICE permission");
- }
- } catch (NameNotFoundException e) {
- throw new IllegalArgumentException("No such service: " + service);
- }
- }
-
- private boolean canPersistJobs(int pid, int uid) {
- // If we get this far we're good to go; all we need to do now is check
- // whether the app is allowed to persist its scheduled work.
- final boolean canPersist;
- synchronized (mPersistCache) {
- Boolean cached = mPersistCache.get(uid);
- if (cached != null) {
- canPersist = cached.booleanValue();
- } else {
- // Persisting tasks is tantamount to running at boot, so we permit
- // it when the app has declared that it uses the RECEIVE_BOOT_COMPLETED
- // permission
- int result = getContext().checkPermission(
- android.Manifest.permission.RECEIVE_BOOT_COMPLETED, pid, uid);
- canPersist = (result == PackageManager.PERMISSION_GRANTED);
- mPersistCache.put(uid, canPersist);
- }
- }
- return canPersist;
- }
-
- // ITaskManager implementation
- @Override
- public int schedule(Task task) throws RemoteException {
- if (DEBUG) {
- Slog.d(TAG, "Scheduling task: " + task);
- }
- final int pid = Binder.getCallingPid();
- final int uid = Binder.getCallingUid();
-
- enforceValidJobRequest(uid, task);
- final boolean canPersist = canPersistJobs(pid, uid);
-
- long ident = Binder.clearCallingIdentity();
- try {
- return TaskManagerService.this.schedule(task, uid, canPersist);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public List<Task> getAllPendingTasks() throws RemoteException {
- final int uid = Binder.getCallingUid();
-
- long ident = Binder.clearCallingIdentity();
- try {
- return TaskManagerService.this.getPendingTasks(uid);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public void cancelAll() throws RemoteException {
- final int uid = Binder.getCallingUid();
-
- long ident = Binder.clearCallingIdentity();
- try {
- TaskManagerService.this.cancelTasksForUid(uid);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- @Override
- public void cancel(int taskId) throws RemoteException {
- final int uid = Binder.getCallingUid();
-
- long ident = Binder.clearCallingIdentity();
- try {
- TaskManagerService.this.cancelTask(uid, taskId);
- } finally {
- Binder.restoreCallingIdentity(ident);
- }
- }
-
- /**
- * "dumpsys" infrastructure
- */
- @Override
- public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
- getContext().enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
-
- long identityToken = Binder.clearCallingIdentity();
- try {
- TaskManagerService.this.dumpInternal(pw);
- } finally {
- Binder.restoreCallingIdentity(identityToken);
- }
- }
- };
-
- void dumpInternal(PrintWriter pw) {
- synchronized (mTasks) {
- pw.println("Registered tasks:");
- if (mTasks.size() > 0) {
- for (TaskStatus ts : mTasks.getTasks()) {
- ts.dump(pw, " ");
- }
- } else {
- pw.println();
- pw.println("No tasks scheduled.");
- }
- for (StateController controller : mControllers) {
- pw.println();
- controller.dumpControllerState(pw);
- }
- pw.println();
- pw.println("Pending");
- for (TaskStatus taskStatus : mPendingTasks) {
- pw.println(taskStatus.hashCode());
- }
- pw.println();
- pw.println("Active jobs:");
- for (TaskServiceContext tsc : mActiveServices) {
- if (tsc.isAvailable()) {
- continue;
- } else {
- pw.println(tsc.getRunningTask().hashCode() + " for: " +
- (SystemClock.elapsedRealtime()
- - tsc.getExecutionStartTimeElapsed())/1000 + "s " +
- "timeout: " + tsc.getTimeoutElapsed());
- }
- }
- }
- pw.println();
- }
-}
diff --git a/services/core/java/com/android/server/trust/TrustManagerService.java b/services/core/java/com/android/server/trust/TrustManagerService.java
index 32546df..b9ef492 100644
--- a/services/core/java/com/android/server/trust/TrustManagerService.java
+++ b/services/core/java/com/android/server/trust/TrustManagerService.java
@@ -186,12 +186,16 @@ public class TrustManagerService extends SystemService {
if (resolveInfo.serviceInfo == null) continue;
String packageName = resolveInfo.serviceInfo.packageName;
+ // STOPSHIP Reenable this check once the GMS Core prebuild library has the
+ // permission.
+ /*
if (pm.checkPermission(PERMISSION_PROVIDE_AGENT, packageName)
!= PackageManager.PERMISSION_GRANTED) {
Log.w(TAG, "Skipping agent because package " + packageName
+ " does not have permission " + PERMISSION_PROVIDE_AGENT + ".");
continue;
}
+ */
ComponentName name = getComponentName(resolveInfo);
if (!enabledAgents.contains(name)) continue;
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index cfd09e5..95cfa24 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -166,6 +166,15 @@ final class AccessibilityController {
}
}
+
+ public void onSomeWindowResizedOrMoved() {
+ // Not relevant for the display magnifier.
+
+ if (mWindowsForAccessibilityObserver != null) {
+ mWindowsForAccessibilityObserver.computeChangedWindows();
+ }
+ }
+
/** NOTE: This has to be called within a surface transaction. */
public void drawMagnifiedRegionBorderIfNeededLocked() {
if (mDisplayMagnifier != null) {
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 2a5dbb4..93a763a 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -151,7 +151,6 @@ import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -1484,10 +1483,15 @@ public class WindowManagerService extends IWindowManager.Stub
if (pos >= 0) {
final AppWindowToken targetAppToken = mInputMethodTarget.mAppToken;
- if (pos < windows.size()) {
- WindowState wp = windows.get(pos);
- if (wp == mInputMethodWindow) {
- pos++;
+ // Skip windows owned by the input method.
+ if (mInputMethodWindow != null) {
+ while (pos < windows.size()) {
+ WindowState wp = windows.get(pos);
+ if (wp == mInputMethodWindow || wp.mAttachedWindow == mInputMethodWindow) {
+ pos++;
+ continue;
+ }
+ break;
}
}
if (DEBUG_INPUT_METHOD) Slog.v(TAG, "Adding " + N + " dialogs at pos=" + pos);
@@ -9223,6 +9227,13 @@ public class WindowManagerService extends IWindowManager.Stub
winAnimator.setAnimation(a);
winAnimator.mAnimDw = w.mLastFrame.left - w.mFrame.left;
winAnimator.mAnimDh = w.mLastFrame.top - w.mFrame.top;
+
+ //TODO (multidisplay): Accessibility supported only for the default display.
+ if (mAccessibilityController != null
+ && displayId == Display.DEFAULT_DISPLAY) {
+ mAccessibilityController.onSomeWindowResizedOrMoved();
+ }
+
try {
w.mClient.moved(w.mFrame.left, w.mFrame.top);
} catch (RemoteException e) {
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 4a80e3e..fe771dc 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -36,6 +36,7 @@ import android.os.Debug;
import android.os.RemoteCallbackList;
import android.os.SystemClock;
import android.util.TimeUtils;
+import android.view.Display;
import android.view.IWindowFocusObserver;
import android.view.IWindowId;
import com.android.server.input.InputWindowHandle;
@@ -1359,6 +1360,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mClient.resized(frame, overscanInsets, contentInsets, visibleInsets, reportDraw,
newConfig);
}
+
+ //TODO (multidisplay): Accessibility supported only for the default display.
+ if (mService.mAccessibilityController != null
+ && getDisplayId() == Display.DEFAULT_DISPLAY) {
+ mService.mAccessibilityController.onSomeWindowResizedOrMoved();
+ }
+
mOverscanInsetsChanged = false;
mContentInsetsChanged = false;
mVisibleInsetsChanged = false;
diff --git a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
index a734026..cbc853d 100644
--- a/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
+++ b/services/core/jni/com_android_server_hdmi_HdmiCecController.cpp
@@ -57,6 +57,12 @@ public:
int getVersion();
// Get vendor id used for vendor command.
uint32_t getVendorId();
+ // Set a flag and its value.
+ void setOption(int flag, int value);
+ // Set audio return channel status.
+ void setAudioReturnChannel(bool flag);
+ // Whether to hdmi device is connected to the given port.
+ bool isConnected(int port);
jobject getCallbacksObj() const {
return mCallbacksObj;
@@ -222,6 +228,20 @@ uint32_t HdmiCecController::getVendorId() {
return vendorId;
}
+void HdmiCecController::setOption(int flag, int value) {
+ mDevice->set_option(mDevice, flag, value);
+}
+
+// Set audio return channel status.
+void HdmiCecController::setAudioReturnChannel(bool enabled) {
+ mDevice->set_audio_return_channel(mDevice, enabled ? 1 : 0);
+}
+
+// Whether to hdmi device is connected to the given port.
+bool HdmiCecController::isConnected(int port) {
+ return mDevice->is_connected(mDevice, port) == HDMI_CONNECTED;
+}
+
// static
void HdmiCecController::onReceived(const hdmi_event_t* event, void* arg) {
@@ -326,6 +346,26 @@ static jint nativeGetVendorId(JNIEnv* env, jclass clazz, jlong controllerPtr) {
return controller->getVendorId();
}
+static void nativeSetOption(JNIEnv* env, jclass clazz, jlong controllerPtr, jint flag,
+ jint value) {
+ HdmiCecController* controller =
+ reinterpret_cast<HdmiCecController*>(controllerPtr);
+ controller->setOption(flag, value);
+}
+
+static void nativeSetAudioReturnChannel(JNIEnv* env, jclass clazz, jlong controllerPtr,
+ jboolean enabled) {
+ HdmiCecController* controller =
+ reinterpret_cast<HdmiCecController*>(controllerPtr);
+ controller->setAudioReturnChannel(enabled == JNI_TRUE);
+}
+
+static jboolean nativeIsConnected(JNIEnv* env, jclass clazz, jlong controllerPtr, jint port) {
+ HdmiCecController* controller =
+ reinterpret_cast<HdmiCecController*>(controllerPtr);
+ return controller->isConnected(port) ? JNI_TRUE : JNI_FALSE ;
+}
+
static JNINativeMethod sMethods[] = {
/* name, signature, funcPtr */
{ "nativeInit",
@@ -337,6 +377,9 @@ static JNINativeMethod sMethods[] = {
{ "nativeGetPhysicalAddress", "(J)I", (void *) nativeGetPhysicalAddress },
{ "nativeGetVersion", "(J)I", (void *) nativeGetVersion },
{ "nativeGetVendorId", "(J)I", (void *) nativeGetVendorId },
+ { "nativeSetOption", "(JII)V", (void *) nativeSetOption },
+ { "nativeSetAudioReturnChannel", "(JZ)V", (void *) nativeSetAudioReturnChannel },
+ { "nativeIsConnected", "(JI)Z", (void *) nativeIsConnected },
};
#define CLASS_PATH "com/android/server/hdmi/HdmiCecController"
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 5cfe0f1..29d6f7e 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -818,12 +818,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
if (who != null) {
+ if (reqPolicy == DeviceAdminInfo.USES_POLICY_DEVICE_OWNER) {
+ throw new SecurityException("Admin " + candidates.get(0).info.getComponent()
+ + " does not own the device");
+ }
+ if (reqPolicy == DeviceAdminInfo.USES_POLICY_PROFILE_OWNER) {
+ throw new SecurityException("Admin " + candidates.get(0).info.getComponent()
+ + " does not own the profile");
+ }
throw new SecurityException("Admin " + candidates.get(0).info.getComponent()
+ " did not specify uses-policy for: "
+ candidates.get(0).info.getTagForPolicy(reqPolicy));
} else {
throw new SecurityException("No active admin owned by uid "
- + Binder.getCallingUid() + " for policy:" + reqPolicy);
+ + Binder.getCallingUid() + " for policy #" + reqPolicy);
}
}
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index bb61b81..3102cce 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -65,6 +65,7 @@ import com.android.server.display.DisplayManagerService;
import com.android.server.dreams.DreamManagerService;
import com.android.server.hdmi.HdmiControlService;
import com.android.server.input.InputManagerService;
+import com.android.server.job.JobSchedulerService;
import com.android.server.lights.LightsManager;
import com.android.server.lights.LightsService;
import com.android.server.media.MediaRouterService;
@@ -84,7 +85,6 @@ import com.android.server.restrictions.RestrictionsManagerService;
import com.android.server.search.SearchManagerService;
import com.android.server.statusbar.StatusBarManagerService;
import com.android.server.storage.DeviceStorageMonitorService;
-import com.android.server.task.TaskManagerService;
import com.android.server.trust.TrustManagerService;
import com.android.server.tv.TvInputManagerService;
import com.android.server.twilight.TwilightService;
@@ -132,8 +132,8 @@ public final class SystemServer {
"com.android.server.wifi.p2p.WifiP2pService";
private static final String ETHERNET_SERVICE_CLASS =
"com.android.server.ethernet.EthernetService";
- private static final String TASK_SERVICE_CLASS =
- "com.android.server.task.TaskManagerService";
+ private static final String JOB_SCHEDULER_SERVICE_CLASS =
+ "com.android.server.job.JobSchedulerService";
private final int mFactoryTestMode;
private Timer mProfilerSnapshotTimer;
@@ -349,6 +349,7 @@ public final class SystemServer {
boolean disableSystemUI = SystemProperties.getBoolean("config.disable_systemui", false);
boolean disableNonCoreServices = SystemProperties.getBoolean("config.disable_noncore", false);
boolean disableNetwork = SystemProperties.getBoolean("config.disable_network", false);
+ boolean isEmulator = SystemProperties.get("ro.kernel.qemu").equals("1");
try {
Slog.i(TAG, "Telephony Registry");
@@ -461,7 +462,7 @@ public final class SystemServer {
// Skip Bluetooth if we have an emulator kernel
// TODO: Use a more reliable check to see if this product should
// support Bluetooth - see bug 988521
- if (SystemProperties.get("ro.kernel.qemu").equals("1")) {
+ if (isEmulator) {
Slog.i(TAG, "No Bluetooh Service (emulator)");
} else if (mFactoryTestMode == FactoryTest.FACTORY_TEST_LOW_LEVEL) {
Slog.i(TAG, "No Bluetooth Service (factory test)");
@@ -662,10 +663,17 @@ public final class SystemServer {
reportWtf("starting Wi-Fi Scanning Service", e);
}
- try {
- mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
- } catch (Throwable e) {
- reportWtf("starting Ethernet Service", e);
+ if (!isEmulator) {
+ try {
+ mSystemServiceManager.startService(ETHERNET_SERVICE_CLASS);
+ } catch (Throwable e) {
+ reportWtf("starting Ethernet Service", e);
+ }
+ } else {
+ // Don't start the Ethernet service on the emulator because
+ // it interferes with qemu's SLIRP emulation, which uses
+ // IPv4 over eth0. http://b/15341003 .
+ Slog.i(TAG, "Not starting Ethernet service (emulator)");
}
try {
@@ -826,7 +834,7 @@ public final class SystemServer {
mSystemServiceManager.startService(UiModeManagerService.class);
- mSystemServiceManager.startService(TaskManagerService.class);
+ mSystemServiceManager.startService(JobSchedulerService.class);
if (!disableNonCoreServices) {
try {
diff --git a/services/tests/servicestests/src/com/android/server/task/TaskStoreTest.java b/services/tests/servicestests/src/com/android/server/task/TaskStoreTest.java
index e7f9ca0..7a7fa07 100644
--- a/services/tests/servicestests/src/com/android/server/task/TaskStoreTest.java
+++ b/services/tests/servicestests/src/com/android/server/task/TaskStoreTest.java
@@ -3,18 +3,19 @@ package com.android.server.task;
import android.content.ComponentName;
import android.content.Context;
-import android.app.task.Task;
-import android.app.task.Task.Builder;
+import android.app.job.JobInfo;
+import android.app.job.JobInfo.Builder;
import android.os.PersistableBundle;
import android.test.AndroidTestCase;
import android.test.RenamingDelegatingContext;
import android.util.Log;
-import com.android.server.task.controllers.TaskStatus;
+import com.android.server.job.JobMapReadFinishedListener;
+import com.android.server.job.JobStore;
+import com.android.server.job.controllers.JobStatus;
import java.util.List;
-import static com.android.server.task.TaskStore.initAndGet;
/**
* Test reading and writing correctly from file.
*/
@@ -26,12 +27,12 @@ public class TaskStoreTest extends AndroidTestCase {
private ComponentName mComponent;
private static final long IO_WAIT = 600L;
- TaskStore mTaskStoreUnderTest;
+ JobStore mTaskStoreUnderTest;
Context mTestContext;
- TaskMapReadFinishedListener mTaskMapReadFinishedListenerStub =
- new TaskMapReadFinishedListener() {
+ JobMapReadFinishedListener mTaskMapReadFinishedListenerStub =
+ new JobMapReadFinishedListener() {
@Override
- public void onTaskMapReadFinished(List<TaskStatus> tasks) {
+ public void onJobMapReadFinished(List<JobStatus> tasks) {
// do nothing.
}
};
@@ -40,7 +41,7 @@ public class TaskStoreTest extends AndroidTestCase {
public void setUp() throws Exception {
mTestContext = new RenamingDelegatingContext(getContext(), TEST_PREFIX);
Log.d(TAG, "Saving tasks to '" + mTestContext.getFilesDir() + "'");
- mTaskStoreUnderTest = TaskStore.initAndGetForTesting(mTestContext,
+ mTaskStoreUnderTest = JobStore.initAndGetForTesting(mTestContext,
mTestContext.getFilesDir(), mTaskMapReadFinishedListenerStub);
mComponent = new ComponentName(getContext().getPackageName(), StubClass.class.getName());
}
@@ -56,23 +57,23 @@ public class TaskStoreTest extends AndroidTestCase {
long runFromMillis = 2000L; // 2s
long initialBackoff = 10000L; // 10s
- final Task task = new Builder(taskId, mComponent)
+ final JobInfo task = new Builder(taskId, mComponent)
.setRequiresCharging(true)
- .setRequiredNetworkCapabilities(Task.NetworkType.ANY)
- .setBackoffCriteria(initialBackoff, Task.BackoffPolicy.EXPONENTIAL)
+ .setRequiredNetworkCapabilities(JobInfo.NetworkType.ANY)
+ .setBackoffCriteria(initialBackoff, JobInfo.BackoffPolicy.EXPONENTIAL)
.setOverrideDeadline(runByMillis)
.setMinimumLatency(runFromMillis)
.build();
- final TaskStatus ts = new TaskStatus(task, SOME_UID, true /* persisted */);
+ final JobStatus ts = new JobStatus(task, SOME_UID, true /* persisted */);
mTaskStoreUnderTest.add(ts);
Thread.sleep(IO_WAIT);
// Manually load tasks from xml file.
- mTaskStoreUnderTest.readTaskMapFromDisk(new TaskMapReadFinishedListener() {
+ mTaskStoreUnderTest.readJobMapFromDisk(new JobMapReadFinishedListener() {
@Override
- public void onTaskMapReadFinished(List<TaskStatus> tasks) {
+ public void onJobMapReadFinished(List<JobStatus> tasks) {
assertEquals("Didn't get expected number of persisted tasks.", 1, tasks.size());
- TaskStatus loadedTaskStatus = tasks.get(0);
- assertTasksEqual(task, loadedTaskStatus.getTask());
+ JobStatus loadedTaskStatus = tasks.get(0);
+ assertTasksEqual(task, loadedTaskStatus.getJob());
assertEquals("Different uids.", SOME_UID, tasks.get(0).getUid());
compareTimestampsSubjectToIoLatency("Early run-times not the same after read.",
ts.getEarliestRunTime(), loadedTaskStatus.getEarliestRunTime());
@@ -84,30 +85,30 @@ public class TaskStoreTest extends AndroidTestCase {
}
public void testWritingTwoFilesToDisk() throws Exception {
- final Task task1 = new Builder(8, mComponent)
+ final JobInfo task1 = new Builder(8, mComponent)
.setRequiresDeviceIdle(true)
.setPeriodic(10000L)
.setRequiresCharging(true)
.build();
- final Task task2 = new Builder(12, mComponent)
+ final JobInfo task2 = new Builder(12, mComponent)
.setMinimumLatency(5000L)
- .setBackoffCriteria(15000L, Task.BackoffPolicy.LINEAR)
+ .setBackoffCriteria(15000L, JobInfo.BackoffPolicy.LINEAR)
.setOverrideDeadline(30000L)
- .setRequiredNetworkCapabilities(Task.NetworkType.UNMETERED)
+ .setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED)
.build();
- final TaskStatus taskStatus1 = new TaskStatus(task1, SOME_UID, true /* persisted */);
- final TaskStatus taskStatus2 = new TaskStatus(task2, SOME_UID, true /* persisted */);
+ final JobStatus taskStatus1 = new JobStatus(task1, SOME_UID, true /* persisted */);
+ final JobStatus taskStatus2 = new JobStatus(task2, SOME_UID, true /* persisted */);
mTaskStoreUnderTest.add(taskStatus1);
mTaskStoreUnderTest.add(taskStatus2);
Thread.sleep(IO_WAIT);
- mTaskStoreUnderTest.readTaskMapFromDisk(new TaskMapReadFinishedListener() {
+ mTaskStoreUnderTest.readJobMapFromDisk(new JobMapReadFinishedListener() {
@Override
- public void onTaskMapReadFinished(List<TaskStatus> tasks) {
+ public void onJobMapReadFinished(List<JobStatus> tasks) {
assertEquals("Incorrect # of persisted tasks.", 2, tasks.size());
- TaskStatus loaded1 = tasks.get(0);
- TaskStatus loaded2 = tasks.get(1);
- assertTasksEqual(task1, loaded1.getTask());
- assertTasksEqual(task2, loaded2.getTask());
+ JobStatus loaded1 = tasks.get(0);
+ JobStatus loaded2 = tasks.get(1);
+ assertTasksEqual(task1, loaded1.getJob());
+ assertTasksEqual(task2, loaded2.getJob());
// Check that the loaded task has the correct runtimes.
compareTimestampsSubjectToIoLatency("Early run-times not the same after read.",
@@ -124,7 +125,7 @@ public class TaskStoreTest extends AndroidTestCase {
}
public void testWritingTaskWithExtras() throws Exception {
- Task.Builder b = new Builder(8, mComponent)
+ JobInfo.Builder b = new Builder(8, mComponent)
.setRequiresDeviceIdle(true)
.setPeriodic(10000L)
.setRequiresCharging(true);
@@ -134,17 +135,17 @@ public class TaskStoreTest extends AndroidTestCase {
extras.putString("hi", "there");
extras.putInt("into", 3);
b.setExtras(extras);
- final Task task = b.build();
- TaskStatus taskStatus = new TaskStatus(task, SOME_UID, true /* persisted */);
+ final JobInfo task = b.build();
+ JobStatus taskStatus = new JobStatus(task, SOME_UID, true /* persisted */);
mTaskStoreUnderTest.add(taskStatus);
Thread.sleep(IO_WAIT);
- mTaskStoreUnderTest.readTaskMapFromDisk(new TaskMapReadFinishedListener() {
+ mTaskStoreUnderTest.readJobMapFromDisk(new JobMapReadFinishedListener() {
@Override
- public void onTaskMapReadFinished(List<TaskStatus> tasks) {
+ public void onJobMapReadFinished(List<JobStatus> tasks) {
assertEquals("Incorrect # of persisted tasks.", 1, tasks.size());
- TaskStatus loaded = tasks.get(0);
- assertTasksEqual(task, loaded.getTask());
+ JobStatus loaded = tasks.get(0);
+ assertTasksEqual(task, loaded.getJob());
}
});
@@ -153,7 +154,7 @@ public class TaskStoreTest extends AndroidTestCase {
/**
* Helper function to throw an error if the provided task and TaskStatus objects are not equal.
*/
- private void assertTasksEqual(Task first, Task second) {
+ private void assertTasksEqual(JobInfo first, JobInfo second) {
assertEquals("Different task ids.", first.getId(), second.getId());
assertEquals("Different components.", first.getService(), second.getService());
assertEquals("Different periodic status.", first.isPeriodic(), second.isPeriodic());
@@ -168,11 +169,11 @@ public class TaskStoreTest extends AndroidTestCase {
assertEquals("Invalid idle constraint.", first.isRequireDeviceIdle(),
second.isRequireDeviceIdle());
assertEquals("Invalid unmetered constraint.",
- first.getNetworkCapabilities() == Task.NetworkType.UNMETERED,
- second.getNetworkCapabilities() == Task.NetworkType.UNMETERED);
+ first.getNetworkCapabilities() == JobInfo.NetworkType.UNMETERED,
+ second.getNetworkCapabilities() == JobInfo.NetworkType.UNMETERED);
assertEquals("Invalid connectivity constraint.",
- first.getNetworkCapabilities() == Task.NetworkType.ANY,
- second.getNetworkCapabilities() == Task.NetworkType.ANY);
+ first.getNetworkCapabilities() == JobInfo.NetworkType.ANY,
+ second.getNetworkCapabilities() == JobInfo.NetworkType.ANY);
assertEquals("Invalid deadline constraint.",
first.hasLateConstraint(),
second.hasLateConstraint());
diff --git a/services/tests/servicestests/src/com/android/server/task/controllers/BatteryControllerTest.java b/services/tests/servicestests/src/com/android/server/task/controllers/BatteryControllerTest.java
deleted file mode 100644
index 6617a05..0000000
--- a/services/tests/servicestests/src/com/android/server/task/controllers/BatteryControllerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.server.task.controllers;
-
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.test.AndroidTestCase;
-
-import com.android.server.task.StateChangedListener;
-
-import static com.android.server.task.controllers.BatteryController.getForTesting;
-
-import static org.mockito.Mockito.*;
-
-/**
- *
- */
-public class BatteryControllerTest extends AndroidTestCase {
- BatteryController mBatteryControllerUnderTest;
-
- StateChangedListener mStateChangedListenerStub = new StateChangedListener() {
- @Override
- public void onControllerStateChanged() {
-
- }
-
- @Override
- public void onRunTaskNow(TaskStatus taskStatus) {
-
- }
- };
- BatteryController.ChargingTracker mTrackerUnderTest;
-
- public void setUp() throws Exception {
- mBatteryControllerUnderTest = getForTesting(mStateChangedListenerStub, getTestContext());
- mTrackerUnderTest = mBatteryControllerUnderTest.getTracker();
- }
-
- public void testSendBatteryChargingIntent() throws Exception {
- Intent batteryConnectedIntent = new Intent(Intent.ACTION_POWER_CONNECTED)
- .setComponent(new ComponentName(getContext(), mTrackerUnderTest.getClass()));
- Intent batteryHealthyIntent = new Intent(Intent.ACTION_BATTERY_OKAY)
- .setComponent(new ComponentName(getContext(), mTrackerUnderTest.getClass()));
-
- mTrackerUnderTest.onReceiveInternal(batteryConnectedIntent);
- mTrackerUnderTest.onReceiveInternal(batteryHealthyIntent);
-
- assertTrue(mTrackerUnderTest.isOnStablePower());
- }
-
-} \ No newline at end of file
diff --git a/tests/Camera2Tests/CameraToo/Android.mk b/tests/Camera2Tests/CameraToo/Android.mk
new file mode 100644
index 0000000..7e5911d
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/Android.mk
@@ -0,0 +1,23 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_PACKAGE_NAME := CameraToo
+LOCAL_SDK_VERSION := current
+LOCAL_SRC_FILES := $(call all-java-files-under,src)
+
+include $(BUILD_PACKAGE)
diff --git a/tests/Camera2Tests/CameraToo/AndroidManifest.xml b/tests/Camera2Tests/CameraToo/AndroidManifest.xml
new file mode 100644
index 0000000..a92b5d8
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.camera2.cameratoo">
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <application android:label="CameraToo">
+ <activity
+ android:name=".CameraTooActivity"
+ android:screenOrientation="portrait">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/tests/Camera2Tests/CameraToo/res/layout/mainactivity.xml b/tests/Camera2Tests/CameraToo/res/layout/mainactivity.xml
new file mode 100644
index 0000000..f93f177
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/res/layout/mainactivity.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ 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.
+-->
+
+<SurfaceView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/mainSurfaceView"
+ android:layout_height="fill_parent"
+ android:layout_width="fill_parent"
+ android:onClick="onClickOnSurfaceView" />
diff --git a/tests/Camera2Tests/CameraToo/src/com/example/android/camera2/cameratoo/CameraTooActivity.java b/tests/Camera2Tests/CameraToo/src/com/example/android/camera2/cameratoo/CameraTooActivity.java
new file mode 100644
index 0000000..c630bad
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/src/com/example/android/camera2/cameratoo/CameraTooActivity.java
@@ -0,0 +1,437 @@
+/*
+ * 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.example.android.camera2.cameratoo;
+
+import android.app.Activity;
+import android.graphics.ImageFormat;
+import android.hardware.camera2.CameraAccessException;
+import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraCaptureSession;
+import android.hardware.camera2.CameraDevice;
+import android.hardware.camera2.CameraManager;
+import android.hardware.camera2.CaptureFailure;
+import android.hardware.camera2.CaptureRequest;
+import android.hardware.camera2.TotalCaptureResult;
+import android.hardware.camera2.params.StreamConfigurationMap;
+import android.media.Image;
+import android.media.ImageReader;
+import android.os.Bundle;
+import android.os.Environment;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Looper;
+import android.util.Size;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.View;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * A basic demonstration of how to write a point-and-shoot camera app against the new
+ * android.hardware.camera2 API.
+ */
+public class CameraTooActivity extends Activity {
+ /** Output files will be saved as /sdcard/Pictures/cameratoo*.jpg */
+ static final String CAPTURE_FILENAME_PREFIX = "cameratoo";
+ /** Tag to distinguish log prints. */
+ static final String TAG = "CameraToo";
+
+ /** An additional thread for running tasks that shouldn't block the UI. */
+ HandlerThread mBackgroundThread;
+ /** Handler for running tasks in the background. */
+ Handler mBackgroundHandler;
+ /** Handler for running tasks on the UI thread. */
+ Handler mForegroundHandler;
+ /** View for displaying the camera preview. */
+ SurfaceView mSurfaceView;
+ /** Used to retrieve the captured image when the user takes a snapshot. */
+ ImageReader mCaptureBuffer;
+ /** Handle to the Android camera services. */
+ CameraManager mCameraManager;
+ /** The specific camera device that we're using. */
+ CameraDevice mCamera;
+ /** Our image capture session. */
+ CameraCaptureSession mCaptureSession;
+
+ /**
+ * Given {@code choices} of {@code Size}s supported by a camera, chooses the smallest one whose
+ * width and height are at least as large as the respective requested values.
+ * @param choices The list of sizes that the camera supports for the intended output class
+ * @param width The minimum desired width
+ * @param height The minimum desired height
+ * @return The optimal {@code Size}, or an arbitrary one if none were big enough
+ */
+ static Size chooseBigEnoughSize(Size[] choices, int width, int height) {
+ // Collect the supported resolutions that are at least as big as the preview Surface
+ List<Size> bigEnough = new ArrayList<Size>();
+ for (Size option : choices) {
+ if (option.getWidth() >= width && option.getHeight() >= height) {
+ bigEnough.add(option);
+ }
+ }
+
+ // Pick the smallest of those, assuming we found any
+ if (bigEnough.size() > 0) {
+ return Collections.min(bigEnough, new CompareSizesByArea());
+ } else {
+ Log.e(TAG, "Couldn't find any suitable preview size");
+ return choices[0];
+ }
+ }
+
+ /**
+ * Compares two {@code Size}s based on their areas.
+ */
+ static class CompareSizesByArea implements Comparator<Size> {
+ @Override
+ public int compare(Size lhs, Size rhs) {
+ // We cast here to ensure the multiplications won't overflow
+ return Long.signum((long) lhs.getWidth() * lhs.getHeight() -
+ (long) rhs.getWidth() * rhs.getHeight());
+ }
+ }
+
+ /**
+ * Called when our {@code Activity} gains focus. <p>Starts initializing the camera.</p>
+ */
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ // Start a background thread to manage camera requests
+ mBackgroundThread = new HandlerThread("background");
+ mBackgroundThread.start();
+ mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
+ mForegroundHandler = new Handler(getMainLooper());
+
+ mCameraManager = (CameraManager) getSystemService(CAMERA_SERVICE);
+
+ // Inflate the SurfaceView, set it as the main layout, and attach a listener
+ View layout = getLayoutInflater().inflate(R.layout.mainactivity, null);
+ mSurfaceView = (SurfaceView) layout.findViewById(R.id.mainSurfaceView);
+ mSurfaceView.getHolder().addCallback(mSurfaceHolderCallback);
+ setContentView(mSurfaceView);
+
+ // Control flow continues in mSurfaceHolderCallback.surfaceChanged()
+ }
+
+ /**
+ * Called when our {@code Activity} loses focus. <p>Tears everything back down.</p>
+ */
+ @Override
+ protected void onPause() {
+ super.onPause();
+
+ try {
+ // Ensure SurfaceHolderCallback#surfaceChanged() will run again if the user returns
+ mSurfaceView.getHolder().setFixedSize(/*width*/0, /*height*/0);
+
+ // Cancel any stale preview jobs
+ if (mCaptureSession != null) {
+ mCaptureSession.close();
+ mCaptureSession = null;
+ }
+ } finally {
+ if (mCamera != null) {
+ mCamera.close();
+ mCamera = null;
+ }
+ }
+
+ // Finish processing posted messages, then join on the handling thread
+ mBackgroundThread.quitSafely();
+ try {
+ mBackgroundThread.join();
+ } catch (InterruptedException ex) {
+ Log.e(TAG, "Background worker thread was interrupted while joined", ex);
+ }
+
+ // Close the ImageReader now that the background thread has stopped
+ if (mCaptureBuffer != null) mCaptureBuffer.close();
+ }
+
+ /**
+ * Called when the user clicks on our {@code SurfaceView}, which has ID {@code mainSurfaceView}
+ * as defined in the {@code mainactivity.xml} layout file. <p>Captures a full-resolution image
+ * and saves it to permanent storage.</p>
+ */
+ public void onClickOnSurfaceView(View v) {
+ if (mCaptureSession != null) {
+ try {
+ CaptureRequest.Builder requester =
+ mCamera.createCaptureRequest(mCamera.TEMPLATE_STILL_CAPTURE);
+ requester.addTarget(mCaptureBuffer.getSurface());
+ try {
+ // This handler can be null because we aren't actually attaching any callback
+ mCaptureSession.capture(requester.build(), /*listener*/null, /*handler*/null);
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to file actual capture request", ex);
+ }
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to build actual capture request", ex);
+ }
+ } else {
+ Log.e(TAG, "User attempted to perform a capture outside our session");
+ }
+
+ // Control flow continues in mImageCaptureListener.onImageAvailable()
+ }
+
+ /**
+ * Callbacks invoked upon state changes in our {@code SurfaceView}.
+ */
+ final SurfaceHolder.Callback mSurfaceHolderCallback = new SurfaceHolder.Callback() {
+ /** The camera device to use, or null if we haven't yet set a fixed surface size. */
+ private String mCameraId;
+
+ /** Whether we received a change callback after setting our fixed surface size. */
+ private boolean mGotSecondCallback;
+
+ @Override
+ public void surfaceCreated(SurfaceHolder holder) {
+ // This is called every time the surface returns to the foreground
+ Log.i(TAG, "Surface created");
+ mCameraId = null;
+ mGotSecondCallback = false;
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ Log.i(TAG, "Surface destroyed");
+ holder.removeCallback(this);
+ // We don't stop receiving callbacks forever because onResume() will reattach us
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+ // On the first invocation, width and height were automatically set to the view's size
+ if (mCameraId == null) {
+ // Find the device's back-facing camera and set the destination buffer sizes
+ try {
+ for (String cameraId : mCameraManager.getCameraIdList()) {
+ CameraCharacteristics cameraCharacteristics =
+ mCameraManager.getCameraCharacteristics(cameraId);
+ if (cameraCharacteristics.get(cameraCharacteristics.LENS_FACING) ==
+ CameraCharacteristics.LENS_FACING_BACK) {
+ Log.i(TAG, "Found a back-facing camera");
+ StreamConfigurationMap info = cameraCharacteristics
+ .get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
+
+ // Bigger is better when it comes to saving our image
+ Size largestSize = Collections.max(
+ Arrays.asList(info.getOutputSizes(ImageFormat.JPEG)),
+ new CompareSizesByArea());
+
+ // Prepare an ImageReader in case the user wants to capture images
+ Log.i(TAG, "Capture size: " + largestSize);
+ mCaptureBuffer = ImageReader.newInstance(largestSize.getWidth(),
+ largestSize.getHeight(), ImageFormat.JPEG, /*maxImages*/2);
+ mCaptureBuffer.setOnImageAvailableListener(
+ mImageCaptureListener, mBackgroundHandler);
+
+ // Danger, W.R.! Attempting to use too large a preview size could
+ // exceed the camera bus' bandwidth limitation, resulting in
+ // gorgeous previews but the storage of garbage capture data.
+ Log.i(TAG, "SurfaceView size: " +
+ mSurfaceView.getWidth() + 'x' + mSurfaceView.getHeight());
+ Size optimalSize = chooseBigEnoughSize(
+ info.getOutputSizes(SurfaceHolder.class), width, height);
+
+ // Set the SurfaceHolder to use the camera's largest supported size
+ Log.i(TAG, "Preview size: " + optimalSize);
+ SurfaceHolder surfaceHolder = mSurfaceView.getHolder();
+ surfaceHolder.setFixedSize(optimalSize.getWidth(),
+ optimalSize.getHeight());
+
+ mCameraId = cameraId;
+ return;
+
+ // Control flow continues with this method one more time
+ // (since we just changed our own size)
+ }
+ }
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Unable to list cameras", ex);
+ }
+
+ Log.e(TAG, "Didn't find any back-facing cameras");
+ // This is the second time the method is being invoked: our size change is complete
+ } else if (!mGotSecondCallback) {
+ if (mCamera != null) {
+ Log.e(TAG, "Aborting camera open because it hadn't been closed");
+ return;
+ }
+
+ // Open the camera device
+ try {
+ mCameraManager.openCamera(mCameraId, mCameraStateListener,
+ mBackgroundHandler);
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to configure output surface", ex);
+ }
+ mGotSecondCallback = true;
+
+ // Control flow continues in mCameraStateListener.onOpened()
+ }
+ }};
+
+ /**
+ * Calledbacks invoked upon state changes in our {@code CameraDevice}. <p>These are run on
+ * {@code mBackgroundThread}.</p>
+ */
+ final CameraDevice.StateListener mCameraStateListener =
+ new CameraDevice.StateListener() {
+ @Override
+ public void onOpened(CameraDevice camera) {
+ Log.i(TAG, "Successfully opened camera");
+ mCamera = camera;
+ try {
+ List<Surface> outputs = Arrays.asList(
+ mSurfaceView.getHolder().getSurface(), mCaptureBuffer.getSurface());
+ camera.createCaptureSession(outputs, mCaptureSessionListener,
+ mBackgroundHandler);
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to create a capture session", ex);
+ }
+
+ // Control flow continues in mCaptureSessionListener.onConfigured()
+ }
+
+ @Override
+ public void onDisconnected(CameraDevice camera) {
+ Log.e(TAG, "Camera was disconnected");
+ }
+
+ @Override
+ public void onError(CameraDevice camera, int error) {
+ Log.e(TAG, "State error on device '" + camera.getId() + "': code " + error);
+ }};
+
+ /**
+ * Callbacks invoked upon state changes in our {@code CameraCaptureSession}. <p>These are run on
+ * {@code mBackgroundThread}.</p>
+ */
+ final CameraCaptureSession.StateListener mCaptureSessionListener =
+ new CameraCaptureSession.StateListener() {
+ @Override
+ public void onConfigured(CameraCaptureSession session) {
+ Log.i(TAG, "Finished configuring camera outputs");
+ mCaptureSession = session;
+
+ SurfaceHolder holder = mSurfaceView.getHolder();
+ if (holder != null) {
+ try {
+ // Build a request for preview footage
+ CaptureRequest.Builder requestBuilder =
+ mCamera.createCaptureRequest(mCamera.TEMPLATE_PREVIEW);
+ requestBuilder.addTarget(holder.getSurface());
+ CaptureRequest previewRequest = requestBuilder.build();
+
+ // Start displaying preview images
+ try {
+ session.setRepeatingRequest(previewRequest, /*listener*/null,
+ /*handler*/null);
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to make repeating preview request", ex);
+ }
+ } catch (CameraAccessException ex) {
+ Log.e(TAG, "Failed to build preview request", ex);
+ }
+ }
+ else {
+ Log.e(TAG, "Holder didn't exist when trying to formulate preview request");
+ }
+ }
+
+ @Override
+ public void onClosed(CameraCaptureSession session) {
+ mCaptureSession = null;
+ }
+
+ @Override
+ public void onConfigureFailed(CameraCaptureSession session) {
+ Log.e(TAG, "Configuration error on device '" + mCamera.getId());
+ }};
+
+ /**
+ * Callback invoked when we've received a JPEG image from the camera.
+ */
+ final ImageReader.OnImageAvailableListener mImageCaptureListener =
+ new ImageReader.OnImageAvailableListener() {
+ @Override
+ public void onImageAvailable(ImageReader reader) {
+ // Save the image once we get a chance
+ mBackgroundHandler.post(new CapturedImageSaver(reader.acquireNextImage()));
+
+ // Control flow continues in CapturedImageSaver#run()
+ }};
+
+ /**
+ * Deferred processor responsible for saving snapshots to disk. <p>This is run on
+ * {@code mBackgroundThread}.</p>
+ */
+ static class CapturedImageSaver implements Runnable {
+ /** The image to save. */
+ private Image mCapture;
+
+ public CapturedImageSaver(Image capture) {
+ mCapture = capture;
+ }
+
+ @Override
+ public void run() {
+ try {
+ // Choose an unused filename under the Pictures/ directory
+ File file = File.createTempFile(CAPTURE_FILENAME_PREFIX, ".jpg",
+ Environment.getExternalStoragePublicDirectory(
+ Environment.DIRECTORY_PICTURES));
+ try (FileOutputStream ostream = new FileOutputStream(file)) {
+ Log.i(TAG, "Retrieved image is" +
+ (mCapture.getFormat() == ImageFormat.JPEG ? "" : "n't") + " a JPEG");
+ ByteBuffer buffer = mCapture.getPlanes()[0].getBuffer();
+ Log.i(TAG, "Captured image size: " +
+ mCapture.getWidth() + 'x' + mCapture.getHeight());
+
+ // Write the image out to the chosen file
+ byte[] jpeg = new byte[buffer.remaining()];
+ buffer.get(jpeg);
+ ostream.write(jpeg);
+ } catch (FileNotFoundException ex) {
+ Log.e(TAG, "Unable to open output file for writing", ex);
+ } catch (IOException ex) {
+ Log.e(TAG, "Failed to write the image to the output file", ex);
+ }
+ } catch (IOException ex) {
+ Log.e(TAG, "Unable to create a new output file", ex);
+ } finally {
+ mCapture.close();
+ }
+ }
+ }
+}
diff --git a/tests/Camera2Tests/CameraToo/tests/Android.mk b/tests/Camera2Tests/CameraToo/tests/Android.mk
new file mode 100644
index 0000000..0b58243
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/tests/Android.mk
@@ -0,0 +1,25 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_PACKAGE_NAME := CameraTooTests
+LOCAL_INSTRUMENTATION_FOR := CameraToo
+LOCAL_SDK_VERSION := current
+LOCAL_SRC_FILES := $(call all-java-files-under,src)
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test mockito-target
+
+include $(BUILD_PACKAGE)
diff --git a/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml b/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml
new file mode 100644
index 0000000..30210ba
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/tests/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.camera2.cameratoo.tests">
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <application android:label="CameraToo">
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.example.android.camera2.cameratoo"
+ android:label="CameraToo tests" />
+</manifest>
diff --git a/tests/Camera2Tests/CameraToo/tests/src/com/example/android/camera2/cameratoo/CameraTooTest.java b/tests/Camera2Tests/CameraToo/tests/src/com/example/android/camera2/cameratoo/CameraTooTest.java
new file mode 100644
index 0000000..3acca5a
--- /dev/null
+++ b/tests/Camera2Tests/CameraToo/tests/src/com/example/android/camera2/cameratoo/CameraTooTest.java
@@ -0,0 +1,189 @@
+/*
+ * 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.example.android.camera2.cameratoo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import android.media.Image;
+import android.os.Environment;
+import android.util.Size;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Set;
+
+import com.example.android.camera2.cameratoo.CameraTooActivity;
+import org.junit.Test;
+
+public class CameraTooTest {
+ private <T> void assertComparatorEq(T lhs, T rhs, Comparator<T> rel) {
+ assertEquals(String.format("%s should be equal to %s", lhs, rhs), rel.compare(lhs, rhs), 0);
+ assertEquals(String.format("%s should be equal to %s (reverse check)", lhs, rhs),
+ rel.compare(rhs, lhs), 0);
+ }
+
+ private <T> void assertComparatorLt(T lhs, T rhs, Comparator<T> rel) {
+ assertTrue(String.format("%s should be less than %s", lhs, rhs), rel.compare(lhs, rhs) < 0);
+ assertTrue(String.format("%s should be less than %s (reverse check)", lhs, rhs),
+ rel.compare(rhs, lhs) > 0);
+ }
+
+ @Test
+ public void compareSizesByArea() {
+ Size empty = new Size(0, 0), fatAndFlat = new Size(100, 0), tallAndThin = new Size(0, 100);
+ Size smallSquare = new Size(4, 4), horizRect = new Size(8, 2), vertRect = new Size(2, 8);
+ Size largeSquare = new Size(5, 5);
+ Comparator<Size> rel = new CameraTooActivity.CompareSizesByArea();
+
+ assertComparatorEq(empty, fatAndFlat, rel);
+ assertComparatorEq(empty, tallAndThin, rel);
+ assertComparatorEq(fatAndFlat, empty, rel);
+ assertComparatorEq(fatAndFlat, tallAndThin, rel);
+ assertComparatorEq(tallAndThin, empty, rel);
+ assertComparatorEq(tallAndThin, fatAndFlat, rel);
+
+ assertComparatorEq(smallSquare, horizRect, rel);
+ assertComparatorEq(smallSquare, vertRect, rel);
+ assertComparatorEq(horizRect, smallSquare, rel);
+ assertComparatorEq(horizRect, vertRect, rel);
+ assertComparatorEq(vertRect, smallSquare, rel);
+ assertComparatorEq(vertRect, horizRect, rel);
+
+ assertComparatorLt(empty, smallSquare, rel);
+ assertComparatorLt(empty, horizRect, rel);
+ assertComparatorLt(empty, vertRect, rel);
+
+ assertComparatorLt(fatAndFlat, smallSquare, rel);
+ assertComparatorLt(fatAndFlat, horizRect, rel);
+ assertComparatorLt(fatAndFlat, vertRect, rel);
+
+ assertComparatorLt(tallAndThin, smallSquare, rel);
+ assertComparatorLt(tallAndThin, horizRect, rel);
+ assertComparatorLt(tallAndThin, vertRect, rel);
+
+ assertComparatorLt(empty, largeSquare, rel);
+ assertComparatorLt(fatAndFlat, largeSquare, rel);
+ assertComparatorLt(tallAndThin, largeSquare, rel);
+ assertComparatorLt(smallSquare, largeSquare, rel);
+ assertComparatorLt(horizRect, largeSquare, rel);
+ assertComparatorLt(vertRect, largeSquare, rel);
+ }
+
+ private void assertOptimalSize(Size[] options, int minWidth, int minHeight, Size expected) {
+ Size verdict = CameraTooActivity.chooseBigEnoughSize(options, minWidth, minHeight);
+ assertEquals(String.format("Expected optimal size %s but got %s", expected, verdict),
+ verdict, expected);
+ }
+
+ @Test
+ public void chooseBigEnoughSize() {
+ Size empty = new Size(0, 0), fatAndFlat = new Size(100, 0), tallAndThin = new Size(0, 100);
+ Size smallSquare = new Size(4, 4), horizRect = new Size(8, 2), vertRect = new Size(2, 8);
+ Size largeSquare = new Size(5, 5);
+ Size[] siz =
+ { empty, fatAndFlat, tallAndThin, smallSquare, horizRect, vertRect, largeSquare };
+
+ assertOptimalSize(siz, 0, 0, empty);
+
+ assertOptimalSize(siz, 1, 0, fatAndFlat);
+ assertOptimalSize(siz, 0, 1, tallAndThin);
+
+ assertOptimalSize(siz, 4, 4, smallSquare);
+ assertOptimalSize(siz, 1, 1, smallSquare);
+ assertOptimalSize(siz, 2, 1, smallSquare);
+ assertOptimalSize(siz, 1, 2, smallSquare);
+ assertOptimalSize(siz, 3, 4, smallSquare);
+ assertOptimalSize(siz, 4, 3, smallSquare);
+
+ assertOptimalSize(siz, 8, 2, horizRect);
+ assertOptimalSize(siz, 5, 1, horizRect);
+ assertOptimalSize(siz, 5, 2, horizRect);
+
+ assertOptimalSize(siz, 2, 8, vertRect);
+ assertOptimalSize(siz, 1, 5, vertRect);
+ assertOptimalSize(siz, 2, 5, vertRect);
+
+ assertOptimalSize(siz, 5, 5, largeSquare);
+ assertOptimalSize(siz, 3, 5, largeSquare);
+ assertOptimalSize(siz, 5, 3, largeSquare);
+ }
+
+ private static final FilenameFilter OUTPUT_FILE_DECIDER = new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String filename) {
+ return filename.indexOf("cameratoo") == 0 &&
+ filename.indexOf(".jpg") == filename.length() - ".jpg".length();
+ }};
+
+ private static <T> Set<T> newlyAddedElements(Set<T> before, Set<T> after) {
+ Set<T> result = new HashSet<T>(after);
+ result.removeAll(before);
+ return result;
+ }
+
+ @Test
+ public void capturedImageSaver() throws FileNotFoundException, IOException {
+ ByteBuffer buf = ByteBuffer.allocate(25);
+ for(int index = 0; index < buf.capacity(); ++index)
+ buf.put(index, (byte) index);
+
+ Image.Plane plane = mock(Image.Plane.class);
+ when(plane.getBuffer()).thenReturn(buf);
+ when(plane.getPixelStride()).thenReturn(1);
+ when(plane.getRowStride()).thenReturn(5);
+
+ Image.Plane[] onlyPlaneThatMatters = { plane };
+ Image image = mock(Image.class);
+ when(image.getPlanes()).thenReturn(onlyPlaneThatMatters);
+ when(image.getWidth()).thenReturn(5);
+ when(image.getHeight()).thenReturn(5);
+
+ File picturesFolder =
+ Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
+ Set<File> preListing =
+ new HashSet<File>(Arrays.asList(picturesFolder.listFiles(OUTPUT_FILE_DECIDER)));
+
+ CameraTooActivity.CapturedImageSaver saver =
+ new CameraTooActivity.CapturedImageSaver(image);
+ saver.run();
+
+ Set<File> postListing =
+ new HashSet<File>(Arrays.asList(picturesFolder.listFiles(OUTPUT_FILE_DECIDER)));
+ Set<File> newFiles = newlyAddedElements(preListing, postListing);
+
+ assertEquals(newFiles.size(), 1);
+
+ File picture = newFiles.iterator().next();
+ FileInputStream istream = new FileInputStream(picture);
+
+ for(int count = 0; count < buf.capacity(); ++count) {
+ assertEquals(istream.read(), buf.get(count));
+ }
+ assertEquals(istream.read(), -1);
+ assertTrue(picture.delete());
+ }
+}
diff --git a/tests/JobSchedulerTestApp/AndroidManifest.xml b/tests/JobSchedulerTestApp/AndroidManifest.xml
index 7431737..9654197 100644
--- a/tests/JobSchedulerTestApp/AndroidManifest.xml
+++ b/tests/JobSchedulerTestApp/AndroidManifest.xml
@@ -25,6 +25,7 @@
<service
android:name=".service.TestJobService"
+ android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true"/>
</application>
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
index 393c594..15050ef 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
@@ -17,8 +17,8 @@
package com.android.demo.jobSchedulerApp;
import android.app.Activity;
-import android.app.task.Task;
-import android.app.task.TaskParams;
+import android.app.job.JobInfo;
+import android.app.job.JobParameters;
import android.content.ComponentName;
import android.content.Intent;
import android.content.res.Resources;
@@ -80,10 +80,10 @@ public class MainActivity extends Activity {
RadioButton mWiFiConnectivityRadioButton;
RadioButton mAnyConnectivityRadioButton;
ComponentName mServiceComponent;
- /** Service object to interact scheduled tasks. */
+ /** Service object to interact scheduled jobs. */
TestJobService mTestService;
- private static int kTaskId = 0;
+ private static int kJobId = 0;
Handler mHandler = new Handler(/* default looper */) {
@Override
@@ -112,7 +112,7 @@ public class MainActivity extends Activity {
}
/**
- * UI onclick listener to schedule a task. What this task is is defined in
+ * UI onclick listener to schedule a job. What this job is is defined in
* TestJobService#scheduleJob()
*/
public void scheduleJob(View v) {
@@ -120,7 +120,7 @@ public class MainActivity extends Activity {
return;
}
- Task.Builder builder = new Task.Builder(kTaskId++, mServiceComponent);
+ JobInfo.Builder builder = new JobInfo.Builder(kJobId++, mServiceComponent);
String delay = mDelayEditText.getText().toString();
if (delay != null && !TextUtils.isEmpty(delay)) {
@@ -133,9 +133,9 @@ public class MainActivity extends Activity {
boolean requiresUnmetered = mWiFiConnectivityRadioButton.isSelected();
boolean requiresAnyConnectivity = mAnyConnectivityRadioButton.isSelected();
if (requiresUnmetered) {
- builder.setRequiredNetworkCapabilities(Task.NetworkType.UNMETERED);
+ builder.setRequiredNetworkCapabilities(JobInfo.NetworkType.UNMETERED);
} else if (requiresAnyConnectivity) {
- builder.setRequiredNetworkCapabilities(Task.NetworkType.ANY);
+ builder.setRequiredNetworkCapabilities(JobInfo.NetworkType.ANY);
}
mTestService.scheduleJob(builder.build());
@@ -143,24 +143,24 @@ public class MainActivity extends Activity {
}
/**
- * UI onclick listener to call taskFinished() in our service.
+ * UI onclick listener to call jobFinished() in our service.
*/
public void finishJob(View v) {
if (!ensureTestService()) {
return;
}
- mTestService.callTaskFinished();
+ mTestService.callJobFinished();
mParamsTextView.setText("");
}
- public void onReceivedStartTask(TaskParams params) {
+ public void onReceivedStartJob(JobParameters params) {
mShowStartView.setBackgroundColor(startJobColor);
Message m = Message.obtain(mHandler, MSG_UNCOLOUR_START);
mHandler.sendMessageDelayed(m, 1000L); // uncolour in 1 second.
- mParamsTextView.setText("Executing: " + params.getTaskId() + " " + params.getExtras());
+ mParamsTextView.setText("Executing: " + params.getJobId() + " " + params.getExtras());
}
- public void onReceivedStopTask() {
+ public void onReceivedStopJob() {
mShowStopView.setBackgroundColor(stopJobColor);
Message m = Message.obtain(mHandler, MSG_UNCOLOUR_STOP);
mHandler.sendMessageDelayed(m, 2000L); // uncolour in 1 second.
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
index 7dd3cf1..bf8e887 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
@@ -16,28 +16,20 @@
package com.android.demo.jobSchedulerApp.service;
-import android.app.Service;
-import android.app.task.Task;
-import android.app.task.TaskManager;
-import android.app.task.TaskParams;
-import android.app.task.TaskService;
-import android.content.ComponentName;
+import android.app.job.JobInfo;
+import android.app.job.JobScheduler;
+import android.app.job.JobParameters;
+import android.app.job.JobService;
import android.content.Context;
import android.content.Intent;
-import android.os.Binder;
-import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
-import android.os.PersistableBundle;
import android.os.RemoteException;
import android.util.Log;
import com.android.demo.jobSchedulerApp.MainActivity;
-import java.util.ArrayList;
-import java.util.HashMap;
import java.util.LinkedList;
-import java.util.List;
/**
@@ -52,7 +44,7 @@ import java.util.List;
* lifecycle of our and provide a handle to said SyncAdapter to the OS on
* request.
*/
-public class TestJobService extends TaskService {
+public class TestJobService extends JobService {
private static final String TAG = "SyncService";
@Override
@@ -82,44 +74,44 @@ public class TestJobService extends TaskService {
}
@Override
- public boolean onStartTask(TaskParams params) {
- taskParamsMap.add(params);
+ public boolean onStartJob(JobParameters params) {
+ jobParamsMap.add(params);
if (mActivity != null) {
- mActivity.onReceivedStartTask(params);
+ mActivity.onReceivedStartJob(params);
}
- Log.i(TAG, "on start task: " + params.getTaskId());
+ Log.i(TAG, "on start job: " + params.getJobId());
return true;
}
@Override
- public boolean onStopTask(TaskParams params) {
- taskParamsMap.remove(params);
- mActivity.onReceivedStopTask();
- Log.i(TAG, "on stop task: " + params.getTaskId());
+ public boolean onStopJob(JobParameters params) {
+ jobParamsMap.remove(params);
+ mActivity.onReceivedStopJob();
+ Log.i(TAG, "on stop job: " + params.getJobId());
return true;
}
MainActivity mActivity;
- private final LinkedList<TaskParams> taskParamsMap = new LinkedList<TaskParams>();
+ private final LinkedList<JobParameters> jobParamsMap = new LinkedList<JobParameters>();
public void setUiCallback(MainActivity activity) {
mActivity = activity;
}
/** Send job to the JobScheduler. */
- public void scheduleJob(Task t) {
+ public void scheduleJob(JobInfo t) {
Log.d(TAG, "Scheduling job");
- TaskManager tm =
- (TaskManager) getSystemService(Context.TASK_SERVICE);
+ JobScheduler tm =
+ (JobScheduler) getSystemService(Context.JOB_SCHEDULER_SERVICE);
tm.schedule(t);
}
- public boolean callTaskFinished() {
- TaskParams params = taskParamsMap.poll();
+ public boolean callJobFinished() {
+ JobParameters params = jobParamsMap.poll();
if (params == null) {
return false;
} else {
- taskFinished(params, false);
+ jobFinished(params, false);
return true;
}
}
diff --git a/tests/VoiceEnrollment/Android.mk b/tests/VoiceEnrollment/Android.mk
new file mode 100644
index 0000000..2ab3d02
--- /dev/null
+++ b/tests/VoiceEnrollment/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := VoiceEnrollment
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_PRIVILEGED_MODULE := true
+
+include $(BUILD_PACKAGE)
diff --git a/tests/VoiceEnrollment/AndroidManifest.xml b/tests/VoiceEnrollment/AndroidManifest.xml
new file mode 100644
index 0000000..6321222
--- /dev/null
+++ b/tests/VoiceEnrollment/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.test.voiceenrollment">
+
+ <application
+ android:permission="android.permission.MANAGE_VOICE_KEYPHRASES">
+ <activity android:name="TestEnrollmentActivity" android:label="Voice Enrollment Application"
+ android:theme="@android:style/Theme.Material.Light.Voice">
+ <intent-filter>
+ <action android:name="com.android.intent.action.MANAGE_VOICE_KEYPHRASES" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+ <meta-data android:name="android.voice_enrollment"
+ android:resource="@xml/enrollment_application"/>
+ </application>
+</manifest>
diff --git a/tests/VoiceEnrollment/res/xml/enrollment_application.xml b/tests/VoiceEnrollment/res/xml/enrollment_application.xml
new file mode 100644
index 0000000..710a0ac
--- /dev/null
+++ b/tests/VoiceEnrollment/res/xml/enrollment_application.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * 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.
+ */
+-->
+
+<voice-enrollment-application xmlns:android="http://schemas.android.com/apk/res/android"
+ android:searchKeyphraseId="101"
+ android:searchKeyphrase="Hello There"
+ android:searchKeyphraseSupportedLocales="en-US,en-GB,fr-FR,de-DE" />
diff --git a/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java
new file mode 100644
index 0000000..7fbd965
--- /dev/null
+++ b/tests/VoiceEnrollment/src/com/android/test/voiceenrollment/TestEnrollmentActivity.java
@@ -0,0 +1,23 @@
+/*
+ * 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.test.voiceenrollment;
+
+import android.app.Activity;
+
+public class TestEnrollmentActivity extends Activity {
+ // TODO(sansid): Add a test enrollment flow here.
+}
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
index d40b05f..00c2c64 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionService.java
@@ -21,6 +21,8 @@ import android.os.Bundle;
import android.service.voice.VoiceInteractionService;
import android.util.Log;
+import java.util.Arrays;
+
public class MainInteractionService extends VoiceInteractionService {
static final String TAG = "MainInteractionService";
@@ -28,6 +30,9 @@ public class MainInteractionService extends VoiceInteractionService {
public void onCreate() {
super.onCreate();
Log.i(TAG, "Creating " + this);
+ Log.i(TAG, "Keyphrase enrollment error? " + getKeyphraseEnrollmentInfo().getParseError());
+ Log.i(TAG, "Keyphrase enrollment meta-data: "
+ + Arrays.toString(getKeyphraseEnrollmentInfo().getKeyphrases()));
}
@Override
diff --git a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
index af22f44..36102f1 100644
--- a/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
+++ b/tools/layoutlib/bridge/src/android/view/BridgeInflater.java
@@ -151,7 +151,7 @@ public final class BridgeInflater extends LayoutInflater {
@Override
public View inflate(int resource, ViewGroup root) {
Context context = getContext();
- if (context instanceof ContextThemeWrapper) {
+ while (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof BridgeContext) {
@@ -217,7 +217,7 @@ public final class BridgeInflater extends LayoutInflater {
private void setupViewInContext(View view, AttributeSet attrs) {
Context context = getContext();
- if (context instanceof ContextThemeWrapper) {
+ while (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof BridgeContext) {
diff --git a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java
index 0dddf3d..dafc96b 100644
--- a/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/MenuInflater_Delegate.java
@@ -48,7 +48,7 @@ public class MenuInflater_Delegate {
AttributeSet attrs) {
if (menuItem instanceof BridgeMenuItemImpl) {
Context context = thisInflater.getContext();
- if (context instanceof ContextThemeWrapper) {
+ while (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof BridgeContext) {
diff --git a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
index cdb839a..8d1d0c1 100644
--- a/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/internal/view/menu/BridgeMenuItemImpl.java
@@ -42,7 +42,7 @@ public class BridgeMenuItemImpl extends MenuItemImpl {
CharSequence title, int showAsAction) {
super(menu, group, id, categoryOrder, ordering, title, showAsAction);
Context context = menu.getContext();
- if (context instanceof ContextThemeWrapper) {
+ while (context instanceof ContextThemeWrapper) {
context = ((ContextThemeWrapper) context).getBaseContext();
}
if (context instanceof BridgeContext) {
diff --git a/tools/layoutlib/create/README.txt b/tools/layoutlib/create/README.txt
index 6e0a300..32625ae 100644
--- a/tools/layoutlib/create/README.txt
+++ b/tools/layoutlib/create/README.txt
@@ -119,8 +119,8 @@ name.
The class is then fed to RefactorClassAdapter which is like RenameClassAdapter but updates the
references in all classes. This is used to update the references of classes in the java package that
-were added in the Dalvik VM but are not a part of the standard JVM. The existing classes are
-modified to update all references to these non-standard classes. An alternate implementation of
+were added in the Dalvik VM but are not a part of the Desktop VM. The existing classes are
+modified to update all references to these non-desktop classes. An alternate implementation of
these (com.android.tools.layoutlib.java.*) is injected.
RenameClassAdapter and RefactorClassAdapter both inherit from AbstractClassAdapter which changes the
@@ -130,11 +130,15 @@ the StackMapTable correctly and Java 7 VM enforces that classes with version gre
valid StackMapTable. As a side benefit of this, we can continue to support Java 6 because Java 7 on
Mac has horrible font rendering support.
+ReplaceMethodCallsAdapter replaces calls to certain methods. Currently, it only rewrites calls to
+java.lang.System.arraycopy([CI[CII)V, which is not part of the Desktop VM to call the more general
+method java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V.
+
The ClassAdapters are chained together to achieve the desired output. (Look at section 2.2.7
Transformation chains in the asm user guide, link in the References.) The order of execution of
these is:
ClassReader -> [DelegateClassAdapter] -> TransformClassAdapter -> [RenameClassAdapter] ->
-RefactorClassAdapter -> ClassWriter
+RefactorClassAdapter -> [ReplaceMethodCallsAdapter] -> ClassWriter
- Method stubs
--------------
@@ -169,7 +173,7 @@ This is the easiest: we currently inject the following classes:
- AutoCloseable and Objects are part of Java 7. To enable us to still run on Java 6, new classes are
injected. The implementation for these classes has been taken from Android's libcore
(platform/libcore/luni/src/main/java/java/...).
-- Charsets, IntegralToString and UnsafeByteSequence are not part of the standard JAVA VM. They are
+- Charsets, IntegralToString and UnsafeByteSequence are not part of the Desktop VM. They are
added to the Dalvik VM for performance reasons. An implementation that is very close to the
original (which is at platform/libcore/luni/src/main/java/...) is injected. Since these classees
were in part of the java package, where we can't inject classes, all references to these have been
@@ -209,7 +213,7 @@ This won't rename/replace the inner static methods of a given class.
This is very similar to the Renaming classes except that it also updates the reference in all
classes. This is done for classes which are added to the Dalvik VM for performance reasons but are
-not present in the Standard Java VM. An implementation for these classes is also injected.
+not present in the Desktop VM. An implementation for these classes is also injected.
5- Method erasure based on return type
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmAnalyzer.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmAnalyzer.java
index 3e75c9e..8373e30 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmAnalyzer.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmAnalyzer.java
@@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -63,7 +64,8 @@ public class AsmAnalyzer {
private final Set<String> mExcludedClasses;
/** Glob patterns of files to keep as is. */
private final String[] mIncludeFileGlobs;
- /** Copy these files into the output as is. */
+ /** Internal names of classes that contain method calls that need to be rewritten. */
+ private final Set<String> mReplaceMethodCallClasses = new HashSet<String>();
/**
* Creates a new analyzer.
@@ -109,6 +111,7 @@ public class AsmAnalyzer {
mGen.setKeep(found);
mGen.setDeps(deps);
mGen.setCopyFiles(filesFound);
+ mGen.setRewriteMethodCallClasses(mReplaceMethodCallClasses);
}
}
@@ -118,7 +121,7 @@ public class AsmAnalyzer {
*
* @param classes The map of class name => ASM ClassReader. Class names are
* in the form "android.view.View".
- * @param fileFound The map of file name => InputStream. The file name is
+ * @param filesFound The map of file name => InputStream. The file name is
* in the form "android/data/dataFile".
*/
void parseZip(List<String> jarPathList, Map<String, ClassReader> classes,
@@ -143,8 +146,8 @@ public class AsmAnalyzer {
String className = classReaderToClassName(cr);
classes.put(className, cr);
} else {
- for (int i = 0; i < includeFilePatterns.length; ++i) {
- if (includeFilePatterns[i].matcher(entry.getName()).matches()) {
+ for (Pattern includeFilePattern : includeFilePatterns) {
+ if (includeFilePattern.matcher(entry.getName()).matches()) {
filesFound.put(entry.getName(), zip.getInputStream(entry));
break;
}
@@ -321,6 +324,7 @@ public class AsmAnalyzer {
deps, new_deps);
for (ClassReader cr : inOutKeepClasses.values()) {
+ visitor.setClassName(cr.getClassName());
cr.accept(visitor, 0 /* flags */);
}
@@ -367,6 +371,8 @@ public class AsmAnalyzer {
/** New classes to keep as-is found by this visitor. */
private final Map<String, ClassReader> mOutKeep;
+ private String mClassName;
+
/**
* Creates a new visitor that will find all the dependencies for the visited class.
* Types which are already in the zipClasses, keepClasses or inDeps are not marked.
@@ -390,6 +396,10 @@ public class AsmAnalyzer {
mOutDeps = outDeps;
}
+ private void setClassName(String className) {
+ mClassName = className;
+ }
+
/**
* Considers the given class name as a dependency.
* If it does, add to the mOutDeps map.
@@ -429,7 +439,7 @@ public class AsmAnalyzer {
// - android classes are added to dependencies
// - non-android classes are added to the list of classes to keep as-is (they don't need
// to be stubbed).
- if (className.indexOf("android") >= 0) { // TODO make configurable
+ if (className.contains("android")) { // TODO make configurable
mOutDeps.put(className, cr);
} else {
mOutKeep.put(className, cr);
@@ -594,7 +604,7 @@ public class AsmAnalyzer {
// type and exceptions do not use generic types.
considerSignature(signature);
- return new MyMethodVisitor();
+ return new MyMethodVisitor(mClassName);
}
@Override
@@ -614,8 +624,11 @@ public class AsmAnalyzer {
private class MyMethodVisitor extends MethodVisitor {
- public MyMethodVisitor() {
+ private String mOwnerClass;
+
+ public MyMethodVisitor(String ownerClass) {
super(Opcodes.ASM4);
+ mOwnerClass = ownerClass;
}
@@ -709,6 +722,13 @@ public class AsmAnalyzer {
considerName(owner);
// desc is the method's descriptor (see Type).
considerDesc(desc);
+
+
+ // Check if method is java.lang.System.arrayCopy([CI[CII)V
+ if (owner.equals("java/lang/System") && name.equals("arraycopy")
+ && desc.equals("([CI[CII)V")) {
+ mReplaceMethodCallClasses.add(mOwnerClass);
+ }
}
// instruction multianewarray, whatever that is
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
index 207d8ae..c96a143 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/AsmGenerator.java
@@ -21,7 +21,6 @@ import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -55,6 +54,8 @@ public class AsmGenerator {
private Map<String, ClassReader> mDeps;
/** All files that are to be copied as-is. */
private Map<String, InputStream> mCopyFiles;
+ /** All classes where certain method calls need to be rewritten. */
+ private Set<String> mReplaceMethodCallsClasses;
/** Counter of number of classes renamed during transform. */
private int mRenameCount;
/** FQCN Names of the classes to rename: map old-FQCN => new-FQCN */
@@ -133,7 +134,7 @@ public class AsmGenerator {
assert i + 1 < n;
String oldFqcn = binaryToInternalClassName(refactorClasses[i]);
String newFqcn = binaryToInternalClassName(refactorClasses[i + 1]);
- mRefactorClasses.put(oldFqcn, newFqcn);;
+ mRefactorClasses.put(oldFqcn, newFqcn);
}
// create the map of renamed class -> return type of method to delete.
@@ -203,23 +204,12 @@ public class AsmGenerator {
mCopyFiles = copyFiles;
}
- /** Gets the map of classes to output as-is, except if they have native methods */
- public Map<String, ClassReader> getKeep() {
- return mKeep;
- }
-
- /** Gets the map of dependencies that must be completely stubbed */
- public Map<String, ClassReader> getDeps() {
- return mDeps;
- }
-
- /** Gets the map of files to output as-is. */
- public Map<String, InputStream> getCopyFiles() {
- return mCopyFiles;
+ public void setRewriteMethodCallClasses(Set<String> rewriteMethodCallClasses) {
+ mReplaceMethodCallsClasses = rewriteMethodCallClasses;
}
/** Generates the final JAR */
- public void generate() throws FileNotFoundException, IOException {
+ public void generate() throws IOException {
TreeMap<String, byte[]> all = new TreeMap<String, byte[]>();
for (Class<?> clazz : mInjectClasses) {
@@ -329,14 +319,14 @@ public class AsmGenerator {
String newName = transformName(className);
// transformName returns its input argument if there's no need to rename the class
- if (newName != className) {
+ if (!newName.equals(className)) {
mRenameCount++;
// This class is being renamed, so remove it from the list of classes not renamed.
mClassesNotRenamed.remove(className);
}
mLog.debug("Transform %s%s%s%s", className,
- newName == className ? "" : " (renamed to " + newName + ")",
+ newName.equals(className) ? "" : " (renamed to " + newName + ")",
hasNativeMethods ? " -- has natives" : "",
stubNativesOnly ? " -- stub natives only" : "");
@@ -344,8 +334,14 @@ public class AsmGenerator {
// original class reader.
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- ClassVisitor cv = new RefactorClassAdapter(cw, mRefactorClasses);
- if (newName != className) {
+ ClassVisitor cv = cw;
+
+ if (mReplaceMethodCallsClasses.contains(className)) {
+ cv = new ReplaceMethodCallsAdapter(cv);
+ }
+
+ cv = new RefactorClassAdapter(cv, mRefactorClasses);
+ if (!newName.equals(className)) {
cv = new RenameClassAdapter(cv, className, newName);
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
index 2e952fc..ad10656 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java
@@ -193,8 +193,7 @@ public class Main {
private static boolean processArgs(Log log, String[] args,
ArrayList<String> osJarPath, String[] osDestJar) {
boolean needs_dest = true;
- for (int i = 0; i < args.length; i++) {
- String s = args[i];
+ for (String s : args) {
if (s.equals("-v")) {
log.setVerbose(true);
} else if (s.equals("-p")) {
@@ -212,7 +211,7 @@ public class Main {
osJarPath.add(s);
}
} else {
- log.error("Unknow argument: %s", s);
+ log.error("Unknown argument: %s", s);
return false;
}
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
new file mode 100644
index 0000000..e57eba1
--- /dev/null
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/ReplaceMethodCallsAdapter.java
@@ -0,0 +1,53 @@
+/*
+ * 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.tools.layoutlib.create;
+
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
+
+/**
+ * Replaces calls to certain methods that do not exist in the Desktop VM.
+ */
+public class ReplaceMethodCallsAdapter extends ClassVisitor {
+ public ReplaceMethodCallsAdapter(ClassVisitor cv) {
+ super(Opcodes.ASM4, cv);
+ }
+
+ @Override
+ public MethodVisitor visitMethod(int access, String name, String desc, String signature,
+ String[] exceptions) {
+ return new MyMethodVisitor(super.visitMethod(access, name, desc, signature, exceptions));
+ }
+
+ private class MyMethodVisitor extends MethodVisitor {
+
+ public MyMethodVisitor(MethodVisitor mv) {
+ super(Opcodes.ASM4, mv);
+ }
+
+ @Override
+ public void visitMethodInsn(int opcode, String owner, String name, String desc) {
+ // Check if method is java.lang.System.arrayCopy([CI[CII)V
+ if (owner.equals("java/lang/System") && name.equals("arraycopy")
+ && desc.equals("([CI[CII)V")) {
+ desc = "(Ljava/lang/Object;ILjava/lang/Object;II)V";
+ }
+ super.visitMethodInsn(opcode, owner, name, desc);
+ }
+ }
+}
diff --git a/tools/layoutlib/rename_font/build_font.py b/tools/layoutlib/rename_font/build_font.py
index aea3241..bd9b14c 100755
--- a/tools/layoutlib/rename_font/build_font.py
+++ b/tools/layoutlib/rename_font/build_font.py
@@ -27,7 +27,7 @@ import sys
from fontTools import ttx
import re
import os
-from lxml import etree
+import xml.etree.ElementTree as etree
import shutil
import glob
from multiprocessing import Pool
@@ -84,14 +84,13 @@ def convert_font(input_path):
ttx.main(ttx_args)
# now parse the xml file to change its PS name.
tree = etree.parse(ttx_path)
- encoding = tree.docinfo.encoding
root = tree.getroot()
for name in root.iter('name'):
[old_ps_name, version] = get_font_info(name)
if old_ps_name is not None and version is not None:
new_ps_name = old_ps_name + version
update_name(name, new_ps_name)
- tree.write(ttx_path, xml_declaration=True, encoding=encoding )
+ tree.write(ttx_path, xml_declaration=True, encoding='utf-8' )
# generate the udpated font now.
ttx_args = ['-q', '-d', dest_dir, ttx_path]
ttx.main(ttx_args)
diff --git a/tools/layoutlib/rename_font/test.py b/tools/layoutlib/rename_font/test.py
index d4c86cb..b0b69d8 100755
--- a/tools/layoutlib/rename_font/test.py
+++ b/tools/layoutlib/rename_font/test.py
@@ -14,7 +14,7 @@ import build_font
from fontTools import ttx
import os
-from lxml import etree
+import xml.etree.ElementTree as etree
import shutil
import tempfile
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 99151c3..8191edd 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -89,6 +89,21 @@ public class ScanResult implements Parcelable {
* {@hide}
*/
public final static int UNSPECIFIED = -1;
+ /**
+ * @hide
+ * TODO: makes real freq boundaries
+ */
+ public boolean is24GHz() {
+ return frequency > 2400 && frequency < 2500;
+ }
+
+ /**
+ * @hide
+ * TODO: makes real freq boundaries
+ */
+ public boolean is5GHz() {
+ return frequency > 4900 && frequency < 5900;
+ }
/** information element from beacon
* @hide
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 192cba6..48396d5 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -405,6 +405,10 @@ public class WifiConfiguration implements Parcelable {
/** @hide **/
public static int INITIAL_AUTO_JOIN_ATTEMPT_MIN_5 = -70;
+ /** @hide
+ * 5GHz band is prefered over 2.4 if the 5GHz RSSI is higher than this threshold **/
+ public static int A_BAND_PREFERENCE_RSSI_THRESHOLD = -65;
+
/**
* @hide
* A summary of the RSSI and Band status for that configuration
@@ -481,11 +485,11 @@ public class WifiConfiguration implements Parcelable {
if (result.seen == 0)
continue;
- if ((result.frequency > 4900) && (result.frequency < 5900)) {
+ if (result.is5GHz()) {
//strictly speaking: [4915, 5825]
//number of known BSSID on 5GHz band
status.num5 = status.num5 + 1;
- } else if ((result.frequency > 2400) && (result.frequency < 2500)) {
+ } else if (result.is24GHz()) {
//strictly speaking: [2412, 2482]
//number of known BSSID on 2.4Ghz band
status.num24 = status.num24 + 1;
@@ -493,12 +497,12 @@ public class WifiConfiguration implements Parcelable {
if ((now_ms - result.seen) > age) continue;
- if ((result.frequency > 4900) && (result.frequency < 5900)) {
+ if (result.is5GHz()) {
if (result.level > status.rssi5) {
status.rssi5 = result.level;
status.age5 = result.seen;
}
- } else if ((result.frequency > 2400) && (result.frequency < 2500)) {
+ } else if (result.is24GHz()) {
if (result.level > status.rssi24) {
status.rssi24 = result.level;
status.age24 = result.seen;
@@ -547,6 +551,17 @@ public class WifiConfiguration implements Parcelable {
*/
public long blackListTimestamp;
+ /**
+ * @hide
+ * last time the system was connected to this configuration.
+ */
+ public long lastConnected;
+
+ /**
+ * @hide
+ * last time the system was disconnected to this configuration.
+ */
+ public long lastDisconnected;
/**
* Set if the configuration was self added by the framework
@@ -658,7 +673,20 @@ public class WifiConfiguration implements Parcelable {
// TODO: Add more checks
return true;
+ }
+ /**
+ * Helper function, identify if a configuration is linked
+ * @hide
+ */
+ public boolean isLinked(WifiConfiguration config) {
+ if (config.linkedConfigurations != null && linkedConfigurations != null) {
+ if (config.linkedConfigurations.get(configKey()) != null
+ && linkedConfigurations.get(config.configKey()) != null) {
+ return true;
+ }
+ }
+ return false;
}
/**
@@ -688,6 +716,7 @@ public class WifiConfiguration implements Parcelable {
/** @hide **/
public void setAutoJoinStatus(int status) {
+ if (status < 0) status = 0;
if (status == 0) {
blackListTimestamp = 0;
} else if (status > autoJoinStatus) {
@@ -1079,6 +1108,8 @@ public class WifiConfiguration implements Parcelable {
creatorUid = source.creatorUid;
peerWifiConfiguration = source.peerWifiConfiguration;
blackListTimestamp = source.blackListTimestamp;
+ lastConnected = source.lastConnected;
+ lastDisconnected = source.lastDisconnected;
}
}
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index f6a94d0..6760c56 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -62,6 +62,17 @@ public class WifiInfo implements Parcelable {
private String mBSSID;
private WifiSsid mWifiSsid;
private int mNetworkId;
+
+ /** @hide **/
+ public static final int INVALID_RSSI = -127;
+
+ /** @hide **/
+ public static final int MIN_RSSI = -126;
+
+ /** @hide **/
+ public static final int MAX_RSSI = 200;
+
+
/**
* Received Signal Strength Indicator
*/
@@ -131,7 +142,8 @@ public class WifiInfo implements Parcelable {
public int score;
/**
- * @hide *
+ * TODO: get actual timestamp and calculate true rates
+ * @hide
*/
public void updatePacketRates(WifiLinkLayerStats stats) {
if (stats != null) {
@@ -156,17 +168,42 @@ public class WifiInfo implements Parcelable {
rxSuccess = rxgood;
txRetries = txretries;
} else {
- txBadRate = 0;
+ txBad = 0;
txSuccess = 0;
rxSuccess = 0;
txRetries = 0;
+ txBadRate = 0;
+ txSuccessRate = 0;
+ rxSuccessRate = 0;
+ txRetriesRate = 0;
}
}
+
/**
- * Flag indicating that AP has hinted that upstream connection is metered,
- * and sensitive to heavy data transfers.
+ * This function is less powerful and used if the WifiLinkLayerStats API is not implemented
+ * at the Wifi HAL
+ * @hide
*/
+ public void updatePacketRates(long txPackets, long rxPackets) {
+ //paranoia
+ txBad = 0;
+ txRetries = 0;
+ txBadRate = 0;
+ txRetriesRate = 0;
+
+ txSuccessRate = (txSuccessRate * 0.5)
+ + ((double) (txPackets - txSuccess) * 0.5);
+ rxSuccessRate = (rxSuccessRate * 0.5)
+ + ((double) (rxPackets - rxSuccess) * 0.5);
+ txSuccess = txPackets;
+ rxSuccess = rxPackets;
+ }
+
+ /**
+ * Flag indicating that AP has hinted that upstream connection is metered,
+ * and sensitive to heavy data transfers.
+ */
private boolean mMeteredHint;
/** @hide */
@@ -175,9 +212,32 @@ public class WifiInfo implements Parcelable {
mBSSID = null;
mNetworkId = -1;
mSupplicantState = SupplicantState.UNINITIALIZED;
- mRssi = -9999;
+ mRssi = INVALID_RSSI;
mLinkSpeed = -1;
mFrequency = -1;
+ txBad = 0;
+ }
+
+ /** @hide */
+ public void reset() {
+ setInetAddress(null);
+ setBSSID(null);
+ setSSID(null);
+ setNetworkId(-1);
+ setRssi(INVALID_RSSI);
+ setLinkSpeed(-1);
+ setFrequency(-1);
+ setMeteredHint(false);
+ txSuccess = 0;
+ rxSuccess = 0;
+ txRetries = 0;
+ txBadRate = 0;
+ txSuccessRate = 0;
+ rxSuccessRate = 0;
+ txRetriesRate = 0;
+ lowRssiCount = 0;
+ badRssiCount = 0;
+ score = 0;
}
/**
@@ -256,7 +316,7 @@ public class WifiInfo implements Parcelable {
/**
* Returns the received signal strength indicator of the current 802.11
* network, in dBm.
- * @return the RSSI, in the range -110 to 10
+ * @return the RSSI, in the range -127 to 200
*/
public int getRssi() {
return mRssi;
@@ -264,6 +324,10 @@ public class WifiInfo implements Parcelable {
/** @hide */
public void setRssi(int rssi) {
+ if (rssi < INVALID_RSSI)
+ rssi = INVALID_RSSI;
+ if (rssi > MAX_RSSI)
+ rssi = MAX_RSSI;
mRssi = rssi;
}
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index 3b65ca8..21b700d 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -153,12 +153,17 @@ public class WifiScanner {
dest.writeInt(band);
dest.writeInt(periodInMs);
dest.writeInt(reportEvents);
- dest.writeInt(channels.length);
- for (int i = 0; i < channels.length; i++) {
- dest.writeInt(channels[i].frequency);
- dest.writeInt(channels[i].dwellTimeMS);
- dest.writeInt(channels[i].passive ? 1 : 0);
+ if (channels != null) {
+ dest.writeInt(channels.length);
+
+ for (int i = 0; i < channels.length; i++) {
+ dest.writeInt(channels[i].frequency);
+ dest.writeInt(channels[i].dwellTimeMS);
+ dest.writeInt(channels[i].passive ? 1 : 0);
+ }
+ } else {
+ dest.writeInt(0);
}
}
@@ -211,10 +216,14 @@ public class WifiScanner {
/** Implement the Parcelable interface {@hide} */
public void writeToParcel(Parcel dest, int flags) {
- dest.writeInt(mResults.length);
- for (int i = 0; i < mResults.length; i++) {
- ScanResult result = mResults[i];
- result.writeToParcel(dest, flags);
+ if (mResults != null) {
+ dest.writeInt(mResults.length);
+ for (int i = 0; i < mResults.length; i++) {
+ ScanResult result = mResults[i];
+ result.writeToParcel(dest, flags);
+ }
+ } else {
+ dest.writeInt(0);
}
}
@@ -324,13 +333,17 @@ public class WifiScanner {
dest.writeInt(unchangedSampleSize);
dest.writeInt(minApsBreachingThreshold);
dest.writeInt(periodInMs);
- dest.writeInt(hotspotInfos.length);
- for (int i = 0; i < hotspotInfos.length; i++) {
- HotspotInfo info = hotspotInfos[i];
- dest.writeString(info.bssid);
- dest.writeInt(info.low);
- dest.writeInt(info.high);
- dest.writeInt(info.frequencyHint);
+ if (hotspotInfos != null) {
+ dest.writeInt(hotspotInfos.length);
+ for (int i = 0; i < hotspotInfos.length; i++) {
+ HotspotInfo info = hotspotInfos[i];
+ dest.writeString(info.bssid);
+ dest.writeInt(info.low);
+ dest.writeInt(info.high);
+ dest.writeInt(info.frequencyHint);
+ }
+ } else {
+ dest.writeInt(0);
}
}
@@ -456,13 +469,18 @@ public class WifiScanner {
/** Implement the Parcelable interface {@hide} */
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(apLostThreshold);
- dest.writeInt(hotspotInfos.length);
- for (int i = 0; i < hotspotInfos.length; i++) {
- HotspotInfo info = hotspotInfos[i];
- dest.writeString(info.bssid);
- dest.writeInt(info.low);
- dest.writeInt(info.high);
- dest.writeInt(info.frequencyHint);
+
+ if (hotspotInfos != null) {
+ dest.writeInt(hotspotInfos.length);
+ for (int i = 0; i < hotspotInfos.length; i++) {
+ HotspotInfo info = hotspotInfos[i];
+ dest.writeString(info.bssid);
+ dest.writeInt(info.low);
+ dest.writeInt(info.high);
+ dest.writeInt(info.frequencyHint);
+ }
+ } else {
+ dest.writeInt(0);
}
}
@@ -680,6 +698,42 @@ public class WifiScanner {
}
}
+ /** @hide */
+ public static class OperationResult implements Parcelable {
+ public int reason;
+ public String description;
+
+ public OperationResult(int reason, String description) {
+ this.reason = reason;
+ this.description = description;
+ }
+
+ /** Implement the Parcelable interface {@hide} */
+ public int describeContents() {
+ return 0;
+ }
+
+ /** Implement the Parcelable interface {@hide} */
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(reason);
+ dest.writeString(description);
+ }
+
+ /** Implement the Parcelable interface {@hide} */
+ public static final Creator<OperationResult> CREATOR =
+ new Creator<OperationResult>() {
+ public OperationResult createFromParcel(Parcel in) {
+ int reason = in.readInt();
+ String description = in.readString();
+ return new OperationResult(reason, description);
+ }
+
+ public OperationResult[] newArray(int size) {
+ return new OperationResult[size];
+ }
+ };
+ }
+
private static class ServiceHandler extends Handler {
ServiceHandler(Looper looper) {
super(looper);
@@ -717,9 +771,11 @@ public class WifiScanner {
case CMD_OP_SUCCEEDED :
((ActionListener) listener).onSuccess();
break;
- case CMD_OP_FAILED :
- ((ActionListener) listener).onFailure(msg.arg1, (String)msg.obj);
- removeListener(msg.arg2);
+ case CMD_OP_FAILED : {
+ OperationResult result = (OperationResult)msg.obj;
+ ((ActionListener) listener).onFailure(result.reason, result.description);
+ removeListener(msg.arg2);
+ }
break;
case CMD_SCAN_RESULT :
((ScanListener) listener).onResults(
diff --git a/wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl b/wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl
index 8375d09..61c2b8a 100644
--- a/wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl
+++ b/wifi/java/android/net/wifi/passpoint/IWifiPasspointManager.aidl
@@ -16,6 +16,8 @@
package android.net.wifi.passpoint;
+import android.net.wifi.ScanResult;
+import android.net.wifi.passpoint.WifiPasspointPolicy;
import android.os.Messenger;
/**
@@ -27,5 +29,6 @@ interface IWifiPasspointManager
{
Messenger getMessenger();
int getPasspointState();
+ List<WifiPasspointPolicy> requestCredentialMatch(in List<ScanResult> requested);
}
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
index 8ab5c1e..aec87976 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
@@ -286,10 +286,11 @@ public class WifiPasspointInfo implements Parcelable {
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append("BSSID: ").append(bssid);
+ sb.append("BSSID: ").append("(").append(bssid).append(")");
if (venueName != null)
- sb.append(" venueName: ").append(venueName.replace("\n", "\\n"));
+ sb.append(" venueName: ").append("(")
+ .append(venueName.replace("\n", "\\n")).append(")");
if (networkAuthType != null) {
sb.append(" networkAuthType: ");
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
index 55acbad..2f158c2 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
@@ -22,6 +22,8 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
+import android.os.Parcel;
+import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Log;
@@ -45,58 +47,53 @@ public class WifiPasspointManager {
/* Passpoint states values */
- /** Passpoint is in an known state. This should only occur in boot time @hide */
+ /** Passpoint is in an unknown state. This should only occur in boot time */
public static final int PASSPOINT_STATE_UNKNOWN = 0;
- /** Passpoint is disabled. This occurs when wifi is disabled. @hide */
+ /** Passpoint is disabled. This occurs when wifi is disabled */
public static final int PASSPOINT_STATE_DISABLED = 1;
- /** Passpoint is enabled and in discovery state. @hide */
+ /** Passpoint is enabled and in discovery state */
public static final int PASSPOINT_STATE_DISCOVERY = 2;
- /** Passpoint is enabled and in access state. @hide */
+ /** Passpoint is enabled and in access state */
public static final int PASSPOINT_STATE_ACCESS = 3;
- /** Passpoint is enabled and in provisioning state. @hide */
+ /** Passpoint is enabled and in provisioning state */
public static final int PASSPOINT_STATE_PROVISION = 4;
/* Passpoint callback error codes */
- /** Indicates that the operation failed due to an internal error @hide */
- public static final int ERROR = 0;
+ /** Indicates that the operation failed due to an internal error */
+ public static final int REASON_ERROR = 0;
- /** Indicates that the operation failed because wifi is disabled @hide */
- public static final int WIFI_DISABLED = 1;
+ /** Indicates that the operation failed because wifi is disabled */
+ public static final int REASON_WIFI_DISABLED = 1;
- /** Indicates that the operation failed because the framework is busy @hide */
- public static final int BUSY = 2;
+ /** Indicates that the operation failed because the framework is busy */
+ public static final int REASON_BUSY = 2;
+
+ /** Indicates that the operation failed because parameter is invalid */
+ public static final int REASON_INVALID_PARAMETER = 3;
+
+ /** Indicates that the operation failed because the server is not trusted */
+ public static final int REASON_NOT_TRUSTED = 4;
/**
* protocol supported for Passpoint
- * @hide
*/
public static final String PROTOCOL_DM = "OMA-DM-ClientInitiated";
/**
* protocol supported for Passpoint
- * @hide
*/
public static final String PROTOCOL_SOAP = "SPP-ClientInitiated";
/* Passpoint broadcasts */
/**
- * Broadcast intent action indicating that Passpoint online sign up is
- * avaiable.
- * @hide
- */
- public static final String PASSPOINT_OSU_AVAILABLE =
- "android.net.wifi.passpoint.OSU_AVAILABLE";
-
- /**
* Broadcast intent action indicating that the state of Passpoint
* connectivity has changed
- * @hide
*/
public static final String PASSPOINT_STATE_CHANGED_ACTION =
"android.net.wifi.passpoint.STATE_CHANGE";
@@ -104,7 +101,6 @@ public class WifiPasspointManager {
/**
* Broadcast intent action indicating that the saved Passpoint credential
* list has changed
- * @hide
*/
public static final String PASSPOINT_CRED_CHANGED_ACTION =
"android.net.wifi.passpoint.CRED_CHANGE";
@@ -112,21 +108,18 @@ public class WifiPasspointManager {
/**
* Broadcast intent action indicating that Passpoint online sign up is
* avaiable.
- * @hide
*/
public static final String PASSPOINT_OSU_AVAILABLE_ACTION =
"android.net.wifi.passpoint.OSU_AVAILABLE";
/**
* Broadcast intent action indicating that user remediation is required
- * @hide
*/
public static final String PASSPOINT_USER_REM_REQ_ACTION =
"android.net.wifi.passpoint.USER_REM_REQ";
/**
* Interface for callback invocation when framework channel is lost
- * @hide
*/
public interface ChannelListener {
/**
@@ -138,14 +131,13 @@ public class WifiPasspointManager {
/**
* Interface for callback invocation on an application action
- * @hide
*/
public interface ActionListener {
/** The operation succeeded */
public void onSuccess();
/**
- * * The operation failed
+ * The operation failed
*
* @param reason The reason for failure could be one of
* {@link #WIFI_DISABLED}, {@link #ERROR} or {@link #BUSY}
@@ -155,7 +147,6 @@ public class WifiPasspointManager {
/**
* Interface for callback invocation when doing OSU or user remediation
- * @hide
*/
public interface OsuRemListener {
/** The operation succeeded */
@@ -171,11 +162,11 @@ public class WifiPasspointManager {
/**
* Browser launch is requried for user interaction. When this callback
- * is called, app should launch browser / webview to the given URL.
+ * is called, app should launch browser / webview to the given URI.
*
- * @param url URL for browser launch
+ * @param uri URI for browser launch
*/
- public void onBrowserLaunch(String url);
+ public void onBrowserLaunch(String uri);
/**
* When this is called, app should dismiss the previously lanched browser.
@@ -187,7 +178,6 @@ public class WifiPasspointManager {
* A channel that connects the application to the wifi passpoint framework.
* Most passpoint operations require a Channel as an argument.
* An instance of Channel is obtained by doing a call on {@link #initialize}
- * @hide
*/
public static class Channel {
private final static int INVALID_LISTENER_KEY = 0;
@@ -288,7 +278,8 @@ public class WifiPasspointManager {
@Override
public void handleMessage(Message message) {
- Object listener = getListener(message.arg2, false);
+ Object listener = null;
+
switch (message.what) {
case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
if (mChannelListener != null) {
@@ -300,6 +291,7 @@ public class WifiPasspointManager {
case REQUEST_ANQP_INFO_SUCCEEDED:
WifiPasspointInfo result = (WifiPasspointInfo) message.obj;
anqpRequestFinish(result);
+ listener = getListener(message.arg2, false);
if (listener != null) {
((ActionListener) listener).onSuccess();
}
@@ -307,6 +299,7 @@ public class WifiPasspointManager {
case REQUEST_ANQP_INFO_FAILED:
anqpRequestFinish((ScanResult) message.obj);
+ listener = getListener(message.arg2, false);
if (listener == null)
getListener(message.arg2, true);
if (listener != null) {
@@ -314,6 +307,31 @@ public class WifiPasspointManager {
}
break;
+ case START_OSU_SUCCEEDED:
+ listener = getListener(message.arg2, true);
+ if (listener != null) {
+ ((OsuRemListener) listener).onSuccess();
+ }
+ break;
+
+ case START_OSU_FAILED:
+ listener = getListener(message.arg2, true);
+ if (listener != null) {
+ ((OsuRemListener) listener).onFailure(message.arg1);
+ }
+ break;
+
+ case START_OSU_BROWSER:
+ listener = getListener(message.arg2, true);
+ if (listener != null) {
+ ParcelableString str = (ParcelableString) message.obj;
+ if (str.string == null)
+ ((OsuRemListener) listener).onBrowserDismiss();
+ else
+ ((OsuRemListener) listener).onBrowserLaunch(str.string);
+ }
+ break;
+
default:
Log.d(TAG, "Ignored " + message);
break;
@@ -323,25 +341,46 @@ public class WifiPasspointManager {
}
- private static final int BASE = Protocol.BASE_WIFI_PASSPOINT_MANAGER;
-
- /** @hide */
- public static final int REQUEST_ANQP_INFO = BASE + 1;
+ public static class ParcelableString implements Parcelable {
+ public String string;
- /** @hide */
- public static final int REQUEST_ANQP_INFO_FAILED = BASE + 2;
+ @Override
+ public int describeContents() {
+ return 0;
+ }
- /** @hide */
- public static final int REQUEST_ANQP_INFO_SUCCEEDED = BASE + 3;
+ @Override
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(string);
+ }
- /** @hide */
- public static final int REQUEST_OSU_INFO = BASE + 4;
+ public static final Parcelable.Creator<ParcelableString> CREATOR =
+ new Parcelable.Creator<ParcelableString>() {
+ @Override
+ public ParcelableString createFromParcel(Parcel in) {
+ ParcelableString ret = new ParcelableString();
+ ret.string = in.readString();
+ return ret;
+ }
+ @Override
+ public ParcelableString[] newArray(int size) {
+ return new ParcelableString[size];
+ }
+ };
+ }
- /** @hide */
- public static final int REQUEST_OSU_INFO_FAILED = BASE + 5;
+ private static final int BASE = Protocol.BASE_WIFI_PASSPOINT_MANAGER;
- /** @hide */
- public static final int REQUEST_OSU_INFO_SUCCEEDED = BASE + 6;
+ public static final int REQUEST_ANQP_INFO = BASE + 1;
+ public static final int REQUEST_ANQP_INFO_FAILED = BASE + 2;
+ public static final int REQUEST_ANQP_INFO_SUCCEEDED = BASE + 3;
+ public static final int REQUEST_OSU_ICON = BASE + 4;
+ public static final int REQUEST_OSU_ICON_FAILED = BASE + 5;
+ public static final int REQUEST_OSU_ICON_SUCCEEDED = BASE + 6;
+ public static final int START_OSU = BASE + 7;
+ public static final int START_OSU_BROWSER = BASE + 8;
+ public static final int START_OSU_FAILED = BASE + 9;
+ public static final int START_OSU_SUCCEEDED = BASE + 10;
private Context mContext;
IWifiPasspointManager mService;
@@ -350,7 +389,6 @@ public class WifiPasspointManager {
* TODO: doc
* @param context
* @param service
- * @hide
*/
public WifiPasspointManager(Context context, IWifiPasspointManager service) {
mContext = context;
@@ -368,7 +406,6 @@ public class WifiPasspointManager {
* @return Channel instance that is necessary for performing any further
* passpoint operations
*
- * @hide
*/
public Channel initialize(Context srcContext, Looper srcLooper, ChannelListener listener) {
Messenger messenger = getMessenger();
@@ -387,8 +424,6 @@ public class WifiPasspointManager {
/**
* STOPSHIP: temp solution, should use supplicant manager instead, check
* with b/13931972
- *
- * @hide
*/
public Messenger getMessenger() {
try {
@@ -398,7 +433,6 @@ public class WifiPasspointManager {
}
}
- /** @hide */
public int getPasspointState() {
try {
return mService.getPasspointState();
@@ -407,7 +441,6 @@ public class WifiPasspointManager {
}
}
- /** @hide */
public void requestAnqpInfo(Channel c, List<ScanResult> requested, int mask,
ActionListener listener) {
Log.d(TAG, "requestAnqpInfo start");
@@ -434,14 +467,16 @@ public class WifiPasspointManager {
Log.d(TAG, "requestAnqpInfo end");
}
- /** @hide */
public void requestOsuIcons(Channel c, List<WifiPasspointOsuProvider> requested,
int resolution, ActionListener listener) {
}
- /** @hide */
public List<WifiPasspointPolicy> requestCredentialMatch(List<ScanResult> requested) {
- return null;
+ try {
+ return mService.requestCredentialMatch(requested);
+ } catch (RemoteException e) {
+ return null;
+ }
}
/**
@@ -486,21 +521,21 @@ public class WifiPasspointManager {
return true;
}
- /** @hide */
- public void startOsu(Channel c, WifiPasspointOsuProvider selected, OsuRemListener listener) {
-
+ public void startOsu(Channel c, WifiPasspointOsuProvider osu, OsuRemListener listener) {
+ Log.d(TAG, "startOsu start");
+ checkChannel(c);
+ int key = c.putListener(listener);
+ c.mAsyncChannel.sendMessage(START_OSU, 0, key, osu);
+ Log.d(TAG, "startOsu end");
}
- /** @hide */
public void startUserRemediation(Channel c, OsuRemListener listener) {
}
- /** @hide */
- public void connect(WifiPasspointPolicy selected) {
+ public void connect(WifiPasspointPolicy policy) {
}
private static void checkChannel(Channel c) {
- if (c == null)
- throw new IllegalArgumentException("Channel needs to be initialized");
+ if (c == null) throw new IllegalArgumentException("Channel needs to be initialized");
}
}
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointOsuProvider.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointOsuProvider.java
index f40dc4f..b54b70c 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointOsuProvider.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointOsuProvider.java
@@ -87,12 +87,12 @@ public class WifiPasspointOsuProvider implements Parcelable {
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
- sb.append("SSID: ").append(ssid);
+ sb.append("SSID: ").append("<").append(ssid).append(">");
if (friendlyName != null)
- sb.append(" friendlyName: ").append(friendlyName);
+ sb.append(" friendlyName: ").append("<").append(friendlyName).append(">");
if (serverUri != null)
- sb.append(" serverUri: ").append(serverUri);
- sb.append(" osuMethod: ").append(osuMethod);
+ sb.append(" serverUri: ").append("<").append(serverUri).append(">");
+ sb.append(" osuMethod: ").append("<").append(osuMethod).append(">");
if (iconFileName != null) {
sb.append(" icon: <").append(iconWidth).append("x")
.append(iconHeight).append(" ")
@@ -100,9 +100,9 @@ public class WifiPasspointOsuProvider implements Parcelable {
.append(iconFileName).append(">");
}
if (osuNai != null)
- sb.append(" osuNai: ").append(osuNai);
+ sb.append(" osuNai: ").append("<").append(osuNai).append(">");
if (osuService != null)
- sb.append(" osuService: ").append(osuService);
+ sb.append(" osuService: ").append("<").append(osuService).append(">");
return sb.toString();
}