summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt20
-rw-r--r--cmds/sensorservice/Android.mk19
-rw-r--r--cmds/sensorservice/main_sensorservice.cpp25
-rw-r--r--cmds/system_server/library/system_init.cpp7
-rw-r--r--core/java/android/accessibilityservice/AccessibilityService.java75
-rw-r--r--core/java/android/accessibilityservice/AccessibilityServiceInfo.java349
-rw-r--r--core/java/android/nfc/tech/MifareClassic.java16
-rw-r--r--core/java/android/nfc/tech/MifareUltralight.java16
-rw-r--r--core/java/android/os/FileUtils.java17
-rw-r--r--core/java/android/provider/Calendar.java42
-rw-r--r--core/java/android/text/MeasuredText.java5
-rw-r--r--core/java/android/text/method/WordIterator.java3
-rw-r--r--core/java/android/util/Log.java12
-rw-r--r--core/java/android/view/Gravity.java6
-rw-r--r--core/java/android/view/accessibility/AccessibilityEvent.java42
-rw-r--r--core/java/android/view/accessibility/AccessibilityManager.java41
-rw-r--r--core/java/android/view/accessibility/IAccessibilityManager.aidl6
-rw-r--r--core/java/android/webkit/JWebCoreJavaBridge.java17
-rw-r--r--core/java/android/webkit/WebTextView.java25
-rw-r--r--core/java/android/webkit/WebView.java14
-rw-r--r--core/java/android/webkit/WebViewCore.java3
-rw-r--r--core/java/android/widget/AbsListView.java11
-rw-r--r--core/java/android/widget/AdapterView.java18
-rw-r--r--core/java/android/widget/TextView.java7
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java3
-rw-r--r--core/jni/android/graphics/Picture.cpp2
-rw-r--r--core/res/res/drawable-hdpi/dialog_middle_holo_light.9.pngbin242 -> 252 bytes
-rw-r--r--core/res/res/drawable-hdpi/dialog_top_holo_light.9.pngbin1033 -> 1042 bytes
-rw-r--r--core/res/res/drawable-mdpi/dialog_middle_holo_light.9.pngbin213 -> 222 bytes
-rw-r--r--core/res/res/drawable-mdpi/dialog_top_holo_light.9.pngbin632 -> 648 bytes
-rw-r--r--core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.pngbin271 -> 281 bytes
-rw-r--r--core/res/res/drawable-xhdpi/dialog_top_holo_light.9.pngbin1487 -> 1496 bytes
-rw-r--r--core/res/res/layout-sw600dp/status_bar_latest_event_ticker.xml (renamed from core/res/res/layout-xlarge/status_bar_latest_event_ticker.xml)0
-rw-r--r--core/res/res/layout-sw600dp/status_bar_latest_event_ticker_large_icon.xml (renamed from core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml)0
-rw-r--r--core/res/res/values-sw600dp/dimens.xml28
-rw-r--r--core/res/res/values-sw600dp/styles.xml (renamed from core/res/res/values-xlarge/styles.xml)0
-rw-r--r--core/res/res/values-xlarge/dimens.xml7
-rwxr-xr-xcore/res/res/values/attrs.xml81
-rw-r--r--core/res/res/values/public.xml9
-rw-r--r--core/tests/coretests/src/android/view/GravityTest.java24
-rw-r--r--docs/html/sdk/android-2.3.3.jd4
-rw-r--r--graphics/java/android/graphics/drawable/AnimationDrawable.java5
-rw-r--r--include/gui/Sensor.h6
-rw-r--r--include/media/AudioEffect.h44
-rw-r--r--include/media/EffectsFactoryApi.h44
-rw-r--r--include/media/IAudioFlinger.h4
-rw-r--r--libs/gui/Sensor.cpp8
-rw-r--r--media/java/android/media/MediaRecorder.java6
-rw-r--r--media/libeffects/factory/EffectsFactory.c12
-rw-r--r--media/libmedia/AudioEffect.cpp14
-rw-r--r--media/libmedia/IAudioFlinger.cpp48
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/app_icon.png)bin7310 -> 7310 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/recents_bg_protect_tile.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/recents_bg_protect_tile.png)bin10841 -> 10841 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_1x.png)bin608 -> 608 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_3g.png)bin684 -> 684 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_4g.png)bin635 -> 635 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_e.png)bin451 -> 451 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_g.png)bin579 -> 579 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_h.png)bin440 -> 440 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_4g.png)bin991 -> 991 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_4g.png)bin959 -> 959 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_4g.png)bin992 -> 992 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_roam.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_roam.png)bin490 -> 490 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_1x.png)bin623 -> 623 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_3g.png)bin718 -> 718 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_4g.png)bin657 -> 657 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_e.png)bin441 -> 441 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_g.png)bin569 -> 569 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_h.png)bin401 -> 401 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_4g.png)bin992 -> 992 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_4g.png)bin992 -> 992 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_1x.png)bin949 -> 949 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_3g.png)bin1040 -> 1040 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_4g.png)bin992 -> 992 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_e.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_e.png)bin622 -> 622 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_g.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_g.png)bin826 -> 826 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_h.png (renamed from packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_h.png)bin644 -> 644 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/app_icon.png)bin5167 -> 5167 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/recents_bg_protect_tile.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/recents_bg_protect_tile.png)bin7927 -> 7927 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/recents_blue_glow.9.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/recents_blue_glow.9.png)bin9784 -> 9784 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/recents_callout_line.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/recents_callout_line.png)bin114 -> 114 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg.png)bin3981 -> 3981 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg_press.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg_press.png)bin2056 -> 2056 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_1x.png)bin495 -> 495 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_3g.png)bin532 -> 532 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_4g.png)bin508 -> 508 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_e.png)bin419 -> 419 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_g.png)bin473 -> 473 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_h.png)bin415 -> 415 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_4g.png)bin740 -> 740 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_4g.png)bin749 -> 749 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_4g.png)bin739 -> 739 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_roam.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_roam.png)bin437 -> 437 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_1x.png)bin512 -> 512 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_3g.png)bin543 -> 543 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_4g.png)bin532 -> 532 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_e.png)bin416 -> 416 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_g.png)bin477 -> 477 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_h.png)bin396 -> 396 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_4g.png)bin739 -> 739 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_4g.png)bin739 -> 739 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_1x.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_1x.png)bin712 -> 712 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_3g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_3g.png)bin745 -> 745 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_4g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_4g.png)bin739 -> 739 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_e.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_e.png)bin524 -> 524 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_g.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_g.png)bin627 -> 627 bytes
-rw-r--r--packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_h.png (renamed from packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_h.png)bin549 -> 549 bytes
-rw-r--r--packages/SystemUI/res/values-sw600dp-port/dimens.xml (renamed from packages/SystemUI/res/values-xlarge-port/dimens.xml)2
-rw-r--r--packages/SystemUI/res/values-sw600dp/colors.xml (renamed from packages/SystemUI/res/values-xlarge/colors.xml)0
-rw-r--r--packages/SystemUI/res/values-sw600dp/dimens.xml (renamed from packages/SystemUI/res/values-xlarge/dimens.xml)5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java20
-rw-r--r--services/audioflinger/AudioFlinger.cpp22
-rw-r--r--services/audioflinger/AudioFlinger.h4
-rw-r--r--services/input/InputReader.cpp123
-rw-r--r--services/input/InputReader.h8
-rw-r--r--services/input/PointerController.cpp56
-rw-r--r--services/input/PointerController.h19
-rw-r--r--services/input/tests/InputReader_test.cpp4
-rw-r--r--services/java/com/android/server/BackupManagerService.java3
-rw-r--r--services/java/com/android/server/ConnectivityService.java31
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java9
-rw-r--r--services/java/com/android/server/accessibility/AccessibilityManagerService.java108
-rw-r--r--services/sensorservice/Android.mk17
-rw-r--r--services/sensorservice/CorrectedGyroSensor.cpp86
-rw-r--r--services/sensorservice/CorrectedGyroSensor.h52
-rw-r--r--services/sensorservice/Fusion.cpp431
-rw-r--r--services/sensorservice/Fusion.h86
-rw-r--r--services/sensorservice/GravitySensor.cpp75
-rw-r--r--services/sensorservice/GravitySensor.h7
-rw-r--r--services/sensorservice/LinearAccelerationSensor.cpp25
-rw-r--r--services/sensorservice/LinearAccelerationSensor.h6
-rw-r--r--services/sensorservice/OrientationSensor.cpp89
-rw-r--r--services/sensorservice/OrientationSensor.h51
-rw-r--r--services/sensorservice/RotationVectorSensor.cpp137
-rw-r--r--services/sensorservice/RotationVectorSensor.h15
-rw-r--r--services/sensorservice/SecondOrderLowPassFilter.cpp28
-rw-r--r--services/sensorservice/SecondOrderLowPassFilter.h20
-rw-r--r--services/sensorservice/SensorDevice.cpp25
-rw-r--r--services/sensorservice/SensorFusion.cpp180
-rw-r--r--services/sensorservice/SensorFusion.h84
-rw-r--r--services/sensorservice/SensorInterface.h2
-rw-r--r--services/sensorservice/SensorService.cpp56
-rw-r--r--services/sensorservice/SensorService.h2
-rw-r--r--services/sensorservice/mat.h370
-rw-r--r--services/sensorservice/traits.h118
-rw-r--r--services/sensorservice/vec.h420
-rw-r--r--services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java3
-rw-r--r--services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java15
-rw-r--r--tests/RenderScriptTests/ModelViewer/AndroidManifest.xml3
-rw-r--r--tests/RenderScriptTests/ModelViewer/res/menu/loader_menu.xml2
-rw-r--r--tests/RenderScriptTests/ModelViewer/res/values/strings.xml1
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModel.java3
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java4
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelView.java57
-rw-r--r--tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs5
207 files changed, 3379 insertions, 665 deletions
diff --git a/api/current.txt b/api/current.txt
index 7dcb714..1e16b6c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -179,6 +179,9 @@ package android {
public static final class R.attr {
ctor public R.attr();
field public static final int absListViewStyle = 16842858; // 0x101006a
+ field public static final int accessibilityEventTypes = 16843642; // 0x101037a
+ field public static final int accessibilityFeedbackType = 16843644; // 0x101037c
+ field public static final int accessibilityFlags = 16843646; // 0x101037e
field public static final int accountPreferences = 16843423; // 0x101029f
field public static final int accountType = 16843407; // 0x101028f
field public static final int action = 16842797; // 0x101002d
@@ -269,6 +272,7 @@ package android {
field public static final int cacheColorHint = 16843009; // 0x1010101
field public static final int calendarViewShown = 16843596; // 0x101034c
field public static final int calendarViewStyle = 16843613; // 0x101035d
+ field public static final int canRetrieveWindowContent = 16843647; // 0x101037f
field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
field public static final deprecated int capitalize = 16843113; // 0x1010169
field public static final int centerBright = 16842956; // 0x10100cc
@@ -526,6 +530,7 @@ package android {
field public static final int installLocation = 16843447; // 0x10102b7
field public static final int interpolator = 16843073; // 0x1010141
field public static final int isAlwaysSyncable = 16843571; // 0x1010333
+ field public static final int isAuxiliary = 16843641; // 0x1010379
field public static final int isDefault = 16843297; // 0x1010221
field public static final int isIndicator = 16843079; // 0x1010147
field public static final int isModifier = 16843334; // 0x1010246
@@ -654,6 +659,7 @@ package android {
field public static final int nextFocusUp = 16842979; // 0x10100e3
field public static final int noHistory = 16843309; // 0x101022d
field public static final int normalScreens = 16843397; // 0x1010285
+ field public static final int notificationTimeout = 16843645; // 0x101037d
field public static final int numColumns = 16843032; // 0x1010118
field public static final int numStars = 16843076; // 0x1010144
field public static final deprecated int numeric = 16843109; // 0x1010165
@@ -670,6 +676,7 @@ package android {
field public static final int overScrollFooter = 16843459; // 0x10102c3
field public static final int overScrollHeader = 16843458; // 0x10102c2
field public static final int overScrollMode = 16843457; // 0x10102c1
+ field public static final int packageNames = 16843643; // 0x101037b
field public static final int padding = 16842965; // 0x10100d5
field public static final int paddingBottom = 16842969; // 0x10100d9
field public static final int paddingLeft = 16842966; // 0x10100d6
@@ -1692,11 +1699,18 @@ package android.accessibilityservice {
method protected void onServiceConnected();
method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService";
+ field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice";
}
public class AccessibilityServiceInfo implements android.os.Parcelable {
ctor public AccessibilityServiceInfo();
method public int describeContents();
+ method public static java.lang.String feedbackTypeToString(int);
+ method public static java.lang.String flagToString(int);
+ method public boolean getCanRetrieveWindowContent();
+ method public java.lang.String getId();
+ method public android.content.pm.ResolveInfo getResolveInfo();
+ method public java.lang.String getSettingsActivityName();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int DEFAULT = 1; // 0x1
@@ -22249,6 +22263,7 @@ package android.view.accessibility {
public final class AccessibilityEvent extends android.view.accessibility.AccessibilityRecord implements android.os.Parcelable {
method public void appendRecord(android.view.accessibility.AccessibilityRecord);
method public int describeContents();
+ method public static java.lang.String eventTypeToString(int);
method public long getEventTime();
method public int getEventType();
method public java.lang.CharSequence getPackageName();
@@ -22284,8 +22299,9 @@ package android.view.accessibility {
}
public final class AccessibilityManager {
- method public java.util.List<android.content.pm.ServiceInfo> getAccessibilityServiceList();
- method public java.util.List<android.content.pm.ServiceInfo> getEnabledAccessibilityServiceList(int);
+ method public deprecated java.util.List<android.content.pm.ServiceInfo> getAccessibilityServiceList();
+ method public java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int);
+ method public java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getInstalledAccessibilityServiceList();
method public void interrupt();
method public boolean isEnabled();
method public void sendAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
diff --git a/cmds/sensorservice/Android.mk b/cmds/sensorservice/Android.mk
new file mode 100644
index 0000000..0811be5
--- /dev/null
+++ b/cmds/sensorservice/Android.mk
@@ -0,0 +1,19 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:= \
+ main_sensorservice.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+ libsensorservice \
+ libbinder \
+ libutils
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/../../services/sensorservice
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE:= sensorservice
+
+include $(BUILD_EXECUTABLE)
diff --git a/cmds/sensorservice/main_sensorservice.cpp b/cmds/sensorservice/main_sensorservice.cpp
new file mode 100644
index 0000000..8610627
--- /dev/null
+++ b/cmds/sensorservice/main_sensorservice.cpp
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+#include <binder/BinderService.h>
+#include <SensorService.h>
+
+using namespace android;
+
+int main(int argc, char** argv) {
+ SensorService::publishAndJoinThreadPool();
+ return 0;
+}
diff --git a/cmds/system_server/library/system_init.cpp b/cmds/system_server/library/system_init.cpp
index b615764..a19711e 100644
--- a/cmds/system_server/library/system_init.cpp
+++ b/cmds/system_server/library/system_init.cpp
@@ -70,8 +70,11 @@ extern "C" status_t system_init()
SurfaceFlinger::instantiate();
}
- // Start the sensor service
- SensorService::instantiate();
+ property_get("system_init.startsensorservice", propBuf, "1");
+ if (strcmp(propBuf, "1") == 0) {
+ // Start the sensor service
+ SensorService::instantiate();
+ }
// On the simulator, audioflinger et al don't get started the
// same way as on the device, and we need to start them here
diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java
index 03346fe..28fc21a 100644
--- a/core/java/android/accessibilityservice/AccessibilityService.java
+++ b/core/java/android/accessibilityservice/AccessibilityService.java
@@ -39,21 +39,57 @@ import android.view.accessibility.AccessibilityEvent;
* <p>
* <code>
* &lt;service android:name=".MyAccessibilityService"&gt;<br>
- * &lt;intent-filter&gt;<br>
- * &lt;action android:name="android.accessibilityservice.AccessibilityService" /&gt;<br>
- * &lt;/intent-filter&gt;<br>
+ * &nbsp;&nbsp;&lt;intent-filter&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;action android:name="android.accessibilityservice.AccessibilityService" /&gt;<br>
+ * &nbsp;&nbsp;&lt;/intent-filter&gt;<br>
* &lt;/service&gt;<br>
* </code>
+ * </p>
* <p>
* The lifecycle of an accessibility service is managed exclusively by the system. Starting
* or stopping an accessibility service is triggered by an explicit user action through
* enabling or disabling it in the device settings. After the system binds to a service it
* calls {@link AccessibilityService#onServiceConnected()}. This method can be
- * overriden by clients that want to perform post binding setup. An accessibility service
- * is configured though setting an {@link AccessibilityServiceInfo} by calling
- * {@link AccessibilityService#setServiceInfo(AccessibilityServiceInfo)}. You can call this
- * method any time to change the service configuration but it is good practice to do that
- * in the overriden {@link AccessibilityService#onServiceConnected()}.
+ * overriden by clients that want to perform post binding setup.
+ * <p>
+ * </p>
+ * There are two approaches for configuring an accessibility service:
+ * <ul>
+ * <li>
+ * Providing a {@link #SERVICE_META_DATA meta-data} entry in the manifest when declaring
+ * the service. A service declaration with a meta-data tag is presented below:
+ * <p>
+ * <code>
+ * &lt;service android:name=".MyAccessibilityService"&gt;<br>
+ * &nbsp;&nbsp;&lt;intent-filter&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;action android:name="android.accessibilityservice.AccessibilityService" /&gt;<br>
+ * &nbsp;&nbsp;&lt;/intent-filter&gt;<br>
+ * &nbsp;&nbsp;&lt;meta-data android:name="android.accessibilityservice.as" android:resource="@xml/accessibilityservice" /&gt;<br>
+ * &lt;/service&gt;<br>
+ * </code>
+ * </p>
+ * <p>
+ * <strong>
+ * This approach enables setting all accessibility service properties.
+ * </strong>
+ * </p>
+ * </li>
+ * <li>
+ * Calling {@link AccessibilityService#setServiceInfo(AccessibilityServiceInfo)}. Note
+ * that this method can be called any time to change the service configuration.<br>
+ * <p>
+ * <strong>
+ * This approach enables setting only dynamically configurable accessibility
+ * service properties:
+ * {@link AccessibilityServiceInfo#eventTypes},
+ * {@link AccessibilityServiceInfo#feedbackType},
+ * {@link AccessibilityServiceInfo#flags},
+ * {@link AccessibilityServiceInfo#notificationTimeout},
+ * {@link AccessibilityServiceInfo#packageNames}
+ * </strong>
+ * </p>
+ * </li>
+ * </ul>
* <p>
* An accessibility service can be registered for events in specific packages to provide a
* specific type of feedback and is notified with a certain timeout after the last event
@@ -105,6 +141,29 @@ public abstract class AccessibilityService extends Service {
public static final String SERVICE_INTERFACE =
"android.accessibilityservice.AccessibilityService";
+ /**
+ * Name under which an AccessibilityService component publishes information
+ * about itself. This meta-data must reference an XML resource containing
+ * an
+ * <code>&lt;{@link android.R.styleable#AccessibilityService accessibility-service}&gt;</code>
+ * tag. This is a a sample XML file configuring an accessibility service:
+ * <p>
+ * <code>
+ * &lt;?xml version="1.0" encoding="utf-8"?&gt;<br>
+ * &lt;accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"<br>
+ * &nbsp;&nbsp;android:eventTypes="typeViewClicked|typeViewFocused"<br>
+ * &nbsp;&nbsp;android:packageNames="foo.bar, foo.baz"<br>
+ * &nbsp;&nbsp;android:feedbackType="feedbackSpoken"<br>
+ * &nbsp;&nbsp;android:notificationTimeout="100"<br>
+ * &nbsp;&nbsp;android:flags="flagDefault"<br>
+ * &nbsp;&nbsp;android:settingsActivity="foo.bar.TestBackActivity"<br>
+ * &nbsp;&nbsp;. . .<br>
+ * /&gt;
+ * </code>
+ * </p>
+ */
+ public static final String SERVICE_META_DATA = "android.accessibilityservice";
+
private static final String LOG_TAG = "AccessibilityService";
private AccessibilityServiceInfo mInfo;
diff --git a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
index bf9e07d..b9878cd 100644
--- a/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
+++ b/core/java/android/accessibilityservice/AccessibilityServiceInfo.java
@@ -16,8 +16,25 @@
package android.accessibilityservice;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.content.pm.ServiceInfo;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.content.res.XmlResourceParser;
import android.os.Parcel;
import android.os.Parcelable;
+import android.util.AttributeSet;
+import android.util.Xml;
+import android.view.accessibility.AccessibilityEvent;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
/**
* This class describes an {@link AccessibilityService}. The system
@@ -30,6 +47,8 @@ import android.os.Parcelable;
*/
public class AccessibilityServiceInfo implements Parcelable {
+ private static final String TAG_ACCESSIBILITY_SERVICE = "accessibility-service";
+
/**
* Denotes spoken feedback.
*/
@@ -64,7 +83,9 @@ public class AccessibilityServiceInfo implements Parcelable {
/**
* The event types an {@link AccessibilityService} is interested in.
- *
+ * <p>
+ * <strong>Can be dynamically set at runtime.</strong>
+ * </p>
* @see android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CLICKED
* @see android.view.accessibility.AccessibilityEvent#TYPE_VIEW_LONG_CLICKED
* @see android.view.accessibility.AccessibilityEvent#TYPE_VIEW_FOCUSED
@@ -77,13 +98,18 @@ public class AccessibilityServiceInfo implements Parcelable {
/**
* The package names an {@link AccessibilityService} is interested in. Setting
- * to null is equivalent to all packages.
+ * to null is equivalent to all packages.
+ * <p>
+ * <strong>Can be dynamically set at runtime.</strong>
+ * </p>
*/
public String[] packageNames;
/**
* The feedback type an {@link AccessibilityService} provides.
- *
+ * <p>
+ * <strong>Can be dynamically set at runtime.</strong>
+ * </p>
* @see #FEEDBACK_AUDIBLE
* @see #FEEDBACK_GENERIC
* @see #FEEDBACK_HAPTIC
@@ -96,6 +122,9 @@ public class AccessibilityServiceInfo implements Parcelable {
* The timeout after the most recent event of a given type before an
* {@link AccessibilityService} is notified.
* <p>
+ * <strong>Can be dynamically set at runtime.</strong>.
+ * </p>
+ * <p>
* Note: The event notification timeout is useful to avoid propagating events to the client
* too frequently since this is accomplished via an expensive interprocess call.
* One can think of the timeout as a criteria to determine when event generation has
@@ -106,11 +135,181 @@ public class AccessibilityServiceInfo implements Parcelable {
/**
* This field represents a set of flags used for configuring an
* {@link AccessibilityService}.
- *
+ * <p>
+ * <strong>Can be dynamically set at runtime.</strong>
+ * </p>
* @see #DEFAULT
*/
public int flags;
+ /**
+ * The unique string Id to identify the accessibility service.
+ */
+ private String mId;
+
+ /**
+ * The Service that implements this accessibility service component.
+ */
+ private ResolveInfo mResolveInfo;
+
+ /**
+ * The accessibility service setting activity's name, used by the system
+ * settings to launch the setting activity of this accessibility service.
+ */
+ private String mSettingsActivityName;
+
+ /**
+ * Flag whether this accessibility service can retrieve screen content.
+ */
+ private boolean mCanRetrieveWindowContent;
+
+ /**
+ * Creates a new instance.
+ */
+ public AccessibilityServiceInfo() {
+ /* do nothing */
+ }
+
+ /**
+ * Creates a new instance.
+ *
+ * @param resolveInfo The service resolve info.
+ * @param context Context for accessing resources.
+ * @throws XmlPullParserException If a XML parsing error occurs.
+ * @throws IOException If a XML parsing error occurs.
+ *
+ * @hide
+ */
+ public AccessibilityServiceInfo(ResolveInfo resolveInfo, Context context)
+ throws XmlPullParserException, IOException {
+ ServiceInfo serviceInfo = resolveInfo.serviceInfo;
+ mId = new ComponentName(serviceInfo.packageName, serviceInfo.name).flattenToShortString();
+ mResolveInfo = resolveInfo;
+
+ String settingsActivityName = null;
+ boolean retrieveScreenContent = false;
+ XmlResourceParser parser = null;
+
+ try {
+ PackageManager packageManager = context.getPackageManager();
+ parser = serviceInfo.loadXmlMetaData(packageManager,
+ AccessibilityService.SERVICE_META_DATA);
+ if (parser == null) {
+ return;
+ }
+
+ int type = 0;
+ while (type != XmlPullParser.END_DOCUMENT && type != XmlPullParser.START_TAG) {
+ type = parser.next();
+ }
+
+ String nodeName = parser.getName();
+ if (!TAG_ACCESSIBILITY_SERVICE.equals(nodeName)) {
+ throw new XmlPullParserException( "Meta-data does not start with"
+ + TAG_ACCESSIBILITY_SERVICE + " tag");
+ }
+
+ AttributeSet allAttributes = Xml.asAttributeSet(parser);
+ Resources resources = packageManager.getResourcesForApplication(
+ serviceInfo.applicationInfo);
+ TypedArray asAttributes = resources.obtainAttributes(allAttributes,
+ com.android.internal.R.styleable.AccessibilityService);
+ eventTypes = asAttributes.getInt(
+ com.android.internal.R.styleable.AccessibilityService_accessibilityEventTypes,
+ 0);
+ String packageNamez = asAttributes.getString(
+ com.android.internal.R.styleable.AccessibilityService_packageNames);
+ if (packageNamez != null) {
+ packageNames = packageNamez.split("(\\s)*,(\\s)*");
+ }
+ feedbackType = asAttributes.getInt(
+ com.android.internal.R.styleable.AccessibilityService_accessibilityFeedbackType,
+ 0);
+ notificationTimeout = asAttributes.getInt(
+ com.android.internal.R.styleable.AccessibilityService_notificationTimeout,
+ 0);
+ flags = asAttributes.getInt(
+ com.android.internal.R.styleable.AccessibilityService_accessibilityFlags, 0);
+ mSettingsActivityName = asAttributes.getString(
+ com.android.internal.R.styleable.AccessibilityService_settingsActivity);
+ mCanRetrieveWindowContent = asAttributes.getBoolean(
+ com.android.internal.R.styleable.AccessibilityService_canRetrieveWindowContent,
+ false);
+ asAttributes.recycle();
+ } catch (NameNotFoundException e) {
+ throw new XmlPullParserException( "Unable to create context for: "
+ + serviceInfo.packageName);
+ } finally {
+ if (parser != null) {
+ parser.close();
+ }
+ }
+ }
+
+ /**
+ * Updates the properties that an AccessibilitySerivice can change dynamically.
+ *
+ * @param other The info from which to update the properties.
+ *
+ * @hide
+ */
+ public void updateDynamicallyConfigurableProperties(AccessibilityServiceInfo other) {
+ eventTypes = other.eventTypes;
+ packageNames = other.packageNames;
+ feedbackType = other.feedbackType;
+ notificationTimeout = other.notificationTimeout;
+ flags = other.flags;
+ }
+
+ /**
+ * The accessibility service id.
+ * <p>
+ * <strong>Generated by the system.</strong>
+ * </p>
+ * @return The id.
+ */
+ public String getId() {
+ return mId;
+ }
+
+ /**
+ * The service {@link ResolveInfo}.
+ * <p>
+ * <strong>Generated by the system.</strong>
+ * </p>
+ * @return The info.
+ */
+ public ResolveInfo getResolveInfo() {
+ return mResolveInfo;
+ }
+
+ /**
+ * The settings activity name.
+ * <p>
+ * <strong>Statically set from
+ * {@link AccessibilityService#SERVICE_META_DATA meta-data}.</strong>
+ * </p>
+ * @return The settings activity name.
+ */
+ public String getSettingsActivityName() {
+ return mSettingsActivityName;
+ }
+
+ /**
+ * Whether this service can retrieve the currently focused window content.
+ * <p>
+ * <strong>Statically set from
+ * {@link AccessibilityService#SERVICE_META_DATA meta-data}.</strong>
+ * </p>
+ * @return True screen content is retrieved.
+ */
+ public boolean getCanRetrieveWindowContent() {
+ return mCanRetrieveWindowContent;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public int describeContents() {
return 0;
}
@@ -121,6 +320,142 @@ public class AccessibilityServiceInfo implements Parcelable {
parcel.writeInt(feedbackType);
parcel.writeLong(notificationTimeout);
parcel.writeInt(flags);
+ parcel.writeString(mId);
+ parcel.writeParcelable(mResolveInfo, 0);
+ parcel.writeString(mSettingsActivityName);
+ parcel.writeInt(mCanRetrieveWindowContent ? 1 : 0);
+ }
+
+ private void initFromParcel(Parcel parcel) {
+ eventTypes = parcel.readInt();
+ packageNames = parcel.readStringArray();
+ feedbackType = parcel.readInt();
+ notificationTimeout = parcel.readLong();
+ flags = parcel.readInt();
+ mId = parcel.readString();
+ mResolveInfo = parcel.readParcelable(null);
+ mSettingsActivityName = parcel.readString();
+ mCanRetrieveWindowContent = (parcel.readInt() == 1);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder stringBuilder = new StringBuilder();
+ appendEventTypes(stringBuilder, eventTypes);
+ stringBuilder.append(", ");
+ appendPackageNames(stringBuilder, packageNames);
+ stringBuilder.append(", ");
+ appendFeedbackTypes(stringBuilder, feedbackType);
+ stringBuilder.append(", ");
+ stringBuilder.append("notificationTimeout: ").append(notificationTimeout);
+ stringBuilder.append(", ");
+ appendFlags(stringBuilder, flags);
+ stringBuilder.append(", ");
+ stringBuilder.append("id: ").append(mId);
+ stringBuilder.append(", ");
+ stringBuilder.append("resolveInfo: ").append(mResolveInfo);
+ stringBuilder.append(", ");
+ stringBuilder.append("settingsActivityName: ").append(mSettingsActivityName);
+ stringBuilder.append(", ");
+ stringBuilder.append("retrieveScreenContent: ").append(mCanRetrieveWindowContent);
+ return stringBuilder.toString();
+ }
+
+ private static void appendFeedbackTypes(StringBuilder stringBuilder, int feedbackTypes) {
+ stringBuilder.append("feedbackTypes:");
+ stringBuilder.append("[");
+ while (feedbackTypes != 0) {
+ final int feedbackTypeBit = (1 << Integer.numberOfTrailingZeros(feedbackTypes));
+ stringBuilder.append(feedbackTypeToString(feedbackTypeBit));
+ feedbackTypes &= ~feedbackTypeBit;
+ if (feedbackTypes != 0) {
+ stringBuilder.append(", ");
+ }
+ }
+ stringBuilder.append("]");
+ }
+
+ private static void appendPackageNames(StringBuilder stringBuilder, String[] packageNames) {
+ stringBuilder.append("packageNames:");
+ stringBuilder.append("[");
+ if (packageNames != null) {
+ final int packageNameCount = packageNames.length;
+ for (int i = 0; i < packageNameCount; i++) {
+ stringBuilder.append(packageNames[i]);
+ if (i < packageNameCount - 1) {
+ stringBuilder.append(", ");
+ }
+ }
+ }
+ stringBuilder.append("]");
+ }
+
+ private static void appendEventTypes(StringBuilder stringBuilder, int eventTypes) {
+ stringBuilder.append("eventTypes:");
+ stringBuilder.append("[");
+ while (eventTypes != 0) {
+ final int eventTypeBit = (1 << Integer.numberOfTrailingZeros(eventTypes));
+ stringBuilder.append(AccessibilityEvent.eventTypeToString(eventTypeBit));
+ eventTypes &= ~eventTypeBit;
+ if (eventTypes != 0) {
+ stringBuilder.append(", ");
+ }
+ }
+ stringBuilder.append("]");
+ }
+
+ private static void appendFlags(StringBuilder stringBuilder, int flags) {
+ stringBuilder.append("flags:");
+ stringBuilder.append("[");
+ while (flags != 0) {
+ final int flagBit = (1 << Integer.numberOfTrailingZeros(flags));
+ stringBuilder.append(flagToString(flagBit));
+ flags &= ~flagBit;
+ if (flags != 0) {
+ stringBuilder.append(", ");
+ }
+ }
+ stringBuilder.append("]");
+ }
+
+ /**
+ * Returns the string representation of a feedback type. For example,
+ * {@link #FEEDBACK_SPOKEN} is represented by the string FEEDBACK_SPOKEN.
+ *
+ * @param feedbackType The feedback type.
+ * @return The string representation.
+ */
+ public static String feedbackTypeToString(int feedbackType) {
+ switch (feedbackType) {
+ case FEEDBACK_AUDIBLE:
+ return "FEEDBACK_AUDIBLE";
+ case FEEDBACK_HAPTIC:
+ return "FEEDBACK_HAPTIC";
+ case FEEDBACK_GENERIC:
+ return "FEEDBACK_GENERIC";
+ case FEEDBACK_SPOKEN:
+ return "FEEDBACK_SPOKEN";
+ case FEEDBACK_VISUAL:
+ return "FEEDBACK_VISUAL";
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * Returns the string representation of a flag. For example,
+ * {@link #DEFAULT} is represented by the string DEFAULT.
+ *
+ * @param flag The flag.
+ * @return The string representation.
+ */
+ public static String flagToString(int flag) {
+ switch (flag) {
+ case DEFAULT:
+ return "DEFAULT";
+ default:
+ return null;
+ }
}
/**
@@ -130,11 +465,7 @@ public class AccessibilityServiceInfo implements Parcelable {
new Parcelable.Creator<AccessibilityServiceInfo>() {
public AccessibilityServiceInfo createFromParcel(Parcel parcel) {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
- info.eventTypes = parcel.readInt();
- info.packageNames = parcel.readStringArray();
- info.feedbackType = parcel.readInt();
- info.notificationTimeout = parcel.readLong();
- info.flags = parcel.readInt();
+ info.initFromParcel(parcel);
return info;
}
diff --git a/core/java/android/nfc/tech/MifareClassic.java b/core/java/android/nfc/tech/MifareClassic.java
index 9a2f2bd..c4b7718 100644
--- a/core/java/android/nfc/tech/MifareClassic.java
+++ b/core/java/android/nfc/tech/MifareClassic.java
@@ -82,12 +82,12 @@ public final class MifareClassic extends BasicTagTechnology {
{(byte)0xA0,(byte)0xA1,(byte)0xA2,(byte)0xA3,(byte)0xA4,(byte)0xA5};
/**
* The well-known key for tags formatted according to the
- * NDEF on Mifare Classic specification.
+ * NDEF on MIFARE Classic specification.
*/
public static final byte[] KEY_NFC_FORUM =
{(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7,(byte)0xD3,(byte)0xF7};
- /** A Mifare Classic compatible card of unknown type */
+ /** A MIFARE Classic compatible card of unknown type */
public static final int TYPE_UNKNOWN = -1;
/** A MIFARE Classic tag */
public static final int TYPE_CLASSIC = 0;
@@ -141,7 +141,7 @@ public final class MifareClassic extends BasicTagTechnology {
public MifareClassic(Tag tag) throws RemoteException {
super(tag, TagTechnology.MIFARE_CLASSIC);
- NfcA a = NfcA.get(tag); // Mifare Classic is always based on NFC a
+ NfcA a = NfcA.get(tag); // MIFARE Classic is always based on NFC a
mIsEmulated = false;
@@ -192,7 +192,7 @@ public final class MifareClassic extends BasicTagTechnology {
// Stack incorrectly reported a MifareClassic. We cannot handle this
// gracefully - we have no idea of the memory layout. Bail.
throw new RuntimeException(
- "Tag incorrectly enumerated as Mifare Classic, SAK = " + a.getSak());
+ "Tag incorrectly enumerated as MIFARE Classic, SAK = " + a.getSak());
}
}
@@ -221,8 +221,8 @@ public final class MifareClassic extends BasicTagTechnology {
/**
* Return true if the tag is emulated, determined at discovery time.
- * These are actually smart-cards that emulate a Mifare Classic interface.
- * They can be treated identically to a Mifare Classic tag.
+ * These are actually smart-cards that emulate a MIFARE Classic interface.
+ * They can be treated identically to a MIFARE Classic tag.
* @hide
*/
public boolean isEmulated() {
@@ -571,8 +571,8 @@ public final class MifareClassic extends BasicTagTechnology {
private static void validateSector(int sector) {
// Do not be too strict on upper bounds checking, since some cards
// have more addressable memory than they report. For example,
- // Mifare Plus 2k cards will appear as Mifare Classic 1k cards when in
- // Mifare Classic compatibility mode.
+ // MIFARE Plus 2k cards will appear as MIFARE Classic 1k cards when in
+ // MIFARE Classic compatibility mode.
// Note that issuing a command to an out-of-bounds block is safe - the
// tag should report error causing IOException. This validation is a
// helper to guard against obvious programming mistakes.
diff --git a/core/java/android/nfc/tech/MifareUltralight.java b/core/java/android/nfc/tech/MifareUltralight.java
index 87c8d99..6c2754b 100644
--- a/core/java/android/nfc/tech/MifareUltralight.java
+++ b/core/java/android/nfc/tech/MifareUltralight.java
@@ -18,6 +18,7 @@ package android.nfc.tech;
import android.nfc.Tag;
import android.nfc.TagLostException;
+import android.os.Bundle;
import android.os.RemoteException;
import java.io.IOException;
@@ -69,6 +70,9 @@ public final class MifareUltralight extends BasicTagTechnology {
private static final int NXP_MANUFACTURER_ID = 0x04;
private static final int MAX_PAGE_COUNT = 256;
+ /** @hide */
+ public static final String EXTRA_IS_UL_C = "isulc";
+
private int mType;
/**
@@ -95,16 +99,18 @@ public final class MifareUltralight extends BasicTagTechnology {
public MifareUltralight(Tag tag) throws RemoteException {
super(tag, TagTechnology.MIFARE_ULTRALIGHT);
- // Check if this could actually be a Mifare
+ // Check if this could actually be a MIFARE
NfcA a = NfcA.get(tag);
mType = TYPE_UNKNOWN;
if (a.getSak() == 0x00 && tag.getId()[0] == NXP_MANUFACTURER_ID) {
- // could be UL or UL-C
- //TODO: stack should use NXP AN1303 procedure to make a best guess
- // attempt at classifying Ultralight vs Ultralight C.
- mType = TYPE_ULTRALIGHT;
+ Bundle extras = tag.getTechExtras(TagTechnology.MIFARE_ULTRALIGHT);
+ if (extras.getBoolean(EXTRA_IS_UL_C)) {
+ mType = TYPE_ULTRALIGHT_C;
+ } else {
+ mType = TYPE_ULTRALIGHT;
+ }
}
}
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index f56f6a9..eb0cf37 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -20,6 +20,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -226,4 +227,20 @@ public class FileUtils
input.close();
}
}
+
+ /**
+ * Writes string to file. Basically same as "echo -n $string > $filename"
+ *
+ * @param filename
+ * @param string
+ * @throws IOException
+ */
+ public static void stringToFile(String filename, String string) throws IOException {
+ FileWriter out = new FileWriter(filename);
+ try {
+ out.write(string);
+ } finally {
+ out.close();
+ }
+ }
}
diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java
index 20614dc..0ef38bf 100644
--- a/core/java/android/provider/Calendar.java
+++ b/core/java/android/provider/Calendar.java
@@ -89,17 +89,17 @@ public final class Calendar {
protected interface BaseSyncColumns {
/** Generic column for use by sync adapters. */
- public static final String SYNC1 = "sync1";
+ public static final String CAL_SYNC1 = "cal_sync1";
/** Generic column for use by sync adapters. */
- public static final String SYNC2 = "sync2";
+ public static final String CAL_SYNC2 = "cal_sync2";
/** Generic column for use by sync adapters. */
- public static final String SYNC3 = "sync3";
+ public static final String CAL_SYNC3 = "cal_sync3";
/** Generic column for use by sync adapters. */
- public static final String SYNC4 = "sync4";
+ public static final String CAL_SYNC4 = "cal_sync4";
/** Generic column for use by sync adapters. */
- public static final String SYNC5 = "sync5";
+ public static final String CAL_SYNC5 = "cal_sync5";
/** Generic column for use by sync adapters. */
- public static final String SYNC6 = "sync6";
+ public static final String CAL_SYNC6 = "cal_sync6";
}
/**
@@ -264,12 +264,12 @@ public final class Calendar {
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_TIME);
DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC1);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC2);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC3);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC4);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC5);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.SYNC6);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC1);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC2);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC3);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC4);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC5);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.CAL_SYNC6);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, Calendars.NAME);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
@@ -453,12 +453,11 @@ public final class Calendar {
CALENDAR_TIMEZONE,
ACCESS_LEVEL,
DELETED,
- SYNC1,
- SYNC2,
- SYNC3,
- SYNC4,
- SYNC5,
- SYNC6,
+ CAL_SYNC1,
+ CAL_SYNC2,
+ CAL_SYNC3,
+ CAL_SYNC4,
+ CAL_SYNC5, CAL_SYNC6,
SYNC_STATE,
};
}
@@ -923,7 +922,12 @@ public final class Calendar {
DatabaseUtils.cursorLongToContentValuesIfPresent(cursor, cv, DIRTY);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, _SYNC_VERSION);
DatabaseUtils.cursorIntToContentValuesIfPresent(cursor, cv, EventsColumns.DELETED);
- DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, SYNC1);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC1);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC2);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC3);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC4);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC5);
+ DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv, CAL_SYNC6);
DatabaseUtils.cursorStringToContentValuesIfPresent(cursor, cv,
Events.SYNC_DATA1);
diff --git a/core/java/android/text/MeasuredText.java b/core/java/android/text/MeasuredText.java
index 761c271..a81be09 100644
--- a/core/java/android/text/MeasuredText.java
+++ b/core/java/android/text/MeasuredText.java
@@ -16,14 +16,14 @@
package android.text;
-import com.android.internal.util.ArrayUtils;
-
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.style.MetricAffectingSpan;
import android.text.style.ReplacementSpan;
import android.util.Log;
+import com.android.internal.util.ArrayUtils;
+
/**
* @hide
*/
@@ -187,6 +187,7 @@ class MeasuredText {
w[mPos] = wid;
for (int i = mPos + 1, e = mPos + len; i < e; i++)
w[i] = 0;
+ mPos += len;
}
if (fm != null) {
diff --git a/core/java/android/text/method/WordIterator.java b/core/java/android/text/method/WordIterator.java
index b250414..af524ee 100644
--- a/core/java/android/text/method/WordIterator.java
+++ b/core/java/android/text/method/WordIterator.java
@@ -213,7 +213,8 @@ public class WordIterator implements Selection.PositionIterator {
private void checkOffsetIsValid(int offset) {
if (offset < 0 || offset > mCurrent.length()) {
- final String message = "Valid range is [0, " + mCurrent.length() + "]";
+ final String message = "Invalid offset: " + offset +
+ ". Valid range is [0, " + mCurrent.length() + "]";
throw new IllegalArgumentException(message);
}
}
diff --git a/core/java/android/util/Log.java b/core/java/android/util/Log.java
index 38903ab..1c3709f 100644
--- a/core/java/android/util/Log.java
+++ b/core/java/android/util/Log.java
@@ -20,6 +20,7 @@ import com.android.internal.os.RuntimeInit;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.UnknownHostException;
/**
* API for sending log output.
@@ -302,6 +303,17 @@ public final class Log {
if (tr == null) {
return "";
}
+
+ // This is to reduce the amount of log spew that apps do in the non-error
+ // condition of the network being unavailable.
+ Throwable t = tr;
+ while (t != null) {
+ if (t instanceof UnknownHostException) {
+ return "";
+ }
+ t = t.getCause();
+ }
+
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
tr.printStackTrace(pw);
diff --git a/core/java/android/view/Gravity.java b/core/java/android/view/Gravity.java
index 176c487..b2a35d3 100644
--- a/core/java/android/view/Gravity.java
+++ b/core/java/android/view/Gravity.java
@@ -345,18 +345,12 @@ public class Gravity
* if horizontal direction is LTR, then BEFORE will set LEFT and AFTER will set RIGHT.
* if horizontal direction is RTL, then BEFORE will set RIGHT and AFTER will set LEFT.
*
- * If no horizontal direction is found, then just add LEFT to the existing gravity
- *
* @param gravity The gravity to convert to absolute (horizontal) values.
* @param isRtl Whether the layout is right-to-left.
* @return gravity converted to absolute (horizontal) values.
*/
public static int getAbsoluteGravity(int gravity, boolean isRtl) {
int result = gravity;
- // Set default gravity, if no horizontal gravity is specified
- if ((result & HORIZONTAL_GRAVITY_MASK) == 0) {
- result |= Gravity.LEFT;
- }
// If layout is script specific and gravity is horizontal relative (BEFORE or AFTER)
if ((result & RELATIVE_HORIZONTAL_DIRECTION) > 0) {
if ((result & Gravity.BEFORE) == Gravity.BEFORE) {
diff --git a/core/java/android/view/accessibility/AccessibilityEvent.java b/core/java/android/view/accessibility/AccessibilityEvent.java
index 5e18f55..7b80797 100644
--- a/core/java/android/view/accessibility/AccessibilityEvent.java
+++ b/core/java/android/view/accessibility/AccessibilityEvent.java
@@ -516,9 +516,9 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
- builder.append("; EventType: " + mEventType);
- builder.append("; EventTime: " + mEventTime);
- builder.append("; PackageName: " + mPackageName);
+ builder.append("; EventType: ").append(eventTypeToString(mEventType));
+ builder.append("; EventTime: ").append(mEventTime);
+ builder.append("; PackageName: ").append(mPackageName);
builder.append(" \n{\n");
builder.append(super.toString());
builder.append("\n");
@@ -535,6 +535,42 @@ public final class AccessibilityEvent extends AccessibilityRecord implements Par
}
/**
+ * Returns the string representation of an event type. For example,
+ * {@link #TYPE_VIEW_CLICKED} is represented by the string TYPE_VIEW_CLICKED.
+ *
+ * @param feedbackType The event type
+ * @return The string representation.
+ */
+ public static String eventTypeToString(int feedbackType) {
+ switch (feedbackType) {
+ case TYPE_VIEW_CLICKED:
+ return "TYPE_VIEW_CLICKED";
+ case TYPE_VIEW_LONG_CLICKED:
+ return "TYPE_VIEW_LONG_CLICKED";
+ case TYPE_VIEW_SELECTED:
+ return "TYPE_VIEW_SELECTED";
+ case TYPE_VIEW_FOCUSED:
+ return "TYPE_VIEW_FOCUSED";
+ case TYPE_VIEW_TEXT_CHANGED:
+ return "TYPE_VIEW_TEXT_CHANGED";
+ case TYPE_WINDOW_STATE_CHANGED:
+ return "TYPE_WINDOW_STATE_CHANGED";
+ case TYPE_VIEW_HOVER_ENTER:
+ return "TYPE_VIEW_HOVER_ENTER";
+ case TYPE_VIEW_HOVER_EXIT:
+ return "TYPE_VIEW_HOVER_EXIT";
+ case TYPE_NOTIFICATION_STATE_CHANGED:
+ return "TYPE_NOTIFICATION_STATE_CHANGED";
+ case TYPE_TOUCH_EXPLORATION_GESTURE_START:
+ return "TYPE_TOUCH_EXPLORATION_GESTURE_START";
+ case TYPE_TOUCH_EXPLORATION_GESTURE_END:
+ return "TYPE_TOUCH_EXPLORATION_GESTURE_END";
+ default:
+ return null;
+ }
+ }
+
+ /**
* @see Parcelable.Creator
*/
public static final Parcelable.Creator<AccessibilityEvent> CREATOR =
diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java
index dd77193..88f8878 100644
--- a/core/java/android/view/accessibility/AccessibilityManager.java
+++ b/core/java/android/view/accessibility/AccessibilityManager.java
@@ -16,7 +16,6 @@
package android.view.accessibility;
-import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.Context;
import android.content.pm.ServiceInfo;
@@ -30,6 +29,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.util.Log;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -201,11 +201,30 @@ public final class AccessibilityManager {
* Returns the {@link ServiceInfo}s of the installed accessibility services.
*
* @return An unmodifiable list with {@link ServiceInfo}s.
+ *
+ * @deprecated Use {@link #getInstalledAccessibilityServiceList()}
*/
+ @Deprecated
public List<ServiceInfo> getAccessibilityServiceList() {
- List<ServiceInfo> services = null;
+ List<AccessibilityServiceInfo> infos = getInstalledAccessibilityServiceList();
+ List<ServiceInfo> services = new ArrayList<ServiceInfo>();
+ final int infoCount = infos.size();
+ for (int i = 0; i < infoCount; i++) {
+ AccessibilityServiceInfo info = infos.get(i);
+ services.add(info.getResolveInfo().serviceInfo);
+ }
+ return Collections.unmodifiableList(services);
+ }
+
+ /**
+ * Returns the {@link AccessibilityServiceInfo}s of the installed accessibility services.
+ *
+ * @return An unmodifiable list with {@link AccessibilityServiceInfo}s.
+ */
+ public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList() {
+ List<AccessibilityServiceInfo> services = null;
try {
- services = mService.getAccessibilityServiceList();
+ services = mService.getInstalledAccessibilityServiceList();
if (DEBUG) {
Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
}
@@ -216,20 +235,14 @@ public final class AccessibilityManager {
}
/**
- * Returns the {@link ServiceInfo}s of the enabled accessibility services
+ * Returns the {@link AccessibilityServiceInfo}s of the enabled accessibility services
* for a given feedback type.
*
- * @param feedbackType The type of feedback.
- * @return An unmodifiable list with {@link ServiceInfo}s.
- *
- * @see AccessibilityServiceInfo#FEEDBACK_AUDIBLE
- * @see AccessibilityServiceInfo#FEEDBACK_HAPTIC
- * @see AccessibilityServiceInfo#FEEDBACK_SPOKEN
- * @see AccessibilityServiceInfo#FEEDBACK_VISUAL
- * @see AccessibilityServiceInfo#FEEDBACK_GENERIC
+ * @param feedbackType The feedback type (can be bitwise or of multiple types).
+ * @return An unmodifiable list with {@link AccessibilityServiceInfo}s.
*/
- public List<ServiceInfo> getEnabledAccessibilityServiceList(int feedbackType) {
- List<ServiceInfo> services = null;
+ public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackType) {
+ List<AccessibilityServiceInfo> services = null;
try {
services = mService.getEnabledAccessibilityServiceList(feedbackType);
if (DEBUG) {
diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl
index aaaae32..6b2aae2 100644
--- a/core/java/android/view/accessibility/IAccessibilityManager.aidl
+++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl
@@ -17,9 +17,9 @@
package android.view.accessibility;
+import android.accessibilityservice.AccessibilityServiceInfo;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManagerClient;
-import android.content.pm.ServiceInfo;
/**
* Interface implemented by the AccessibilityManagerService called by
@@ -33,9 +33,9 @@ interface IAccessibilityManager {
boolean sendAccessibilityEvent(in AccessibilityEvent uiEvent);
- List<ServiceInfo> getAccessibilityServiceList();
+ List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList();
- List<ServiceInfo> getEnabledAccessibilityServiceList(int feedbackType);
+ List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackType);
void interrupt();
}
diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java
index 12391df..5b78586 100644
--- a/core/java/android/webkit/JWebCoreJavaBridge.java
+++ b/core/java/android/webkit/JWebCoreJavaBridge.java
@@ -16,6 +16,7 @@
package android.webkit;
+import android.net.ProxyProperties;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
@@ -294,6 +295,20 @@ final class JWebCoreJavaBridge extends Handler {
mContentUriToFilePathMap.put(contentUri, path);
}
+ public void updateProxy(ProxyProperties proxyProperties) {
+ if (proxyProperties == null) {
+ nativeUpdateProxy("", "");
+ return;
+ }
+
+ String host = proxyProperties.getHost();
+ int port = proxyProperties.getPort();
+ if (port != 0)
+ host += ":" + port;
+
+ nativeUpdateProxy(host, proxyProperties.getExclusionList());
+ }
+
private native void nativeConstructor();
private native void nativeFinalize();
private native void sharedTimerFired();
@@ -304,5 +319,5 @@ final class JWebCoreJavaBridge extends Handler {
public native void addPackageNames(Set<String> packageNames);
public native void addPackageName(String packageName);
public native void removePackageName(String packageName);
- public native void updateProxy(String newProxy);
+ public native void nativeUpdateProxy(String newProxy, String exclusionList);
}
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index a480b84..d54230c 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -34,6 +34,7 @@ import android.text.BoringLayout.Metrics;
import android.text.DynamicLayout;
import android.text.Editable;
import android.text.InputFilter;
+import android.text.InputType;
import android.text.Layout;
import android.text.Selection;
import android.text.Spannable;
@@ -853,7 +854,7 @@ import junit.framework.Assert;
public void setAdapterCustom(AutoCompleteAdapter adapter) {
if (adapter != null) {
setInputType(getInputType()
- | EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE);
+ | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
adapter.setTextView(this);
if (mAutoFillable) {
setOnItemClickListener(this);
@@ -934,7 +935,7 @@ import junit.framework.Assert;
*/
/* package */ void setInPassword(boolean inPassword) {
if (inPassword) {
- setInputType(EditorInfo.TYPE_CLASS_TEXT | EditorInfo.
+ setInputType(InputType.TYPE_CLASS_TEXT | EditorInfo.
TYPE_TEXT_VARIATION_WEB_PASSWORD);
createBackground();
}
@@ -1146,8 +1147,8 @@ import junit.framework.Assert;
boolean single = true;
boolean inPassword = false;
int maxLength = -1;
- int inputType = EditorInfo.TYPE_CLASS_TEXT
- | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
+ int inputType = InputType.TYPE_CLASS_TEXT
+ | InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
int imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
| EditorInfo.IME_FLAG_NO_FULLSCREEN;
if (TEXT_AREA != type
@@ -1160,9 +1161,9 @@ import junit.framework.Assert;
break;
case TEXT_AREA:
single = false;
- inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
- | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES
- | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
+ inputType |= InputType.TYPE_TEXT_FLAG_MULTI_LINE
+ | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
+ | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
imeOptions |= EditorInfo.IME_ACTION_NONE;
break;
case PASSWORD:
@@ -1173,17 +1174,21 @@ import junit.framework.Assert;
imeOptions |= EditorInfo.IME_ACTION_SEARCH;
break;
case EMAIL:
- inputType |= EditorInfo.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
+ // inputType needs to be overwritten because of the different text variation.
+ inputType = InputType.TYPE_CLASS_TEXT
+ | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS;
imeOptions |= EditorInfo.IME_ACTION_GO;
break;
case NUMBER:
- inputType |= EditorInfo.TYPE_CLASS_NUMBER;
+ // inputType needs to be overwritten because of the different class.
+ inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL;
// Number and telephone do not have both a Tab key and an
// action, so set the action to NEXT
imeOptions |= EditorInfo.IME_ACTION_NEXT;
break;
case TELEPHONE:
- inputType |= EditorInfo.TYPE_CLASS_PHONE;
+ // inputType needs to be overwritten because of the different class.
+ inputType = InputType.TYPE_CLASS_PHONE;
imeOptions |= EditorInfo.IME_ACTION_NEXT;
break;
case URL:
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 61a69ca..3c2c8f6 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -1067,20 +1067,10 @@ public class WebView extends AbsoluteLayout
private static void handleProxyBroadcast(Intent intent) {
ProxyProperties proxyProperties = (ProxyProperties)intent.getExtra(Proxy.EXTRA_PROXY_INFO);
if (proxyProperties == null || proxyProperties.getHost() == null) {
- WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, "");
+ WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, null);
return;
}
-
- String host = proxyProperties.getHost();
- int port = proxyProperties.getPort();
- if (port != 0)
- host += ":" + port;
-
- // TODO: Handle exclusion list
- // The plan is to make an AndroidProxyResolver, and handle the blacklist
- // there
- String exclusionList = proxyProperties.getExclusionList();
- WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, host);
+ WebViewCore.sendStaticMessage(EventHub.PROXY_CHANGED, proxyProperties);
}
/*
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index db5ff54..13a9793 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -24,6 +24,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
import android.media.MediaFile;
+import android.net.ProxyProperties;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
@@ -708,7 +709,7 @@ public final class WebViewCore {
throw new IllegalStateException(
"No WebView has been created in this process!");
}
- BrowserFrame.sJavaBridge.updateProxy((String) msg.obj);
+ BrowserFrame.sJavaBridge.updateProxy((ProxyProperties)msg.obj);
break;
}
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index f4300a5..680bb7d 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2572,17 +2572,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
}
@Override
- public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
- // Add a record for ourselves as well.
- AccessibilityEvent record = AccessibilityEvent.obtain();
- // Set the class since it is not populated in #dispatchPopulateAccessibilityEvent
- record.setClassName(getClass().getName());
- child.dispatchPopulateAccessibilityEvent(record);
- event.appendRecord(record);
- return true;
- }
-
- @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return false;
}
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java
index 14ea853..c4d05e9 100644
--- a/core/java/android/widget/AdapterView.java
+++ b/core/java/android/widget/AdapterView.java
@@ -887,14 +887,28 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup {
// We first get a chance to populate the event.
onPopulateAccessibilityEvent(event);
+ return false;
+ }
+
+ @Override
+ public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
// We send selection events only from AdapterView to avoid
// generation of such event for each child.
View selectedView = getSelectedView();
if (selectedView != null) {
- return selectedView.dispatchPopulateAccessibilityEvent(event);
+ selectedView.dispatchPopulateAccessibilityEvent(event);
}
+ }
- return false;
+ @Override
+ public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
+ // Add a record for ourselves as well.
+ AccessibilityEvent record = AccessibilityEvent.obtain();
+ // Set the class since it is not populated in #dispatchPopulateAccessibilityEvent
+ record.setClassName(getClass().getName());
+ child.dispatchPopulateAccessibilityEvent(record);
+ event.appendRecord(record);
+ return true;
}
@Override
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 34f748a..18c3b24 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -9165,6 +9165,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
public abstract void updatePosition(float x, float y);
protected void positionAtCursorOffset(int offset) {
+ // A HandleView relies on the layout, which may be nulled by external methods.
+ if (mLayout == null) {
+ // Will update controllers' state, hiding them and stopping selection mode if needed
+ prepareCursorControllers();
+ return;
+ }
+
addPositionToTouchUpFilter(offset);
final int line = mLayout.getLineForOffset(offset);
final int lineBottom = mLayout.getLineBottom(line);
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 31897ef..b7aac14 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -285,6 +285,9 @@ public class ActionBarView extends AbsActionBarView {
public void setEmbeddedTabView(ScrollingTabContainerView tabs) {
mTabScrollView = tabs;
mIncludeTabs = tabs != null;
+ if (mIncludeTabs) {
+ addView(mTabScrollView);
+ }
}
public void setCallback(OnNavigationListener callback) {
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index 5ab6dd3..f28fc26 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -48,7 +48,7 @@ public:
static void killPicture(JNIEnv* env, jobject, SkPicture* picture) {
SkASSERT(picture);
- delete picture;
+ picture->unref();
}
static void draw(JNIEnv* env, jobject, SkCanvas* canvas,
diff --git a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
index abaea2d..ee1054e 100644
--- a/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_middle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
index 8982396..b7ddbb4 100644
--- a/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/dialog_top_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
index 68f9e57..ec06c17 100644
--- a/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_middle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
index 60aa8cb..7a2bf8d 100644
--- a/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/dialog_top_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png
index 55c60b8..bdb6824 100644
--- a/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/dialog_middle_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png b/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png
index d33d033..aa8401d 100644
--- a/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/dialog_top_holo_light.9.png
Binary files differ
diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_ticker.xml b/core/res/res/layout-sw600dp/status_bar_latest_event_ticker.xml
index 7631781..7631781 100644
--- a/core/res/res/layout-xlarge/status_bar_latest_event_ticker.xml
+++ b/core/res/res/layout-sw600dp/status_bar_latest_event_ticker.xml
diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml b/core/res/res/layout-sw600dp/status_bar_latest_event_ticker_large_icon.xml
index ff0f7d4..ff0f7d4 100644
--- a/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml
+++ b/core/res/res/layout-sw600dp/status_bar_latest_event_ticker_large_icon.xml
diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml
new file mode 100644
index 0000000..df1597c
--- /dev/null
+++ b/core/res/res/values-sw600dp/dimens.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/dimens.xml
+**
+** Copyright 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.
+*/
+-->
+<resources>
+ <!-- Height of the status bar -->
+ <dimen name="status_bar_height">48dip</dimen>
+ <!-- Width and height of a single notification icon in the status bar -->
+ <dimen name="status_bar_icon_size">32dip</dimen>
+ <!-- Size of the giant number (unread count) in the notifications -->
+ <dimen name="status_bar_content_number_size">48sp</dimen>
+</resources>
+
diff --git a/core/res/res/values-xlarge/styles.xml b/core/res/res/values-sw600dp/styles.xml
index 7515c98..7515c98 100644
--- a/core/res/res/values-xlarge/styles.xml
+++ b/core/res/res/values-sw600dp/styles.xml
diff --git a/core/res/res/values-xlarge/dimens.xml b/core/res/res/values-xlarge/dimens.xml
index b906e1a..c15770d 100644
--- a/core/res/res/values-xlarge/dimens.xml
+++ b/core/res/res/values-xlarge/dimens.xml
@@ -18,13 +18,6 @@
*/
-->
<resources>
- <!-- Height of the status bar -->
- <dimen name="status_bar_height">48dip</dimen>
- <!-- Width and height of a single notification icon in the status bar -->
- <dimen name="status_bar_icon_size">32dip</dimen>
- <!-- Size of the giant number (unread count) in the notifications -->
- <dimen name="status_bar_content_number_size">48sp</dimen>
-
<!-- Default height of a key in the password keyboard for alpha -->
<dimen name="password_keyboard_key_height_alpha">75dip</dimen>
<!-- Default height of a key in the password keyboard for numeric -->
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index b82a2d2..e325b8d 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -2137,11 +2137,92 @@
string will be passed to the IME when the framework calls the IME with the
subtype. -->
<attr name="imeSubtypeMode" format="string" />
+ <!-- Set true if the subtype is auxiliary. An auxiliary subtype won't be shown in the
+ input method selection list in the settings app.
+ InputMethodManager#switchToLastInputMethod will ignore auxiliary subtypes when it
+ chooses a target subtype. -->
+ <attr name="isAuxiliary" format="boolean" />
<!-- The extra value of the subtype. This string can be any string and will be passed to
the IME when the framework calls the IME with the subtype. -->
<attr name="imeSubtypeExtraValue" format="string" />
</declare-styleable>
+ <!-- Use <code>accessibility-service</code> as the root tag of the XML resource that
+ describes an {@link android.accessibilityservice.AccessibilityService} service,
+ which is referenced from its
+ {@link android.accessibilityservice.AccessibilityService#SERVICE_META_DATA}
+ meta-data entry. -->
+ <declare-styleable name="AccessibilityService">
+ <!-- The event types this serivce would like to receive as specified in
+ {@link android.view.accessibility.AccessibilityEvent}. This setting
+ can be changed at runtime by calling
+ {@link android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. -->
+ <attr name="accessibilityEventTypes">
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_CLICKED} events.-->
+ <flag name="typeViewClicked" value="0x00000001" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_LONG_CLICKED} events. -->
+ <flag name="typeViewLongClicked" value="0x00000002" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_SELECTED} events. -->
+ <flag name="typeViewSelected" value="0x00000004" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_FOCUSED} events. -->
+ <flag name="typeViewFocused" value="0x00000008" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_TEXT_CHANGED} events. -->
+ <flag name="typeViewTextChanged" value="0x00000010" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_WINDOW_STATE_CHANGED} events. -->
+ <flag name="typeWindowStateChanged" value="0x00000020" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_NOTIFICATION_STATE_CHANGED} events. -->
+ <flag name="typeNotificationStateChanged" value="0x00000040" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_HOVER_ENTER} events. -->
+ <flag name="typeViewHoverEnter" value="0x00000080" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_VIEW_HOVER_EXIT} events. -->
+ <flag name="typeViewHoverExit" value="0x00000100" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_START} events. -->
+ <flag name="typeTouchExplorationGestureStart" value="0x00000200" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPE_TOUCH_EXPLORATION_GESTURE_END} events. -->
+ <flag name="typeTouchExplorationGestureEnd" value="0x00000400" />
+ <!-- Receives {@link android.view.accessibility.AccessibilityEvent#TYPES_ALL_MASK} i.e. all events. -->
+ <flag name="typeAllMask" value="0xffffffff" />
+ </attr>
+ <!-- Comma separated package names from which this serivce would like to receive events (leave out for all packages).
+ This setting can be changed at runtime by calling
+ {@link android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. -->
+ <attr name="packageNames" format="string" />
+ <!-- The feedback types this serivce provides as specified in
+ {@link android.accessibilityservice.AccessibilityServiceInfo}. This setting
+ can be changed at runtime by calling
+ {@link android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. -->
+ <attr name="accessibilityFeedbackType">
+ <!-- Provides {@link android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_SPOKEN} feedback. -->
+ <flag name="feedbackSpoken" value="0x00000001" />
+ <!-- Provides {@link android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_HAPTIC} feedback. -->
+ <flag name="feedbackHaptic" value="0x00000002" />
+ <!-- Provides {@link android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_AUDIBLE} feedback. -->
+ <flag name="feedbackAudible" value="0x00000004" />
+ <!-- Provides {@link android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_VISUAL} feedback. -->
+ <flag name="feedbackVisual" value="0x00000008" />
+ <!-- Provides {@link android.accessibilityservice.AccessibilityServiceInfo#FEEDBACK_GENERIC} feedback. -->
+ <flag name="feedbackGeneric" value="0x00000010" />
+ </attr>
+ <!-- The minimal period in milliseconds between two accessibility events are sent
+ to this serivce. This setting can be changed at runtime by calling
+ {@link android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. -->
+ <attr name="notificationTimeout" format="integer" />
+ <!-- Additional flags as specified in
+ {@link android.accessibilityservice.AccessibilityServiceInfo}.
+ This setting can be changed at runtime by calling
+ {@link android.accessibilityservice.AccessibilityService#setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo)}. -->
+ <attr name="accessibilityFlags">
+ <!-- Has flag {@link android.accessibilityservice.AccessibilityServiceInfo#DEFAULT} -->
+ <flag name="flagDefault" value="0x00000001" />
+ </attr>
+ <!-- Component name of an activity that allows the user to modify
+ the settings for this service. This setting cannot be changed at runtime. -->
+ <attr name="settingsActivity" />
+ <!-- Flag whether the accessibility service wants to be able to retrieve the
+ focused window content. This setting cannot be changed at runtime. -->
+ <attr name="canRetrieveWindowContent" format="boolean" />
+ </declare-styleable>
+
<!-- =============================== -->
<!-- Widget package class attributes -->
<!-- =============================== -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 0bd939e..41a566c 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1685,4 +1685,13 @@
<public type="attr" name="layout_columnSpan" />
<public type="attr" name="layout_columnWeight" />
+ <public type="attr" name="isAuxiliary" />
+
+ <public type="attr" name="accessibilityEventTypes" />
+ <public type="attr" name="packageNames" />
+ <public type="attr" name="accessibilityFeedbackType" />
+ <public type="attr" name="notificationTimeout" />
+ <public type="attr" name="accessibilityFlags" />
+ <public type="attr" name="canRetrieveWindowContent" />
+
</resources>
diff --git a/core/tests/coretests/src/android/view/GravityTest.java b/core/tests/coretests/src/android/view/GravityTest.java
index 010127f..180a390 100644
--- a/core/tests/coretests/src/android/view/GravityTest.java
+++ b/core/tests/coretests/src/android/view/GravityTest.java
@@ -29,14 +29,14 @@ public class GravityTest extends AndroidTestCase {
assertOneGravity(Gravity.RIGHT, Gravity.RIGHT, false);
assertOneGravity(Gravity.RIGHT, Gravity.RIGHT, true);
- assertOneGravity(Gravity.TOP|Gravity.LEFT, Gravity.TOP, false);
- assertOneGravity(Gravity.TOP|Gravity.LEFT, Gravity.TOP, true);
+ assertOneGravity(Gravity.TOP, Gravity.TOP, false);
+ assertOneGravity(Gravity.TOP, Gravity.TOP, true);
- assertOneGravity(Gravity.BOTTOM|Gravity.LEFT, Gravity.BOTTOM, false);
- assertOneGravity(Gravity.BOTTOM|Gravity.LEFT, Gravity.BOTTOM, true);
+ assertOneGravity(Gravity.BOTTOM, Gravity.BOTTOM, false);
+ assertOneGravity(Gravity.BOTTOM, Gravity.BOTTOM, true);
- assertOneGravity(Gravity.CENTER_VERTICAL|Gravity.LEFT, Gravity.CENTER_VERTICAL, false);
- assertOneGravity(Gravity.CENTER_VERTICAL|Gravity.LEFT, Gravity.CENTER_VERTICAL, true);
+ assertOneGravity(Gravity.CENTER_VERTICAL, Gravity.CENTER_VERTICAL, false);
+ assertOneGravity(Gravity.CENTER_VERTICAL, Gravity.CENTER_VERTICAL, true);
assertOneGravity(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_HORIZONTAL, false);
assertOneGravity(Gravity.CENTER_HORIZONTAL, Gravity.CENTER_HORIZONTAL, true);
@@ -44,8 +44,8 @@ public class GravityTest extends AndroidTestCase {
assertOneGravity(Gravity.CENTER, Gravity.CENTER, false);
assertOneGravity(Gravity.CENTER, Gravity.CENTER, true);
- assertOneGravity(Gravity.FILL_VERTICAL|Gravity.LEFT, Gravity.FILL_VERTICAL, false);
- assertOneGravity(Gravity.FILL_VERTICAL|Gravity.LEFT, Gravity.FILL_VERTICAL, true);
+ assertOneGravity(Gravity.FILL_VERTICAL, Gravity.FILL_VERTICAL, false);
+ assertOneGravity(Gravity.FILL_VERTICAL, Gravity.FILL_VERTICAL, true);
assertOneGravity(Gravity.FILL_HORIZONTAL, Gravity.FILL_HORIZONTAL, false);
assertOneGravity(Gravity.FILL_HORIZONTAL, Gravity.FILL_HORIZONTAL, true);
@@ -53,11 +53,11 @@ public class GravityTest extends AndroidTestCase {
assertOneGravity(Gravity.FILL, Gravity.FILL, false);
assertOneGravity(Gravity.FILL, Gravity.FILL, true);
- assertOneGravity(Gravity.CLIP_HORIZONTAL|Gravity.LEFT, Gravity.CLIP_HORIZONTAL, false);
- assertOneGravity(Gravity.CLIP_HORIZONTAL|Gravity.LEFT, Gravity.CLIP_HORIZONTAL, true);
+ assertOneGravity(Gravity.CLIP_HORIZONTAL, Gravity.CLIP_HORIZONTAL, false);
+ assertOneGravity(Gravity.CLIP_HORIZONTAL, Gravity.CLIP_HORIZONTAL, true);
- assertOneGravity(Gravity.CLIP_VERTICAL|Gravity.LEFT, Gravity.CLIP_VERTICAL, false);
- assertOneGravity(Gravity.CLIP_VERTICAL|Gravity.LEFT, Gravity.CLIP_VERTICAL, true);
+ assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, false);
+ assertOneGravity(Gravity.CLIP_VERTICAL, Gravity.CLIP_VERTICAL, true);
assertOneGravity(Gravity.LEFT, Gravity.BEFORE, false);
assertOneGravity(Gravity.RIGHT, Gravity.BEFORE, true);
diff --git a/docs/html/sdk/android-2.3.3.jd b/docs/html/sdk/android-2.3.3.jd
index 6d60fcc..10fc049 100644
--- a/docs/html/sdk/android-2.3.3.jd
+++ b/docs/html/sdk/android-2.3.3.jd
@@ -141,8 +141,8 @@ to a wider range of standard tag technologies, including:</p>
<li>NFC-F (JIS 6319-4)</li>
<li>NFC-V (ISO 15693)</li>
<li>ISO-DEP (ISO 14443-4)</li>
-<li>Mifare Classic</li>
-<li>Mifare Ultralight</li>
+<li>MIFARE Classic</li>
+<li>MIFARE Ultralight</li>
<li>NFC Forum NDEF tags</li>
</ul>
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java
index e275ba8..2220f96 100644
--- a/graphics/java/android/graphics/drawable/AnimationDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java
@@ -62,7 +62,7 @@ import android.util.AttributeSet;
* AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
*
* // Start the animation (looped playback by default).
- * frameAnimation.start()
+ * frameAnimation.start();
* </pre>
* <p>For more information, see the guide to <a
* href="{@docRoot}guide/topics/resources/animation-resource.html">Animation Resources</a>.</p>
@@ -192,6 +192,9 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
*/
public void addFrame(Drawable frame, int duration) {
mAnimationState.addFrame(frame, duration);
+ if (mCurFrame < 0) {
+ setFrame(0, true, false);
+ }
}
private void nextFrame(boolean unschedule) {
diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h
index 2de07b1..e59757a 100644
--- a/include/gui/Sensor.h
+++ b/include/gui/Sensor.h
@@ -21,8 +21,9 @@
#include <sys/types.h>
#include <utils/Errors.h>
-#include <utils/String8.h>
#include <utils/Flattenable.h>
+#include <utils/String8.h>
+#include <utils/Timers.h>
#include <hardware/sensors.h>
@@ -64,6 +65,8 @@ public:
float getResolution() const;
float getPowerUsage() const;
int32_t getMinDelay() const;
+ nsecs_t getMinDelayNs() const;
+ int32_t getVersion() const;
// Flattenable interface
virtual size_t getFlattenedSize() const;
@@ -83,6 +86,7 @@ private:
float mResolution;
float mPower;
int32_t mMinDelay;
+ int32_t mVersion;
};
// ----------------------------------------------------------------------------
diff --git a/include/media/AudioEffect.h b/include/media/AudioEffect.h
index 401638a..dd93fd8 100644
--- a/include/media/AudioEffect.h
+++ b/include/media/AudioEffect.h
@@ -44,50 +44,6 @@ class AudioEffect : public RefBase
public:
/*
- * Static methods for effect libraries management.
- */
-
- /*
- * Loads the effect library which path is given as first argument.
- * This must be the full path of a dynamic library (.so) implementing one or
- * more effect engines and exposing the effect library interface described in
- * EffectApi.h. The function returns a handle on the library for use by
- * further call to unloadEffectLibrary() to unload the library.
- *
- * Parameters:
- * libPath: full path of the dynamic library file in the file system.
- * handle: address where to return the library handle
- *
- * Returned status (from utils/Errors.h) can be:
- * NO_ERROR successful operation.
- * PERMISSION_DENIED could not get AudioFlinger interface or
- * application does not have permission to configure audio
- * NO_INIT effect factory not initialized or
- * library could not be loaded or
- * library does not implement required functions
- * BAD_VALUE invalid libPath string or handle
- *
- * Returned value:
- * *handle updated with library handle
- */
- static status_t loadEffectLibrary(const char *libPath, int *handle);
-
- /*
- * Unloads the effect library which handle is given as argument.
- *
- * Parameters:
- * handle: library handle
- *
- * Returned status (from utils/Errors.h) can be:
- * NO_ERROR successful operation.
- * PERMISSION_DENIED could not get AudioFlinger interface or
- * application does not have permission to configure audio
- * NO_INIT effect factory not initialized
- * BAD_VALUE invalid handle
- */
- static status_t unloadEffectLibrary(int handle);
-
- /*
* Static methods for effects enumeration.
*/
diff --git a/include/media/EffectsFactoryApi.h b/include/media/EffectsFactoryApi.h
index b63fac6..8ae13cc 100644
--- a/include/media/EffectsFactoryApi.h
+++ b/include/media/EffectsFactoryApi.h
@@ -132,50 +132,6 @@ int EffectRelease(effect_handle_t handle);
////////////////////////////////////////////////////////////////////////////////
//
-// Function: EffectLoadLibrary
-//
-// Description: Loads the effect library which path is given as first argument.
-// This must be the full path of a dynamic library (.so) implementing one or
-// more effect engines and exposing the effect library interface described in
-// EffectApi.h. The function returns a handle on the library for used by
-// further call to EffectUnloadLibrary() to unload the library.
-//
-// Input:
-// libPath: full path of the dynamic library file in the file system.
-//
-// handle: address where to return the library handle
-//
-// Output:
-// returned value: 0 successful operation.
-// -ENODEV effect factory not initialized or
-// library could not be loaded or
-// library does not implement required functions
-// -EINVAL invalid libPath string or handle
-//
-////////////////////////////////////////////////////////////////////////////////
-int EffectLoadLibrary(const char *libPath, int *handle);
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// Function: EffectUnloadLibrary
-//
-// Description: Unloads the effect library which handle is given as argument.
-//
-// Input:
-// handle: library handle
-//
-// Output:
-// returned value: 0 successful operation.
-// -ENODEV effect factory not initialized
-// -ENOENT invalid handle
-//
-////////////////////////////////////////////////////////////////////////////////
-int EffectUnloadLibrary(int handle);
-
-
-
-////////////////////////////////////////////////////////////////////////////////
-//
// Function: EffectGetDescriptor
//
// Description: Returns the descriptor of the effect which uuid is pointed
diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h
index 75f3e71..d8fdc27 100644
--- a/include/media/IAudioFlinger.h
+++ b/include/media/IAudioFlinger.h
@@ -139,10 +139,6 @@ public:
virtual int newAudioSessionId() = 0;
- virtual status_t loadEffectLibrary(const char *libPath, int *handle) = 0;
-
- virtual status_t unloadEffectLibrary(int handle) = 0;
-
virtual status_t queryNumberEffects(uint32_t *numEffects) = 0;
virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) = 0;
diff --git a/libs/gui/Sensor.cpp b/libs/gui/Sensor.cpp
index b1f37ff..f9a2c04 100644
--- a/libs/gui/Sensor.cpp
+++ b/libs/gui/Sensor.cpp
@@ -89,6 +89,14 @@ int32_t Sensor::getMinDelay() const {
return mMinDelay;
}
+nsecs_t Sensor::getMinDelayNs() const {
+ return getMinDelay() * 1000;
+}
+
+int32_t Sensor::getVersion() const {
+ return mVersion;
+}
+
size_t Sensor::getFlattenedSize() const
{
return sizeof(int32_t) + ((mName.length() + 3) & ~3) +
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 38202f2..1478a6d 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -716,6 +716,12 @@ public class MediaRecorder
/**
* Stops recording. Call this after start(). Once recording is stopped,
* you will have to configure it again as if it has just been constructed.
+ * Note that a RuntimeException is intentionally thrown to the
+ * application, if no valid audio/video data has been received when stop()
+ * is called. This happens if stop() is called immediately after
+ * start(). The failure lets the application take action accordingly to
+ * clean up the output file (delete the output file, for instance), since
+ * the output file is not properly constructed when this happens.
*
* @throws IllegalStateException if it is called before start()
*/
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index b541be5..b0e8585 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -332,18 +332,6 @@ exit:
return ret;
}
-int EffectLoadLibrary(const char *libPath, int *handle)
-{
- // TODO: see if this interface still makes sense with the use of config files
- return -ENOSYS;
-}
-
-int EffectUnloadLibrary(int handle)
-{
- // TODO: see if this interface still makes sense with the use of config files
- return -ENOSYS;
-}
-
int EffectIsNullUuid(effect_uuid_t *uuid)
{
if (memcmp(uuid, EFFECT_UUID_NULL, sizeof(effect_uuid_t))) {
diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp
index a043329..8d98900 100644
--- a/media/libmedia/AudioEffect.cpp
+++ b/media/libmedia/AudioEffect.cpp
@@ -398,20 +398,6 @@ void AudioEffect::commandExecuted(uint32_t cmdCode,
// -------------------------------------------------------------------------
-status_t AudioEffect::loadEffectLibrary(const char *libPath, int *handle)
-{
- const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
- if (af == 0) return PERMISSION_DENIED;
- return af->loadEffectLibrary(libPath, handle);
-}
-
-status_t AudioEffect::unloadEffectLibrary(int handle)
-{
- const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
- if (af == 0) return PERMISSION_DENIED;
- return af->unloadEffectLibrary(handle);
-}
-
status_t AudioEffect::queryNumberEffects(uint32_t *numEffects)
{
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp
index eec47c0..158d2f5 100644
--- a/media/libmedia/IAudioFlinger.cpp
+++ b/media/libmedia/IAudioFlinger.cpp
@@ -63,8 +63,6 @@ enum {
GET_RENDER_POSITION,
GET_INPUT_FRAMES_LOST,
NEW_AUDIO_SESSION_ID,
- LOAD_EFFECT_LIBRARY,
- UNLOAD_EFFECT_LIBRARY,
QUERY_NUM_EFFECTS,
QUERY_EFFECT,
GET_EFFECT_DESCRIPTOR,
@@ -528,37 +526,6 @@ public:
return id;
}
- virtual status_t loadEffectLibrary(const char *libPath, int *handle)
- {
- if (libPath == NULL || handle == NULL) {
- return BAD_VALUE;
- }
- *handle = 0;
- Parcel data, reply;
- data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
- data.writeCString(libPath);
- status_t status = remote()->transact(LOAD_EFFECT_LIBRARY, data, &reply);
- if (status == NO_ERROR) {
- status = reply.readInt32();
- if (status == NO_ERROR) {
- *handle = reply.readInt32();
- }
- }
- return status;
- }
-
- virtual status_t unloadEffectLibrary(int handle)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
- data.writeInt32(handle);
- status_t status = remote()->transact(UNLOAD_EFFECT_LIBRARY, data, &reply);
- if (status == NO_ERROR) {
- status = reply.readInt32();
- }
- return status;
- }
-
virtual status_t queryNumberEffects(uint32_t *numEffects)
{
Parcel data, reply;
@@ -952,21 +919,6 @@ status_t BnAudioFlinger::onTransact(
reply->writeInt32(newAudioSessionId());
return NO_ERROR;
} break;
- case LOAD_EFFECT_LIBRARY: {
- CHECK_INTERFACE(IAudioFlinger, data, reply);
- int handle;
- status_t status = loadEffectLibrary(data.readCString(), &handle);
- reply->writeInt32(status);
- if (status == NO_ERROR) {
- reply->writeInt32(handle);
- }
- return NO_ERROR;
- }
- case UNLOAD_EFFECT_LIBRARY: {
- CHECK_INTERFACE(IAudioFlinger, data, reply);
- reply->writeInt32(unloadEffectLibrary(data.readInt32()));
- return NO_ERROR;
- }
case QUERY_NUM_EFFECTS: {
CHECK_INTERFACE(IAudioFlinger, data, reply);
uint32_t numEffects;
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/app_icon.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png
index aedf7e7..aedf7e7 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/app_icon.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/app_icon.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/recents_bg_protect_tile.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/recents_bg_protect_tile.png
index a57c27a..a57c27a 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/recents_bg_protect_tile.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/recents_bg_protect_tile.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_1x.png
index 1629575..1629575 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_3g.png
index e87bcec..e87bcec 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_4g.png
index fd44002..fd44002 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_e.png
index e455ad6..e455ad6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_g.png
index 6613585..6613585 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_h.png
index 7502a54..7502a54 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_4g.png
index 5f88279..5f88279 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_in_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_in_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_4g.png
index 8c04bd6..8c04bd6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_inandout_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_inandout_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_4g.png
index 456d0b6..456d0b6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_out_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_out_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_roam.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_roam.png
index 1309176..1309176 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_connected_roam.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_connected_roam.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_1x.png
index 810714e..810714e 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_3g.png
index 72176ba..72176ba 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_4g.png
index 82a2bf0..82a2bf0 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_e.png
index 1e6c604..1e6c604 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_g.png
index 13aee06..13aee06 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_h.png
index 76c48a8..76c48a8 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_connected_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_connected_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_4g.png
index 456d0b6..456d0b6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_in_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_in_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_4g.png
index 456d0b6..456d0b6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_inandout_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_inandout_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_1x.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_1x.png
index 39dfcd3..39dfcd3 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_3g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_3g.png
index e78d872..e78d872 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_4g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_4g.png
index 456d0b6..456d0b6 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_e.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_e.png
index ad73252..ad73252 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_g.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_g.png
index d02de5b..d02de5b 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_h.png b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_h.png
index cb13b91..cb13b91 100644
--- a/packages/SystemUI/res/drawable-xlarge-hdpi/stat_sys_data_fully_out_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_data_fully_out_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/app_icon.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png
index 50a8ac8..50a8ac8 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/app_icon.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/app_icon.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_bg_protect_tile.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_bg_protect_tile.png
index 87c7be6..87c7be6 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_bg_protect_tile.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_bg_protect_tile.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_blue_glow.9.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_blue_glow.9.png
index 4f4ae78..4f4ae78 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_blue_glow.9.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_blue_glow.9.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_callout_line.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_callout_line.png
index 5f4c035..5f4c035 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_callout_line.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_callout_line.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg.png
index 87a67c9..87a67c9 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg_press.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg_press.png
index a1c39e6..a1c39e6 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/recents_thumbnail_bg_press.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/recents_thumbnail_bg_press.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_1x.png
index 73cdabe..73cdabe 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_3g.png
index b5a39cc..b5a39cc 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_4g.png
index 6de880c..6de880c 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_e.png
index 2dbbfc0..2dbbfc0 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_g.png
index a45f011..a45f011 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_h.png
index 517a6bb..517a6bb 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_4g.png
index 821d00e..821d00e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_in_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_in_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_4g.png
index 4cdce84..4cdce84 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_inandout_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_inandout_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_4g.png
index 5a2662a..5a2662a 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_out_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_out_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_roam.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_roam.png
index 5226c1c..5226c1c 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_connected_roam.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_connected_roam.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_1x.png
index a845648..a845648 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_3g.png
index 1d15587..1d15587 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_4g.png
index 52d5736..52d5736 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_e.png
index 79a2a05..79a2a05 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_g.png
index b032594..b032594 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_h.png
index c4abcc9..c4abcc9 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_connected_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_connected_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_4g.png
index 5a2662a..5a2662a 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_in_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_in_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_4g.png
index 5a2662a..5a2662a 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_inandout_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_inandout_h.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_1x.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_1x.png
index f50c987..f50c987 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_1x.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_1x.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_3g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_3g.png
index 1fff17e..1fff17e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_3g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_3g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_4g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_4g.png
index 5a2662a..5a2662a 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_4g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_4g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_e.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_e.png
index e27439e..e27439e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_e.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_e.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_g.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_g.png
index 8b53f0f..8b53f0f 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_g.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_g.png
Binary files differ
diff --git a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_h.png b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_h.png
index a23ec6e..a23ec6e 100644
--- a/packages/SystemUI/res/drawable-xlarge-mdpi/stat_sys_data_fully_out_h.png
+++ b/packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_data_fully_out_h.png
Binary files differ
diff --git a/packages/SystemUI/res/values-xlarge-port/dimens.xml b/packages/SystemUI/res/values-sw600dp-port/dimens.xml
index 56effa3..78dd8c4 100644
--- a/packages/SystemUI/res/values-xlarge-port/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp-port/dimens.xml
@@ -20,5 +20,3 @@
<dimen name="status_bar_icon_padding">2dp</dimen>
</resources>
-
-
diff --git a/packages/SystemUI/res/values-xlarge/colors.xml b/packages/SystemUI/res/values-sw600dp/colors.xml
index a7a70c3..a7a70c3 100644
--- a/packages/SystemUI/res/values-xlarge/colors.xml
+++ b/packages/SystemUI/res/values-sw600dp/colors.xml
diff --git a/packages/SystemUI/res/values-xlarge/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml
index 9d89e21..dec8b67 100644
--- a/packages/SystemUI/res/values-xlarge/dimens.xml
+++ b/packages/SystemUI/res/values-sw600dp/dimens.xml
@@ -22,6 +22,9 @@
<dimen name="status_bar_panel_bottom_offset">36dp</dimen>
<!-- gap on either side of status bar notification icons -->
<dimen name="status_bar_icon_padding">8dp</dimen>
+ <!-- The width of the notification panel window -->
+ <dimen name="notification_panel_width">512dp</dimen>
+ <!-- The minimum height of the notification panel window -->
+ <dimen name="notification_panel_min_height">770dp</dimen>
</resources>
-
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 7d6c57b..7dafb89 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -36,6 +36,8 @@ import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.R;
public class NavigationBarView extends LinearLayout {
+ final static boolean NAVBAR_ALWAYS_AT_RIGHT = true;
+
protected IStatusBarService mBarService;
final Display mDisplay;
View[] mRotatedViews = new View[4];
@@ -88,7 +90,9 @@ public class NavigationBarView extends LinearLayout {
mRotatedViews[Surface.ROTATION_90] = findViewById(R.id.rot90);
- mRotatedViews[Surface.ROTATION_270] = findViewById(R.id.rot270);
+ mRotatedViews[Surface.ROTATION_270] = NAVBAR_ALWAYS_AT_RIGHT
+ ? findViewById(R.id.rot90)
+ : findViewById(R.id.rot270);
}
@Override
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 e66a1a2..00de920 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -360,7 +360,9 @@ public class PhoneStatusBar extends StatusBar {
break;
case Surface.ROTATION_270:
// device has been turned 90deg clockwise
- lp.gravity = Gravity.LEFT | Gravity.FILL_VERTICAL;
+ lp.gravity = (NavigationBarView.NAVBAR_ALWAYS_AT_RIGHT ? Gravity.RIGHT
+ : Gravity.LEFT)
+ | Gravity.FILL_VERTICAL;
break;
default:
lp.gravity = Gravity.BOTTOM | Gravity.FILL_HORIZONTAL;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 91c3cc1..63bc9b7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -43,6 +43,7 @@ import android.os.ServiceManager;
import android.text.TextUtils;
import android.util.Slog;
import android.view.accessibility.AccessibilityEvent;
+import android.view.Display;
import android.view.Gravity;
import android.view.IWindowManager;
import android.view.KeyEvent;
@@ -130,6 +131,7 @@ public class TabletStatusBar extends StatusBar implements
InputMethodButton mInputMethodSwitchButton;
NotificationPanel mNotificationPanel;
+ WindowManager.LayoutParams mNotificationPanelParams;
NotificationPeekPanel mNotificationPeekWindow;
ViewGroup mNotificationPeekRow;
int mNotificationPeekIndex;
@@ -170,6 +172,7 @@ public class TabletStatusBar extends StatusBar implements
protected void addPanelWindows() {
final Context context = mContext;
+ final Resources res = mContext.getResources();
// Notification Panel
mNotificationPanel = (NotificationPanel)View.inflate(context,
@@ -197,11 +200,12 @@ public class TabletStatusBar extends StatusBar implements
mStatusBarView.setIgnoreChildren(0, mNotificationTrigger, mNotificationPanel);
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
- 512, // ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT,
+ WindowManager.LayoutParams lp = mNotificationPanelParams = new WindowManager.LayoutParams(
+ res.getDimensionPixelSize(R.dimen.notification_panel_width),
+ getNotificationPanelHeight(),
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
+ | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
| WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM
| WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
@@ -303,6 +307,13 @@ public class TabletStatusBar extends StatusBar implements
WindowManagerImpl.getDefault().addView(mInputMethodsPanel, lp);
}
+ private int getNotificationPanelHeight() {
+ final Resources res = mContext.getResources();
+ final Display d = WindowManagerImpl.getDefault().getDefaultDisplay();
+ return Math.max(res.getDimensionPixelSize(R.dimen.notification_panel_min_height),
+ d.getHeight());
+ }
+
@Override
public void start() {
super.start(); // will add the main bar view
@@ -311,6 +322,9 @@ public class TabletStatusBar extends StatusBar implements
@Override
protected void onConfigurationChanged(Configuration newConfig) {
loadDimens();
+ mNotificationPanelParams.height = getNotificationPanelHeight();
+ WindowManagerImpl.getDefault().updateViewLayout(mNotificationPanel,
+ mNotificationPanelParams);
}
protected void loadDimens() {
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 67c6d96..053854f 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -4615,28 +4615,6 @@ int AudioFlinger::nextUniqueId_l()
// ----------------------------------------------------------------------------
-status_t AudioFlinger::loadEffectLibrary(const char *libPath, int *handle)
-{
- // check calling permissions
- if (!settingsAllowed()) {
- return PERMISSION_DENIED;
- }
-
- Mutex::Autolock _l(mLock);
- return EffectLoadLibrary(libPath, handle);
-}
-
-status_t AudioFlinger::unloadEffectLibrary(int handle)
-{
- // check calling permissions
- if (!settingsAllowed()) {
- return PERMISSION_DENIED;
- }
-
- Mutex::Autolock _l(mLock);
- return EffectUnloadLibrary(handle);
-}
-
status_t AudioFlinger::queryNumberEffects(uint32_t *numEffects)
{
Mutex::Autolock _l(mLock);
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index f3e1984..0698dcb 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -147,10 +147,6 @@ public:
virtual int newAudioSessionId();
- virtual status_t loadEffectLibrary(const char *libPath, int *handle);
-
- virtual status_t unloadEffectLibrary(int handle);
-
virtual status_t queryNumberEffects(uint32_t *numEffects);
virtual status_t queryEffect(uint32_t index, effect_descriptor_t *descriptor);
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 25a2c78..35e08d4 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1694,7 +1694,7 @@ void CursorInputMapper::sync(nsecs_t when) {
mPointerController->setButtonState(mLocked.buttonState);
}
- mPointerController->unfade();
+ mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
}
float x, y;
@@ -1772,7 +1772,7 @@ void CursorInputMapper::fadePointer() {
{ // acquire lock
AutoMutex _l(mLock);
if (mPointerController != NULL) {
- mPointerController->fade();
+ mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
}
} // release lock
}
@@ -1965,10 +1965,22 @@ void TouchInputMapper::configureParameters() {
mParameters.useJumpyTouchFilter = getPolicy()->filterJumpyTouchEvents();
mParameters.virtualKeyQuietTime = getPolicy()->getVirtualKeyQuietTime();
- // TODO: Make this configurable.
- //mParameters.gestureMode = Parameters::GESTURE_MODE_POINTER;
+ // TODO: select the default gesture mode based on whether the device supports
+ // distinct multitouch
mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
+ String8 gestureModeString;
+ if (getDevice()->getConfiguration().tryGetProperty(String8("touch.gestureMode"),
+ gestureModeString)) {
+ if (gestureModeString == "pointer") {
+ mParameters.gestureMode = Parameters::GESTURE_MODE_POINTER;
+ } else if (gestureModeString == "spots") {
+ mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS;
+ } else if (gestureModeString != "default") {
+ LOGW("Invalid value for touch.gestureMode: '%s'", gestureModeString.string());
+ }
+ }
+
if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X)
|| getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) {
// The device is a cursor device with a touch pad attached.
@@ -1994,7 +2006,7 @@ void TouchInputMapper::configureParameters() {
mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD;
} else if (deviceTypeString == "pointer") {
mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER;
- } else {
+ } else if (deviceTypeString != "default") {
LOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string());
}
}
@@ -2012,6 +2024,17 @@ void TouchInputMapper::configureParameters() {
void TouchInputMapper::dumpParameters(String8& dump) {
dump.append(INDENT3 "Parameters:\n");
+ switch (mParameters.gestureMode) {
+ case Parameters::GESTURE_MODE_POINTER:
+ dump.append(INDENT4 "GestureMode: pointer\n");
+ break;
+ case Parameters::GESTURE_MODE_SPOTS:
+ dump.append(INDENT4 "GestureMode: spots\n");
+ break;
+ default:
+ assert(false);
+ }
+
switch (mParameters.deviceType) {
case Parameters::DEVICE_TYPE_TOUCH_SCREEN:
dump.append(INDENT4 "DeviceType: touchScreen\n");
@@ -3465,10 +3488,36 @@ void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlag
return;
}
- // Show the pointer if needed.
- if (mPointerGesture.currentGestureMode != PointerGesture::NEUTRAL
- && mPointerGesture.currentGestureMode != PointerGesture::QUIET) {
- mPointerController->unfade();
+ // Show or hide the pointer if needed.
+ switch (mPointerGesture.currentGestureMode) {
+ case PointerGesture::NEUTRAL:
+ case PointerGesture::QUIET:
+ if (mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS
+ && (mPointerGesture.lastGestureMode == PointerGesture::SWIPE
+ || mPointerGesture.lastGestureMode == PointerGesture::FREEFORM)) {
+ // Remind the user of where the pointer is after finishing a gesture with spots.
+ mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL);
+ }
+ break;
+ case PointerGesture::TAP:
+ case PointerGesture::TAP_DRAG:
+ case PointerGesture::BUTTON_CLICK_OR_DRAG:
+ case PointerGesture::HOVER:
+ case PointerGesture::PRESS:
+ // Unfade the pointer when the current gesture manipulates the
+ // area directly under the pointer.
+ mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
+ break;
+ case PointerGesture::SWIPE:
+ case PointerGesture::FREEFORM:
+ // Fade the pointer when the current gesture manipulates a different
+ // area and there are spots to guide the user experience.
+ if (mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS) {
+ mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
+ } else {
+ mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE);
+ }
+ break;
}
// Send events!
@@ -4037,6 +4086,7 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when,
*outFinishPreviousGesture = true;
mPointerGesture.currentGestureMode = PointerGesture::PRESS;
mPointerGesture.activeGestureId = 0;
+ mPointerGesture.referenceIdBits.clear();
if (settled && mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS
&& mLastTouch.idBits.hasBit(mPointerGesture.activeTouchId)) {
@@ -4167,6 +4217,17 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when,
}
}
+ // Clear the reference deltas for fingers not yet included in the reference calculation.
+ for (BitSet32 idBits(mCurrentTouch.idBits.value & ~mPointerGesture.referenceIdBits.value);
+ !idBits.isEmpty(); ) {
+ uint32_t id = idBits.firstMarkedBit();
+ idBits.clearBit(id);
+
+ mPointerGesture.referenceDeltas[id].dx = 0;
+ mPointerGesture.referenceDeltas[id].dy = 0;
+ }
+ mPointerGesture.referenceIdBits = mCurrentTouch.idBits;
+
// Move the reference points based on the overall group motion of the fingers.
// The objective is to calculate a vector delta that is common to the movement
// of all fingers.
@@ -4180,27 +4241,39 @@ bool TouchInputMapper::preparePointerGestures(nsecs_t when,
const PointerData& cpd = mCurrentTouch.pointers[mCurrentTouch.idToIndex[id]];
const PointerData& lpd = mLastTouch.pointers[mLastTouch.idToIndex[id]];
- float deltaX = cpd.x - lpd.x;
- float deltaY = cpd.y - lpd.y;
+ PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];
+ delta.dx += cpd.x - lpd.x;
+ delta.dy += cpd.y - lpd.y;
if (first) {
- commonDeltaX = deltaX;
- commonDeltaY = deltaY;
+ commonDeltaX = delta.dx;
+ commonDeltaY = delta.dy;
} else {
- commonDeltaX = calculateCommonVector(commonDeltaX, deltaX);
- commonDeltaY = calculateCommonVector(commonDeltaY, deltaY);
+ commonDeltaX = calculateCommonVector(commonDeltaX, delta.dx);
+ commonDeltaY = calculateCommonVector(commonDeltaY, delta.dy);
}
}
- mPointerGesture.referenceTouchX += commonDeltaX;
- mPointerGesture.referenceTouchY += commonDeltaY;
- mPointerGesture.referenceGestureX +=
- commonDeltaX * mLocked.pointerGestureXMovementScale;
- mPointerGesture.referenceGestureY +=
- commonDeltaY * mLocked.pointerGestureYMovementScale;
- clampPositionUsingPointerBounds(mPointerController,
- &mPointerGesture.referenceGestureX,
- &mPointerGesture.referenceGestureY);
+ if (commonDeltaX || commonDeltaY) {
+ for (BitSet32 idBits(commonIdBits); !idBits.isEmpty(); ) {
+ uint32_t id = idBits.firstMarkedBit();
+ idBits.clearBit(id);
+
+ PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id];
+ delta.dx = 0;
+ delta.dy = 0;
+ }
+
+ mPointerGesture.referenceTouchX += commonDeltaX;
+ mPointerGesture.referenceTouchY += commonDeltaY;
+ mPointerGesture.referenceGestureX +=
+ commonDeltaX * mLocked.pointerGestureXMovementScale;
+ mPointerGesture.referenceGestureY +=
+ commonDeltaY * mLocked.pointerGestureYMovementScale;
+ clampPositionUsingPointerBounds(mPointerController,
+ &mPointerGesture.referenceGestureX,
+ &mPointerGesture.referenceGestureY);
+ }
}
// Report gestures.
@@ -4508,7 +4581,7 @@ void TouchInputMapper::fadePointer() {
{ // acquire lock
AutoMutex _l(mLock);
if (mPointerController != NULL) {
- mPointerController->fade();
+ mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL);
}
} // release lock
}
diff --git a/services/input/InputReader.h b/services/input/InputReader.h
index 85338b6..671e194 100644
--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -1048,6 +1048,14 @@ private:
float referenceGestureX; // reference gesture X/Y coordinates in pixels
float referenceGestureY;
+ // Distance that each pointer has traveled which has not yet been
+ // subsumed into the reference gesture position.
+ BitSet32 referenceIdBits;
+ struct Delta {
+ float dx, dy;
+ };
+ Delta referenceDeltas[MAX_POINTER_ID + 1];
+
// Describes how touch ids are mapped to gesture ids for freeform gestures.
uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1];
diff --git a/services/input/PointerController.cpp b/services/input/PointerController.cpp
index b87c98d..c18ebcf 100644
--- a/services/input/PointerController.cpp
+++ b/services/input/PointerController.cpp
@@ -69,10 +69,10 @@ PointerController::PointerController(const sp<PointerControllerPolicyInterface>&
mLocked.inactivityTimeout = INACTIVITY_TIMEOUT_NORMAL;
- mLocked.pointerIsFading = true; // keep the pointer initially faded
+ mLocked.pointerFadeDirection = 0;
mLocked.pointerX = 0;
mLocked.pointerY = 0;
- mLocked.pointerAlpha = 0.0f;
+ mLocked.pointerAlpha = 0.0f; // pointer is initially faded
mLocked.pointerSprite = mSpriteController->createSprite();
mLocked.pointerIconChanged = false;
@@ -191,23 +191,37 @@ void PointerController::getPosition(float* outX, float* outY) const {
*outY = mLocked.pointerY;
}
-void PointerController::fade() {
+void PointerController::fade(Transition transition) {
AutoMutex _l(mLock);
- sendImmediateInactivityTimeoutLocked();
+ // Remove the inactivity timeout, since we are fading now.
+ removeInactivityTimeoutLocked();
+
+ // Start fading.
+ if (transition == TRANSITION_IMMEDIATE) {
+ mLocked.pointerFadeDirection = 0;
+ mLocked.pointerAlpha = 0.0f;
+ updatePointerLocked();
+ } else {
+ mLocked.pointerFadeDirection = -1;
+ startAnimationLocked();
+ }
}
-void PointerController::unfade() {
+void PointerController::unfade(Transition transition) {
AutoMutex _l(mLock);
// Always reset the inactivity timer.
resetInactivityTimeoutLocked();
- // Unfade immediately if needed.
- if (mLocked.pointerIsFading) {
- mLocked.pointerIsFading = false;
+ // Start unfading.
+ if (transition == TRANSITION_IMMEDIATE) {
+ mLocked.pointerFadeDirection = 0;
mLocked.pointerAlpha = 1.0f;
updatePointerLocked();
+ } else {
+ mLocked.pointerFadeDirection = 1;
+ startAnimationLocked();
}
}
@@ -401,10 +415,20 @@ void PointerController::doAnimate() {
nsecs_t frameDelay = systemTime(SYSTEM_TIME_MONOTONIC) - mLocked.animationTime;
// Animate pointer fade.
- if (mLocked.pointerIsFading) {
+ if (mLocked.pointerFadeDirection < 0) {
mLocked.pointerAlpha -= float(frameDelay) / POINTER_FADE_DURATION;
- if (mLocked.pointerAlpha <= 0) {
- mLocked.pointerAlpha = 0;
+ if (mLocked.pointerAlpha <= 0.0f) {
+ mLocked.pointerAlpha = 0.0f;
+ mLocked.pointerFadeDirection = 0;
+ } else {
+ keepAnimating = true;
+ }
+ updatePointerLocked();
+ } else if (mLocked.pointerFadeDirection > 0) {
+ mLocked.pointerAlpha += float(frameDelay) / POINTER_FADE_DURATION;
+ if (mLocked.pointerAlpha >= 1.0f) {
+ mLocked.pointerAlpha = 1.0f;
+ mLocked.pointerFadeDirection = 0;
} else {
keepAnimating = true;
}
@@ -432,12 +456,7 @@ void PointerController::doAnimate() {
}
void PointerController::doInactivityTimeout() {
- AutoMutex _l(mLock);
-
- if (!mLocked.pointerIsFading) {
- mLocked.pointerIsFading = true;
- startAnimationLocked();
- }
+ fade(TRANSITION_GRADUAL);
}
void PointerController::startAnimationLocked() {
@@ -456,9 +475,8 @@ void PointerController::resetInactivityTimeoutLocked() {
mLooper->sendMessageDelayed(timeout, mHandler, MSG_INACTIVITY_TIMEOUT);
}
-void PointerController::sendImmediateInactivityTimeoutLocked() {
+void PointerController::removeInactivityTimeoutLocked() {
mLooper->removeMessages(mHandler, MSG_INACTIVITY_TIMEOUT);
- mLooper->sendMessage(mHandler, MSG_INACTIVITY_TIMEOUT);
}
void PointerController::updatePointerLocked() {
diff --git a/services/input/PointerController.h b/services/input/PointerController.h
index c7435ee..1c21db1 100644
--- a/services/input/PointerController.h
+++ b/services/input/PointerController.h
@@ -64,14 +64,21 @@ public:
/* Gets the absolute location of the pointer. */
virtual void getPosition(float* outX, float* outY) const = 0;
+ enum Transition {
+ // Fade/unfade immediately.
+ TRANSITION_IMMEDIATE,
+ // Fade/unfade gradually.
+ TRANSITION_GRADUAL,
+ };
+
/* Fades the pointer out now. */
- virtual void fade() = 0;
+ virtual void fade(Transition transition) = 0;
/* Makes the pointer visible if it has faded out.
* The pointer never unfades itself automatically. This method must be called
* by the client whenever the pointer is moved or a button is pressed and it
* wants to ensure that the pointer becomes visible again. */
- virtual void unfade() = 0;
+ virtual void unfade(Transition transition) = 0;
enum Presentation {
// Show the mouse pointer.
@@ -187,8 +194,8 @@ public:
virtual int32_t getButtonState() const;
virtual void setPosition(float x, float y);
virtual void getPosition(float* outX, float* outY) const;
- virtual void fade();
- virtual void unfade();
+ virtual void fade(Transition transition);
+ virtual void unfade(Transition transition);
virtual void setPresentation(Presentation presentation);
virtual void setSpots(SpotGesture spotGesture,
@@ -250,7 +257,7 @@ private:
Presentation presentation;
bool presentationChanged;
- bool pointerIsFading;
+ int32_t pointerFadeDirection;
float pointerX;
float pointerY;
float pointerAlpha;
@@ -274,7 +281,7 @@ private:
void startAnimationLocked();
void resetInactivityTimeoutLocked();
- void sendImmediateInactivityTimeoutLocked();
+ void removeInactivityTimeoutLocked();
void updatePointerLocked();
Spot* getSpotLocked(uint32_t id);
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index 1ab2a3e..78d1db6 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -92,10 +92,10 @@ private:
*outY = 0;
}
- virtual void fade() {
+ virtual void fade(Transition transition) {
}
- virtual void unfade() {
+ virtual void unfade(Transition transition) {
}
virtual void setPresentation(Presentation presentation) {
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 77c2a44..455b4c2 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -66,8 +66,6 @@ import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.StringBuilderPrinter;
-import libcore.io.Libcore;
-
import com.android.internal.backup.BackupConstants;
import com.android.internal.backup.IBackupTransport;
import com.android.internal.backup.LocalTransport;
@@ -1801,7 +1799,6 @@ class BackupManagerService extends IBackupManager.Stub {
}
FileOutputStream outstream = new FileOutputStream(manifestFile);
- Libcore.os.ftruncate(outstream.getFD(), 0);
outstream.write(builder.toString().getBytes());
outstream.close();
}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index d2fd04b..a564c2d 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -39,6 +39,7 @@ import android.net.RouteInfo;
import android.net.vpn.VpnManager;
import android.net.wifi.WifiStateTracker;
import android.os.Binder;
+import android.os.FileUtils;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -58,7 +59,6 @@ import com.android.internal.telephony.Phone;
import com.android.server.connectivity.Tethering;
import java.io.FileDescriptor;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
@@ -1552,12 +1552,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (values.length == 6) {
final String prefix = "/sys/kernel/ipv4/tcp_";
- stringToFile(prefix + "rmem_min", values[0]);
- stringToFile(prefix + "rmem_def", values[1]);
- stringToFile(prefix + "rmem_max", values[2]);
- stringToFile(prefix + "wmem_min", values[3]);
- stringToFile(prefix + "wmem_def", values[4]);
- stringToFile(prefix + "wmem_max", values[5]);
+ FileUtils.stringToFile(prefix + "rmem_min", values[0]);
+ FileUtils.stringToFile(prefix + "rmem_def", values[1]);
+ FileUtils.stringToFile(prefix + "rmem_max", values[2]);
+ FileUtils.stringToFile(prefix + "wmem_min", values[3]);
+ FileUtils.stringToFile(prefix + "wmem_def", values[4]);
+ FileUtils.stringToFile(prefix + "wmem_max", values[5]);
} else {
loge("Invalid buffersize string: " + bufferSizes);
}
@@ -1566,23 +1566,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
}
}
- /**
- * Writes string to file. Basically same as "echo -n $string > $filename"
- *
- * @param filename
- * @param string
- * @throws IOException
- */
- private void stringToFile(String filename, String string) throws IOException {
- FileWriter out = new FileWriter(filename);
- try {
- out.write(string);
- } finally {
- out.close();
- }
- }
-
-
/**
* Adjust the per-process dns entries (net.dns<x>.<pid>) based
* on the highest priority active net which this process requested.
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 465fd2e..c96273b 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -126,10 +126,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private static final String SUBTYPE_MODE_KEYBOARD = "keyboard";
private static final String SUBTYPE_MODE_VOICE = "voice";
- // TODO: Will formalize this value as API
- private static final String SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME =
- "excludeFromLastInputMethod";
-
final Context mContext;
final Resources mRes;
final Handler mHandler;
@@ -1883,7 +1879,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
final int subtypeCount = imi.getSubtypeCount();
for (int j = 0; j < subtypeCount; ++j) {
InputMethodSubtype subtype = imi.getSubtypeAt(j);
- if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))) {
+ if (enabledSubtypeSet.contains(String.valueOf(subtype.hashCode()))
+ && !subtype.isAuxiliary()) {
final CharSequence title;
int nameResId = subtype.getNameResId();
String mode = subtype.getMode();
@@ -2078,7 +2075,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
private boolean canAddToLastInputMethod(InputMethodSubtype subtype) {
if (subtype == null) return true;
- return !subtype.containsExtraValueKey(SUBTYPE_EXTRAVALUE_EXCLUDE_FROM_LAST_IME);
+ return !subtype.isAuxiliary();
}
private void saveCurrentInputMethodAndSubtypeToHistory() {
diff --git a/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index d96369b..cc9e532 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -21,6 +21,8 @@ import com.android.internal.os.HandlerCaller;
import com.android.internal.os.HandlerCaller.SomeArgs;
import com.android.server.wm.WindowManagerService;
+import org.xmlpull.v1.XmlPullParserException;
+
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.accessibilityservice.IAccessibilityServiceConnection;
@@ -54,6 +56,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;
import android.view.accessibility.IAccessibilityManagerClient;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -96,17 +99,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
final List<IAccessibilityManagerClient> mClients =
new ArrayList<IAccessibilityManagerClient>();
- final Map<ComponentName, Service> mComponentNameToServiceMap =
- new HashMap<ComponentName, Service>();
+ final Map<ComponentName, Service> mComponentNameToServiceMap = new HashMap<ComponentName, Service>();
- private final List<ServiceInfo> mInstalledServices = new ArrayList<ServiceInfo>();
+ private final List<AccessibilityServiceInfo> mInstalledServices = new ArrayList<AccessibilityServiceInfo>();
private final Set<ComponentName> mEnabledServices = new HashSet<ComponentName>();
private final SimpleStringSplitter mStringColonSplitter = new SimpleStringSplitter(':');
- private final SparseArray<List<ServiceInfo>> mFeedbackTypeToEnabledServicesMap =
- new SparseArray<List<ServiceInfo>>();
+ private final SparseArray<List<AccessibilityServiceInfo>> mFeedbackTypeToEnabledServicesMap =
+ new SparseArray<List<AccessibilityServiceInfo>>();
private PackageManager mPackageManager;
@@ -298,20 +300,28 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
return (OWN_PROCESS_ID != Binder.getCallingPid());
}
- public List<ServiceInfo> getAccessibilityServiceList() {
+ public List<AccessibilityServiceInfo> getInstalledAccessibilityServiceList() {
synchronized (mLock) {
return mInstalledServices;
}
}
- public List<ServiceInfo> getEnabledAccessibilityServiceList(int feedbackType) {
+ public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackType) {
+ SparseArray<List<AccessibilityServiceInfo>> feedbackTypeToEnabledServicesMap =
+ mFeedbackTypeToEnabledServicesMap;
+ List<AccessibilityServiceInfo> enabledServices = new ArrayList<AccessibilityServiceInfo>();
synchronized (mLock) {
- List<ServiceInfo> enabledServices = mFeedbackTypeToEnabledServicesMap.get(feedbackType);
- if (enabledServices == null) {
- return Collections.emptyList();
+ while (feedbackType != 0) {
+ final int feedbackTypeBit = (1 << Integer.numberOfTrailingZeros(feedbackType));
+ feedbackType &= ~feedbackTypeBit;
+ List<AccessibilityServiceInfo> perFeedbackType =
+ feedbackTypeToEnabledServicesMap.get(feedbackTypeBit);
+ if (perFeedbackType != null) {
+ enabledServices.addAll(perFeedbackType);
+ }
}
- return enabledServices;
}
+ return enabledServices;
}
public void interrupt() {
@@ -345,15 +355,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
Service service = (Service) arguments.arg2;
synchronized (mLock) {
- service.mEventTypes = info.eventTypes;
- service.mFeedbackType = info.feedbackType;
- String[] packageNames = info.packageNames;
- if (packageNames != null) {
- service.mPackageNames.addAll(Arrays.asList(packageNames));
+ // If the XML manifest had data to configure the service its info
+ // should be already set. In such a case update only the dynamically
+ // configurable properties.
+ AccessibilityServiceInfo oldInfo = service.mAccessibilityServiceInfo;
+ if (oldInfo != null) {
+ oldInfo.updateDynamicallyConfigurableProperties(info);
+ service.setAccessibilityServiceInfo(oldInfo);
+ } else {
+ service.setAccessibilityServiceInfo(info);
}
- service.mNotificationTimeout = info.notificationTimeout;
- service.mIsDefault = (info.flags & AccessibilityServiceInfo.DEFAULT) != 0;
-
updateStateOnEnabledService(service);
}
return;
@@ -369,10 +380,20 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
mInstalledServices.clear();
List<ResolveInfo> installedServices = mPackageManager.queryIntentServices(
- new Intent(AccessibilityService.SERVICE_INTERFACE), PackageManager.GET_SERVICES);
+ new Intent(AccessibilityService.SERVICE_INTERFACE),
+ PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
for (int i = 0, count = installedServices.size(); i < count; i++) {
- mInstalledServices.add(installedServices.get(i).serviceInfo);
+ ResolveInfo resolveInfo = installedServices.get(i);
+ AccessibilityServiceInfo accessibilityServiceInfo;
+ try {
+ accessibilityServiceInfo = new AccessibilityServiceInfo(resolveInfo, mContext);
+ mInstalledServices.add(accessibilityServiceInfo);
+ } catch (XmlPullParserException xppe) {
+ Slog.e(LOG_TAG, "Error while initializing AccessibilityServiceInfo", xppe);
+ } catch (IOException ioe) {
+ Slog.e(LOG_TAG, "Error while initializing AccessibilityServiceInfo", ioe);
+ }
}
}
@@ -595,22 +616,22 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
* @param installedServices All installed {@link AccessibilityService}s.
* @param enabledServices The {@link ComponentName}s of the enabled services.
*/
- private void updateServicesStateLocked(List<ServiceInfo> installedServices,
+ private void updateServicesStateLocked(List<AccessibilityServiceInfo> installedServices,
Set<ComponentName> enabledServices) {
Map<ComponentName, Service> componentNameToServiceMap = mComponentNameToServiceMap;
boolean isEnabled = mIsEnabled;
for (int i = 0, count = installedServices.size(); i < count; i++) {
- ServiceInfo intalledService = installedServices.get(i);
- ComponentName componentName = new ComponentName(intalledService.packageName,
- intalledService.name);
+ AccessibilityServiceInfo installedService = installedServices.get(i);
+ ComponentName componentName = ComponentName.unflattenFromString(
+ installedService.getId());
Service service = componentNameToServiceMap.get(componentName);
if (isEnabled) {
if (enabledServices.contains(componentName)) {
if (service == null) {
- service = new Service(componentName, intalledService);
+ service = new Service(installedService);
}
service.bind();
} else if (!enabledServices.contains(componentName)) {
@@ -671,12 +692,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
*/
private void updateStateOnEnabledService(Service service) {
int feedbackType = service.mFeedbackType;
- List<ServiceInfo> enabledServices = mFeedbackTypeToEnabledServicesMap.get(feedbackType);
+ List<AccessibilityServiceInfo> enabledServices =
+ mFeedbackTypeToEnabledServicesMap.get(feedbackType);
if (enabledServices == null) {
- enabledServices = new ArrayList<ServiceInfo>();
+ enabledServices = new ArrayList<AccessibilityServiceInfo>();
mFeedbackTypeToEnabledServicesMap.put(feedbackType, enabledServices);
}
- enabledServices.add(service.mServiceInfo);
+ enabledServices.add(service.mAccessibilityServiceInfo);
// We enable touch exploration if at least one
// enabled service provides spoken feedback.
@@ -688,12 +710,12 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
private void updateStateOnDisabledService(Service service) {
- List<ServiceInfo> enabledServices =
+ List<AccessibilityServiceInfo> enabledServices =
mFeedbackTypeToEnabledServicesMap.get(service.mFeedbackType);
if (enabledServices == null) {
return;
}
- enabledServices.remove(service.mServiceInfo);
+ enabledServices.remove(service.mAccessibilityServiceInfo);
// We disable touch exploration if no
// enabled service provides spoken feedback.
if (enabledServices.isEmpty()
@@ -714,7 +736,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
class Service extends IAccessibilityServiceConnection.Stub implements ServiceConnection {
int mId = 0;
- ServiceInfo mServiceInfo;
+ AccessibilityServiceInfo mAccessibilityServiceInfo;
IBinder mService;
@@ -740,10 +762,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
final SparseArray<AccessibilityEvent> mPendingEvents =
new SparseArray<AccessibilityEvent>();
- Service(ComponentName componentName, ServiceInfo serviceInfo) {
+ Service(AccessibilityServiceInfo accessibilityServiceInfo) {
mId = sIdCounter++;
- mComponentName = componentName;
- mServiceInfo = serviceInfo;
+ setAccessibilityServiceInfo(accessibilityServiceInfo);
mIntent = new Intent().setComponent(mComponentName);
mIntent.putExtra(Intent.EXTRA_CLIENT_LABEL,
com.android.internal.R.string.accessibility_binding_label);
@@ -751,6 +772,20 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
mContext, 0, new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS), 0));
}
+ public void setAccessibilityServiceInfo(AccessibilityServiceInfo info) {
+ mAccessibilityServiceInfo = info;
+ ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
+ mComponentName = new ComponentName(serviceInfo.packageName, serviceInfo.name);
+ mEventTypes = info.eventTypes;
+ mFeedbackType = info.feedbackType;
+ String[] packageNames = info.packageNames;
+ if (packageNames != null) {
+ mPackageNames.addAll(Arrays.asList(packageNames));
+ }
+ mNotificationTimeout = info.notificationTimeout;
+ mIsDefault = (info.flags & AccessibilityServiceInfo.DEFAULT) != 0;
+ }
+
/**
* Binds to the accessibility service.
*
@@ -805,6 +840,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
if (!mServices.contains(this)) {
mServices.add(this);
mComponentNameToServiceMap.put(componentName, this);
+ if (isConfigured()) {
+ updateStateOnEnabledService(this);
+ }
}
}
} catch (RemoteException re) {
diff --git a/services/sensorservice/Android.mk b/services/sensorservice/Android.mk
index c50e4a1..57a3b15 100644
--- a/services/sensorservice/Android.mk
+++ b/services/sensorservice/Android.mk
@@ -2,13 +2,18 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- GravitySensor.cpp \
- LinearAccelerationSensor.cpp \
- RotationVectorSensor.cpp \
- SensorService.cpp \
- SensorInterface.cpp \
+ CorrectedGyroSensor.cpp \
+ Fusion.cpp \
+ GravitySensor.cpp \
+ LinearAccelerationSensor.cpp \
+ OrientationSensor.cpp \
+ RotationVectorSensor.cpp \
+ SecondOrderLowPassFilter.cpp \
SensorDevice.cpp \
- SecondOrderLowPassFilter.cpp
+ SensorFusion.cpp \
+ SensorInterface.cpp \
+ SensorService.cpp \
+
LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\"
diff --git a/services/sensorservice/CorrectedGyroSensor.cpp b/services/sensorservice/CorrectedGyroSensor.cpp
new file mode 100644
index 0000000..9b75b70
--- /dev/null
+++ b/services/sensorservice/CorrectedGyroSensor.cpp
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#include <stdint.h>
+#include <math.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+
+#include <hardware/sensors.h>
+
+#include "CorrectedGyroSensor.h"
+#include "SensorDevice.h"
+#include "SensorFusion.h"
+
+namespace android {
+// ---------------------------------------------------------------------------
+
+CorrectedGyroSensor::CorrectedGyroSensor(sensor_t const* list, size_t count)
+ : mSensorDevice(SensorDevice::getInstance()),
+ mSensorFusion(SensorFusion::getInstance())
+{
+ for (size_t i=0 ; i<count ; i++) {
+ if (list[i].type == SENSOR_TYPE_GYROSCOPE) {
+ mGyro = Sensor(list + i);
+ break;
+ }
+ }
+}
+
+bool CorrectedGyroSensor::process(sensors_event_t* outEvent,
+ const sensors_event_t& event)
+{
+ if (event.type == SENSOR_TYPE_GYROSCOPE) {
+ const vec3_t bias(mSensorFusion.getGyroBias() * mSensorFusion.getEstimatedRate());
+ *outEvent = event;
+ outEvent->data[0] -= bias.x;
+ outEvent->data[1] -= bias.y;
+ outEvent->data[2] -= bias.z;
+ outEvent->sensor = '_cgy';
+ return true;
+ }
+ return false;
+}
+
+status_t CorrectedGyroSensor::activate(void* ident, bool enabled) {
+ mSensorDevice.activate(this, mGyro.getHandle(), enabled);
+ return mSensorFusion.activate(this, enabled);
+}
+
+status_t CorrectedGyroSensor::setDelay(void* ident, int handle, int64_t ns) {
+ mSensorDevice.setDelay(this, mGyro.getHandle(), ns);
+ return mSensorFusion.setDelay(this, ns);
+}
+
+Sensor CorrectedGyroSensor::getSensor() const {
+ sensor_t hwSensor;
+ hwSensor.name = "Corrected Gyroscope Sensor";
+ hwSensor.vendor = "Google Inc.";
+ hwSensor.version = 1;
+ hwSensor.handle = '_cgy';
+ hwSensor.type = SENSOR_TYPE_GYROSCOPE;
+ hwSensor.maxRange = mGyro.getMaxValue();
+ hwSensor.resolution = mGyro.getResolution();
+ hwSensor.power = mSensorFusion.getPowerUsage();
+ hwSensor.minDelay = mGyro.getMinDelay();
+ Sensor sensor(&hwSensor);
+ return sensor;
+}
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
diff --git a/services/sensorservice/CorrectedGyroSensor.h b/services/sensorservice/CorrectedGyroSensor.h
new file mode 100644
index 0000000..3c49c08
--- /dev/null
+++ b/services/sensorservice/CorrectedGyroSensor.h
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_CORRECTED_GYRO_SENSOR_H
+#define ANDROID_CORRECTED_GYRO_SENSOR_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <gui/Sensor.h>
+
+#include "SensorInterface.h"
+
+// ---------------------------------------------------------------------------
+namespace android {
+// ---------------------------------------------------------------------------
+
+class SensorDevice;
+class SensorFusion;
+
+class CorrectedGyroSensor : public SensorInterface {
+ SensorDevice& mSensorDevice;
+ SensorFusion& mSensorFusion;
+ Sensor mGyro;
+
+public:
+ CorrectedGyroSensor(sensor_t const* list, size_t count);
+ virtual bool process(sensors_event_t* outEvent,
+ const sensors_event_t& event);
+ virtual status_t activate(void* ident, bool enabled);
+ virtual status_t setDelay(void* ident, int handle, int64_t ns);
+ virtual Sensor getSensor() const;
+ virtual bool isVirtual() const { return true; }
+};
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_CORRECTED_GYRO_SENSOR_H
diff --git a/services/sensorservice/Fusion.cpp b/services/sensorservice/Fusion.cpp
new file mode 100644
index 0000000..56ac9f9
--- /dev/null
+++ b/services/sensorservice/Fusion.cpp
@@ -0,0 +1,431 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+
+#include <utils/Log.h>
+
+#include "Fusion.h"
+
+namespace android {
+
+// -----------------------------------------------------------------------
+
+template <typename TYPE>
+static inline TYPE sqr(TYPE x) {
+ return x*x;
+}
+
+template <typename T>
+static inline T clamp(T v) {
+ return v < 0 ? 0 : v;
+}
+
+template <typename TYPE, size_t C, size_t R>
+static mat<TYPE, R, R> scaleCovariance(
+ const mat<TYPE, C, R>& A,
+ const mat<TYPE, C, C>& P) {
+ // A*P*transpose(A);
+ mat<TYPE, R, R> APAt;
+ for (size_t r=0 ; r<R ; r++) {
+ for (size_t j=r ; j<R ; j++) {
+ double apat(0);
+ for (size_t c=0 ; c<C ; c++) {
+ double v(A[c][r]*P[c][c]*0.5);
+ for (size_t k=c+1 ; k<C ; k++)
+ v += A[k][r] * P[c][k];
+ apat += 2 * v * A[c][j];
+ }
+ APAt[j][r] = apat;
+ APAt[r][j] = apat;
+ }
+ }
+ return APAt;
+}
+
+template <typename TYPE, typename OTHER_TYPE>
+static mat<TYPE, 3, 3> crossMatrix(const vec<TYPE, 3>& p, OTHER_TYPE diag) {
+ mat<TYPE, 3, 3> r;
+ r[0][0] = diag;
+ r[1][1] = diag;
+ r[2][2] = diag;
+ r[0][1] = p.z;
+ r[1][0] =-p.z;
+ r[0][2] =-p.y;
+ r[2][0] = p.y;
+ r[1][2] = p.x;
+ r[2][1] =-p.x;
+ return r;
+}
+
+template <typename TYPE>
+static mat<TYPE, 3, 3> MRPsToMatrix(const vec<TYPE, 3>& p) {
+ mat<TYPE, 3, 3> res(1);
+ const mat<TYPE, 3, 3> px(crossMatrix(p, 0));
+ const TYPE ptp(dot_product(p,p));
+ const TYPE t = 4/sqr(1+ptp);
+ res -= t * (1-ptp) * px;
+ res += t * 2 * sqr(px);
+ return res;
+}
+
+template <typename TYPE>
+vec<TYPE, 3> matrixToMRPs(const mat<TYPE, 3, 3>& R) {
+ // matrix to MRPs
+ vec<TYPE, 3> q;
+ const float Hx = R[0].x;
+ const float My = R[1].y;
+ const float Az = R[2].z;
+ const float w = 1 / (1 + sqrtf( clamp( Hx + My + Az + 1) * 0.25f ));
+ q.x = sqrtf( clamp( Hx - My - Az + 1) * 0.25f ) * w;
+ q.y = sqrtf( clamp(-Hx + My - Az + 1) * 0.25f ) * w;
+ q.z = sqrtf( clamp(-Hx - My + Az + 1) * 0.25f ) * w;
+ q.x = copysignf(q.x, R[2].y - R[1].z);
+ q.y = copysignf(q.y, R[0].z - R[2].x);
+ q.z = copysignf(q.z, R[1].x - R[0].y);
+ return q;
+}
+
+template<typename TYPE, size_t SIZE>
+class Covariance {
+ mat<TYPE, SIZE, SIZE> mSumXX;
+ vec<TYPE, SIZE> mSumX;
+ size_t mN;
+public:
+ Covariance() : mSumXX(0.0f), mSumX(0.0f), mN(0) { }
+ void update(const vec<TYPE, SIZE>& x) {
+ mSumXX += x*transpose(x);
+ mSumX += x;
+ mN++;
+ }
+ mat<TYPE, SIZE, SIZE> operator()() const {
+ const float N = 1.0f / mN;
+ return mSumXX*N - (mSumX*transpose(mSumX))*(N*N);
+ }
+ void reset() {
+ mN = 0;
+ mSumXX = 0;
+ mSumX = 0;
+ }
+ size_t getCount() const {
+ return mN;
+ }
+};
+
+// -----------------------------------------------------------------------
+
+Fusion::Fusion() {
+ // process noise covariance matrix
+ const float w1 = gyroSTDEV;
+ const float w2 = biasSTDEV;
+ Q[0] = w1*w1;
+ Q[1] = w2*w2;
+
+ Ba.x = 0;
+ Ba.y = 0;
+ Ba.z = 1;
+
+ Bm.x = 0;
+ Bm.y = 1;
+ Bm.z = 0;
+
+ init();
+}
+
+void Fusion::init() {
+ // initial estimate: E{ x(t0) }
+ x = 0;
+
+ // initial covariance: Var{ x(t0) }
+ P = 0;
+
+ mInitState = 0;
+ mCount[0] = 0;
+ mCount[1] = 0;
+ mCount[2] = 0;
+ mData = 0;
+}
+
+bool Fusion::hasEstimate() const {
+ return (mInitState == (MAG|ACC|GYRO));
+}
+
+bool Fusion::checkInitComplete(int what, const vec3_t& d) {
+ if (mInitState == (MAG|ACC|GYRO))
+ return true;
+
+ if (what == ACC) {
+ mData[0] += d * (1/length(d));
+ mCount[0]++;
+ mInitState |= ACC;
+ } else if (what == MAG) {
+ mData[1] += d * (1/length(d));
+ mCount[1]++;
+ mInitState |= MAG;
+ } else if (what == GYRO) {
+ mData[2] += d;
+ mCount[2]++;
+ if (mCount[2] == 64) {
+ // 64 samples is good enough to estimate the gyro drift and
+ // doesn't take too much time.
+ mInitState |= GYRO;
+ }
+ }
+
+ if (mInitState == (MAG|ACC|GYRO)) {
+ // Average all the values we collected so far
+ mData[0] *= 1.0f/mCount[0];
+ mData[1] *= 1.0f/mCount[1];
+ mData[2] *= 1.0f/mCount[2];
+
+ // calculate the MRPs from the data collection, this gives us
+ // a rough estimate of our initial state
+ mat33_t R;
+ vec3_t up(mData[0]);
+ vec3_t east(cross_product(mData[1], up));
+ east *= 1/length(east);
+ vec3_t north(cross_product(up, east));
+ R << east << north << up;
+ x[0] = matrixToMRPs(R);
+
+ // NOTE: we could try to use the average of the gyro data
+ // to estimate the initial bias, but this only works if
+ // the device is not moving. For now, we don't use that value
+ // and start with a bias of 0.
+ x[1] = 0;
+
+ // initial covariance
+ P = 0;
+ }
+
+ return false;
+}
+
+void Fusion::handleGyro(const vec3_t& w, float dT) {
+ const vec3_t wdT(w * dT); // rad/s * s -> rad
+ if (!checkInitComplete(GYRO, wdT))
+ return;
+
+ predict(wdT);
+}
+
+status_t Fusion::handleAcc(const vec3_t& a) {
+ if (length(a) < 0.981f)
+ return BAD_VALUE;
+
+ if (!checkInitComplete(ACC, a))
+ return BAD_VALUE;
+
+ // ignore acceleration data if we're close to free-fall
+ const float l = 1/length(a);
+ update(a*l, Ba, accSTDEV*l);
+ return NO_ERROR;
+}
+
+status_t Fusion::handleMag(const vec3_t& m) {
+ // the geomagnetic-field should be between 30uT and 60uT
+ // reject obviously wrong magnetic-fields
+ if (length(m) > 100)
+ return BAD_VALUE;
+
+ if (!checkInitComplete(MAG, m))
+ return BAD_VALUE;
+
+ const vec3_t up( getRotationMatrix() * Ba );
+ const vec3_t east( cross_product(m, up) );
+ vec3_t north( cross_product(up, east) );
+
+ const float l = 1 / length(north);
+ north *= l;
+
+#if 0
+ // in practice the magnetic-field sensor is so wrong
+ // that there is no point trying to use it to constantly
+ // correct the gyro. instead, we use the mag-sensor only when
+ // the device points north (just to give us a reference).
+ // We're hoping that it'll actually point north, if it doesn't
+ // we'll be offset, but at least the instantaneous posture
+ // of the device will be correct.
+
+ const float cos_30 = 0.8660254f;
+ if (dot_product(north, Bm) < cos_30)
+ return BAD_VALUE;
+#endif
+
+ update(north, Bm, magSTDEV*l);
+ return NO_ERROR;
+}
+
+bool Fusion::checkState(const vec3_t& v) {
+ if (isnanf(length(v))) {
+ LOGW("9-axis fusion diverged. reseting state.");
+ P = 0;
+ x[1] = 0;
+ mInitState = 0;
+ mCount[0] = 0;
+ mCount[1] = 0;
+ mCount[2] = 0;
+ mData = 0;
+ return false;
+ }
+ return true;
+}
+
+vec3_t Fusion::getAttitude() const {
+ return x[0];
+}
+
+vec3_t Fusion::getBias() const {
+ return x[1];
+}
+
+mat33_t Fusion::getRotationMatrix() const {
+ return MRPsToMatrix(x[0]);
+}
+
+mat33_t Fusion::getF(const vec3_t& p) {
+ const float p0 = p.x;
+ const float p1 = p.y;
+ const float p2 = p.z;
+
+ // f(p, w)
+ const float p0p1 = p0*p1;
+ const float p0p2 = p0*p2;
+ const float p1p2 = p1*p2;
+ const float p0p0 = p0*p0;
+ const float p1p1 = p1*p1;
+ const float p2p2 = p2*p2;
+ const float pp = 0.5f * (1 - (p0p0 + p1p1 + p2p2));
+
+ mat33_t F;
+ F[0][0] = 0.5f*(p0p0 + pp);
+ F[0][1] = 0.5f*(p0p1 + p2);
+ F[0][2] = 0.5f*(p0p2 - p1);
+ F[1][0] = 0.5f*(p0p1 - p2);
+ F[1][1] = 0.5f*(p1p1 + pp);
+ F[1][2] = 0.5f*(p1p2 + p0);
+ F[2][0] = 0.5f*(p0p2 + p1);
+ F[2][1] = 0.5f*(p1p2 - p0);
+ F[2][2] = 0.5f*(p2p2 + pp);
+ return F;
+}
+
+mat33_t Fusion::getdFdp(const vec3_t& p, const vec3_t& we) {
+
+ // dF = | A = df/dp -F |
+ // | 0 0 |
+
+ mat33_t A;
+ A[0][0] = A[1][1] = A[2][2] = 0.5f * (p.x*we.x + p.y*we.y + p.z*we.z);
+ A[0][1] = 0.5f * (p.y*we.x - p.x*we.y - we.z);
+ A[0][2] = 0.5f * (p.z*we.x - p.x*we.z + we.y);
+ A[1][2] = 0.5f * (p.z*we.y - p.y*we.z - we.x);
+ A[1][0] = -A[0][1];
+ A[2][0] = -A[0][2];
+ A[2][1] = -A[1][2];
+ return A;
+}
+
+void Fusion::predict(const vec3_t& w) {
+ // f(p, w)
+ vec3_t& p(x[0]);
+
+ // There is a discontinuity at 2.pi, to avoid it we need to switch to
+ // the shadow of p when pT.p gets too big.
+ const float ptp(dot_product(p,p));
+ if (ptp >= 2.0f) {
+ p = -p * (1/ptp);
+ }
+
+ const mat33_t F(getF(p));
+
+ // compute w with the bias correction:
+ // w_estimated = w - b_estimated
+ const vec3_t& b(x[1]);
+ const vec3_t we(w - b);
+
+ // prediction
+ const vec3_t dX(F*we);
+
+ if (!checkState(dX))
+ return;
+
+ p += dX;
+
+ const mat33_t A(getdFdp(p, we));
+
+ // G = | G0 0 | = | -F 0 |
+ // | 0 1 | | 0 1 |
+
+ // P += A*P + P*At + F*Q*Ft
+ const mat33_t AP(A*transpose(P[0][0]));
+ const mat33_t PAt(P[0][0]*transpose(A));
+ const mat33_t FPSt(F*transpose(P[1][0]));
+ const mat33_t PSFt(P[1][0]*transpose(F));
+ const mat33_t FQFt(scaleCovariance(F, Q[0]));
+ P[0][0] += AP + PAt - FPSt - PSFt + FQFt;
+ P[1][0] += A*P[1][0] - F*P[1][1];
+ P[1][1] += Q[1];
+}
+
+void Fusion::update(const vec3_t& z, const vec3_t& Bi, float sigma) {
+ const vec3_t p(x[0]);
+ // measured vector in body space: h(p) = A(p)*Bi
+ const mat33_t A(MRPsToMatrix(p));
+ const vec3_t Bb(A*Bi);
+
+ // Sensitivity matrix H = dh(p)/dp
+ // H = [ L 0 ]
+ const float ptp(dot_product(p,p));
+ const mat33_t px(crossMatrix(p, 0.5f*(ptp-1)));
+ const mat33_t ppt(p*transpose(p));
+ const mat33_t L((8 / sqr(1+ptp))*crossMatrix(Bb, 0)*(ppt-px));
+
+ // update...
+ const mat33_t R(sigma*sigma);
+ const mat33_t S(scaleCovariance(L, P[0][0]) + R);
+ const mat33_t Si(invert(S));
+ const mat33_t LtSi(transpose(L)*Si);
+
+ vec<mat33_t, 2> K;
+ K[0] = P[0][0] * LtSi;
+ K[1] = transpose(P[1][0])*LtSi;
+
+ const vec3_t e(z - Bb);
+ const vec3_t K0e(K[0]*e);
+ const vec3_t K1e(K[1]*e);
+
+ if (!checkState(K0e))
+ return;
+
+ if (!checkState(K1e))
+ return;
+
+ x[0] += K0e;
+ x[1] += K1e;
+
+ // P -= K*H*P;
+ const mat33_t K0L(K[0] * L);
+ const mat33_t K1L(K[1] * L);
+ P[0][0] -= K0L*P[0][0];
+ P[1][1] -= K1L*P[1][0];
+ P[1][0] -= K0L*P[1][0];
+}
+
+// -----------------------------------------------------------------------
+
+}; // namespace android
+
diff --git a/services/sensorservice/Fusion.h b/services/sensorservice/Fusion.h
new file mode 100644
index 0000000..571a415
--- /dev/null
+++ b/services/sensorservice/Fusion.h
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_FUSION_H
+#define ANDROID_FUSION_H
+
+#include <utils/Errors.h>
+
+#include "vec.h"
+#include "mat.h"
+
+namespace android {
+
+class Fusion {
+ /*
+ * the state vector is made of two sub-vector containing respectively:
+ * - modified Rodrigues parameters
+ * - the estimated gyro bias
+ */
+ vec<vec3_t, 2> x;
+
+ /*
+ * the predicated covariance matrix is made of 4 3x3 sub-matrices and it
+ * semi-definite positive.
+ *
+ * P = | P00 P10 | = | P00 P10 |
+ * | P01 P11 | | P10t Q1 |
+ *
+ * Since P01 = transpose(P10), the code below never calculates or
+ * stores P01. P11 is always equal to Q1, so we don't store it either.
+ */
+ mat<mat33_t, 2, 2> P;
+
+ /*
+ * the process noise covariance matrix is made of 2 3x3 sub-matrices
+ * Q0 encodes the attitude's noise
+ * Q1 encodes the bias' noise
+ */
+ vec<mat33_t, 2> Q;
+
+ static const float gyroSTDEV = 1.0e-5; // rad/s (measured 1.2e-5)
+ static const float accSTDEV = 0.05f; // m/s^2 (measured 0.08 / CDD 0.05)
+ static const float magSTDEV = 0.5f; // uT (measured 0.7 / CDD 0.5)
+ static const float biasSTDEV = 2e-9; // rad/s^2 (guessed)
+
+public:
+ Fusion();
+ void init();
+ void handleGyro(const vec3_t& w, float dT);
+ status_t handleAcc(const vec3_t& a);
+ status_t handleMag(const vec3_t& m);
+ vec3_t getAttitude() const;
+ vec3_t getBias() const;
+ mat33_t getRotationMatrix() const;
+ bool hasEstimate() const;
+
+private:
+ vec3_t Ba, Bm;
+ uint32_t mInitState;
+ vec<vec3_t, 3> mData;
+ size_t mCount[3];
+ enum { ACC=0x1, MAG=0x2, GYRO=0x4 };
+ bool checkInitComplete(int, const vec3_t&);
+ bool checkState(const vec3_t& v);
+ void predict(const vec3_t& w);
+ void update(const vec3_t& z, const vec3_t& Bi, float sigma);
+ static mat33_t getF(const vec3_t& p);
+ static mat33_t getdFdp(const vec3_t& p, const vec3_t& we);
+};
+
+}; // namespace android
+
+#endif // ANDROID_FUSION_H
diff --git a/services/sensorservice/GravitySensor.cpp b/services/sensorservice/GravitySensor.cpp
index 5c6aa99..541fad2 100644
--- a/services/sensorservice/GravitySensor.cpp
+++ b/services/sensorservice/GravitySensor.cpp
@@ -23,16 +23,18 @@
#include <hardware/sensors.h>
#include "GravitySensor.h"
+#include "SensorDevice.h"
+#include "SensorFusion.h"
namespace android {
// ---------------------------------------------------------------------------
GravitySensor::GravitySensor(sensor_t const* list, size_t count)
: mSensorDevice(SensorDevice::getInstance()),
+ mSensorFusion(SensorFusion::getInstance()),
mAccTime(0),
mLowPass(M_SQRT1_2, 1.5f),
mX(mLowPass), mY(mLowPass), mZ(mLowPass)
-
{
for (size_t i=0 ; i<count ; i++) {
if (list[i].type == SENSOR_TYPE_ACCELEROMETER) {
@@ -47,35 +49,52 @@ bool GravitySensor::process(sensors_event_t* outEvent,
{
const static double NS2S = 1.0 / 1000000000.0;
if (event.type == SENSOR_TYPE_ACCELEROMETER) {
- float x, y, z;
- const double now = event.timestamp * NS2S;
- if (mAccTime == 0) {
- x = mX.init(event.acceleration.x);
- y = mY.init(event.acceleration.y);
- z = mZ.init(event.acceleration.z);
+ vec3_t g;
+ if (mSensorFusion.hasGyro()) {
+ if (!mSensorFusion.hasEstimate())
+ return false;
+ const mat33_t R(mSensorFusion.getRotationMatrix());
+ // FIXME: we need to estimate the length of gravity because
+ // the accelerometer may have a small scaling error. This
+ // translates to an offset in the linear-acceleration sensor.
+ g = R[2] * GRAVITY_EARTH;
} else {
- double dT = now - mAccTime;
- mLowPass.setSamplingPeriod(dT);
- x = mX(event.acceleration.x);
- y = mY(event.acceleration.y);
- z = mZ(event.acceleration.z);
+ const double now = event.timestamp * NS2S;
+ if (mAccTime == 0) {
+ g.x = mX.init(event.acceleration.x);
+ g.y = mY.init(event.acceleration.y);
+ g.z = mZ.init(event.acceleration.z);
+ } else {
+ double dT = now - mAccTime;
+ mLowPass.setSamplingPeriod(dT);
+ g.x = mX(event.acceleration.x);
+ g.y = mY(event.acceleration.y);
+ g.z = mZ(event.acceleration.z);
+ }
+ g *= (GRAVITY_EARTH / length(g));
+ mAccTime = now;
}
- mAccTime = now;
*outEvent = event;
- outEvent->data[0] = x;
- outEvent->data[1] = y;
- outEvent->data[2] = z;
+ outEvent->data[0] = g.x;
+ outEvent->data[1] = g.y;
+ outEvent->data[2] = g.z;
outEvent->sensor = '_grv';
outEvent->type = SENSOR_TYPE_GRAVITY;
return true;
}
return false;
}
+
status_t GravitySensor::activate(void* ident, bool enabled) {
- status_t err = mSensorDevice.activate(this, mAccelerometer.getHandle(), enabled);
- if (err == NO_ERROR) {
- if (enabled) {
- mAccTime = 0;
+ status_t err;
+ if (mSensorFusion.hasGyro()) {
+ err = mSensorFusion.activate(this, enabled);
+ } else {
+ err = mSensorDevice.activate(this, mAccelerometer.getHandle(), enabled);
+ if (err == NO_ERROR) {
+ if (enabled) {
+ mAccTime = 0;
+ }
}
}
return err;
@@ -83,20 +102,26 @@ status_t GravitySensor::activate(void* ident, bool enabled) {
status_t GravitySensor::setDelay(void* ident, int handle, int64_t ns)
{
- return mSensorDevice.setDelay(this, mAccelerometer.getHandle(), ns);
+ if (mSensorFusion.hasGyro()) {
+ return mSensorFusion.setDelay(this, ns);
+ } else {
+ return mSensorDevice.setDelay(this, mAccelerometer.getHandle(), ns);
+ }
}
Sensor GravitySensor::getSensor() const {
sensor_t hwSensor;
hwSensor.name = "Gravity Sensor";
hwSensor.vendor = "Google Inc.";
- hwSensor.version = 1;
+ hwSensor.version = mSensorFusion.hasGyro() ? 3 : 2;
hwSensor.handle = '_grv';
hwSensor.type = SENSOR_TYPE_GRAVITY;
- hwSensor.maxRange = mAccelerometer.getMaxValue();
+ hwSensor.maxRange = GRAVITY_EARTH * 2;
hwSensor.resolution = mAccelerometer.getResolution();
- hwSensor.power = mAccelerometer.getPowerUsage();
- hwSensor.minDelay = mAccelerometer.getMinDelay();
+ hwSensor.power = mSensorFusion.hasGyro() ?
+ mSensorFusion.getPowerUsage() : mAccelerometer.getPowerUsage();
+ hwSensor.minDelay = mSensorFusion.hasGyro() ?
+ mSensorFusion.getMinDelay() : mAccelerometer.getMinDelay();
Sensor sensor(&hwSensor);
return sensor;
}
diff --git a/services/sensorservice/GravitySensor.h b/services/sensorservice/GravitySensor.h
index decfbb8..0ca3a3c 100644
--- a/services/sensorservice/GravitySensor.h
+++ b/services/sensorservice/GravitySensor.h
@@ -22,7 +22,6 @@
#include <gui/Sensor.h>
-#include "SensorDevice.h"
#include "SensorInterface.h"
#include "SecondOrderLowPassFilter.h"
@@ -30,13 +29,17 @@
namespace android {
// ---------------------------------------------------------------------------
+class SensorDevice;
+class SensorFusion;
+
class GravitySensor : public SensorInterface {
SensorDevice& mSensorDevice;
+ SensorFusion& mSensorFusion;
Sensor mAccelerometer;
double mAccTime;
SecondOrderLowPassFilter mLowPass;
- CascadedBiquadFilter mX, mY, mZ;
+ CascadedBiquadFilter<float> mX, mY, mZ;
public:
GravitySensor(sensor_t const* list, size_t count);
diff --git a/services/sensorservice/LinearAccelerationSensor.cpp b/services/sensorservice/LinearAccelerationSensor.cpp
index 9425a92..f0054f2 100644
--- a/services/sensorservice/LinearAccelerationSensor.cpp
+++ b/services/sensorservice/LinearAccelerationSensor.cpp
@@ -23,6 +23,8 @@
#include <hardware/sensors.h>
#include "LinearAccelerationSensor.h"
+#include "SensorDevice.h"
+#include "SensorFusion.h"
namespace android {
// ---------------------------------------------------------------------------
@@ -31,34 +33,29 @@ LinearAccelerationSensor::LinearAccelerationSensor(sensor_t const* list, size_t
: mSensorDevice(SensorDevice::getInstance()),
mGravitySensor(list, count)
{
- mData[0] = mData[1] = mData[2] = 0;
}
bool LinearAccelerationSensor::process(sensors_event_t* outEvent,
const sensors_event_t& event)
{
bool result = mGravitySensor.process(outEvent, event);
- if (result) {
- if (event.type == SENSOR_TYPE_ACCELEROMETER) {
- mData[0] = event.acceleration.x;
- mData[1] = event.acceleration.y;
- mData[2] = event.acceleration.z;
- }
- outEvent->data[0] = mData[0] - outEvent->data[0];
- outEvent->data[1] = mData[1] - outEvent->data[1];
- outEvent->data[2] = mData[2] - outEvent->data[2];
+ if (result && event.type == SENSOR_TYPE_ACCELEROMETER) {
+ outEvent->data[0] = event.acceleration.x - outEvent->data[0];
+ outEvent->data[1] = event.acceleration.y - outEvent->data[1];
+ outEvent->data[2] = event.acceleration.z - outEvent->data[2];
outEvent->sensor = '_lin';
outEvent->type = SENSOR_TYPE_LINEAR_ACCELERATION;
+ return true;
}
- return result;
+ return false;
}
status_t LinearAccelerationSensor::activate(void* ident, bool enabled) {
- return mGravitySensor.activate(ident, enabled);
+ return mGravitySensor.activate(this, enabled);
}
status_t LinearAccelerationSensor::setDelay(void* ident, int handle, int64_t ns) {
- return mGravitySensor.setDelay(ident, handle, ns);
+ return mGravitySensor.setDelay(this, handle, ns);
}
Sensor LinearAccelerationSensor::getSensor() const {
@@ -66,7 +63,7 @@ Sensor LinearAccelerationSensor::getSensor() const {
sensor_t hwSensor;
hwSensor.name = "Linear Acceleration Sensor";
hwSensor.vendor = "Google Inc.";
- hwSensor.version = 1;
+ hwSensor.version = gsensor.getVersion();
hwSensor.handle = '_lin';
hwSensor.type = SENSOR_TYPE_LINEAR_ACCELERATION;
hwSensor.maxRange = gsensor.getMaxValue();
diff --git a/services/sensorservice/LinearAccelerationSensor.h b/services/sensorservice/LinearAccelerationSensor.h
index c577086..5deb24f 100644
--- a/services/sensorservice/LinearAccelerationSensor.h
+++ b/services/sensorservice/LinearAccelerationSensor.h
@@ -22,19 +22,19 @@
#include <gui/Sensor.h>
-#include "SensorDevice.h"
#include "SensorInterface.h"
#include "GravitySensor.h"
// ---------------------------------------------------------------------------
-
namespace android {
// ---------------------------------------------------------------------------
+class SensorDevice;
+class SensorFusion;
+
class LinearAccelerationSensor : public SensorInterface {
SensorDevice& mSensorDevice;
GravitySensor mGravitySensor;
- float mData[3];
virtual bool process(sensors_event_t* outEvent,
const sensors_event_t& event);
diff --git a/services/sensorservice/OrientationSensor.cpp b/services/sensorservice/OrientationSensor.cpp
new file mode 100644
index 0000000..c9e5080
--- /dev/null
+++ b/services/sensorservice/OrientationSensor.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+#include <stdint.h>
+#include <math.h>
+#include <sys/types.h>
+
+#include <utils/Errors.h>
+
+#include <hardware/sensors.h>
+
+#include "OrientationSensor.h"
+#include "SensorDevice.h"
+#include "SensorFusion.h"
+
+namespace android {
+// ---------------------------------------------------------------------------
+
+OrientationSensor::OrientationSensor()
+ : mSensorDevice(SensorDevice::getInstance()),
+ mSensorFusion(SensorFusion::getInstance())
+{
+}
+
+bool OrientationSensor::process(sensors_event_t* outEvent,
+ const sensors_event_t& event)
+{
+ if (event.type == SENSOR_TYPE_ACCELEROMETER) {
+ if (mSensorFusion.hasEstimate()) {
+ vec3_t g;
+ const float rad2deg = 180 / M_PI;
+ const mat33_t R(mSensorFusion.getRotationMatrix());
+ g[0] = atan2f(-R[1][0], R[0][0]) * rad2deg;
+ g[1] = atan2f(-R[2][1], R[2][2]) * rad2deg;
+ g[2] = asinf ( R[2][0]) * rad2deg;
+ if (g[0] < 0)
+ g[0] += 360;
+
+ *outEvent = event;
+ outEvent->data[0] = g.x;
+ outEvent->data[1] = g.y;
+ outEvent->data[2] = g.z;
+ outEvent->sensor = '_ypr';
+ outEvent->type = SENSOR_TYPE_ORIENTATION;
+ return true;
+ }
+ }
+ return false;
+}
+
+status_t OrientationSensor::activate(void* ident, bool enabled) {
+ return mSensorFusion.activate(this, enabled);
+}
+
+status_t OrientationSensor::setDelay(void* ident, int handle, int64_t ns) {
+ return mSensorFusion.setDelay(this, ns);
+}
+
+Sensor OrientationSensor::getSensor() const {
+ sensor_t hwSensor;
+ hwSensor.name = "Orientation Sensor";
+ hwSensor.vendor = "Google Inc.";
+ hwSensor.version = 1;
+ hwSensor.handle = '_ypr';
+ hwSensor.type = SENSOR_TYPE_ORIENTATION;
+ hwSensor.maxRange = 360.0f;
+ hwSensor.resolution = 1.0f/256.0f; // FIXME: real value here
+ hwSensor.power = mSensorFusion.getPowerUsage();
+ hwSensor.minDelay = mSensorFusion.getMinDelay();
+ Sensor sensor(&hwSensor);
+ return sensor;
+}
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
diff --git a/services/sensorservice/OrientationSensor.h b/services/sensorservice/OrientationSensor.h
new file mode 100644
index 0000000..855949d
--- /dev/null
+++ b/services/sensorservice/OrientationSensor.h
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_ORIENTATION_SENSOR_H
+#define ANDROID_ORIENTATION_SENSOR_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <gui/Sensor.h>
+
+#include "SensorInterface.h"
+
+// ---------------------------------------------------------------------------
+namespace android {
+// ---------------------------------------------------------------------------
+
+class SensorDevice;
+class SensorFusion;
+
+class OrientationSensor : public SensorInterface {
+ SensorDevice& mSensorDevice;
+ SensorFusion& mSensorFusion;
+
+public:
+ OrientationSensor();
+ virtual bool process(sensors_event_t* outEvent,
+ const sensors_event_t& event);
+ virtual status_t activate(void* ident, bool enabled);
+ virtual status_t setDelay(void* ident, int handle, int64_t ns);
+ virtual Sensor getSensor() const;
+ virtual bool isVirtual() const { return true; }
+};
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_ORIENTATION_SENSOR_H
diff --git a/services/sensorservice/RotationVectorSensor.cpp b/services/sensorservice/RotationVectorSensor.cpp
index 3abfc12..cba89c9 100644
--- a/services/sensorservice/RotationVectorSensor.cpp
+++ b/services/sensorservice/RotationVectorSensor.cpp
@@ -32,134 +32,67 @@ static inline T clamp(T v) {
return v < 0 ? 0 : v;
}
-RotationVectorSensor::RotationVectorSensor(sensor_t const* list, size_t count)
+RotationVectorSensor::RotationVectorSensor()
: mSensorDevice(SensorDevice::getInstance()),
- mALowPass(M_SQRT1_2, 1.5f),
- mAX(mALowPass), mAY(mALowPass), mAZ(mALowPass),
- mMLowPass(M_SQRT1_2, 1.5f),
- mMX(mMLowPass), mMY(mMLowPass), mMZ(mMLowPass)
+ mSensorFusion(SensorFusion::getInstance())
{
- for (size_t i=0 ; i<count ; i++) {
- if (list[i].type == SENSOR_TYPE_ACCELEROMETER) {
- mAcc = Sensor(list + i);
- }
- if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) {
- mMag = Sensor(list + i);
- }
- }
- memset(mMagData, 0, sizeof(mMagData));
}
bool RotationVectorSensor::process(sensors_event_t* outEvent,
const sensors_event_t& event)
{
- const static double NS2S = 1.0 / 1000000000.0;
- if (event.type == SENSOR_TYPE_MAGNETIC_FIELD) {
- const double now = event.timestamp * NS2S;
- if (mMagTime == 0) {
- mMagData[0] = mMX.init(event.magnetic.x);
- mMagData[1] = mMY.init(event.magnetic.y);
- mMagData[2] = mMZ.init(event.magnetic.z);
- } else {
- double dT = now - mMagTime;
- mMLowPass.setSamplingPeriod(dT);
- mMagData[0] = mMX(event.magnetic.x);
- mMagData[1] = mMY(event.magnetic.y);
- mMagData[2] = mMZ(event.magnetic.z);
- }
- mMagTime = now;
- }
if (event.type == SENSOR_TYPE_ACCELEROMETER) {
- const double now = event.timestamp * NS2S;
- float Ax, Ay, Az;
- if (mAccTime == 0) {
- Ax = mAX.init(event.acceleration.x);
- Ay = mAY.init(event.acceleration.y);
- Az = mAZ.init(event.acceleration.z);
- } else {
- double dT = now - mAccTime;
- mALowPass.setSamplingPeriod(dT);
- Ax = mAX(event.acceleration.x);
- Ay = mAY(event.acceleration.y);
- Az = mAZ(event.acceleration.z);
- }
- mAccTime = now;
- const float Ex = mMagData[0];
- const float Ey = mMagData[1];
- const float Ez = mMagData[2];
- float Hx = Ey*Az - Ez*Ay;
- float Hy = Ez*Ax - Ex*Az;
- float Hz = Ex*Ay - Ey*Ax;
- const float normH = sqrtf(Hx*Hx + Hy*Hy + Hz*Hz);
- if (normH < 0.1f) {
- // device is close to free fall (or in space?), or close to
- // magnetic north pole. Typical values are > 100.
- return false;
+ if (mSensorFusion.hasEstimate()) {
+ const mat33_t R(mSensorFusion.getRotationMatrix());
+
+ // matrix to rotation vector (normalized quaternion)
+ const float Hx = R[0].x;
+ const float My = R[1].y;
+ const float Az = R[2].z;
+
+ float qw = sqrtf( clamp( Hx + My + Az + 1) * 0.25f );
+ float qx = sqrtf( clamp( Hx - My - Az + 1) * 0.25f );
+ float qy = sqrtf( clamp(-Hx + My - Az + 1) * 0.25f );
+ float qz = sqrtf( clamp(-Hx - My + Az + 1) * 0.25f );
+ qx = copysignf(qx, R[2].y - R[1].z);
+ qy = copysignf(qy, R[0].z - R[2].x);
+ qz = copysignf(qz, R[1].x - R[0].y);
+
+ // this quaternion is guaranteed to be normalized, by construction
+ // of the rotation matrix.
+
+ *outEvent = event;
+ outEvent->data[0] = qx;
+ outEvent->data[1] = qy;
+ outEvent->data[2] = qz;
+ outEvent->data[3] = qw;
+ outEvent->sensor = '_rov';
+ outEvent->type = SENSOR_TYPE_ROTATION_VECTOR;
+ return true;
}
- const float invH = 1.0f / normH;
- const float invA = 1.0f / sqrtf(Ax*Ax + Ay*Ay + Az*Az);
- Hx *= invH;
- Hy *= invH;
- Hz *= invH;
- Ax *= invA;
- Ay *= invA;
- Az *= invA;
- const float Mx = Ay*Hz - Az*Hy;
- const float My = Az*Hx - Ax*Hz;
- const float Mz = Ax*Hy - Ay*Hx;
-
- // matrix to rotation vector (normalized quaternion)
- float qw = sqrtf( clamp( Hx + My + Az + 1) * 0.25f );
- float qx = sqrtf( clamp( Hx - My - Az + 1) * 0.25f );
- float qy = sqrtf( clamp(-Hx + My - Az + 1) * 0.25f );
- float qz = sqrtf( clamp(-Hx - My + Az + 1) * 0.25f );
- qx = copysignf(qx, Ay - Mz);
- qy = copysignf(qy, Hz - Ax);
- qz = copysignf(qz, Mx - Hy);
-
- // this quaternion is guaranteed to be normalized, by construction
- // of the rotation matrix.
-
- *outEvent = event;
- outEvent->data[0] = qx;
- outEvent->data[1] = qy;
- outEvent->data[2] = qz;
- outEvent->data[3] = qw;
- outEvent->sensor = '_rov';
- outEvent->type = SENSOR_TYPE_ROTATION_VECTOR;
- return true;
}
return false;
}
status_t RotationVectorSensor::activate(void* ident, bool enabled) {
- mSensorDevice.activate(this, mAcc.getHandle(), enabled);
- mSensorDevice.activate(this, mMag.getHandle(), enabled);
- if (enabled) {
- mMagTime = 0;
- mAccTime = 0;
- }
- return NO_ERROR;
+ return mSensorFusion.activate(this, enabled);
}
-status_t RotationVectorSensor::setDelay(void* ident, int handle, int64_t ns)
-{
- mSensorDevice.setDelay(this, mAcc.getHandle(), ns);
- mSensorDevice.setDelay(this, mMag.getHandle(), ns);
- return NO_ERROR;
+status_t RotationVectorSensor::setDelay(void* ident, int handle, int64_t ns) {
+ return mSensorFusion.setDelay(this, ns);
}
Sensor RotationVectorSensor::getSensor() const {
sensor_t hwSensor;
hwSensor.name = "Rotation Vector Sensor";
hwSensor.vendor = "Google Inc.";
- hwSensor.version = 1;
+ hwSensor.version = mSensorFusion.hasGyro() ? 3 : 2;
hwSensor.handle = '_rov';
hwSensor.type = SENSOR_TYPE_ROTATION_VECTOR;
hwSensor.maxRange = 1;
hwSensor.resolution = 1.0f / (1<<24);
- hwSensor.power = mAcc.getPowerUsage() + mMag.getPowerUsage();
- hwSensor.minDelay = mAcc.getMinDelay();
+ hwSensor.power = mSensorFusion.getPowerUsage();
+ hwSensor.minDelay = mSensorFusion.getMinDelay();
Sensor sensor(&hwSensor);
return sensor;
}
diff --git a/services/sensorservice/RotationVectorSensor.h b/services/sensorservice/RotationVectorSensor.h
index 17699f8..ac76487 100644
--- a/services/sensorservice/RotationVectorSensor.h
+++ b/services/sensorservice/RotationVectorSensor.h
@@ -26,24 +26,19 @@
#include "SensorInterface.h"
#include "SecondOrderLowPassFilter.h"
+#include "Fusion.h"
+#include "SensorFusion.h"
+
// ---------------------------------------------------------------------------
namespace android {
// ---------------------------------------------------------------------------
class RotationVectorSensor : public SensorInterface {
SensorDevice& mSensorDevice;
- Sensor mAcc;
- Sensor mMag;
- float mMagData[3];
- double mAccTime;
- double mMagTime;
- SecondOrderLowPassFilter mALowPass;
- CascadedBiquadFilter mAX, mAY, mAZ;
- SecondOrderLowPassFilter mMLowPass;
- CascadedBiquadFilter mMX, mMY, mMZ;
+ SensorFusion& mSensorFusion;
public:
- RotationVectorSensor(sensor_t const* list, size_t count);
+ RotationVectorSensor();
virtual bool process(sensors_event_t* outEvent,
const sensors_event_t& event);
virtual status_t activate(void* ident, bool enabled);
diff --git a/services/sensorservice/SecondOrderLowPassFilter.cpp b/services/sensorservice/SecondOrderLowPassFilter.cpp
index eeb6d1e..c76dd4c 100644
--- a/services/sensorservice/SecondOrderLowPassFilter.cpp
+++ b/services/sensorservice/SecondOrderLowPassFilter.cpp
@@ -21,6 +21,7 @@
#include <cutils/log.h>
#include "SecondOrderLowPassFilter.h"
+#include "vec.h"
// ---------------------------------------------------------------------------
@@ -44,21 +45,24 @@ void SecondOrderLowPassFilter::setSamplingPeriod(float dT)
// ---------------------------------------------------------------------------
-BiquadFilter::BiquadFilter(const SecondOrderLowPassFilter& s)
+template<typename T>
+BiquadFilter<T>::BiquadFilter(const SecondOrderLowPassFilter& s)
: s(s)
{
}
-float BiquadFilter::init(float x)
+template<typename T>
+T BiquadFilter<T>::init(const T& x)
{
x1 = x2 = x;
y1 = y2 = x;
return x;
}
-float BiquadFilter::operator()(float x)
+template<typename T>
+T BiquadFilter<T>::operator()(const T& x)
{
- float y = (x + x2)*s.a0 + x1*s.a1 - y1*s.b1 - y2*s.b2;
+ T y = (x + x2)*s.a0 + x1*s.a1 - y1*s.b1 - y2*s.b2;
x2 = x1;
y2 = y1;
x1 = x;
@@ -68,22 +72,32 @@ float BiquadFilter::operator()(float x)
// ---------------------------------------------------------------------------
-CascadedBiquadFilter::CascadedBiquadFilter(const SecondOrderLowPassFilter& s)
+template<typename T>
+CascadedBiquadFilter<T>::CascadedBiquadFilter(const SecondOrderLowPassFilter& s)
: mA(s), mB(s)
{
}
-float CascadedBiquadFilter::init(float x)
+template<typename T>
+T CascadedBiquadFilter<T>::init(const T& x)
{
mA.init(x);
mB.init(x);
return x;
}
-float CascadedBiquadFilter::operator()(float x)
+template<typename T>
+T CascadedBiquadFilter<T>::operator()(const T& x)
{
return mB(mA(x));
}
// ---------------------------------------------------------------------------
+
+template class BiquadFilter<float>;
+template class CascadedBiquadFilter<float>;
+template class BiquadFilter<vec3_t>;
+template class CascadedBiquadFilter<vec3_t>;
+
+// ---------------------------------------------------------------------------
}; // namespace android
diff --git a/services/sensorservice/SecondOrderLowPassFilter.h b/services/sensorservice/SecondOrderLowPassFilter.h
index 85698ca..0cc2446 100644
--- a/services/sensorservice/SecondOrderLowPassFilter.h
+++ b/services/sensorservice/SecondOrderLowPassFilter.h
@@ -25,12 +25,14 @@
namespace android {
// ---------------------------------------------------------------------------
+template<typename T>
class BiquadFilter;
/*
* State of a 2nd order low-pass IIR filter
*/
class SecondOrderLowPassFilter {
+ template<typename T>
friend class BiquadFilter;
float iQ, fc;
float K, iD;
@@ -44,27 +46,29 @@ public:
/*
* Implements a Biquad IIR filter
*/
+template<typename T>
class BiquadFilter {
- float x1, x2;
- float y1, y2;
+ T x1, x2;
+ T y1, y2;
const SecondOrderLowPassFilter& s;
public:
BiquadFilter(const SecondOrderLowPassFilter& s);
- float init(float in);
- float operator()(float in);
+ T init(const T& in);
+ T operator()(const T& in);
};
/*
* Two cascaded biquad IIR filters
* (4-poles IIR)
*/
+template<typename T>
class CascadedBiquadFilter {
- BiquadFilter mA;
- BiquadFilter mB;
+ BiquadFilter<T> mA;
+ BiquadFilter<T> mB;
public:
CascadedBiquadFilter(const SecondOrderLowPassFilter& s);
- float init(float in);
- float operator()(float in);
+ T init(const T& in);
+ T operator()(const T& in);
};
// ---------------------------------------------------------------------------
diff --git a/services/sensorservice/SensorDevice.cpp b/services/sensorservice/SensorDevice.cpp
index f192913..38d498c 100644
--- a/services/sensorservice/SensorDevice.cpp
+++ b/services/sensorservice/SensorDevice.cpp
@@ -29,6 +29,7 @@
#include <hardware/sensors.h>
#include "SensorDevice.h"
+#include "SensorService.h"
namespace android {
// ---------------------------------------------------------------------------
@@ -166,17 +167,32 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
bool actuateHardware = false;
Info& info( mActivationCount.editValueFor(handle) );
+
+
+ LOGD_IF(DEBUG_CONNECTIONS,
+ "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%d",
+ ident, handle, enabled, info.rates.size());
+
if (enabled) {
Mutex::Autolock _l(mLock);
+ LOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
+ info.rates.indexOfKey(ident));
+
if (info.rates.indexOfKey(ident) < 0) {
info.rates.add(ident, DEFAULT_EVENTS_PERIOD);
- actuateHardware = true;
+ if (info.rates.size() == 1) {
+ actuateHardware = true;
+ }
} else {
// sensor was already activated for this ident
}
} else {
Mutex::Autolock _l(mLock);
- if (info.rates.removeItem(ident) >= 0) {
+ LOGD_IF(DEBUG_CONNECTIONS, "... index=%ld",
+ info.rates.indexOfKey(ident));
+
+ ssize_t idx = info.rates.removeItem(ident);
+ if (idx >= 0) {
if (info.rates.size() == 0) {
actuateHardware = true;
}
@@ -186,6 +202,8 @@ status_t SensorDevice::activate(void* ident, int handle, int enabled)
}
if (actuateHardware) {
+ LOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w");
+
err = mSensorDevice->activate(mSensorDevice, handle, enabled);
if (enabled) {
LOGE_IF(err, "Error activating sensor %d (%s)", handle, strerror(-err));
@@ -233,6 +251,9 @@ status_t SensorDevice::setDelay(void* ident, int handle, int64_t ns)
}
}
}
+
+ //LOGD("setDelay: ident=%p, handle=%d, ns=%lld", ident, handle, ns);
+
return mSensorDevice->setDelay(mSensorDevice, handle, ns);
}
diff --git a/services/sensorservice/SensorFusion.cpp b/services/sensorservice/SensorFusion.cpp
new file mode 100644
index 0000000..d4226ec
--- /dev/null
+++ b/services/sensorservice/SensorFusion.cpp
@@ -0,0 +1,180 @@
+/*
+ * 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.
+ */
+
+#include "SensorDevice.h"
+#include "SensorFusion.h"
+#include "SensorService.h"
+
+namespace android {
+// ---------------------------------------------------------------------------
+
+ANDROID_SINGLETON_STATIC_INSTANCE(SensorFusion)
+
+SensorFusion::SensorFusion()
+ : mSensorDevice(SensorDevice::getInstance()),
+ mEnabled(false), mHasGyro(false), mGyroTime(0), mRotationMatrix(1),
+ mLowPass(M_SQRT1_2, 1.0f), mAccData(mLowPass),
+ mFilteredMag(0.0f), mFilteredAcc(0.0f)
+{
+ sensor_t const* list;
+ size_t count = mSensorDevice.getSensorList(&list);
+ for (size_t i=0 ; i<count ; i++) {
+ if (list[i].type == SENSOR_TYPE_ACCELEROMETER) {
+ mAcc = Sensor(list + i);
+ }
+ if (list[i].type == SENSOR_TYPE_MAGNETIC_FIELD) {
+ mMag = Sensor(list + i);
+ }
+ if (list[i].type == SENSOR_TYPE_GYROSCOPE) {
+ mGyro = Sensor(list + i);
+ // 200 Hz for gyro events is a good compromise between precision
+ // and power/cpu usage.
+ mTargetDelayNs = 1000000000LL/200;
+ mGyroRate = 1000000000.0f / mTargetDelayNs;
+ mHasGyro = true;
+ }
+ }
+ mFusion.init();
+ mAccData.init(vec3_t(0.0f));
+}
+
+void SensorFusion::process(const sensors_event_t& event) {
+
+ if (event.type == SENSOR_TYPE_GYROSCOPE && mHasGyro) {
+ if (mGyroTime != 0) {
+ const float dT = (event.timestamp - mGyroTime) / 1000000000.0f;
+ const float freq = 1 / dT;
+ const float alpha = 2 / (2 + dT); // 2s time-constant
+ mGyroRate = mGyroRate*alpha + freq*(1 - alpha);
+ }
+ mGyroTime = event.timestamp;
+ mFusion.handleGyro(vec3_t(event.data), 1.0f/mGyroRate);
+ } else if (event.type == SENSOR_TYPE_MAGNETIC_FIELD) {
+ const vec3_t mag(event.data);
+ if (mHasGyro) {
+ mFusion.handleMag(mag);
+ } else {
+ const float l(length(mag));
+ if (l>5 && l<100) {
+ mFilteredMag = mag * (1/l);
+ }
+ }
+ } else if (event.type == SENSOR_TYPE_ACCELEROMETER) {
+ const vec3_t acc(event.data);
+ if (mHasGyro) {
+ mFusion.handleAcc(acc);
+ mRotationMatrix = mFusion.getRotationMatrix();
+ } else {
+ const float l(length(acc));
+ if (l > 0.981f) {
+ // remove the linear-acceleration components
+ mFilteredAcc = mAccData(acc * (1/l));
+ }
+ if (length(mFilteredAcc)>0 && length(mFilteredMag)>0) {
+ vec3_t up(mFilteredAcc);
+ vec3_t east(cross_product(mFilteredMag, up));
+ east *= 1/length(east);
+ vec3_t north(cross_product(up, east));
+ mRotationMatrix << east << north << up;
+ }
+ }
+ }
+}
+
+template <typename T> inline T min(T a, T b) { return a<b ? a : b; }
+template <typename T> inline T max(T a, T b) { return a>b ? a : b; }
+
+status_t SensorFusion::activate(void* ident, bool enabled) {
+
+ LOGD_IF(DEBUG_CONNECTIONS,
+ "SensorFusion::activate(ident=%p, enabled=%d)",
+ ident, enabled);
+
+ const ssize_t idx = mClients.indexOf(ident);
+ if (enabled) {
+ if (idx < 0) {
+ mClients.add(ident);
+ }
+ } else {
+ if (idx >= 0) {
+ mClients.removeItemsAt(idx);
+ }
+ }
+
+ mSensorDevice.activate(ident, mAcc.getHandle(), enabled);
+ mSensorDevice.activate(ident, mMag.getHandle(), enabled);
+ if (mHasGyro) {
+ mSensorDevice.activate(ident, mGyro.getHandle(), enabled);
+ }
+
+ const bool newState = mClients.size() != 0;
+ if (newState != mEnabled) {
+ mEnabled = newState;
+ if (newState) {
+ mFusion.init();
+ }
+ }
+ return NO_ERROR;
+}
+
+status_t SensorFusion::setDelay(void* ident, int64_t ns) {
+ if (mHasGyro) {
+ mSensorDevice.setDelay(ident, mAcc.getHandle(), ns);
+ mSensorDevice.setDelay(ident, mMag.getHandle(), ms2ns(20));
+ mSensorDevice.setDelay(ident, mGyro.getHandle(), mTargetDelayNs);
+ } else {
+ const static double NS2S = 1.0 / 1000000000.0;
+ mSensorDevice.setDelay(ident, mAcc.getHandle(), ns);
+ mSensorDevice.setDelay(ident, mMag.getHandle(), max(ns, mMag.getMinDelayNs()));
+ mLowPass.setSamplingPeriod(ns*NS2S);
+ }
+ return NO_ERROR;
+}
+
+
+float SensorFusion::getPowerUsage() const {
+ float power = mAcc.getPowerUsage() + mMag.getPowerUsage();
+ if (mHasGyro) {
+ power += mGyro.getPowerUsage();
+ }
+ return power;
+}
+
+int32_t SensorFusion::getMinDelay() const {
+ return mAcc.getMinDelay();
+}
+
+void SensorFusion::dump(String8& result, char* buffer, size_t SIZE) {
+ const Fusion& fusion(mFusion);
+ snprintf(buffer, SIZE, "Fusion (%s) %s (%d clients), gyro-rate=%7.2fHz, "
+ "MRPS=< %g, %g, %g > (%g), "
+ "BIAS=< %g, %g, %g >\n",
+ mHasGyro ? "9-axis" : "6-axis",
+ mEnabled ? "enabled" : "disabled",
+ mClients.size(),
+ mGyroRate,
+ fusion.getAttitude().x,
+ fusion.getAttitude().y,
+ fusion.getAttitude().z,
+ dot_product(fusion.getAttitude(), fusion.getAttitude()),
+ fusion.getBias().x,
+ fusion.getBias().y,
+ fusion.getBias().z);
+ result.append(buffer);
+}
+
+// ---------------------------------------------------------------------------
+}; // namespace android
diff --git a/services/sensorservice/SensorFusion.h b/services/sensorservice/SensorFusion.h
new file mode 100644
index 0000000..c7eab12
--- /dev/null
+++ b/services/sensorservice/SensorFusion.h
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_SENSOR_FUSION_H
+#define ANDROID_SENSOR_FUSION_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#include <utils/SortedVector.h>
+#include <utils/Singleton.h>
+#include <utils/String8.h>
+
+#include <gui/Sensor.h>
+
+#include "Fusion.h"
+#include "SecondOrderLowPassFilter.h"
+
+// ---------------------------------------------------------------------------
+
+namespace android {
+// ---------------------------------------------------------------------------
+
+class SensorDevice;
+
+class SensorFusion : public Singleton<SensorFusion> {
+ friend class Singleton<SensorFusion>;
+
+ SensorDevice& mSensorDevice;
+ Sensor mAcc;
+ Sensor mMag;
+ Sensor mGyro;
+ Fusion mFusion;
+ bool mEnabled;
+ bool mHasGyro;
+ float mGyroRate;
+ nsecs_t mTargetDelayNs;
+ nsecs_t mGyroTime;
+ mat33_t mRotationMatrix;
+ SecondOrderLowPassFilter mLowPass;
+ BiquadFilter<vec3_t> mAccData;
+ vec3_t mFilteredMag;
+ vec3_t mFilteredAcc;
+ SortedVector<void*> mClients;
+
+ SensorFusion();
+
+public:
+ void process(const sensors_event_t& event);
+
+ bool isEnabled() const { return mEnabled; }
+ bool hasGyro() const { return mHasGyro; }
+ bool hasEstimate() const { return !mHasGyro || mFusion.hasEstimate(); }
+ mat33_t getRotationMatrix() const { return mRotationMatrix; }
+ vec3_t getGyroBias() const { return mFusion.getBias(); }
+ float getEstimatedRate() const { return mGyroRate; }
+
+ status_t activate(void* ident, bool enabled);
+ status_t setDelay(void* ident, int64_t ns);
+
+ float getPowerUsage() const;
+ int32_t getMinDelay() const;
+
+ void dump(String8& result, char* buffer, size_t SIZE);
+};
+
+
+// ---------------------------------------------------------------------------
+}; // namespace android
+
+#endif // ANDROID_SENSOR_FUSION_H
diff --git a/services/sensorservice/SensorInterface.h b/services/sensorservice/SensorInterface.h
index 084f2f5..fb357d7 100644
--- a/services/sensorservice/SensorInterface.h
+++ b/services/sensorservice/SensorInterface.h
@@ -20,8 +20,6 @@
#include <stdint.h>
#include <sys/types.h>
-#include <utils/Singleton.h>
-
#include <gui/Sensor.h>
#include "SensorDevice.h"
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index c5e69ff..5b86d10 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -35,10 +35,13 @@
#include <hardware/sensors.h>
-#include "SensorService.h"
+#include "CorrectedGyroSensor.h"
#include "GravitySensor.h"
#include "LinearAccelerationSensor.h"
+#include "OrientationSensor.h"
#include "RotationVectorSensor.h"
+#include "SensorFusion.h"
+#include "SensorService.h"
namespace android {
// ---------------------------------------------------------------------------
@@ -74,14 +77,26 @@ void SensorService::onFirstRef()
}
}
- if (virtualSensorsNeeds & (1<<SENSOR_TYPE_GRAVITY)) {
- registerVirtualSensor( new GravitySensor(list, count) );
- }
- if (virtualSensorsNeeds & (1<<SENSOR_TYPE_LINEAR_ACCELERATION)) {
- registerVirtualSensor( new LinearAccelerationSensor(list, count) );
- }
- if (virtualSensorsNeeds & (1<<SENSOR_TYPE_ROTATION_VECTOR)) {
- registerVirtualSensor( new RotationVectorSensor(list, count) );
+ // it's safe to instantiate the SensorFusion object here
+ // (it wants to be instantiated after h/w sensors have been
+ // registered)
+ const SensorFusion& fusion(SensorFusion::getInstance());
+
+ // Always instantiate Android's virtual sensors. Since they are
+ // instantiated behind sensors from the HAL, they won't
+ // interfere with applications, unless they looks specifically
+ // for them (by name).
+
+ registerVirtualSensor( new RotationVectorSensor() );
+ registerVirtualSensor( new GravitySensor(list, count) );
+ registerVirtualSensor( new LinearAccelerationSensor(list, count) );
+
+ // if we have a gyro, we have the option of enabling these
+ // "better" orientation and gyro sensors
+ if (fusion.hasGyro()) {
+ // FIXME: OrientationSensor buggy when not pointing north
+ registerVirtualSensor( new OrientationSensor() );
+ registerVirtualSensor( new CorrectedGyroSensor(list, count) );
}
run("SensorService", PRIORITY_URGENT_DISPLAY);
@@ -133,7 +148,9 @@ status_t SensorService::dump(int fd, const Vector<String16>& args)
for (size_t i=0 ; i<mSensorList.size() ; i++) {
const Sensor& s(mSensorList[i]);
const sensors_event_t& e(mLastEventSeen.valueFor(s.getHandle()));
- snprintf(buffer, SIZE, "%-48s| %-32s | 0x%08x | maxRate=%7.2fHz | last=<%5.1f,%5.1f,%5.1f>\n",
+ snprintf(buffer, SIZE,
+ "%-48s| %-32s | 0x%08x | maxRate=%7.2fHz | "
+ "last=<%5.1f,%5.1f,%5.1f>\n",
s.getName().string(),
s.getVendor().string(),
s.getHandle(),
@@ -141,6 +158,7 @@ status_t SensorService::dump(int fd, const Vector<String16>& args)
e.data[0], e.data[1], e.data[2]);
result.append(buffer);
}
+ SensorFusion::getInstance().dump(result, buffer, SIZE);
SensorDevice::getInstance().dump(result, buffer, SIZE);
snprintf(buffer, SIZE, "%d active connections\n",
@@ -183,13 +201,19 @@ bool SensorService::threadLoop()
// handle virtual sensors
if (count && vcount) {
+ sensors_event_t const * const event = buffer;
const DefaultKeyedVector<int, SensorInterface*> virtualSensors(
getActiveVirtualSensors());
const size_t activeVirtualSensorCount = virtualSensors.size();
if (activeVirtualSensorCount) {
size_t k = 0;
+ SensorFusion& fusion(SensorFusion::getInstance());
+ if (fusion.isEnabled()) {
+ for (size_t i=0 ; i<size_t(count) ; i++) {
+ fusion.process(event[i]);
+ }
+ }
for (size_t i=0 ; i<size_t(count) ; i++) {
- sensors_event_t const * const event = buffer;
for (size_t j=0 ; j<activeVirtualSensorCount ; j++) {
sensors_event_t out;
if (virtualSensors.valueAt(j)->process(&out, event[i])) {
@@ -297,16 +321,25 @@ void SensorService::cleanupConnection(SensorEventConnection* c)
Mutex::Autolock _l(mLock);
const wp<SensorEventConnection> connection(c);
size_t size = mActiveSensors.size();
+ LOGD_IF(DEBUG_CONNECTIONS, "%d active sensors", size);
for (size_t i=0 ; i<size ; ) {
int handle = mActiveSensors.keyAt(i);
if (c->hasSensor(handle)) {
+ LOGD_IF(DEBUG_CONNECTIONS, "%i: disabling handle=0x%08x", i, handle);
SensorInterface* sensor = mSensorMap.valueFor( handle );
+ LOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle);
if (sensor) {
sensor->activate(c, false);
}
}
SensorRecord* rec = mActiveSensors.valueAt(i);
+ LOGE_IF(!rec, "mActiveSensors[%d] is null (handle=0x%08x)!", i, handle);
+ LOGD_IF(DEBUG_CONNECTIONS,
+ "removing connection %p for sensor[%d].handle=0x%08x",
+ c, i, handle);
+
if (rec && rec->removeConnection(connection)) {
+ LOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection");
mActiveSensors.removeItemsAt(i, 1);
mActiveVirtualSensors.removeItem(handle);
delete rec;
@@ -446,6 +479,7 @@ SensorService::SensorEventConnection::SensorEventConnection(
SensorService::SensorEventConnection::~SensorEventConnection()
{
+ LOGD_IF(DEBUG_CONNECTIONS, "~SensorEventConnection(%p)", this);
mService->cleanupConnection(this);
}
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index 21f12bd..77a7e34 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -38,6 +38,8 @@
// ---------------------------------------------------------------------------
+#define DEBUG_CONNECTIONS false
+
struct sensors_poll_device_t;
struct sensors_module_t;
diff --git a/services/sensorservice/mat.h b/services/sensorservice/mat.h
new file mode 100644
index 0000000..1302ca3
--- /dev/null
+++ b/services/sensorservice/mat.h
@@ -0,0 +1,370 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_MAT_H
+#define ANDROID_MAT_H
+
+#include "vec.h"
+#include "traits.h"
+
+// -----------------------------------------------------------------------
+
+namespace android {
+
+template <typename TYPE, size_t C, size_t R>
+class mat;
+
+namespace helpers {
+
+template <typename TYPE, size_t C, size_t R>
+mat<TYPE, C, R>& doAssign(
+ mat<TYPE, C, R>& lhs,
+ typename TypeTraits<TYPE>::ParameterType rhs) {
+ for (size_t i=0 ; i<C ; i++)
+ for (size_t j=0 ; j<R ; j++)
+ lhs[i][j] = (i==j) ? rhs : 0;
+ return lhs;
+}
+
+template <typename TYPE, size_t C, size_t R, size_t D>
+mat<TYPE, C, R> PURE doMul(
+ const mat<TYPE, D, R>& lhs,
+ const mat<TYPE, C, D>& rhs)
+{
+ mat<TYPE, C, R> res;
+ for (size_t c=0 ; c<C ; c++) {
+ for (size_t r=0 ; r<R ; r++) {
+ TYPE v(0);
+ for (size_t k=0 ; k<D ; k++) {
+ v += lhs[k][r] * rhs[c][k];
+ }
+ res[c][r] = v;
+ }
+ }
+ return res;
+}
+
+template <typename TYPE, size_t R, size_t D>
+vec<TYPE, R> PURE doMul(
+ const mat<TYPE, D, R>& lhs,
+ const vec<TYPE, D>& rhs)
+{
+ vec<TYPE, R> res;
+ for (size_t r=0 ; r<R ; r++) {
+ TYPE v(0);
+ for (size_t k=0 ; k<D ; k++) {
+ v += lhs[k][r] * rhs[k];
+ }
+ res[r] = v;
+ }
+ return res;
+}
+
+template <typename TYPE, size_t C, size_t R>
+mat<TYPE, C, R> PURE doMul(
+ const vec<TYPE, R>& lhs,
+ const mat<TYPE, C, 1>& rhs)
+{
+ mat<TYPE, C, R> res;
+ for (size_t c=0 ; c<C ; c++) {
+ for (size_t r=0 ; r<R ; r++) {
+ res[c][r] = lhs[r] * rhs[c][0];
+ }
+ }
+ return res;
+}
+
+template <typename TYPE, size_t C, size_t R>
+mat<TYPE, C, R> PURE doMul(
+ const mat<TYPE, C, R>& rhs,
+ typename TypeTraits<TYPE>::ParameterType v)
+{
+ mat<TYPE, C, R> res;
+ for (size_t c=0 ; c<C ; c++) {
+ for (size_t r=0 ; r<R ; r++) {
+ res[c][r] = rhs[c][r] * v;
+ }
+ }
+ return res;
+}
+
+template <typename TYPE, size_t C, size_t R>
+mat<TYPE, C, R> PURE doMul(
+ typename TypeTraits<TYPE>::ParameterType v,
+ const mat<TYPE, C, R>& rhs)
+{
+ mat<TYPE, C, R> res;
+ for (size_t c=0 ; c<C ; c++) {
+ for (size_t r=0 ; r<R ; r++) {
+ res[c][r] = v * rhs[c][r];
+ }
+ }
+ return res;
+}
+
+
+}; // namespace helpers
+
+// -----------------------------------------------------------------------
+
+template <typename TYPE, size_t C, size_t R>
+class mat : public vec< vec<TYPE, R>, C > {
+ typedef typename TypeTraits<TYPE>::ParameterType pTYPE;
+ typedef vec< vec<TYPE, R>, C > base;
+public:
+ // STL-like interface.
+ typedef TYPE value_type;
+ typedef TYPE& reference;
+ typedef TYPE const& const_reference;
+ typedef size_t size_type;
+ size_type size() const { return R*C; }
+ enum { ROWS = R, COLS = C };
+
+
+ // -----------------------------------------------------------------------
+ // default constructors
+
+ mat() { }
+ mat(const mat& rhs) : base(rhs) { }
+ mat(const base& rhs) : base(rhs) { }
+
+ // -----------------------------------------------------------------------
+ // conversion constructors
+
+ // sets the diagonal to the value, off-diagonal to zero
+ mat(pTYPE rhs) {
+ helpers::doAssign(*this, rhs);
+ }
+
+ // -----------------------------------------------------------------------
+ // Assignment
+
+ mat& operator=(const mat& rhs) {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ mat& operator=(const base& rhs) {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ mat& operator=(pTYPE rhs) {
+ return helpers::doAssign(*this, rhs);
+ }
+
+ // -----------------------------------------------------------------------
+ // non-member function declaration and definition
+
+ friend inline mat PURE operator + (const mat& lhs, const mat& rhs) {
+ return helpers::doAdd(
+ static_cast<const base&>(lhs),
+ static_cast<const base&>(rhs));
+ }
+ friend inline mat PURE operator - (const mat& lhs, const mat& rhs) {
+ return helpers::doSub(
+ static_cast<const base&>(lhs),
+ static_cast<const base&>(rhs));
+ }
+
+ // matrix*matrix
+ template <size_t D>
+ friend mat PURE operator * (
+ const mat<TYPE, D, R>& lhs,
+ const mat<TYPE, C, D>& rhs) {
+ return helpers::doMul(lhs, rhs);
+ }
+
+ // matrix*vector
+ friend vec<TYPE, R> PURE operator * (
+ const mat& lhs, const vec<TYPE, C>& rhs) {
+ return helpers::doMul(lhs, rhs);
+ }
+
+ // vector*matrix
+ friend mat PURE operator * (
+ const vec<TYPE, R>& lhs, const mat<TYPE, C, 1>& rhs) {
+ return helpers::doMul(lhs, rhs);
+ }
+
+ // matrix*scalar
+ friend inline mat PURE operator * (const mat& lhs, pTYPE v) {
+ return helpers::doMul(lhs, v);
+ }
+
+ // scalar*matrix
+ friend inline mat PURE operator * (pTYPE v, const mat& rhs) {
+ return helpers::doMul(v, rhs);
+ }
+
+ // -----------------------------------------------------------------------
+ // streaming operator to set the columns of the matrix:
+ // example:
+ // mat33_t m;
+ // m << v0 << v1 << v2;
+
+ // column_builder<> stores the matrix and knows which column to set
+ template<size_t PREV_COLUMN>
+ struct column_builder {
+ mat& matrix;
+ column_builder(mat& matrix) : matrix(matrix) { }
+ };
+
+ // operator << is not a method of column_builder<> so we can
+ // overload it for unauthorized values (partial specialization
+ // not allowed in class-scope).
+ // we just set the column and return the next column_builder<>
+ template<size_t PREV_COLUMN>
+ friend column_builder<PREV_COLUMN+1> operator << (
+ const column_builder<PREV_COLUMN>& lhs,
+ const vec<TYPE, R>& rhs) {
+ lhs.matrix[PREV_COLUMN+1] = rhs;
+ return column_builder<PREV_COLUMN+1>(lhs.matrix);
+ }
+
+ // we return void here so we get a compile-time error if the
+ // user tries to set too many columns
+ friend void operator << (
+ const column_builder<C-2>& lhs,
+ const vec<TYPE, R>& rhs) {
+ lhs.matrix[C-1] = rhs;
+ }
+
+ // this is where the process starts. we set the first columns and
+ // return the next column_builder<>
+ column_builder<0> operator << (const vec<TYPE, R>& rhs) {
+ (*this)[0] = rhs;
+ return column_builder<0>(*this);
+ }
+};
+
+// Specialize column matrix so they're exactly equivalent to a vector
+template <typename TYPE, size_t R>
+class mat<TYPE, 1, R> : public vec<TYPE, R> {
+ typedef vec<TYPE, R> base;
+public:
+ // STL-like interface.
+ typedef TYPE value_type;
+ typedef TYPE& reference;
+ typedef TYPE const& const_reference;
+ typedef size_t size_type;
+ size_type size() const { return R; }
+ enum { ROWS = R, COLS = 1 };
+
+ mat() { }
+ mat(const base& rhs) : base(rhs) { }
+ mat(const mat& rhs) : base(rhs) { }
+ mat(const TYPE& rhs) { helpers::doAssign(*this, rhs); }
+ mat& operator=(const mat& rhs) { base::operator=(rhs); return *this; }
+ mat& operator=(const base& rhs) { base::operator=(rhs); return *this; }
+ mat& operator=(const TYPE& rhs) { return helpers::doAssign(*this, rhs); }
+ // we only have one column, so ignore the index
+ const base& operator[](size_t) const { return *this; }
+ base& operator[](size_t) { return *this; }
+ void operator << (const vec<TYPE, R>& rhs) { base::operator[](0) = rhs; }
+};
+
+// -----------------------------------------------------------------------
+// matrix functions
+
+// transpose. this handles matrices of matrices
+inline int PURE transpose(int v) { return v; }
+inline float PURE transpose(float v) { return v; }
+inline double PURE transpose(double v) { return v; }
+
+// Transpose a matrix
+template <typename TYPE, size_t C, size_t R>
+mat<TYPE, R, C> PURE transpose(const mat<TYPE, C, R>& m) {
+ mat<TYPE, R, C> r;
+ for (size_t i=0 ; i<R ; i++)
+ for (size_t j=0 ; j<C ; j++)
+ r[i][j] = transpose(m[j][i]);
+ return r;
+}
+
+// Transpose a vector
+template <
+ template<typename T, size_t S> class VEC,
+ typename TYPE,
+ size_t SIZE
+>
+mat<TYPE, SIZE, 1> PURE transpose(const VEC<TYPE, SIZE>& v) {
+ mat<TYPE, SIZE, 1> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i][0] = transpose(v[i]);
+ return r;
+}
+
+// -----------------------------------------------------------------------
+// "dumb" matrix inversion
+template<typename T, size_t N>
+mat<T, N, N> PURE invert(const mat<T, N, N>& src) {
+ T t;
+ size_t swap;
+ mat<T, N, N> tmp(src);
+ mat<T, N, N> inverse(1);
+
+ for (size_t i=0 ; i<N ; i++) {
+ // look for largest element in column
+ swap = i;
+ for (size_t j=i+1 ; j<N ; j++) {
+ if (fabs(tmp[j][i]) > fabs(tmp[i][i])) {
+ swap = j;
+ }
+ }
+
+ if (swap != i) {
+ /* swap rows. */
+ for (size_t k=0 ; k<N ; k++) {
+ t = tmp[i][k];
+ tmp[i][k] = tmp[swap][k];
+ tmp[swap][k] = t;
+
+ t = inverse[i][k];
+ inverse[i][k] = inverse[swap][k];
+ inverse[swap][k] = t;
+ }
+ }
+
+ t = 1 / tmp[i][i];
+ for (size_t k=0 ; k<N ; k++) {
+ tmp[i][k] *= t;
+ inverse[i][k] *= t;
+ }
+ for (size_t j=0 ; j<N ; j++) {
+ if (j != i) {
+ t = tmp[j][i];
+ for (size_t k=0 ; k<N ; k++) {
+ tmp[j][k] -= tmp[i][k] * t;
+ inverse[j][k] -= inverse[i][k] * t;
+ }
+ }
+ }
+ }
+ return inverse;
+}
+
+// -----------------------------------------------------------------------
+
+typedef mat<float, 2, 2> mat22_t;
+typedef mat<float, 3, 3> mat33_t;
+typedef mat<float, 4, 4> mat44_t;
+
+// -----------------------------------------------------------------------
+
+}; // namespace android
+
+#endif /* ANDROID_MAT_H */
diff --git a/services/sensorservice/traits.h b/services/sensorservice/traits.h
new file mode 100644
index 0000000..da4c599
--- /dev/null
+++ b/services/sensorservice/traits.h
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_TRAITS_H
+#define ANDROID_TRAITS_H
+
+// -----------------------------------------------------------------------
+// Typelists
+
+namespace android {
+
+// end-of-list marker
+class NullType {};
+
+// type-list node
+template <typename T, typename U>
+struct TypeList {
+ typedef T Head;
+ typedef U Tail;
+};
+
+// helpers to build typelists
+#define TYPELIST_1(T1) TypeList<T1, NullType>
+#define TYPELIST_2(T1, T2) TypeList<T1, TYPELIST_1(T2)>
+#define TYPELIST_3(T1, T2, T3) TypeList<T1, TYPELIST_2(T2, T3)>
+#define TYPELIST_4(T1, T2, T3, T4) TypeList<T1, TYPELIST_3(T2, T3, T4)>
+
+// typelists algorithms
+namespace TL {
+template <typename TList, typename T> struct IndexOf;
+
+template <typename T>
+struct IndexOf<NullType, T> {
+ enum { value = -1 };
+};
+
+template <typename T, typename Tail>
+struct IndexOf<TypeList<T, Tail>, T> {
+ enum { value = 0 };
+};
+
+template <typename Head, typename Tail, typename T>
+struct IndexOf<TypeList<Head, Tail>, T> {
+private:
+ enum { temp = IndexOf<Tail, T>::value };
+public:
+ enum { value = temp == -1 ? -1 : 1 + temp };
+};
+
+}; // namespace TL
+
+// type selection based on a boolean
+template <bool flag, typename T, typename U>
+struct Select {
+ typedef T Result;
+};
+template <typename T, typename U>
+struct Select<false, T, U> {
+ typedef U Result;
+};
+
+// -----------------------------------------------------------------------
+// Type traits
+
+template <typename T>
+class TypeTraits {
+ typedef TYPELIST_4(
+ unsigned char, unsigned short,
+ unsigned int, unsigned long int) UnsignedInts;
+
+ typedef TYPELIST_4(
+ signed char, signed short,
+ signed int, signed long int) SignedInts;
+
+ typedef TYPELIST_1(
+ bool) OtherInts;
+
+ typedef TYPELIST_3(
+ float, double, long double) Floats;
+
+ template<typename U> struct PointerTraits {
+ enum { result = false };
+ typedef NullType PointeeType;
+ };
+ template<typename U> struct PointerTraits<U*> {
+ enum { result = true };
+ typedef U PointeeType;
+ };
+
+public:
+ enum { isStdUnsignedInt = TL::IndexOf<UnsignedInts, T>::value >= 0 };
+ enum { isStdSignedInt = TL::IndexOf<SignedInts, T>::value >= 0 };
+ enum { isStdIntegral = TL::IndexOf<OtherInts, T>::value >= 0 || isStdUnsignedInt || isStdSignedInt };
+ enum { isStdFloat = TL::IndexOf<Floats, T>::value >= 0 };
+ enum { isPointer = PointerTraits<T>::result };
+ enum { isStdArith = isStdIntegral || isStdFloat };
+
+ // best parameter type for given type
+ typedef typename Select<isStdArith || isPointer, T, const T&>::Result ParameterType;
+};
+
+// -----------------------------------------------------------------------
+}; // namespace android
+
+#endif /* ANDROID_TRAITS_H */
diff --git a/services/sensorservice/vec.h b/services/sensorservice/vec.h
new file mode 100644
index 0000000..736ff37
--- /dev/null
+++ b/services/sensorservice/vec.h
@@ -0,0 +1,420 @@
+/*
+ * 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.
+ */
+
+#ifndef ANDROID_VEC_H
+#define ANDROID_VEC_H
+
+#include <math.h>
+
+#include <stdint.h>
+#include <stddef.h>
+
+#include "traits.h"
+
+// -----------------------------------------------------------------------
+
+#define PURE __attribute__((pure))
+
+namespace android {
+
+// -----------------------------------------------------------------------
+// non-inline helpers
+
+template <typename TYPE, size_t SIZE>
+class vec;
+
+template <typename TYPE, size_t SIZE>
+class vbase;
+
+namespace helpers {
+
+template <typename T> inline T min(T a, T b) { return a<b ? a : b; }
+template <typename T> inline T max(T a, T b) { return a>b ? a : b; }
+
+template < template<typename T, size_t S> class VEC,
+ typename TYPE, size_t SIZE, size_t S>
+vec<TYPE, SIZE>& doAssign(
+ vec<TYPE, SIZE>& lhs, const VEC<TYPE, S>& rhs) {
+ const size_t minSize = min(SIZE, S);
+ const size_t maxSize = max(SIZE, S);
+ for (size_t i=0 ; i<minSize ; i++)
+ lhs[i] = rhs[i];
+ for (size_t i=minSize ; i<maxSize ; i++)
+ lhs[i] = 0;
+ return lhs;
+}
+
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE,
+ size_t SIZE
+>
+VLHS<TYPE, SIZE> PURE doAdd(
+ const VLHS<TYPE, SIZE>& lhs,
+ const VRHS<TYPE, SIZE>& rhs) {
+ VLHS<TYPE, SIZE> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i] = lhs[i] + rhs[i];
+ return r;
+}
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE,
+ size_t SIZE
+>
+VLHS<TYPE, SIZE> PURE doSub(
+ const VLHS<TYPE, SIZE>& lhs,
+ const VRHS<TYPE, SIZE>& rhs) {
+ VLHS<TYPE, SIZE> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i] = lhs[i] - rhs[i];
+ return r;
+}
+
+template <
+ template<typename T, size_t S> class VEC,
+ typename TYPE,
+ size_t SIZE
+>
+VEC<TYPE, SIZE> PURE doMulScalar(
+ const VEC<TYPE, SIZE>& lhs,
+ typename TypeTraits<TYPE>::ParameterType rhs) {
+ VEC<TYPE, SIZE> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i] = lhs[i] * rhs;
+ return r;
+}
+
+template <
+ template<typename T, size_t S> class VEC,
+ typename TYPE,
+ size_t SIZE
+>
+VEC<TYPE, SIZE> PURE doScalarMul(
+ typename TypeTraits<TYPE>::ParameterType lhs,
+ const VEC<TYPE, SIZE>& rhs) {
+ VEC<TYPE, SIZE> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i] = lhs * rhs[i];
+ return r;
+}
+
+}; // namespace helpers
+
+// -----------------------------------------------------------------------
+// Below we define the mathematical operators for vectors.
+// We use template template arguments so we can generically
+// handle the case where the right-hand-size and left-hand-side are
+// different vector types (but with same value_type and size).
+// This is needed for performance when using ".xy{z}" element access
+// on vec<>. Without this, an extra conversion to vec<> would be needed.
+//
+// example:
+// vec4_t a;
+// vec3_t b;
+// vec3_t c = a.xyz + b;
+//
+// "a.xyz + b" is a mixed-operation between a vbase<> and a vec<>, requiring
+// a conversion of vbase<> to vec<>. The template gunk below avoids this,
+// by allowing the addition on these different vector types directly
+//
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE,
+ size_t SIZE
+>
+inline VLHS<TYPE, SIZE> PURE operator + (
+ const VLHS<TYPE, SIZE>& lhs,
+ const VRHS<TYPE, SIZE>& rhs) {
+ return helpers::doAdd(lhs, rhs);
+}
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE,
+ size_t SIZE
+>
+inline VLHS<TYPE, SIZE> PURE operator - (
+ const VLHS<TYPE, SIZE>& lhs,
+ const VRHS<TYPE, SIZE>& rhs) {
+ return helpers::doSub(lhs, rhs);
+}
+
+template <
+ template<typename T, size_t S> class VEC,
+ typename TYPE,
+ size_t SIZE
+>
+inline VEC<TYPE, SIZE> PURE operator * (
+ const VEC<TYPE, SIZE>& lhs,
+ typename TypeTraits<TYPE>::ParameterType rhs) {
+ return helpers::doMulScalar(lhs, rhs);
+}
+
+template <
+ template<typename T, size_t S> class VEC,
+ typename TYPE,
+ size_t SIZE
+>
+inline VEC<TYPE, SIZE> PURE operator * (
+ typename TypeTraits<TYPE>::ParameterType lhs,
+ const VEC<TYPE, SIZE>& rhs) {
+ return helpers::doScalarMul(lhs, rhs);
+}
+
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE,
+ size_t SIZE
+>
+TYPE PURE dot_product(
+ const VLHS<TYPE, SIZE>& lhs,
+ const VRHS<TYPE, SIZE>& rhs) {
+ TYPE r(0);
+ for (size_t i=0 ; i<SIZE ; i++)
+ r += lhs[i] * rhs[i];
+ return r;
+}
+
+template <
+ template<typename T, size_t S> class V,
+ typename TYPE,
+ size_t SIZE
+>
+TYPE PURE length(const V<TYPE, SIZE>& v) {
+ return sqrt(dot_product(v, v));
+}
+
+template <
+ template<typename T, size_t S> class VLHS,
+ template<typename T, size_t S> class VRHS,
+ typename TYPE
+>
+VLHS<TYPE, 3> PURE cross_product(
+ const VLHS<TYPE, 3>& u,
+ const VRHS<TYPE, 3>& v) {
+ VLHS<TYPE, 3> r;
+ r.x = u.y*v.z - u.z*v.y;
+ r.y = u.z*v.x - u.x*v.z;
+ r.z = u.x*v.y - u.y*v.x;
+ return r;
+}
+
+
+template <typename TYPE, size_t SIZE>
+vec<TYPE, SIZE> PURE operator - (const vec<TYPE, SIZE>& lhs) {
+ vec<TYPE, SIZE> r;
+ for (size_t i=0 ; i<SIZE ; i++)
+ r[i] = -lhs[i];
+ return r;
+}
+
+// -----------------------------------------------------------------------
+
+// This our basic vector type, it just implements the data storage
+// and accessors.
+
+template <typename TYPE, size_t SIZE>
+struct vbase {
+ TYPE v[SIZE];
+ inline const TYPE& operator[](size_t i) const { return v[i]; }
+ inline TYPE& operator[](size_t i) { return v[i]; }
+};
+template<> struct vbase<float, 2> {
+ union {
+ float v[2];
+ struct { float x, y; };
+ struct { float s, t; };
+ };
+ inline const float& operator[](size_t i) const { return v[i]; }
+ inline float& operator[](size_t i) { return v[i]; }
+};
+template<> struct vbase<float, 3> {
+ union {
+ float v[3];
+ struct { float x, y, z; };
+ struct { float s, t, r; };
+ vbase<float, 2> xy;
+ vbase<float, 2> st;
+ };
+ inline const float& operator[](size_t i) const { return v[i]; }
+ inline float& operator[](size_t i) { return v[i]; }
+};
+template<> struct vbase<float, 4> {
+ union {
+ float v[4];
+ struct { float x, y, z, w; };
+ struct { float s, t, r, q; };
+ vbase<float, 3> xyz;
+ vbase<float, 3> str;
+ vbase<float, 2> xy;
+ vbase<float, 2> st;
+ };
+ inline const float& operator[](size_t i) const { return v[i]; }
+ inline float& operator[](size_t i) { return v[i]; }
+};
+
+// -----------------------------------------------------------------------
+
+template <typename TYPE, size_t SIZE>
+class vec : public vbase<TYPE, SIZE>
+{
+ typedef typename TypeTraits<TYPE>::ParameterType pTYPE;
+ typedef vbase<TYPE, SIZE> base;
+
+public:
+ // STL-like interface.
+ typedef TYPE value_type;
+ typedef TYPE& reference;
+ typedef TYPE const& const_reference;
+ typedef size_t size_type;
+
+ typedef TYPE* iterator;
+ typedef TYPE const* const_iterator;
+ iterator begin() { return base::v; }
+ iterator end() { return base::v + SIZE; }
+ const_iterator begin() const { return base::v; }
+ const_iterator end() const { return base::v + SIZE; }
+ size_type size() const { return SIZE; }
+
+ // -----------------------------------------------------------------------
+ // default constructors
+
+ vec() { }
+ vec(const vec& rhs) : base(rhs) { }
+ vec(const base& rhs) : base(rhs) { }
+
+ // -----------------------------------------------------------------------
+ // conversion constructors
+
+ vec(pTYPE rhs) {
+ for (size_t i=0 ; i<SIZE ; i++)
+ base::operator[](i) = rhs;
+ }
+
+ template < template<typename T, size_t S> class VEC, size_t S>
+ explicit vec(const VEC<TYPE, S>& rhs) {
+ helpers::doAssign(*this, rhs);
+ }
+
+ explicit vec(TYPE const* array) {
+ for (size_t i=0 ; i<SIZE ; i++)
+ base::operator[](i) = array[i];
+ }
+
+ // -----------------------------------------------------------------------
+ // Assignment
+
+ vec& operator = (const vec& rhs) {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ vec& operator = (const base& rhs) {
+ base::operator=(rhs);
+ return *this;
+ }
+
+ vec& operator = (pTYPE rhs) {
+ for (size_t i=0 ; i<SIZE ; i++)
+ base::operator[](i) = rhs;
+ return *this;
+ }
+
+ template < template<typename T, size_t S> class VEC, size_t S>
+ vec& operator = (const VEC<TYPE, S>& rhs) {
+ return helpers::doAssign(*this, rhs);
+ }
+
+ // -----------------------------------------------------------------------
+ // operation-assignment
+
+ vec& operator += (const vec& rhs);
+ vec& operator -= (const vec& rhs);
+ vec& operator *= (pTYPE rhs);
+
+ // -----------------------------------------------------------------------
+ // non-member function declaration and definition
+ // NOTE: we declare the non-member function as friend inside the class
+ // so that they are known to the compiler when the class is instantiated.
+ // This helps the compiler doing template argument deduction when the
+ // passed types are not identical. Essentially this helps with
+ // type conversion so that you can multiply a vec<float> by an scalar int
+ // (for instance).
+
+ friend inline vec PURE operator + (const vec& lhs, const vec& rhs) {
+ return helpers::doAdd(lhs, rhs);
+ }
+ friend inline vec PURE operator - (const vec& lhs, const vec& rhs) {
+ return helpers::doSub(lhs, rhs);
+ }
+ friend inline vec PURE operator * (const vec& lhs, pTYPE v) {
+ return helpers::doMulScalar(lhs, v);
+ }
+ friend inline vec PURE operator * (pTYPE v, const vec& rhs) {
+ return helpers::doScalarMul(v, rhs);
+ }
+ friend inline TYPE PURE dot_product(const vec& lhs, const vec& rhs) {
+ return android::dot_product(lhs, rhs);
+ }
+};
+
+// -----------------------------------------------------------------------
+
+template <typename TYPE, size_t SIZE>
+vec<TYPE, SIZE>& vec<TYPE, SIZE>::operator += (const vec<TYPE, SIZE>& rhs) {
+ vec<TYPE, SIZE>& lhs(*this);
+ for (size_t i=0 ; i<SIZE ; i++)
+ lhs[i] += rhs[i];
+ return lhs;
+}
+
+template <typename TYPE, size_t SIZE>
+vec<TYPE, SIZE>& vec<TYPE, SIZE>::operator -= (const vec<TYPE, SIZE>& rhs) {
+ vec<TYPE, SIZE>& lhs(*this);
+ for (size_t i=0 ; i<SIZE ; i++)
+ lhs[i] -= rhs[i];
+ return lhs;
+}
+
+template <typename TYPE, size_t SIZE>
+vec<TYPE, SIZE>& vec<TYPE, SIZE>::operator *= (vec<TYPE, SIZE>::pTYPE rhs) {
+ vec<TYPE, SIZE>& lhs(*this);
+ for (size_t i=0 ; i<SIZE ; i++)
+ lhs[i] *= rhs;
+ return lhs;
+}
+
+// -----------------------------------------------------------------------
+
+typedef vec<float, 2> vec2_t;
+typedef vec<float, 3> vec3_t;
+typedef vec<float, 4> vec4_t;
+
+// -----------------------------------------------------------------------
+
+}; // namespace android
+
+#endif /* ANDROID_VEC_H */
diff --git a/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
index 2bc6825..302a2d6 100644
--- a/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/AccessibilityManagerServiceTest.java
@@ -150,7 +150,8 @@ public class AccessibilityManagerServiceTest extends AndroidTestCase {
String secondMockServiceClassName = MySecondMockAccessibilityService.class.getName();
// look for the two mock services
- for (ServiceInfo serviceInfo : mManagerService.getAccessibilityServiceList()) {
+ for (AccessibilityServiceInfo info : mManagerService.getInstalledAccessibilityServiceList()) {
+ ServiceInfo serviceInfo = info.getResolveInfo().serviceInfo;
if (packageName.equals(serviceInfo.packageName)) {
if (firstMockServiceClassName.equals(serviceInfo.name)) {
firstMockServiceInstalled = true;
diff --git a/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java b/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
index 38fed22..1463d30 100644
--- a/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/AccessibilityManagerTest.java
@@ -25,6 +25,7 @@ import static org.easymock.EasyMock.verify;
import org.easymock.IArgumentMatcher;
+import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ServiceInfo;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.LargeTest;
@@ -62,20 +63,22 @@ public class AccessibilityManagerTest extends AndroidTestCase {
@MediumTest
public void testGetAccessibilityServiceList() throws Exception {
// create a list of installed accessibility services the mock service returns
- List<ServiceInfo> expectedServices = new ArrayList<ServiceInfo>();
- ServiceInfo serviceInfo = new ServiceInfo();
- serviceInfo.name = "TestServiceInfoName";
- expectedServices.add(serviceInfo);
+ List<AccessibilityServiceInfo> expectedServices = new ArrayList<AccessibilityServiceInfo>();
+ AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
+ accessibilityServiceInfo.packageNames = new String[] { "foo.bar" };
+ expectedServices.add(accessibilityServiceInfo);
// configure the mock service behavior
IAccessibilityManager mockServiceInterface = mMockServiceInterface;
expect(mockServiceInterface.addClient(anyIAccessibilityManagerClient())).andReturn(true);
- expect(mockServiceInterface.getAccessibilityServiceList()).andReturn(expectedServices);
+ expect(mockServiceInterface.getInstalledAccessibilityServiceList()).andReturn(
+ expectedServices);
replay(mockServiceInterface);
// invoke the method under test
AccessibilityManager manager = new AccessibilityManager(mContext, mockServiceInterface);
- List<ServiceInfo> receivedServices = manager.getAccessibilityServiceList();
+ List<AccessibilityServiceInfo> receivedServices =
+ manager.getInstalledAccessibilityServiceList();
// check expected result (list equals() compares it contents as well)
assertEquals("All expected services must be returned", receivedServices, expectedServices);
diff --git a/tests/RenderScriptTests/ModelViewer/AndroidManifest.xml b/tests/RenderScriptTests/ModelViewer/AndroidManifest.xml
index e5e449b..57ec4fe 100644
--- a/tests/RenderScriptTests/ModelViewer/AndroidManifest.xml
+++ b/tests/RenderScriptTests/ModelViewer/AndroidManifest.xml
@@ -3,7 +3,8 @@
package="com.android.modelviewer">
<application android:label="ModelViewer">
<activity android:name="SimpleModel"
- android:label="SimpleModel">
+ android:label="SimpleModel"
+ android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/tests/RenderScriptTests/ModelViewer/res/menu/loader_menu.xml b/tests/RenderScriptTests/ModelViewer/res/menu/loader_menu.xml
index 3c34023..2a8759c 100644
--- a/tests/RenderScriptTests/ModelViewer/res/menu/loader_menu.xml
+++ b/tests/RenderScriptTests/ModelViewer/res/menu/loader_menu.xml
@@ -22,4 +22,6 @@
android:title="@string/load_model" />
<item android:id="@+id/display_options"
android:title="@string/display_options" />
+ <item android:id="@+id/sensor"
+ android:title="@string/sensor" />
</menu>
diff --git a/tests/RenderScriptTests/ModelViewer/res/values/strings.xml b/tests/RenderScriptTests/ModelViewer/res/values/strings.xml
index 8e1673f..a5c8f22 100644
--- a/tests/RenderScriptTests/ModelViewer/res/values/strings.xml
+++ b/tests/RenderScriptTests/ModelViewer/res/values/strings.xml
@@ -21,4 +21,5 @@
<skip />
<string name="load_model">Load Model</string>
<string name="display_options">Display Options</string>
+ <string name="sensor">Toggle Sensor</string>
</resources>
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModel.java b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModel.java
index 00e8a5e..2b29ff4 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModel.java
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModel.java
@@ -85,6 +85,9 @@ public class SimpleModel extends Activity {
return true;
case R.id.display_options:
return true;
+ case R.id.sensor:
+ mView.toggleSensor();
+ return true;
default:
return super.onOptionsItemSelected(item);
}
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java
index 63ef466..5fa3a9e 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelRS.java
@@ -70,6 +70,10 @@ public class SimpleModelRS {
mScript.invoke_onActionMove(x, y);
}
+ public void onPostureChanged(Matrix4f posture) {
+ mScript.set_gPostureMatrix(posture);
+ }
+
private void initPFS() {
ProgramStore.Builder b = new ProgramStore.Builder(mRS);
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelView.java b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelView.java
index 9ab0f22..4b7836b 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelView.java
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/SimpleModelView.java
@@ -16,29 +16,46 @@
package com.android.modelviewer;
+import android.renderscript.Matrix4f;
import android.renderscript.RSSurfaceView;
import android.renderscript.RenderScriptGL;
import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.ScaleGestureDetector;
import android.util.Log;
-public class SimpleModelView extends RSSurfaceView {
+public class SimpleModelView extends RSSurfaceView implements SensorEventListener {
private RenderScriptGL mRS;
private SimpleModelRS mRender;
private ScaleGestureDetector mScaleDetector;
+ private SensorManager mSensorManager;
+ private Sensor mRotationVectorSensor;
+ private final float[] mRotationMatrix = new float[16];
+
private static final int INVALID_POINTER_ID = -1;
private int mActivePointerId = INVALID_POINTER_ID;
+ private boolean mUseSensor = false;
+ private Matrix4f mIdentityMatrix = new Matrix4f();
public SimpleModelView(Context context) {
super(context);
ensureRenderScript();
mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
+ // Get an instance of the SensorManager
+ mSensorManager = (SensorManager)getContext().getSystemService(Context.SENSOR_SERVICE);
+ // find the rotation-vector sensor
+ mRotationVectorSensor = mSensorManager.getDefaultSensor(
+ Sensor.TYPE_ROTATION_VECTOR);
+ mIdentityMatrix.loadIdentity();
}
private void ensureRenderScript() {
@@ -52,6 +69,16 @@ public class SimpleModelView extends RSSurfaceView {
}
@Override
+ public void resume() {
+ mSensorManager.registerListener(this, mRotationVectorSensor, 10000);
+ }
+
+ @Override
+ public void pause() {
+ mSensorManager.unregisterListener(this);
+ }
+
+ @Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
ensureRenderScript();
@@ -139,6 +166,32 @@ public class SimpleModelView extends RSSurfaceView {
return true;
}
}
-}
+ public void onSensorChanged(SensorEvent event) {
+ // we received a sensor event. it is a good practice to check
+ // that we received the proper event
+ if (mUseSensor) {
+ if (event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
+ // convert the rotation-vector to a 4x4 matrix. the matrix
+ // is interpreted by Open GL as the inverse of the
+ // rotation-vector, which is what we want.
+ SensorManager.getRotationMatrixFromVector(
+ mRotationMatrix , event.values);
+
+ if (mRender != null) {
+ mRender.onPostureChanged(new Matrix4f(mRotationMatrix));
+ }
+ }
+ }
+ }
+
+ public void onAccuracyChanged(Sensor sensor, int accuracy) {
+ }
+ public void toggleSensor() {
+ mUseSensor = !mUseSensor;
+ if (mUseSensor == false) {
+ mRender.onPostureChanged(mIdentityMatrix);
+ }
+ }
+}
diff --git a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs
index 809f02c..8cec409 100644
--- a/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs
+++ b/tests/RenderScriptTests/ModelViewer/src/com/android/modelviewer/simplemodel.rs
@@ -28,6 +28,8 @@ rs_program_store gPFSBackground;
rs_font gItalic;
rs_allocation gTextAlloc;
+rs_matrix4x4 gPostureMatrix;
+
typedef struct MeshInfo {
rs_mesh mMesh;
int mNumIndexSets;
@@ -89,6 +91,7 @@ void init() {
gRotateY = 0.0f;
gZoom = 50.0f;
gLookAt = 0.0f;
+ rsMatrixLoadIdentity(&gPostureMatrix);
}
void updateMeshInfo() {
@@ -149,8 +152,10 @@ int root(void) {
rsMatrixLoadIdentity(&matrix);
// Position our models on the screen
rsMatrixTranslate(&matrix, gLookAt.x, gLookAt.y, gLookAt.z - gZoom);
+ rsMatrixMultiply(&matrix, &gPostureMatrix);
rsMatrixRotate(&matrix, gRotateX, 1.0f, 0.0f, 0.0f);
rsMatrixRotate(&matrix, gRotateY, 0.0f, 1.0f, 0.0f);
+
rsgProgramVertexLoadModelMatrix(&matrix);
renderAllMeshes();