diff options
| -rw-r--r-- | CleanSpec.mk | 3 | ||||
| -rw-r--r-- | api/current.txt | 3 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 5 | ||||
| -rw-r--r-- | core/java/android/content/Context.java | 20 | ||||
| -rw-r--r-- | core/java/android/hardware/display/DisplayViewport.java | 8 | ||||
| -rw-r--r-- | core/java/android/os/Process.java | 3 | ||||
| -rw-r--r-- | core/java/android/view/KeyEvent.java | 6 | ||||
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 2 | ||||
| -rw-r--r-- | core/java/com/android/internal/policy/PhoneWindow.java | 4 | ||||
| -rw-r--r-- | core/jni/android_hardware_display_DisplayViewport.cpp | 13 | ||||
| -rw-r--r-- | core/jni/android_os_Debug.cpp | 6 | ||||
| -rw-r--r-- | core/jni/android_os_Debug.h | 7 | ||||
| -rw-r--r-- | core/jni/android_util_Process.cpp | 34 | ||||
| -rw-r--r-- | media/java/android/media/AudioManager.java | 1 | ||||
| -rw-r--r-- | media/java/android/media/RemoteController.java | 4 | ||||
| -rw-r--r-- | media/java/android/media/session/MediaController.java | 2 | ||||
| -rw-r--r-- | media/java/android/media/tv/TvInputService.java | 4 | ||||
| -rw-r--r-- | packages/CarSystemUI/src/com/android/systemui/statusbar/car/AssitantButton.java | 72 | ||||
| -rw-r--r-- | packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java | 204 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarDefaultOverlay/Android.mk | 30 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarDefaultOverlay/AndroidManifest.xml | 27 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/config.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-as/strings.xml) | 17 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gu/strings.xml) | 15 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarFloatingOverlay/AndroidManifest.xml | 2 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarFloatingOverlay/res/values/config.xml | 4 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/Android.mk (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/Android.mk) | 4 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/AndroidManifest.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/AndroidManifest.xml) | 4 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-af/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-af/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-am/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-am/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ar/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ar/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-az/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-az/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-b+sr+Latn/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-b+sr+Latn/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-be/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-be/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bg/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bg/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bs/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bs/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ca/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ca/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-cs/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-cs/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-da/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-da/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-de/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-de/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-el/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-el/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rAU/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rAU/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rCA/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rCA/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rGB/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rGB/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rIN/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rIN/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rXC/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rXC/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es-rUS/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es-rUS/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-et/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-et/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-eu/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-eu/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fa/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fa/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fi/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fi/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr-rCA/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr-rCA/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-gl/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gl/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hi/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hi/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hr/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hr/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hu/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hu/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hy/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hy/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-in/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-in/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-is/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-is/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-it/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-it/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-iw/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-iw/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ja/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ja/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ka/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ka/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-kk/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kk/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-km/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-km/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ko/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ko/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ky/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ky/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lo/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lo/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lt/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lt/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lv/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lv/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mk/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mk/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mn/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mn/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mr/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mr/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ms/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ms/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-my/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-my/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nb/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nb/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nl/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nl/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pl/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pl/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rBR/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rBR/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rPT/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rPT/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ro/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ro/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ru/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ru/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sk/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sk/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sl/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sl/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sq/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sq/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sr/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sr/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sv/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sv/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sw/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sw/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-th/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-th/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tl/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tl/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tr/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tr/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uk/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uk/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ur/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ur/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uz/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uz/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-vi/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-vi/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rCN/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rCN/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rHK/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rHK/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rTW/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rTW/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zu/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zu/strings.xml) | 0 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/config.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/config.xml) | 8 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/strings.xml) | 2 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim32Overlay/Android.mk | 30 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim32Overlay/AndroidManifest.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bn/strings.xml) | 18 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/config.xml | 28 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-si/strings.xml) | 15 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim40Overlay/Android.mk | 30 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim40Overlay/AndroidManifest.xml | 27 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/config.xml | 28 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/strings.xml (renamed from packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ml/strings.xml) | 15 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kn/strings.xml | 23 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ne/strings.xml | 23 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-or/strings.xml | 23 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pa/strings.xml | 23 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ta/strings.xml | 23 | ||||
| -rw-r--r-- | packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-te/strings.xml | 23 | ||||
| -rw-r--r-- | services/core/java/com/android/server/StorageManagerService.java | 25 | ||||
| -rw-r--r-- | services/core/java/com/android/server/display/DisplayDevice.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/input/ConfigurationProcessor.java | 121 | ||||
| -rw-r--r-- | services/core/java/com/android/server/input/InputManagerService.java | 77 | ||||
| -rw-r--r-- | services/core/java/com/android/server/media/MediaSessionService.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java | 7 | ||||
| -rw-r--r-- | services/core/java/com/android/server/storage/AppFuseBridge.java | 22 | ||||
| -rw-r--r-- | services/core/jni/Android.bp | 1 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_input_InputManagerService.cpp | 59 | ||||
| -rw-r--r-- | services/core/jni/com_android_server_location_GnssLocationProvider.cpp | 231 | ||||
| -rw-r--r-- | services/tests/servicestests/AndroidManifest.xml | 9 | ||||
| -rw-r--r-- | services/tests/servicestests/res/raw/input_port_associations.xml | 4 | ||||
| -rw-r--r-- | services/tests/servicestests/res/raw/input_port_associations_bad_displayport.xml | 3 | ||||
| -rw-r--r-- | services/tests/servicestests/res/raw/input_port_associations_bad_xml.xml | 3 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/input/ConfigurationProcessorTest.java | 93 | ||||
| -rw-r--r-- | services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java | 322 | ||||
| -rw-r--r-- | services/tests/wmtests/AndroidManifest.xml | 2 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java) | 6 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/AppTransitionControllerTest.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/AppTransitionTests.java) | 5 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/AppWindowTokenAnimationTests.java) | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java) | 22 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/BoundsAnimationControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/BoundsAnimationControllerTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DimmerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DimmerTests.java) | 13 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java) | 8 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayPolicyInsetsTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayPolicyInsetsTests.java) | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayPolicyLayoutTests.java) | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTests.java) | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTestsBase.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DisplayWindowSettingsTests.java) | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DockedStackDividerControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DockedStackDividerControllerTests.java) | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java) | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/InsetsSourceProviderTest.java) | 8 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/InsetsStateControllerTest.java) | 8 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/PinnedStackControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/PinnedStackControllerTest.java) | 13 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/RecentsAnimationControllerTest.java) | 8 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java) | 17 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/StackWindowControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/StackWindowControllerTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java) | 13 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java) | 9 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskPositionerTests.java) | 8 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskPositioningControllerTests.java) | 7 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskSnapshotCacheTest.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskSnapshotControllerTest.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java) | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskStackContainersTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TaskWindowContainerControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/TaskWindowContainerControllerTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TestIWindow.java (renamed from services/tests/servicestests/src/com/android/server/wm/TestIWindow.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java (renamed from services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java) | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java) | 2 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WallpaperControllerTests.java) | 5 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowConfigurationTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowContainerControllerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowContainerControllerTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowContainerTests.java) | 24 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowContainerTraversalTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowContainerTraversalTests.java) | 5 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java) | 2 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java) | 12 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRuleTest.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRuleTest.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java) | 11 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java | 261 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowTestsBase.java) | 2 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/WindowTokenTests.java) | 0 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java (renamed from services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java) | 0 | ||||
| -rw-r--r-- | test-mock/api/current.txt | 1 | ||||
| -rw-r--r-- | test-mock/api/test-current.txt | 4 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/ActivityReport.java | 92 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/AppActivity.java | 80 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/AppInfo.java | 56 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/AppList.java | 91 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/AppPower.java | 86 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/BatteryStatsReader.java | 74 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/ComponentActivity.java | 42 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/ComponentPower.java | 41 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/PowerReport.java | 101 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/RawBatteryStats.java | 222 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemAppActivity.java | 85 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemAppPower.java | 24 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemBatteryStatsReader.java | 110 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemGlobalActivity.java | 51 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemRemainderActivity.java | 87 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/component/ModemRemainderPower.java | 30 | ||||
| -rw-r--r-- | tools/powermodel/src/com/android/powermodel/util/Conversion.java | 4 | ||||
| -rw-r--r-- | tools/powermodel/test-resource/bs.csv | 7 | ||||
| -rw-r--r-- | tools/powermodel/test/com/android/powermodel/BatteryStatsReaderTest.java | 80 | ||||
| -rw-r--r-- | tools/powermodel/test/com/android/powermodel/PowerReportTest.java | 128 | ||||
| -rw-r--r-- | tools/processors/unsupportedappusage/src/android/processor/unsupportedappusage/UnsupportedAppUsageProcessor.java | 23 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/p2p/WifiP2pManager.java | 32 |
208 files changed, 3055 insertions, 851 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index 6deda0caa9aa..478e4fe86d3b 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -248,6 +248,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.mediad $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.location.provider.jar) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.future.usb.accessory.jar) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/com.android.media.remotedisplay.jar) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/overlay/ExperimentNavigationBarSlim) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/overlay/ExperimentNavigationBarSlim) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/overlay/ExperimentNavigationBarSlim) # ****************************************************************** # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST ABOVE THIS BANNER # ****************************************************************** diff --git a/api/current.txt b/api/current.txt index 38a721f35ee9..d86b8b11a60e 100644 --- a/api/current.txt +++ b/api/current.txt @@ -9556,6 +9556,7 @@ package android.content { method public abstract java.io.File getNoBackupFilesDir(); method public abstract java.io.File getObbDir(); method public abstract java.io.File[] getObbDirs(); + method public abstract java.lang.String getOpPackageName(); method public abstract java.lang.String getPackageCodePath(); method public abstract android.content.pm.PackageManager getPackageManager(); method public abstract java.lang.String getPackageName(); @@ -9766,6 +9767,7 @@ package android.content { method public java.io.File getNoBackupFilesDir(); method public java.io.File getObbDir(); method public java.io.File[] getObbDirs(); + method public java.lang.String getOpPackageName(); method public java.lang.String getPackageCodePath(); method public android.content.pm.PackageManager getPackageManager(); method public java.lang.String getPackageName(); @@ -29527,6 +29529,7 @@ package android.net.wifi.p2p { method public void clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); method public void connect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener); method public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); + method public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener); method public void discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); method public void discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener); method public android.net.wifi.p2p.WifiP2pManager.Channel initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager.ChannelListener); diff --git a/api/system-current.txt b/api/system-current.txt index b4c73362d7cc..6cfcad3c4b9f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -2871,6 +2871,7 @@ package android.media { field public static final int AUDIOFOCUS_FLAG_DELAY_OK = 1; // 0x1 field public static final int AUDIOFOCUS_FLAG_LOCK = 4; // 0x4 field public static final int AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS = 2; // 0x2 + field public static final int FLAG_FROM_KEY = 4096; // 0x1000 } public static abstract class AudioManager.AudioServerStateCallback { diff --git a/api/test-current.txt b/api/test-current.txt index c0f7ab63003b..b871c78571ad 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -305,16 +305,11 @@ package android.content { public abstract class Context { method public android.content.Context createPackageContextAsUser(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; - method public abstract java.lang.String getOpPackageName(); method public android.os.UserHandle getUser(); method public int getUserId(); method public void setAutofillCompatibilityEnabled(boolean); } - public class ContextWrapper extends android.content.Context { - method public java.lang.String getOpPackageName(); - } - } package android.content.pm { diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index cec8ef59b961..ff57b0311d60 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -741,16 +741,22 @@ public abstract class Context { /** Return the name of this application's package. */ public abstract String getPackageName(); - /** @hide Return the name of the base context this context is derived from. */ + /** + * @hide Return the name of the base context this context is derived from. + * This is the same as {@link #getOpPackageName()} except in + * cases where system components are loaded into other app processes, in which + * case {@link #getOpPackageName()} will be the name of the primary package in + * that process (so that app ops uid verification will work with the name). + */ @UnsupportedAppUsage public abstract String getBasePackageName(); - /** @hide Return the package name that should be used for app ops calls from - * this context. This is the same as {@link #getBasePackageName()} except in - * cases where system components are loaded into other app processes, in which - * case this will be the name of the primary package in that process (so that app - * ops uid verification will work with the name). */ - @TestApi + /** + * Return the package name that should be used for {@link android.app.AppOpsManager} calls from + * this context, so that app ops manager's uid verification will work with the name. + * <p> + * This is not generally intended for third party application developers. + */ public abstract String getOpPackageName(); /** Return the full application info for this context's package. */ diff --git a/core/java/android/hardware/display/DisplayViewport.java b/core/java/android/hardware/display/DisplayViewport.java index df0d46be1354..f2c50b5cc464 100644 --- a/core/java/android/hardware/display/DisplayViewport.java +++ b/core/java/android/hardware/display/DisplayViewport.java @@ -19,6 +19,7 @@ package android.hardware.display; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; +import android.annotation.Nullable; import android.graphics.Rect; import android.text.TextUtils; @@ -71,6 +72,9 @@ public final class DisplayViewport { // The ID used to uniquely identify this display. public String uniqueId; + // The physical port that the associated display device is connected to. + public @Nullable Byte physicalPort; + public @ViewportType int type; public void copyFrom(DisplayViewport viewport) { @@ -82,6 +86,7 @@ public final class DisplayViewport { deviceWidth = viewport.deviceWidth; deviceHeight = viewport.deviceHeight; uniqueId = viewport.uniqueId; + physicalPort = viewport.physicalPort; type = viewport.type; } @@ -113,6 +118,7 @@ public final class DisplayViewport { && deviceWidth == other.deviceWidth && deviceHeight == other.deviceHeight && TextUtils.equals(uniqueId, other.uniqueId) + && physicalPort == other.physicalPort && type == other.type; } @@ -128,6 +134,7 @@ public final class DisplayViewport { result += prime * result + deviceWidth; result += prime * result + deviceHeight; result += prime * result + uniqueId.hashCode(); + result += prime * result + physicalPort; result += prime * result + type; return result; } @@ -139,6 +146,7 @@ public final class DisplayViewport { + ", valid=" + valid + ", displayId=" + displayId + ", uniqueId='" + uniqueId + "'" + + ", physicalPort=" + physicalPort + ", orientation=" + orientation + ", logicalFrame=" + logicalFrame + ", physicalFrame=" + physicalFrame diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java index 651caece01f9..2abcb4cd9379 100644 --- a/core/java/android/os/Process.java +++ b/core/java/android/os/Process.java @@ -1055,6 +1055,9 @@ public class Process { */ public static final native long getPss(int pid); + /** @hide */ + public static final native long[] getRss(int pid); + /** * Specifies the outcome of having started a process. * @hide diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 0739516e4e96..8b39cc72af8f 100644 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -1862,12 +1862,12 @@ public class KeyEvent extends InputEvent implements Parcelable { } /** - * Whether this key is a media key, which can be send to apps that are - * interested in media key events. + * Returns whether this key can be handled by + * {@link android.media.session.MediaSession.Callback}. * * @hide */ - public static final boolean isMediaKey(int keyCode) { + public static final boolean isMediaSessionKey(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index d9d52c01924f..937e23813cec 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -459,7 +459,7 @@ public final class ViewRootImpl implements ViewParent, final DisplayCutout.ParcelableWrapper mPendingDisplayCutout = new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); boolean mPendingAlwaysConsumeNavBar; - private InsetsState mPendingInsets; + private InsetsState mPendingInsets = new InsetsState(); final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets = new ViewTreeObserver.InternalInsetsInfo(); diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 3b7ce0a22b18..031377ebe27b 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -1891,7 +1891,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return true; } // These are all the recognized media key codes in - // KeyEvent.isMediaKey() + // KeyEvent.isMediaSessionKey() case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: @@ -1992,7 +1992,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return true; } // These are all the recognized media key codes in - // KeyEvent.isMediaKey() + // KeyEvent.isMediaSessionKey() case KeyEvent.KEYCODE_MEDIA_PLAY: case KeyEvent.KEYCODE_MEDIA_PAUSE: case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: diff --git a/core/jni/android_hardware_display_DisplayViewport.cpp b/core/jni/android_hardware_display_DisplayViewport.cpp index 05f6556bfb35..e74aafe61e00 100644 --- a/core/jni/android_hardware_display_DisplayViewport.cpp +++ b/core/jni/android_hardware_display_DisplayViewport.cpp @@ -40,6 +40,7 @@ static struct { jfieldID deviceWidth; jfieldID deviceHeight; jfieldID uniqueId; + jfieldID physicalPort; jfieldID type; } gDisplayViewportClassInfo; @@ -54,6 +55,9 @@ static struct { status_t android_hardware_display_DisplayViewport_toNative(JNIEnv* env, jobject viewportObj, DisplayViewport* viewport) { + static const jclass byteClass = FindClassOrDie(env, "java/lang/Byte"); + static const jmethodID byteValue = env->GetMethodID(byteClass, "byteValue", "()B"); + viewport->displayId = env->GetIntField(viewportObj, gDisplayViewportClassInfo.displayId); viewport->orientation = env->GetIntField(viewportObj, gDisplayViewportClassInfo.orientation); viewport->deviceWidth = env->GetIntField(viewportObj, gDisplayViewportClassInfo.deviceWidth); @@ -65,6 +69,12 @@ status_t android_hardware_display_DisplayViewport_toNative(JNIEnv* env, jobject viewport->uniqueId = ScopedUtfChars(env, uniqueId).c_str(); } + viewport->physicalPort = std::nullopt; + jobject physicalPort = env->GetObjectField(viewportObj, gDisplayViewportClassInfo.physicalPort); + if (physicalPort != nullptr) { + viewport->physicalPort = std::make_optional(env->CallByteMethod(physicalPort, byteValue)); + } + viewport->type = static_cast<ViewportType>(env->GetIntField(viewportObj, gDisplayViewportClassInfo.type)); @@ -112,6 +122,9 @@ int register_android_hardware_display_DisplayViewport(JNIEnv* env) { gDisplayViewportClassInfo.uniqueId = GetFieldIDOrDie(env, gDisplayViewportClassInfo.clazz, "uniqueId", "Ljava/lang/String;"); + gDisplayViewportClassInfo.physicalPort = GetFieldIDOrDie(env, + gDisplayViewportClassInfo.clazz, "physicalPort", "Ljava/lang/Byte;"); + gDisplayViewportClassInfo.type = GetFieldIDOrDie(env, gDisplayViewportClassInfo.clazz, "type", "I"); diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp index 49d500754290..fa1da4bfbf3a 100644 --- a/core/jni/android_os_Debug.cpp +++ b/core/jni/android_os_Debug.cpp @@ -33,8 +33,6 @@ #include <iomanip> #include <string> -#include <android-base/stringprintf.h> -#include <android-base/unique_fd.h> #include <debuggerd/client.h> #include <log/log.h> #include <utils/misc.h> @@ -50,10 +48,6 @@ namespace android { -static inline UniqueFile MakeUniqueFile(const char* path, const char* mode) { - return UniqueFile(fopen(path, mode), safeFclose); -} - enum { HEAP_UNKNOWN, HEAP_DALVIK, diff --git a/core/jni/android_os_Debug.h b/core/jni/android_os_Debug.h index 81270ca994bb..c7b731bdb615 100644 --- a/core/jni/android_os_Debug.h +++ b/core/jni/android_os_Debug.h @@ -19,6 +19,8 @@ #include <memory> #include <stdio.h> +#include <android-base/stringprintf.h> +#include <android-base/unique_fd.h> namespace android { @@ -27,6 +29,11 @@ inline void safeFclose(FILE* fp) { } using UniqueFile = std::unique_ptr<FILE, decltype(&safeFclose)>; + +inline UniqueFile MakeUniqueFile(const char* path, const char* mode) { + return UniqueFile(fopen(path, mode), safeFclose); +} + UniqueFile OpenSmapsOrRollup(int pid); } // namespace android diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 4c7defbf7358..377e65c33dd0 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -1128,6 +1128,39 @@ static jlong android_os_Process_getPss(JNIEnv* env, jobject clazz, jint pid) return pss * 1024; } +static jlongArray android_os_Process_getRss(JNIEnv* env, jobject clazz, jint pid) +{ + // total, file, anon, swap + jlong rss[4] = {0, 0, 0, 0}; + std::string status_path = + android::base::StringPrintf("/proc/%d/status", pid); + UniqueFile file = MakeUniqueFile(status_path.c_str(), "re"); + + char line[256]; + while (fgets(line, sizeof(line), file.get())) { + jlong v; + if ( sscanf(line, "VmRSS: %" SCNd64 " kB", &v) == 1) { + rss[0] = v; + } else if ( sscanf(line, "RssFile: %" SCNd64 " kB", &v) == 1) { + rss[1] = v; + } else if ( sscanf(line, "RssAnon: %" SCNd64 " kB", &v) == 1) { + rss[2] = v; + } else if ( sscanf(line, "VmSwap: %" SCNd64 " kB", &v) == 1) { + rss[3] = v; + } + } + + jlongArray rssArray = env->NewLongArray(4); + if (rssArray == NULL) { + jniThrowException(env, "java/lang/OutOfMemoryError", NULL); + return NULL; + } + + env->SetLongArrayRegion(rssArray, 0, 4, rss); + + return rssArray; +} + jintArray android_os_Process_getPidsForCommands(JNIEnv* env, jobject clazz, jobjectArray commandNames) { @@ -1253,6 +1286,7 @@ static const JNINativeMethod methods[] = { {"parseProcLine", "([BII[I[Ljava/lang/String;[J[F)Z", (void*)android_os_Process_parseProcLine}, {"getElapsedCpuTime", "()J", (void*)android_os_Process_getElapsedCpuTime}, {"getPss", "(I)J", (void*)android_os_Process_getPss}, + {"getRss", "(I)[J", (void*)android_os_Process_getRss}, {"getPidsForCommands", "([Ljava/lang/String;)[I", (void*)android_os_Process_getPidsForCommands}, //{"setApplicationObject", "(Landroid/os/IBinder;)V", (void*)android_os_Process_setApplicationObject}, {"killProcessGroup", "(II)I", (void*)android_os_Process_killProcessGroup}, diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index ff1bdd47f565..d10900e5d160 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -541,6 +541,7 @@ public class AudioManager { * Adjusting the volume due to a hardware key press. * @hide */ + @SystemApi public static final int FLAG_FROM_KEY = 1 << 12; private static final String[] FLAG_NAMES = { diff --git a/media/java/android/media/RemoteController.java b/media/java/android/media/RemoteController.java index b6e3276a4e43..5e9eed737256 100644 --- a/media/java/android/media/RemoteController.java +++ b/media/java/android/media/RemoteController.java @@ -20,7 +20,6 @@ import android.annotation.UnsupportedAppUsage; import android.app.ActivityManager; import android.content.ComponentName; import android.content.Context; -import android.content.Intent; import android.graphics.Bitmap; import android.media.session.MediaController; import android.media.session.MediaSession; @@ -36,7 +35,6 @@ import android.util.DisplayMetrics; import android.util.Log; import android.view.KeyEvent; -import java.lang.ref.WeakReference; import java.util.List; /** @@ -250,7 +248,7 @@ import java.util.List; * @throws IllegalArgumentException */ public boolean sendMediaKeyEvent(KeyEvent keyEvent) throws IllegalArgumentException { - if (!KeyEvent.isMediaKey(keyEvent.getKeyCode())) { + if (!KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())) { throw new IllegalArgumentException("not a media key event"); } synchronized (mInfoLock) { diff --git a/media/java/android/media/session/MediaController.java b/media/java/android/media/session/MediaController.java index c4b82c3141d3..b457357600fe 100644 --- a/media/java/android/media/session/MediaController.java +++ b/media/java/android/media/session/MediaController.java @@ -149,7 +149,7 @@ public final class MediaController { if (keyEvent == null) { throw new IllegalArgumentException("KeyEvent may not be null"); } - if (!KeyEvent.isMediaKey(keyEvent.getKeyCode())) { + if (!KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())) { return false; } try { diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index d9017b4fb14c..ff6977914ac3 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -59,9 +59,7 @@ import com.android.internal.os.SomeArgs; import com.android.internal.util.Preconditions; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; /** * The TvInputService class represents a TV input or source such as HDMI or built-in tuner which @@ -1400,7 +1398,7 @@ public abstract class TvInputService extends Service { // ViewRootImpl always consumes the keys. In this case, the application loses // a chance to handle media keys. Therefore, media keys are not dispatched to // ViewRootImpl. - skipDispatchToOverlayView = KeyEvent.isMediaKey(keyEvent.getKeyCode()) + skipDispatchToOverlayView = KeyEvent.isMediaSessionKey(keyEvent.getKeyCode()) || keyEvent.getKeyCode() == KeyEvent.KEYCODE_MEDIA_AUDIO_TRACK; } else if (event instanceof MotionEvent) { MotionEvent motionEvent = (MotionEvent) event; diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/AssitantButton.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/AssitantButton.java new file mode 100644 index 000000000000..5bf30ca10694 --- /dev/null +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/AssitantButton.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.car; + +import static android.service.voice.VoiceInteractionSession.SHOW_SOURCE_ASSIST_GESTURE; + +import android.content.Context; +import android.content.res.TypedArray; +import android.os.Bundle; +import android.util.AttributeSet; +import android.util.Log; + +import com.android.internal.app.AssistUtils; +import com.android.internal.app.IVoiceInteractionSessionShowCallback; + +/** + * AssitantButton is a ui component that will trigger the Voice Interaction Service. + */ +public class AssitantButton extends CarFacetButton { + + private static final String TAG = "CarFacetButton"; + private IVoiceInteractionSessionShowCallback mShowCallback = + new IVoiceInteractionSessionShowCallback.Stub() { + @Override + public void onFailed() { + Log.w(TAG, "Failed to show VoiceInteractionSession"); + } + + @Override + public void onShown() { + Log.d(TAG, "IVoiceInteractionSessionShowCallback onShown()"); + } + }; + + private static final String EXTRA_CAR_PUSH_TO_TALK = + "com.android.car.input.EXTRA_CAR_PUSH_TO_TALK"; + private final AssistUtils mAssistUtils; + + public AssitantButton(Context context, AttributeSet attrs) { + super(context, attrs); + mAssistUtils = new AssistUtils(context); + setOnClickListener(v -> { + showAssistant(); + }); + } + + private void showAssistant() { + final Bundle args = new Bundle(); + args.putBoolean(EXTRA_CAR_PUSH_TO_TALK, true); + mAssistUtils.showSessionForActiveService(args, + SHOW_SOURCE_ASSIST_GESTURE, mShowCallback, /*activityToken=*/ null); + } + + @Override + protected void setupIntents(TypedArray typedArray){ + // left blank because for the assistant button Intent will not be passed from the layout. + } +} diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java new file mode 100644 index 000000000000..cea4ab0e4992 --- /dev/null +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarFacetButton.java @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.car; + +import android.content.Context; +import android.content.Intent; +import android.content.res.TypedArray; +import android.os.UserHandle; +import android.util.AttributeSet; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; + +import com.android.keyguard.AlphaOptimizedImageButton; +import com.android.systemui.Dependency; +import com.android.systemui.R; + +/** + * CarFacetButton is a ui component designed to be used as a shortcut for an app of a defined + * category. It can also render a indicator impling that there are more options of apps to launch + * using this component. This is done with a "More icon" currently an arrow as defined in the layout + * file. The class is to serve as an example. + * Usage example: A button that allows a user to select a music app and indicate that there are + * other music apps installed. + */ +public class CarFacetButton extends LinearLayout { + private static final String FACET_FILTER_DELIMITER = ";"; + /** + * Extra information to be sent to a helper to make the decision of what app to launch when + * clicked. + */ + private static final String EXTRA_FACET_CATEGORIES = "categories"; + private static final String EXTRA_FACET_PACKAGES = "packages"; + private static final String EXTRA_FACET_ID = "filter_id"; + private static final String EXTRA_FACET_LAUNCH_PICKER = "launch_picker"; + private static final String TAG = "CarFacetButton"; + + private Context mContext; + private AlphaOptimizedImageButton mIcon; + private AlphaOptimizedImageButton mMoreIcon; + private boolean mSelected = false; + private String[] mComponentNames; + /** App categories that are to be used with this widget */ + private String[] mFacetCategories; + /** App packages that are allowed to be used with this widget */ + private String[] mFacetPackages; + private int mIconResourceId; + /** + * If defined in the xml this will be the icon that's rendered when the button is marked as + * selected + */ + private int mSelectedIconResourceId; + private boolean mUseMoreIcon = true; + private float mSelectedAlpha = 1f; + private float mUnselectedAlpha = 1f; + + public CarFacetButton(Context context, AttributeSet attrs) { + super(context, attrs); + mContext = context; + View.inflate(context, R.layout.car_facet_button, this); + // extract custom attributes + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CarFacetButton); + setupIntents(typedArray); + setupIcons(typedArray); + CarFacetButtonController carFacetButtonController = Dependency.get( + CarFacetButtonController.class); + carFacetButtonController.addFacetButton(this); + } + + /** + * Reads the custom attributes to setup click handlers for this component. + */ + protected void setupIntents(TypedArray typedArray) { + String intentString = typedArray.getString(R.styleable.CarFacetButton_intent); + String longPressIntentString = typedArray.getString(R.styleable.CarFacetButton_longIntent); + String categoryString = typedArray.getString(R.styleable.CarFacetButton_categories); + String packageString = typedArray.getString(R.styleable.CarFacetButton_packages); + String componentNameString = + typedArray.getString(R.styleable.CarFacetButton_componentNames); + try { + final Intent intent = Intent.parseUri(intentString, Intent.URI_INTENT_SCHEME); + intent.putExtra(EXTRA_FACET_ID, Integer.toString(getId())); + + if (packageString != null) { + mFacetPackages = packageString.split(FACET_FILTER_DELIMITER); + intent.putExtra(EXTRA_FACET_PACKAGES, mFacetPackages); + } + if (categoryString != null) { + mFacetCategories = categoryString.split(FACET_FILTER_DELIMITER); + intent.putExtra(EXTRA_FACET_CATEGORIES, mFacetCategories); + } + if (componentNameString != null) { + mComponentNames = componentNameString.split(FACET_FILTER_DELIMITER); + } + + setOnClickListener(v -> { + intent.putExtra(EXTRA_FACET_LAUNCH_PICKER, mSelected); + mContext.startActivityAsUser(intent, UserHandle.CURRENT); + }); + + if (longPressIntentString != null) { + final Intent longPressIntent = Intent.parseUri(longPressIntentString, + Intent.URI_INTENT_SCHEME); + setOnLongClickListener(v -> { + mContext.startActivityAsUser(longPressIntent, UserHandle.CURRENT); + return true; + }); + } + } catch (Exception e) { + throw new RuntimeException("Failed to attach intent", e); + } + } + + private void setupIcons(TypedArray styledAttributes) { + mSelectedAlpha = styledAttributes.getFloat( + R.styleable.CarFacetButton_selectedAlpha, mSelectedAlpha); + mUnselectedAlpha = styledAttributes.getFloat( + R.styleable.CarFacetButton_unselectedAlpha, mUnselectedAlpha); + mIcon = findViewById(R.id.car_nav_button_icon); + mIcon.setScaleType(ImageView.ScaleType.CENTER); + mIcon.setClickable(false); + mIcon.setAlpha(mUnselectedAlpha); + mIconResourceId = styledAttributes.getResourceId(R.styleable.CarFacetButton_icon, 0); + mIcon.setImageResource(mIconResourceId); + mSelectedIconResourceId = styledAttributes.getResourceId( + R.styleable.CarFacetButton_selectedIcon, mIconResourceId); + + mMoreIcon = findViewById(R.id.car_nav_button_more_icon); + mMoreIcon.setClickable(false); + mMoreIcon.setAlpha(mSelectedAlpha); + mMoreIcon.setVisibility(GONE); + mUseMoreIcon = styledAttributes.getBoolean(R.styleable.CarFacetButton_useMoreIcon, true); + } + + /** + * @return The app categories the component represents + */ + public String[] getCategories() { + if (mFacetCategories == null) { + return new String[0]; + } + return mFacetCategories; + } + + /** + * @return The valid packages that should be considered. + */ + public String[] getFacetPackages() { + if (mFacetPackages == null) { + return new String[0]; + } + return mFacetPackages; + } + + /** + * @return The list of component names. + */ + public String[] getComponentName() { + if (mComponentNames == null) { + return new String[0]; + } + return mComponentNames; + } + + /** + * Updates the alpha of the icons to "selected" and shows the "More icon" + * + * @param selected true if the view must be selected, false otherwise + */ + public void setSelected(boolean selected) { + super.setSelected(selected); + setSelected(selected, selected); + } + + /** + * Updates the visual state to let the user know if it's been selected. + * + * @param selected true if should update the alpha of the icon to selected, false otherwise + * @param showMoreIcon true if the "more icon" should be shown, false otherwise. Note this + * is ignored if the attribute useMoreIcon is set to false + */ + public void setSelected(boolean selected, boolean showMoreIcon) { + mSelected = selected; + mIcon.setAlpha(mSelected ? mSelectedAlpha : mUnselectedAlpha); + mIcon.setImageResource(mSelected ? mSelectedIconResourceId : mIconResourceId); + if (mUseMoreIcon) { + mMoreIcon.setVisibility(showMoreIcon ? VISIBLE : GONE); + } + } +} diff --git a/packages/overlays/ExperimentNavigationBarDefaultOverlay/Android.mk b/packages/overlays/ExperimentNavigationBarDefaultOverlay/Android.mk new file mode 100644 index 000000000000..ecad42097738 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarDefaultOverlay/Android.mk @@ -0,0 +1,30 @@ +# +# Copyright 2018, The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_RRO_THEME := ExperimentNavigationBarDefault +LOCAL_CERTIFICATE := platform + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res + +LOCAL_PACKAGE_NAME := ExperimentNavigationBarDefaultOverlay +LOCAL_SDK_VERSION := current + +include $(BUILD_RRO_PACKAGE)
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarDefaultOverlay/AndroidManifest.xml b/packages/overlays/ExperimentNavigationBarDefaultOverlay/AndroidManifest.xml new file mode 100644 index 000000000000..1639fc5fc302 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarDefaultOverlay/AndroidManifest.xml @@ -0,0 +1,27 @@ +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.internal.experiment.navbar.default" + android:versionCode="1" + android:versionName="1.0"> + <overlay android:targetPackage="android" + android:category="com.android.internal.experiment_navbar_default" + android:priority="1"/> + + <application android:label="@string/experiment_navigationbar_overlay" android:hasCode="false"/> +</manifest>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-as/strings.xml b/packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/config.xml index 8cce57046c37..d8b69cde863b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-as/strings.xml +++ b/packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/config.xml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?> +<!-- /** * Copyright (c) 2018, The Android Open Source Project * @@ -15,9 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"লাহী নেভিগে’শ্বন বাৰ সম্পৰীক্ষা"</string> -</resources> +--> +<resources> + <!-- Height of the bottom navigation / system bar frame; navigation buttons height. --> + <dimen name="navigation_bar_frame_width">48dp</dimen> + <!-- Width of the navigation bar frame when it is placed vertically on the screen --> + <dimen name="navigation_bar_frame_height">48dp</dimen> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gu/strings.xml b/packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/strings.xml index 96418aec29bc..c9332903be2e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gu/strings.xml +++ b/packages/overlays/ExperimentNavigationBarDefaultOverlay/res/values/strings.xml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?> +<!-- /** * Copyright (c) 2018, The Android Open Source Project * @@ -15,9 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"સ્લિમ નૅવિગેશન બારનો પ્રયોગ"</string> -</resources> +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Name of overlay [CHAR LIMIT=64] --> + <string name="experiment_navigationbar_overlay">Default Navigation Bar Experiment (48dp)</string> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarFloatingOverlay/AndroidManifest.xml b/packages/overlays/ExperimentNavigationBarFloatingOverlay/AndroidManifest.xml index b4b2b161ad71..b4cc34f15af7 100644 --- a/packages/overlays/ExperimentNavigationBarFloatingOverlay/AndroidManifest.xml +++ b/packages/overlays/ExperimentNavigationBarFloatingOverlay/AndroidManifest.xml @@ -16,7 +16,7 @@ */ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.internal.experiment.navbar.floating" + package="com.android.internal.experiment.navbar.type.floating" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" diff --git a/packages/overlays/ExperimentNavigationBarFloatingOverlay/res/values/config.xml b/packages/overlays/ExperimentNavigationBarFloatingOverlay/res/values/config.xml index 6a5845321556..30bca3c00164 100644 --- a/packages/overlays/ExperimentNavigationBarFloatingOverlay/res/values/config.xml +++ b/packages/overlays/ExperimentNavigationBarFloatingOverlay/res/values/config.xml @@ -21,8 +21,4 @@ <dimen name="navigation_bar_height">0dp</dimen> <!-- Width of the navigation bar when it is placed vertically on the screen --> <dimen name="navigation_bar_width">0dp</dimen> - <!-- Height of the bottom navigation / system bar frame; navigation buttons height. --> - <dimen name="navigation_bar_frame_height">48dp</dimen> - <!-- Width of the navigation bar frame when it is placed vertically on the screen --> - <dimen name="navigation_bar_frame_width">48dp</dimen> </resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/Android.mk b/packages/overlays/ExperimentNavigationBarSlim24Overlay/Android.mk index e642a68f1a3a..58cf134fd04d 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/Android.mk +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/Android.mk @@ -17,14 +17,14 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_RRO_THEME := ExperimentNavigationBarSlim +LOCAL_RRO_THEME := ExperimentNavigationBarSlim24 LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES := $(call all-subdir-java-files) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res -LOCAL_PACKAGE_NAME := ExperimentNavigationBarSlimOverlay +LOCAL_PACKAGE_NAME := ExperimentNavigationBarSlimOverlay24 LOCAL_SDK_VERSION := current include $(BUILD_RRO_PACKAGE)
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/AndroidManifest.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/AndroidManifest.xml index a1bd58274fc0..aee543a0b23b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/AndroidManifest.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/AndroidManifest.xml @@ -16,11 +16,11 @@ */ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.internal.experiment.navbar.slim" + package="com.android.internal.experiment.navbar.slim24" android:versionCode="1" android:versionName="1.0"> <overlay android:targetPackage="android" - android:category="com.android.internal.experiment_navbar_slim" + android:category="com.android.internal.experiment_navbar_slim24" android:priority="1"/> <application android:label="@string/experiment_navigationbar_overlay" android:hasCode="false"/> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-af/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-af/strings.xml index 21a0003bdaa7..21a0003bdaa7 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-af/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-af/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-am/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-am/strings.xml index 6a7d644ff432..6a7d644ff432 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-am/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-am/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ar/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ar/strings.xml index 2cebf40c0cba..2cebf40c0cba 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ar/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ar/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-az/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-az/strings.xml index 266c051abc7d..266c051abc7d 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-az/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-az/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-b+sr+Latn/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-b+sr+Latn/strings.xml index dc57a3f6a076..dc57a3f6a076 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-b+sr+Latn/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-b+sr+Latn/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-be/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-be/strings.xml index 8b53bcdfe9d7..8b53bcdfe9d7 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-be/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-be/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bg/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bg/strings.xml index 4bf000e193c0..4bf000e193c0 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bg/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bg/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bs/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bs/strings.xml index 981420945aea..981420945aea 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bs/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-bs/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ca/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ca/strings.xml index 4a9b598158e6..4a9b598158e6 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ca/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ca/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-cs/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-cs/strings.xml index d923a3cc4376..d923a3cc4376 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-cs/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-cs/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-da/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-da/strings.xml index 12bb2f23fe1e..12bb2f23fe1e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-da/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-da/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-de/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-de/strings.xml index 960a7d94e7ae..960a7d94e7ae 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-de/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-de/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-el/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-el/strings.xml index 119b7e611cf9..119b7e611cf9 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-el/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-el/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rAU/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rAU/strings.xml index 5ebf40348199..5ebf40348199 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rAU/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rAU/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rCA/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rCA/strings.xml index 5ebf40348199..5ebf40348199 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rCA/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rCA/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rGB/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rGB/strings.xml index 5ebf40348199..5ebf40348199 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rGB/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rGB/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rIN/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rIN/strings.xml index 5ebf40348199..5ebf40348199 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rIN/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rIN/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rXC/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rXC/strings.xml index 79884ce615cf..79884ce615cf 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-en-rXC/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-en-rXC/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es-rUS/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es-rUS/strings.xml index 00b044459777..00b044459777 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es-rUS/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es-rUS/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es/strings.xml index 58bdaa26115b..58bdaa26115b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-es/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-es/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-et/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-et/strings.xml index 4c5023cf1d14..4c5023cf1d14 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-et/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-et/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-eu/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-eu/strings.xml index fc16eeb8dc3e..fc16eeb8dc3e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-eu/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-eu/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fa/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fa/strings.xml index e4246d79decb..e4246d79decb 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fa/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fa/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fi/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fi/strings.xml index 9385a470368f..9385a470368f 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fi/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fi/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr-rCA/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr-rCA/strings.xml index d22848beda3d..d22848beda3d 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr-rCA/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr-rCA/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr/strings.xml index cfa1db2a06d3..cfa1db2a06d3 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-fr/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-fr/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gl/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-gl/strings.xml index d2194ce1a820..d2194ce1a820 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-gl/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-gl/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hi/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hi/strings.xml index d51cee34f895..d51cee34f895 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hi/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hi/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hr/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hr/strings.xml index 410c58ef2cbc..410c58ef2cbc 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hr/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hr/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hu/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hu/strings.xml index d7eafed699ab..d7eafed699ab 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hu/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hu/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hy/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hy/strings.xml index b0200cab636b..b0200cab636b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-hy/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-hy/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-in/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-in/strings.xml index 3e0bded06e68..3e0bded06e68 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-in/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-in/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-is/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-is/strings.xml index 03ccaf3de068..03ccaf3de068 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-is/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-is/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-it/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-it/strings.xml index f7c5d253e5ab..f7c5d253e5ab 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-it/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-it/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-iw/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-iw/strings.xml index 0d0ec2c7c2a5..0d0ec2c7c2a5 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-iw/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-iw/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ja/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ja/strings.xml index a3d6874e84f6..a3d6874e84f6 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ja/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ja/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ka/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ka/strings.xml index ffddf3bee802..ffddf3bee802 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ka/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ka/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kk/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-kk/strings.xml index f34ac0810127..f34ac0810127 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kk/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-kk/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-km/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-km/strings.xml index 114a78270d79..114a78270d79 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-km/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-km/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ko/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ko/strings.xml index fca02c3e49bd..fca02c3e49bd 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ko/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ko/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ky/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ky/strings.xml index 449de4fadfbc..449de4fadfbc 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ky/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ky/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lo/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lo/strings.xml index 6ec48ca13d19..6ec48ca13d19 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lo/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lo/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lt/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lt/strings.xml index 1df54aa3fc02..1df54aa3fc02 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lt/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lt/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lv/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lv/strings.xml index 5c6c5658406b..5c6c5658406b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-lv/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-lv/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mk/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mk/strings.xml index 3517813f74ad..3517813f74ad 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mk/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mk/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mn/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mn/strings.xml index a2282c4c71c9..a2282c4c71c9 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mn/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mn/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mr/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mr/strings.xml index c714370cdc7e..c714370cdc7e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-mr/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-mr/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ms/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ms/strings.xml index 68f831e39b46..68f831e39b46 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ms/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ms/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-my/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-my/strings.xml index 84db27962308..84db27962308 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-my/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-my/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nb/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nb/strings.xml index e1ff863ac5c8..e1ff863ac5c8 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nb/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nb/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nl/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nl/strings.xml index 01190bc624c8..01190bc624c8 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-nl/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-nl/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pl/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pl/strings.xml index 1742aadbcdd3..1742aadbcdd3 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pl/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pl/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rBR/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rBR/strings.xml index 22194b7e1ca5..22194b7e1ca5 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rBR/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rBR/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rPT/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rPT/strings.xml index f6c030983578..f6c030983578 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt-rPT/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt-rPT/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt/strings.xml index 22194b7e1ca5..22194b7e1ca5 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pt/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-pt/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ro/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ro/strings.xml index e1655f27b977..e1655f27b977 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ro/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ro/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ru/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ru/strings.xml index cac66dc921b1..cac66dc921b1 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ru/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ru/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sk/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sk/strings.xml index 6a1ce4128cd9..6a1ce4128cd9 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sk/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sk/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sl/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sl/strings.xml index beab7b67f60e..beab7b67f60e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sl/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sl/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sq/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sq/strings.xml index b7a28d57391d..b7a28d57391d 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sq/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sq/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sr/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sr/strings.xml index 048f649ddb7b..048f649ddb7b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sr/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sr/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sv/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sv/strings.xml index b94438f6971a..b94438f6971a 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sv/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sv/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sw/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sw/strings.xml index 3a5a73cd0afa..3a5a73cd0afa 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-sw/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-sw/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-th/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-th/strings.xml index 945297bec53d..945297bec53d 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-th/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-th/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tl/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tl/strings.xml index 0c8087c68b8b..0c8087c68b8b 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tl/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tl/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tr/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tr/strings.xml index a3ca75455391..a3ca75455391 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-tr/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-tr/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uk/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uk/strings.xml index 656c4a97bd6c..656c4a97bd6c 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uk/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uk/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ur/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ur/strings.xml index bcd6bc3f257e..bcd6bc3f257e 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ur/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-ur/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uz/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uz/strings.xml index 0d40981784c8..0d40981784c8 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-uz/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-uz/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-vi/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-vi/strings.xml index dad56b41ae39..dad56b41ae39 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-vi/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-vi/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rCN/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rCN/strings.xml index b2602e0e0093..b2602e0e0093 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rCN/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rCN/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rHK/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rHK/strings.xml index d5259d38ffa1..d5259d38ffa1 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rHK/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rHK/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rTW/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rTW/strings.xml index 6586a573b494..6586a573b494 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zh-rTW/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zh-rTW/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zu/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zu/strings.xml index 12d04d3b21f6..12d04d3b21f6 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-zu/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values-zu/strings.xml diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/config.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/config.xml index 4c3571a1e7d4..58c653d23e44 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/config.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/config.xml @@ -18,11 +18,11 @@ --> <resources> <!-- Height of the bottom navigation / system bar. --> - <dimen name="navigation_bar_height">36dp</dimen> + <dimen name="navigation_bar_height">24dp</dimen> <!-- Width of the navigation bar when it is placed vertically on the screen --> - <dimen name="navigation_bar_width">36dp</dimen> + <dimen name="navigation_bar_width">24dp</dimen> <!-- Height of the bottom navigation / system bar frame; navigation buttons height. --> - <dimen name="navigation_bar_frame_width">36dp</dimen> + <dimen name="navigation_bar_frame_width">24dp</dimen> <!-- Width of the navigation bar frame when it is placed vertically on the screen --> - <dimen name="navigation_bar_frame_height">36dp</dimen> + <dimen name="navigation_bar_frame_height">24dp</dimen> </resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/strings.xml b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/strings.xml index 5ca9d155cb08..670bc5538474 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim24Overlay/res/values/strings.xml @@ -18,5 +18,5 @@ --> <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <!-- Name of overlay [CHAR LIMIT=64] --> - <string name="experiment_navigationbar_overlay">Slim Navigation Bar Experiment</string> + <string name="experiment_navigationbar_overlay">Slim Navigation Bar Experiment (24dp)</string> </resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlim32Overlay/Android.mk b/packages/overlays/ExperimentNavigationBarSlim32Overlay/Android.mk new file mode 100644 index 000000000000..7ebbb7458922 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarSlim32Overlay/Android.mk @@ -0,0 +1,30 @@ +# +# Copyright 2018, The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_RRO_THEME := ExperimentNavigationBarSlim32 +LOCAL_CERTIFICATE := platform + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res + +LOCAL_PACKAGE_NAME := ExperimentNavigationBarSlimOverlay32 +LOCAL_SDK_VERSION := current + +include $(BUILD_RRO_PACKAGE)
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bn/strings.xml b/packages/overlays/ExperimentNavigationBarSlim32Overlay/AndroidManifest.xml index c0ab3b1b321d..10cf6a15a782 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-bn/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim32Overlay/AndroidManifest.xml @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<!-- /** * Copyright (c) 2018, The Android Open Source Project * @@ -15,9 +14,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - --> +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.internal.experiment.navbar.slim32" + android:versionCode="1" + android:versionName="1.0"> + <overlay android:targetPackage="android" + android:category="com.android.internal.experiment_navbar_slim32" + android:priority="1"/> -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"স্লিম নেভিগেশন বার সম্পর্কিত পরীক্ষা"</string> -</resources> + <application android:label="@string/experiment_navigationbar_overlay" android:hasCode="false"/> +</manifest>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/config.xml b/packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/config.xml new file mode 100644 index 000000000000..00dd8fecbf8c --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<resources> + <!-- Height of the bottom navigation / system bar. --> + <dimen name="navigation_bar_height">32dp</dimen> + <!-- Width of the navigation bar when it is placed vertically on the screen --> + <dimen name="navigation_bar_width">32dp</dimen> + <!-- Height of the bottom navigation / system bar frame; navigation buttons height. --> + <dimen name="navigation_bar_frame_width">32dp</dimen> + <!-- Width of the navigation bar frame when it is placed vertically on the screen --> + <dimen name="navigation_bar_frame_height">32dp</dimen> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-si/strings.xml b/packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/strings.xml index a1abb64fbf47..b48661c387ab 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-si/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim32Overlay/res/values/strings.xml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?> +<!-- /** * Copyright (c) 2018, The Android Open Source Project * @@ -15,9 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"සිහින් සංචාලන තීරු අත්දැකීම"</string> -</resources> +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Name of overlay [CHAR LIMIT=64] --> + <string name="experiment_navigationbar_overlay">Slim Navigation Bar Experiment (32dp)</string> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlim40Overlay/Android.mk b/packages/overlays/ExperimentNavigationBarSlim40Overlay/Android.mk new file mode 100644 index 000000000000..28354e3a3473 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarSlim40Overlay/Android.mk @@ -0,0 +1,30 @@ +# +# Copyright 2018, The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_RRO_THEME := ExperimentNavigationBarSlim40 +LOCAL_CERTIFICATE := platform + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res + +LOCAL_PACKAGE_NAME := ExperimentNavigationBarSlimOverlay40 +LOCAL_SDK_VERSION := current + +include $(BUILD_RRO_PACKAGE)
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlim40Overlay/AndroidManifest.xml b/packages/overlays/ExperimentNavigationBarSlim40Overlay/AndroidManifest.xml new file mode 100644 index 000000000000..ce8133f3ed40 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarSlim40Overlay/AndroidManifest.xml @@ -0,0 +1,27 @@ +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.android.internal.experiment.navbar.slim40" + android:versionCode="1" + android:versionName="1.0"> + <overlay android:targetPackage="android" + android:category="com.android.internal.experiment_navbar_slim40" + android:priority="1"/> + + <application android:label="@string/experiment_navigationbar_overlay" android:hasCode="false"/> +</manifest>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/config.xml b/packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/config.xml new file mode 100644 index 000000000000..4e65f3399114 --- /dev/null +++ b/packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/** + * Copyright (c) 2018, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<resources> + <!-- Height of the bottom navigation / system bar. --> + <dimen name="navigation_bar_height">40dp</dimen> + <!-- Width of the navigation bar when it is placed vertically on the screen --> + <dimen name="navigation_bar_width">40dp</dimen> + <!-- Height of the bottom navigation / system bar frame; navigation buttons height. --> + <dimen name="navigation_bar_frame_width">40dp</dimen> + <!-- Width of the navigation bar frame when it is placed vertically on the screen --> + <dimen name="navigation_bar_frame_height">40dp</dimen> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ml/strings.xml b/packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/strings.xml index b65afe35950c..8fe3a5c17bba 100644 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ml/strings.xml +++ b/packages/overlays/ExperimentNavigationBarSlim40Overlay/res/values/strings.xml @@ -1,5 +1,5 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- +<?xml version="1.0" encoding="utf-8"?> +<!-- /** * Copyright (c) 2018, The Android Open Source Project * @@ -15,9 +15,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"സ്ലിം നാവിഗേഷൻ ബാർ പരീക്ഷണം"</string> -</resources> +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Name of overlay [CHAR LIMIT=64] --> + <string name="experiment_navigationbar_overlay">Slim Navigation Bar Experiment (40dp)</string> +</resources>
\ No newline at end of file diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kn/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kn/strings.xml deleted file mode 100644 index ccdddea95afa..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-kn/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"ಸ್ಲಿಮ್ ನ್ಯಾವಿಗೇಷನ್ ಬಾರ್ ಪ್ರಯೋಗ"</string> -</resources> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ne/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ne/strings.xml deleted file mode 100644 index 6022b7f495d4..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ne/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"पातलो नेभिगेसन पट्टीको परीक्षण"</string> -</resources> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-or/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-or/strings.xml deleted file mode 100644 index 1db9783d4503..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-or/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"ସ୍ଲିମ୍ ନାଭିଗେସନ୍ ବାର୍ର ପ୍ରୟୋଗ"</string> -</resources> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pa/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pa/strings.xml deleted file mode 100644 index a782f46b2e23..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-pa/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"ਸਲਿਮ ਦਿਸ਼ਾ-ਨਿਰਦੇਸ਼ ਪੱਟੀ ਪ੍ਰਯੋਗ"</string> -</resources> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ta/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ta/strings.xml deleted file mode 100644 index 9e95c3872155..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-ta/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"மெலிதான வழிசெலுத்துதல் பட்டி சோதனை"</string> -</resources> diff --git a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-te/strings.xml b/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-te/strings.xml deleted file mode 100644 index d273ab744d9b..000000000000 --- a/packages/overlays/ExperimentNavigationBarSlimOverlay/res/values-te/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Copyright (c) 2018, The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - --> - -<resources xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="experiment_navigationbar_overlay" msgid="6953777362606036161">"సన్నని నావిగేషన్ పట్టీ ప్రయోగం"</string> -</resources> diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java index 923ac0063baf..0e6f8dda44f6 100644 --- a/services/core/java/com/android/server/StorageManagerService.java +++ b/services/core/java/com/android/server/StorageManagerService.java @@ -2686,24 +2686,35 @@ class StorageManagerService extends IStorageManager.Stub class AppFuseMountScope extends AppFuseBridge.MountScope { boolean opened = false; - public AppFuseMountScope(int uid, int pid, int mountId) { - super(uid, pid, mountId); + public AppFuseMountScope(int uid, int mountId) { + super(uid, mountId); } @Override public ParcelFileDescriptor open() throws NativeDaemonConnectorException { try { return new ParcelFileDescriptor( - mVold.mountAppFuse(uid, Process.myPid(), mountId)); + mVold.mountAppFuse(uid, mountId)); } catch (Exception e) { throw new NativeDaemonConnectorException("Failed to mount", e); } } @Override + public ParcelFileDescriptor openFile(int mountId, int fileId, int flags) + throws NativeDaemonConnectorException { + try { + return new ParcelFileDescriptor( + mVold.openAppFuseFile(uid, mountId, fileId, flags)); + } catch (Exception e) { + throw new NativeDaemonConnectorException("Failed to open", e); + } + } + + @Override public void close() throws Exception { if (opened) { - mVold.unmountAppFuse(uid, Process.myPid(), mountId); + mVold.unmountAppFuse(uid, mountId); opened = false; } } @@ -2713,7 +2724,6 @@ class StorageManagerService extends IStorageManager.Stub public @Nullable AppFuseMount mountProxyFileDescriptorBridge() { Slog.v(TAG, "mountProxyFileDescriptorBridge"); final int uid = Binder.getCallingUid(); - final int pid = Binder.getCallingPid(); while (true) { synchronized (mAppFuseLock) { @@ -2727,7 +2737,7 @@ class StorageManagerService extends IStorageManager.Stub final int name = mNextAppFuseName++; try { return new AppFuseMount( - name, mAppFuseBridge.addBridge(new AppFuseMountScope(uid, pid, name))); + name, mAppFuseBridge.addBridge(new AppFuseMountScope(uid, name))); } catch (FuseUnavailableMountException e) { if (newlyCreated) { // If newly created bridge fails, it's a real error. @@ -2748,14 +2758,13 @@ class StorageManagerService extends IStorageManager.Stub public @Nullable ParcelFileDescriptor openProxyFileDescriptor( int mountId, int fileId, int mode) { Slog.v(TAG, "mountProxyFileDescriptor"); - final int pid = Binder.getCallingPid(); try { synchronized (mAppFuseLock) { if (mAppFuseBridge == null) { Slog.e(TAG, "FuseBridge has not been created"); return null; } - return mAppFuseBridge.openFile(pid, mountId, fileId, mode); + return mAppFuseBridge.openFile(mountId, fileId, mode); } } catch (FuseUnavailableMountException | InterruptedException error) { Slog.v(TAG, "The mount point has already been invalid", error); diff --git a/services/core/java/com/android/server/display/DisplayDevice.java b/services/core/java/com/android/server/display/DisplayDevice.java index 7bfe9ce7017c..6ee5665b9e42 100644 --- a/services/core/java/com/android/server/display/DisplayDevice.java +++ b/services/core/java/com/android/server/display/DisplayDevice.java @@ -225,6 +225,8 @@ abstract class DisplayDevice { viewport.deviceHeight = isRotated ? info.width : info.height; viewport.uniqueId = info.uniqueId; + // TODO(b/112898898) Use an actual port here. + viewport.physicalPort = null; } /** diff --git a/services/core/java/com/android/server/input/ConfigurationProcessor.java b/services/core/java/com/android/server/input/ConfigurationProcessor.java new file mode 100644 index 000000000000..970e86acf8b8 --- /dev/null +++ b/services/core/java/com/android/server/input/ConfigurationProcessor.java @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.input; + +import android.text.TextUtils; +import android.util.Pair; +import android.util.Slog; +import android.util.Xml; + +import com.android.internal.annotations.VisibleForTesting; +import com.android.internal.util.XmlUtils; + +import org.xmlpull.v1.XmlPullParser; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + + +class ConfigurationProcessor { + private static final String TAG = "ConfigurationProcessor"; + + static List<String> processExcludedDeviceNames(InputStream xml) throws Exception { + List<String> names = new ArrayList<>(); + try (InputStreamReader confReader = new InputStreamReader(xml)) { + XmlPullParser parser = Xml.newPullParser(); + parser.setInput(confReader); + XmlUtils.beginDocument(parser, "devices"); + while (true) { + XmlUtils.nextElement(parser); + if (!"device".equals(parser.getName())) { + break; + } + String name = parser.getAttributeValue(null, "name"); + if (name != null) { + names.add(name); + } + } + } + return names; + } + + /** + * Parse the configuration for input port associations. + * + * Configuration format: + * <code> + * <ports> + * <port display="0" input="usb-xhci-hcd.0.auto-1.4.3/input0" /> + * <port display="1" input="usb-xhci-hcd.0.auto-1.4.2/input0" /> + * </ports> + * </code> + * + * In this example, any input device that has physical port of + * "usb-xhci-hcd.0.auto-1.4.3/input0" will be associated with a display + * that has the physical port "0". If such a display does not exist, the input device + * will be disabled and no input events will be dispatched from that input device until a + * matching display appears. Likewise, an input device that has port "..1.4.2.." will have + * its input events forwarded to a display that has physical port of "1". + * + * Note: display port must be a numeric value, and this is checked at runtime for validity. + * At the same time, it is specified as a string for simplicity. + * + * Note: do not confuse "display id" with "display port". + * The "display port" is the physical port on which the display is connected. This could + * be something like HDMI0, HDMI1, etc. For virtual displays, "display port" will be null. + * The "display id" is a way to identify a particular display, and is not a stable API. + * All displays, including virtual ones, will have a display id. + * + * Return the pairs of associations. The first item in the pair is the input port, + * the second item in the pair is the display port. + */ + @VisibleForTesting + static List<Pair<String, String>> processInputPortAssociations(InputStream xml) + throws Exception { + List<Pair<String, String>> associations = new ArrayList<>(); + try (InputStreamReader confReader = new InputStreamReader(xml)) { + XmlPullParser parser = Xml.newPullParser(); + parser.setInput(confReader); + XmlUtils.beginDocument(parser, "ports"); + + while (true) { + XmlUtils.nextElement(parser); + String entryName = parser.getName(); + if (!"port".equals(entryName)) { + break; + } + String inputPort = parser.getAttributeValue(null, "input"); + String displayPort = parser.getAttributeValue(null, "display"); + if (TextUtils.isEmpty(inputPort) || TextUtils.isEmpty(displayPort)) { + // This is likely an error by an OEM during device configuration + Slog.wtf(TAG, "Ignoring incomplete entry"); + continue; + } + try { + Integer.parseUnsignedInt(displayPort); + } catch (NumberFormatException e) { + Slog.wtf(TAG, "Display port should be an integer"); + continue; + } + associations.add(new Pair<>(inputPort, displayPort)); + } + } + return associations; + } +} diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 3339a49c5ed0..d96b6cba119b 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -64,18 +64,18 @@ import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.text.TextUtils; import android.util.Log; +import android.util.Pair; import android.util.Slog; import android.util.SparseArray; -import android.util.Xml; import android.view.Display; import android.view.IInputFilter; import android.view.IInputFilterHost; import android.view.IWindow; -import android.view.InputChannel; import android.view.InputApplicationHandle; -import android.view.InputWindowHandle; +import android.view.InputChannel; import android.view.InputDevice; import android.view.InputEvent; +import android.view.InputWindowHandle; import android.view.KeyEvent; import android.view.PointerIcon; import android.view.Surface; @@ -97,14 +97,13 @@ import com.android.server.policy.WindowManagerPolicy; import libcore.io.IoUtils; import libcore.io.Streams; -import org.xmlpull.v1.XmlPullParser; - import java.io.File; import java.io.FileDescriptor; +import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; @@ -124,6 +123,7 @@ public class InputManagerService extends IInputManager.Stub static final boolean DEBUG = false; private static final String EXCLUDED_DEVICES_PATH = "etc/excluded-input-devices.xml"; + private static final String PORT_ASSOCIATIONS_PATH = "etc/input-port-associations.xml"; private static final int MSG_DELIVER_INPUT_DEVICES_CHANGED = 1; private static final int MSG_SWITCH_KEYBOARD_LAYOUT = 2; @@ -1852,11 +1852,9 @@ public class InputManagerService extends IInputManager.Stub } // Native callback. - private String[] getExcludedDeviceNames() { - ArrayList<String> names = new ArrayList<String>(); - + private static String[] getExcludedDeviceNames() { + List<String> names = new ArrayList<>(); // Read partner-provided list of excluded input devices - XmlPullParser parser = null; // Environment.getRootDirectory() is a fancy way of saying ANDROID_ROOT or "/system". final File[] baseDirs = { Environment.getRootDirectory(), @@ -1864,33 +1862,52 @@ public class InputManagerService extends IInputManager.Stub }; for (File baseDir: baseDirs) { File confFile = new File(baseDir, EXCLUDED_DEVICES_PATH); - FileReader confreader = null; try { - confreader = new FileReader(confFile); - parser = Xml.newPullParser(); - parser.setInput(confreader); - XmlUtils.beginDocument(parser, "devices"); - - while (true) { - XmlUtils.nextElement(parser); - if (!"device".equals(parser.getName())) { - break; - } - String name = parser.getAttributeValue(null, "name"); - if (name != null) { - names.add(name); - } - } + InputStream stream = new FileInputStream(confFile); + names.addAll(ConfigurationProcessor.processExcludedDeviceNames(stream)); } catch (FileNotFoundException e) { // It's ok if the file does not exist. } catch (Exception e) { - Slog.e(TAG, "Exception while parsing '" + confFile.getAbsolutePath() + "'", e); - } finally { - try { if (confreader != null) confreader.close(); } catch (IOException e) { } + Slog.e(TAG, "Could not parse '" + confFile.getAbsolutePath() + "'", e); } } + return names.toArray(new String[0]); + } + + /** + * Flatten a list of pairs into a list, with value positioned directly next to the key + * @return Flattened list + */ + private static <T> List<T> flatten(@NonNull List<Pair<T, T>> pairs) { + List<T> list = new ArrayList<>(pairs.size() * 2); + for (Pair<T, T> pair : pairs) { + list.add(pair.first); + list.add(pair.second); + } + return list; + } + + /** + * Ports are highly platform-specific, so only allow these to be specified in the vendor + * directory. + */ + // Native callback + private static String[] getInputPortAssociations() { + File baseDir = Environment.getVendorDirectory(); + File confFile = new File(baseDir, PORT_ASSOCIATIONS_PATH); - return names.toArray(new String[names.size()]); + try { + InputStream stream = new FileInputStream(confFile); + List<Pair<String, String>> associations = + ConfigurationProcessor.processInputPortAssociations(stream); + List<String> associationList = flatten(associations); + return associationList.toArray(new String[0]); + } catch (FileNotFoundException e) { + // Most of the time, file will not exist, which is expected. + } catch (Exception e) { + Slog.e(TAG, "Could not parse '" + confFile.getAbsolutePath() + "'", e); + } + return new String[0]; } // Native callback. diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java index c18a79fc183c..93b66208e752 100644 --- a/services/core/java/com/android/server/media/MediaSessionService.java +++ b/services/core/java/com/android/server/media/MediaSessionService.java @@ -923,7 +923,7 @@ public class MediaSessionService extends SystemService implements Monitor { @Override public void dispatchMediaKeyEvent(String packageName, boolean asSystemService, KeyEvent keyEvent, boolean needWakeLock) { - if (keyEvent == null || !KeyEvent.isMediaKey(keyEvent.getKeyCode())) { + if (keyEvent == null || !KeyEvent.isMediaSessionKey(keyEvent.getKeyCode())) { Log.w(TAG, "Attempted to dispatch null or non-media key event."); return; } diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java index 21cc14e20bc7..e9b9930600a0 100644 --- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java @@ -144,6 +144,11 @@ public final class DefaultPermissionGrantPolicy { LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION); } + private static final Set<String> ACTIVITY_RECOGNITION_PERMISSIONS = new ArraySet<>(); + static { + ACTIVITY_RECOGNITION_PERMISSIONS.add(Manifest.permission.ACTIVITY_RECOGNITION); + } + private static final Set<String> COARSE_LOCATION_PERMISSIONS = new ArraySet<>(); static { COARSE_LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_COARSE_LOCATION); @@ -624,7 +629,7 @@ public final class DefaultPermissionGrantPolicy { PHONE_PERMISSIONS, SMS_PERMISSIONS, CAMERA_PERMISSIONS, SENSORS_PERMISSIONS, STORAGE_PERMISSIONS); grantSystemFixedPermissionsToSystemPackage(packageName, userId, - LOCATION_PERMISSIONS); + LOCATION_PERMISSIONS, ACTIVITY_RECOGNITION_PERMISSIONS); } } diff --git a/services/core/java/com/android/server/storage/AppFuseBridge.java b/services/core/java/com/android/server/storage/AppFuseBridge.java index 6a0b6489f470..9d6a64701e85 100644 --- a/services/core/java/com/android/server/storage/AppFuseBridge.java +++ b/services/core/java/com/android/server/storage/AppFuseBridge.java @@ -16,6 +16,7 @@ package com.android.server.storage; +import android.os.FileUtils; import android.os.ParcelFileDescriptor; import android.system.ErrnoException; import android.system.Os; @@ -25,8 +26,6 @@ import com.android.internal.os.FuseUnavailableMountException; import com.android.internal.util.Preconditions; import com.android.server.NativeDaemonConnectorException; import libcore.io.IoUtils; -import java.io.File; -import java.io.FileNotFoundException; import java.util.concurrent.CountDownLatch; /** @@ -87,7 +86,7 @@ public class AppFuseBridge implements Runnable { } } - public ParcelFileDescriptor openFile(int pid, int mountId, int fileId, int mode) + public ParcelFileDescriptor openFile(int mountId, int fileId, int mode) throws FuseUnavailableMountException, InterruptedException { final MountScope scope; synchronized (this) { @@ -96,17 +95,14 @@ public class AppFuseBridge implements Runnable { throw new FuseUnavailableMountException(mountId); } } - if (scope.pid != pid) { - throw new SecurityException("PID does not match"); - } final boolean result = scope.waitForMount(); if (result == false) { throw new FuseUnavailableMountException(mountId); } try { - return ParcelFileDescriptor.open( - new File(scope.mountPoint, String.valueOf(fileId)), mode); - } catch (FileNotFoundException error) { + int flags = FileUtils.translateModePfdToPosix(mode); + return scope.openFile(mountId, fileId, flags); + } catch (NativeDaemonConnectorException error) { throw new FuseUnavailableMountException(mountId); } } @@ -131,17 +127,13 @@ public class AppFuseBridge implements Runnable { public static abstract class MountScope implements AutoCloseable { public final int uid; - public final int pid; public final int mountId; - public final File mountPoint; private final CountDownLatch mMounted = new CountDownLatch(1); private boolean mMountResult = false; - public MountScope(int uid, int pid, int mountId) { + public MountScope(int uid, int mountId) { this.uid = uid; - this.pid = pid; this.mountId = mountId; - this.mountPoint = new File(String.format(APPFUSE_MOUNT_NAME_TEMPLATE, uid, mountId)); } @GuardedBy("AppFuseBridge.this") @@ -159,6 +151,8 @@ public class AppFuseBridge implements Runnable { } public abstract ParcelFileDescriptor open() throws NativeDaemonConnectorException; + public abstract ParcelFileDescriptor openFile(int mountId, int fileId, int flags) + throws NativeDaemonConnectorException; } private native long native_new(); diff --git a/services/core/jni/Android.bp b/services/core/jni/Android.bp index bf83ac13fd93..8b873e3f9ad7 100644 --- a/services/core/jni/Android.bp +++ b/services/core/jni/Android.bp @@ -108,6 +108,7 @@ cc_defaults { "android.hardware.contexthub@1.0", "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", + "android.hardware.gnss@2.0", "android.hardware.ir@1.0", "android.hardware.light@2.0", "android.hardware.power@1.0", diff --git a/services/core/jni/com_android_server_input_InputManagerService.cpp b/services/core/jni/com_android_server_input_InputManagerService.cpp index fcd9335874e1..b36a8a7cdf19 100644 --- a/services/core/jni/com_android_server_input_InputManagerService.cpp +++ b/services/core/jni/com_android_server_input_InputManagerService.cpp @@ -32,6 +32,7 @@ #include <atomic> #include <cinttypes> #include <limits.h> +#include <android-base/parseint.h> #include <android-base/stringprintf.h> #include <android_runtime/AndroidRuntime.h> #include <android_runtime/Log.h> @@ -71,6 +72,7 @@ #define INDENT " " +using android::base::ParseUint; using android::base::StringPrintf; namespace android { @@ -81,6 +83,7 @@ namespace android { static const float POINTER_SPEED_EXPONENT = 1.0f / 4; static struct { + jclass clazz; jmethodID notifyConfigurationChanged; jmethodID notifyInputDevicesChanged; jmethodID notifySwitch; @@ -95,6 +98,7 @@ static struct { jmethodID checkInjectEventsPermission; jmethodID getVirtualKeyQuietTimeMillis; jmethodID getExcludedDeviceNames; + jmethodID getInputPortAssociations; jmethodID getKeyRepeatTimeout; jmethodID getKeyRepeatDelay; jmethodID getHoverTapTimeout; @@ -183,6 +187,13 @@ enum { WM_ACTION_PASS_TO_USER = 1, }; +static std::string getStringElementFromJavaArray(JNIEnv* env, jobjectArray array, jsize index) { + jstring item = jstring(env->GetObjectArrayElement(array, index)); + ScopedUtfChars chars(env, item); + std::string result(chars.c_str()); + return result; +} + // --- NativeInputManager --- @@ -452,20 +463,44 @@ void NativeInputManager::getReaderConfiguration(InputReaderConfiguration* outCon } outConfig->excludedDeviceNames.clear(); - jobjectArray excludedDeviceNames = jobjectArray(env->CallObjectMethod(mServiceObj, - gServiceClassInfo.getExcludedDeviceNames)); + jobjectArray excludedDeviceNames = jobjectArray(env->CallStaticObjectMethod( + gServiceClassInfo.clazz, gServiceClassInfo.getExcludedDeviceNames)); if (!checkAndClearExceptionFromCallback(env, "getExcludedDeviceNames") && excludedDeviceNames) { jsize length = env->GetArrayLength(excludedDeviceNames); for (jsize i = 0; i < length; i++) { - jstring item = jstring(env->GetObjectArrayElement(excludedDeviceNames, i)); - const char* deviceNameChars = env->GetStringUTFChars(item, nullptr); - outConfig->excludedDeviceNames.push_back(deviceNameChars); - env->ReleaseStringUTFChars(item, deviceNameChars); - env->DeleteLocalRef(item); + std::string deviceName = getStringElementFromJavaArray(env, excludedDeviceNames, i); + outConfig->excludedDeviceNames.push_back(deviceName); } env->DeleteLocalRef(excludedDeviceNames); } + // Associations between input ports and display ports + // The java method packs the information in the following manner: + // Original data: [{'inputPort1': '1'}, {'inputPort2': '2'}] + // Received data: ['inputPort1', '1', 'inputPort2', '2'] + // So we unpack accordingly here. + outConfig->portAssociations.clear(); + jobjectArray portAssociations = jobjectArray(env->CallStaticObjectMethod( + gServiceClassInfo.clazz, gServiceClassInfo.getInputPortAssociations)); + if (!checkAndClearExceptionFromCallback(env, "getInputPortAssociations") && portAssociations) { + jsize length = env->GetArrayLength(portAssociations); + for (jsize i = 0; i < length / 2; i++) { + std::string inputPort = getStringElementFromJavaArray(env, portAssociations, 2 * i); + std::string displayPortStr = + getStringElementFromJavaArray(env, portAssociations, 2 * i + 1); + uint8_t displayPort; + // Should already have been validated earlier, but do it here for safety. + bool success = ParseUint(displayPortStr, &displayPort); + if (!success) { + ALOGE("Could not parse entry in port configuration file, received: %s", + displayPortStr.c_str()); + continue; + } + outConfig->portAssociations.insert({inputPort, displayPort}); + } + env->DeleteLocalRef(portAssociations); + } + jint hoverTapTimeout = env->CallIntMethod(mServiceObj, gServiceClassInfo.getHoverTapTimeout); if (!checkAndClearExceptionFromCallback(env, "getHoverTapTimeout")) { @@ -1697,6 +1732,10 @@ static const JNINativeMethod gInputManagerMethods[] = { var = env->GetMethodID(clazz, methodName, methodDescriptor); \ LOG_FATAL_IF(! (var), "Unable to find method " methodName); +#define GET_STATIC_METHOD_ID(var, clazz, methodName, methodDescriptor) \ + var = env->GetStaticMethodID(clazz, methodName, methodDescriptor); \ + LOG_FATAL_IF(! (var), "Unable to find static method " methodName); + #define GET_FIELD_ID(var, clazz, fieldName, fieldDescriptor) \ var = env->GetFieldID(clazz, fieldName, fieldDescriptor); \ LOG_FATAL_IF(! (var), "Unable to find field " fieldName); @@ -1711,6 +1750,7 @@ int register_android_server_InputManager(JNIEnv* env) { jclass clazz; FIND_CLASS(clazz, "com/android/server/input/InputManagerService"); + gServiceClassInfo.clazz = clazz; GET_METHOD_ID(gServiceClassInfo.notifyConfigurationChanged, clazz, "notifyConfigurationChanged", "(J)V"); @@ -1754,9 +1794,12 @@ int register_android_server_InputManager(JNIEnv* env) { GET_METHOD_ID(gServiceClassInfo.getVirtualKeyQuietTimeMillis, clazz, "getVirtualKeyQuietTimeMillis", "()I"); - GET_METHOD_ID(gServiceClassInfo.getExcludedDeviceNames, clazz, + GET_STATIC_METHOD_ID(gServiceClassInfo.getExcludedDeviceNames, clazz, "getExcludedDeviceNames", "()[Ljava/lang/String;"); + GET_STATIC_METHOD_ID(gServiceClassInfo.getInputPortAssociations, clazz, + "getInputPortAssociations", "()[Ljava/lang/String;"); + GET_METHOD_ID(gServiceClassInfo.getKeyRepeatTimeout, clazz, "getKeyRepeatTimeout", "()I"); diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp index 92160053804d..4d0556c7507a 100644 --- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp +++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp @@ -20,9 +20,11 @@ #include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/1.1/IGnss.h> +#include <android/hardware/gnss/2.0/IGnss.h> #include <android/hardware/gnss/1.0/IGnssMeasurement.h> #include <android/hardware/gnss/1.1/IGnssMeasurement.h> +#include <android/hardware/gnss/2.0/IGnssMeasurement.h> #include <nativehelper/JNIHelp.h> #include "jni.h" #include "hardware_legacy/power.h" @@ -110,13 +112,15 @@ using android::hidl::base::V1_0::IBase; using IGnss_V1_0 = android::hardware::gnss::V1_0::IGnss; using IGnss_V1_1 = android::hardware::gnss::V1_1::IGnss; +using IGnss_V2_0 = android::hardware::gnss::V2_0::IGnss; using IGnssConfiguration_V1_0 = android::hardware::gnss::V1_0::IGnssConfiguration; using IGnssConfiguration_V1_1 = android::hardware::gnss::V1_1::IGnssConfiguration; using IGnssMeasurement_V1_0 = android::hardware::gnss::V1_0::IGnssMeasurement; using IGnssMeasurement_V1_1 = android::hardware::gnss::V1_1::IGnssMeasurement; +using IGnssMeasurement_V2_0 = android::hardware::gnss::V2_0::IGnssMeasurement; using IGnssMeasurementCallback_V1_0 = android::hardware::gnss::V1_0::IGnssMeasurementCallback; using IGnssMeasurementCallback_V1_1 = android::hardware::gnss::V1_1::IGnssMeasurementCallback; - +using IGnssMeasurementCallback_V2_0 = android::hardware::gnss::V2_0::IGnssMeasurementCallback; struct GnssDeathRecipient : virtual public hidl_death_recipient { @@ -135,6 +139,7 @@ static const uint32_t ADR_STATE_HALF_CYCLE_REPORTED = (1<<4); sp<GnssDeathRecipient> gnssHalDeathRecipient = nullptr; sp<IGnss_V1_0> gnssHal = nullptr; sp<IGnss_V1_1> gnssHal_V1_1 = nullptr; +sp<IGnss_V2_0> gnssHal_V2_0 = nullptr; sp<IGnssXtra> gnssXtraIface = nullptr; sp<IAGnssRil> agnssRilIface = nullptr; sp<IGnssGeofencing> gnssGeofencingIface = nullptr; @@ -146,6 +151,7 @@ sp<IGnssConfiguration_V1_1> gnssConfigurationIface_V1_1 = nullptr; sp<IGnssNi> gnssNiIface = nullptr; sp<IGnssMeasurement_V1_0> gnssMeasurementIface = nullptr; sp<IGnssMeasurement_V1_1> gnssMeasurementIface_V1_1 = nullptr; +sp<IGnssMeasurement_V2_0> gnssMeasurementIface_V2_0 = nullptr; sp<IGnssNavigationMessage> gnssNavigationMessageIface = nullptr; #define WAKE_LOCK_NAME "GPS" @@ -744,7 +750,9 @@ Return<void> GnssNavigationMessageCallback::gnssNavigationMessageCb( * GnssMeasurementCallback implements the callback methods required for the * GnssMeasurement interface. */ -struct GnssMeasurementCallback : public IGnssMeasurementCallback_V1_1 { +struct GnssMeasurementCallback : public IGnssMeasurementCallback_V2_0 { + Return<void> gnssMeasurementCb_2_0(const IGnssMeasurementCallback_V2_0::GnssData& data) + override; Return<void> gnssMeasurementCb(const IGnssMeasurementCallback_V1_1::GnssData& data) override; Return<void> GnssMeasurementCb(const IGnssMeasurementCallback_V1_0::GnssData& data) override; private: @@ -761,6 +769,11 @@ struct GnssMeasurementCallback : public IGnssMeasurementCallback_V1_1 { void setMeasurementData(JNIEnv* env, jobject clock, jobjectArray measurementArray); }; +Return<void> GnssMeasurementCallback::gnssMeasurementCb_2_0( + const IGnssMeasurementCallback_V2_0::GnssData& data) { + // TODO(b/119571122): implement gnssMeasurementCb_2_0 + return Void(); +} Return<void> GnssMeasurementCallback::gnssMeasurementCb( const IGnssMeasurementCallback_V1_1::GnssData& data) { @@ -1126,13 +1139,22 @@ Return<void> GnssBatchingCallback::gnssLocationBatchCb(const hidl_vec<GnssLocati } static void android_location_GnssLocationProvider_class_init_native(JNIEnv* env, jclass clazz) { + gnssHal_V2_0 = IGnss_V2_0::getService(); + if (gnssHal_V2_0 != nullptr) { + gnssHal = gnssHal_V2_0; + gnssHal_V1_1 = gnssHal_V2_0; + return; + } + + ALOGD("gnssHal 2.0 was null, trying 1.1"); gnssHal_V1_1 = IGnss_V1_1::getService(); - if (gnssHal_V1_1 == nullptr) { - ALOGD("gnssHal 1.1 was null, trying 1.0"); - gnssHal = IGnss_V1_0::getService(); - } else { + if (gnssHal_V1_1 != nullptr) { gnssHal = gnssHal_V1_1; + return; } + + ALOGD("gnssHal 1.1 was null, trying 1.0"); + gnssHal = IGnss_V1_0::getService(); } static void android_location_GnssLocationProvider_init_once(JNIEnv* env, jclass clazz) { @@ -1187,110 +1209,120 @@ static void android_location_GnssLocationProvider_init_once(JNIEnv* env, jclass LOG_ALWAYS_FATAL("Unable to get Java VM. Error: %d", jvmStatus); } - if (gnssHal != nullptr) { - gnssHalDeathRecipient = new GnssDeathRecipient(); - hardware::Return<bool> linked = gnssHal->linkToDeath( - gnssHalDeathRecipient, /*cookie*/ 0); - if (!linked.isOk()) { - ALOGE("Transaction error in linking to GnssHAL death: %s", - linked.description().c_str()); - } else if (!linked) { - ALOGW("Unable to link to GnssHal death notifications"); - } else { - ALOGD("Link to death notification successful"); - } + if (gnssHal == nullptr) { + ALOGE("Unable to get GPS service\n"); + return; + } - auto gnssXtra = gnssHal->getExtensionXtra(); - if (!gnssXtra.isOk()) { - ALOGD("Unable to get a handle to Xtra"); - } else { - gnssXtraIface = gnssXtra; - } + gnssHalDeathRecipient = new GnssDeathRecipient(); + hardware::Return<bool> linked = gnssHal->linkToDeath(gnssHalDeathRecipient, /*cookie*/ 0); + if (!linked.isOk()) { + ALOGE("Transaction error in linking to GnssHAL death: %s", + linked.description().c_str()); + } else if (!linked) { + ALOGW("Unable to link to GnssHal death notifications"); + } else { + ALOGD("Link to death notification successful"); + } - auto gnssRil = gnssHal->getExtensionAGnssRil(); - if (!gnssRil.isOk()) { - ALOGD("Unable to get a handle to AGnssRil"); - } else { - agnssRilIface = gnssRil; - } + auto gnssXtra = gnssHal->getExtensionXtra(); + if (!gnssXtra.isOk()) { + ALOGD("Unable to get a handle to Xtra"); + } else { + gnssXtraIface = gnssXtra; + } - auto gnssAgnss = gnssHal->getExtensionAGnss(); - if (!gnssAgnss.isOk()) { - ALOGD("Unable to get a handle to AGnss"); - } else { - agnssIface = gnssAgnss; - } + auto gnssRil = gnssHal->getExtensionAGnssRil(); + if (!gnssRil.isOk()) { + ALOGD("Unable to get a handle to AGnssRil"); + } else { + agnssRilIface = gnssRil; + } - auto gnssNavigationMessage = gnssHal->getExtensionGnssNavigationMessage(); - if (!gnssNavigationMessage.isOk()) { - ALOGD("Unable to get a handle to GnssNavigationMessage"); - } else { - gnssNavigationMessageIface = gnssNavigationMessage; - } + auto gnssAgnss = gnssHal->getExtensionAGnss(); + if (!gnssAgnss.isOk()) { + ALOGD("Unable to get a handle to AGnss"); + } else { + agnssIface = gnssAgnss; + } - if (gnssHal_V1_1 != nullptr) { - auto gnssMeasurement = gnssHal_V1_1->getExtensionGnssMeasurement_1_1(); - if (!gnssMeasurement.isOk()) { - ALOGD("Unable to get a handle to GnssMeasurement"); - } else { - gnssMeasurementIface_V1_1 = gnssMeasurement; - gnssMeasurementIface = gnssMeasurementIface_V1_1; - } - } else { - auto gnssMeasurement_V1_0 = gnssHal->getExtensionGnssMeasurement(); - if (!gnssMeasurement_V1_0.isOk()) { - ALOGD("Unable to get a handle to GnssMeasurement"); - } else { - gnssMeasurementIface = gnssMeasurement_V1_0; - } - } + auto gnssNavigationMessage = gnssHal->getExtensionGnssNavigationMessage(); + if (!gnssNavigationMessage.isOk()) { + ALOGD("Unable to get a handle to GnssNavigationMessage"); + } else { + gnssNavigationMessageIface = gnssNavigationMessage; + } - auto gnssDebug = gnssHal->getExtensionGnssDebug(); - if (!gnssDebug.isOk()) { - ALOGD("Unable to get a handle to GnssDebug"); + if (gnssHal_V2_0 != nullptr) { + // TODO(b/119638366): getExtensionGnssMeasurement_1_1 from gnssHal_V2_0 + auto gnssMeasurement = gnssHal_V2_0->getExtensionGnssMeasurement_2_0(); + if (!gnssMeasurement.isOk()) { + ALOGD("Unable to get a handle to GnssMeasurement_V2_0"); } else { - gnssDebugIface = gnssDebug; + gnssMeasurementIface_V2_0 = gnssMeasurement; + gnssMeasurementIface_V1_1 = gnssMeasurementIface_V2_0; + gnssMeasurementIface = gnssMeasurementIface_V2_0; } + } else if (gnssHal_V1_1 != nullptr) { + auto gnssMeasurement = gnssHal_V1_1->getExtensionGnssMeasurement_1_1(); + if (!gnssMeasurement.isOk()) { + ALOGD("Unable to get a handle to GnssMeasurement_V1_1"); + } else { + gnssMeasurementIface_V1_1 = gnssMeasurement; + gnssMeasurementIface = gnssMeasurementIface_V1_1; + } + } else { + auto gnssMeasurement_V1_0 = gnssHal->getExtensionGnssMeasurement(); + if (!gnssMeasurement_V1_0.isOk()) { + ALOGD("Unable to get a handle to GnssMeasurement"); + } else { + gnssMeasurementIface = gnssMeasurement_V1_0; + } + } - auto gnssNi = gnssHal->getExtensionGnssNi(); - if (!gnssNi.isOk()) { - ALOGD("Unable to get a handle to GnssNi"); - } else { - gnssNiIface = gnssNi; - } + auto gnssDebug = gnssHal->getExtensionGnssDebug(); + if (!gnssDebug.isOk()) { + ALOGD("Unable to get a handle to GnssDebug"); + } else { + gnssDebugIface = gnssDebug; + } - if (gnssHal_V1_1 != nullptr) { - auto gnssConfiguration = gnssHal_V1_1->getExtensionGnssConfiguration_1_1(); - if (!gnssConfiguration.isOk()) { - ALOGD("Unable to get a handle to GnssConfiguration"); - } else { - gnssConfigurationIface_V1_1 = gnssConfiguration; - gnssConfigurationIface = gnssConfigurationIface_V1_1; - } - } else { - auto gnssConfiguration_V1_0 = gnssHal->getExtensionGnssConfiguration(); - if (!gnssConfiguration_V1_0.isOk()) { - ALOGD("Unable to get a handle to GnssConfiguration"); - } else { - gnssConfigurationIface = gnssConfiguration_V1_0; - } - } + auto gnssNi = gnssHal->getExtensionGnssNi(); + if (!gnssNi.isOk()) { + ALOGD("Unable to get a handle to GnssNi"); + } else { + gnssNiIface = gnssNi; + } - auto gnssGeofencing = gnssHal->getExtensionGnssGeofencing(); - if (!gnssGeofencing.isOk()) { - ALOGD("Unable to get a handle to GnssGeofencing"); + if (gnssHal_V1_1 != nullptr) { + auto gnssConfiguration = gnssHal_V1_1->getExtensionGnssConfiguration_1_1(); + if (!gnssConfiguration.isOk()) { + ALOGD("Unable to get a handle to GnssConfiguration"); } else { - gnssGeofencingIface = gnssGeofencing; + gnssConfigurationIface_V1_1 = gnssConfiguration; + gnssConfigurationIface = gnssConfigurationIface_V1_1; } - - auto gnssBatching = gnssHal->getExtensionGnssBatching(); - if (!gnssBatching.isOk()) { - ALOGD("Unable to get a handle to gnssBatching"); + } else { + auto gnssConfiguration_V1_0 = gnssHal->getExtensionGnssConfiguration(); + if (!gnssConfiguration_V1_0.isOk()) { + ALOGD("Unable to get a handle to GnssConfiguration"); } else { - gnssBatchingIface = gnssBatching; + gnssConfigurationIface = gnssConfiguration_V1_0; } + } + + auto gnssGeofencing = gnssHal->getExtensionGnssGeofencing(); + if (!gnssGeofencing.isOk()) { + ALOGD("Unable to get a handle to GnssGeofencing"); + } else { + gnssGeofencingIface = gnssGeofencing; + } + + auto gnssBatching = gnssHal->getExtensionGnssBatching(); + if (!gnssBatching.isOk()) { + ALOGD("Unable to get a handle to gnssBatching"); } else { - ALOGE("Unable to get GPS service\n"); + gnssBatchingIface = gnssBatching; } } @@ -1820,10 +1852,11 @@ static jboolean android_location_GnssMeasurementsProvider_start_measurement_coll sp<GnssMeasurementCallback> cbIface = new GnssMeasurementCallback(); IGnssMeasurement_V1_0::GnssMeasurementStatus result = - IGnssMeasurement_V1_0::GnssMeasurementStatus::ERROR_GENERIC;; - if (gnssMeasurementIface_V1_1 != nullptr) { - result = gnssMeasurementIface_V1_1->setCallback_1_1(cbIface, - enableFullTracking); + IGnssMeasurement_V1_0::GnssMeasurementStatus::ERROR_GENERIC; + if (gnssMeasurementIface_V2_0 != nullptr) { + result = gnssMeasurementIface_V2_0->setCallback_2_0(cbIface, enableFullTracking); + } else if (gnssMeasurementIface_V1_1 != nullptr) { + result = gnssMeasurementIface_V1_1->setCallback_1_1(cbIface, enableFullTracking); } else { if (enableFullTracking == JNI_TRUE) { // full tracking mode not supported in 1.0 HAL @@ -1837,7 +1870,7 @@ static jboolean android_location_GnssMeasurementsProvider_start_measurement_coll static_cast<int32_t>(result)); return JNI_FALSE; } else { - ALOGD("gnss measurement infc has been enabled"); + ALOGD("gnss measurement infc has been enabled"); } return JNI_TRUE; diff --git a/services/tests/servicestests/AndroidManifest.xml b/services/tests/servicestests/AndroidManifest.xml index fa17b6125983..746c4530a5e1 100644 --- a/services/tests/servicestests/AndroidManifest.xml +++ b/services/tests/servicestests/AndroidManifest.xml @@ -143,9 +143,6 @@ <activity android:name="com.android.server.pm.BaseShortcutManagerTest$ShortcutActivity2" /> <activity android:name="com.android.server.pm.BaseShortcutManagerTest$ShortcutActivity3" /> - <activity android:name="com.android.server.wm.ScreenDecorWindowTests$TestActivity" - android:showWhenLocked="true"/> - <activity android:name="com.android.server.pm.ShortcutTestActivity" android:enabled="true" android:exported="true" /> @@ -206,12 +203,6 @@ </intent-filter> </activity-alias> - <activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityA" /> - <activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityB" /> - <activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityRequestedOrientationChange" /> - <activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityTaskChangeCallbacks" /> - <activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityTaskDescriptionChange" /> - <receiver android:name="com.android.server.appwidget.DummyAppWidget"> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> diff --git a/services/tests/servicestests/res/raw/input_port_associations.xml b/services/tests/servicestests/res/raw/input_port_associations.xml new file mode 100644 index 000000000000..b10d541f942c --- /dev/null +++ b/services/tests/servicestests/res/raw/input_port_associations.xml @@ -0,0 +1,4 @@ +<ports> + <port display="0" input="USB1" /> + <port display="1" input="USB2" /> +</ports>
\ No newline at end of file diff --git a/services/tests/servicestests/res/raw/input_port_associations_bad_displayport.xml b/services/tests/servicestests/res/raw/input_port_associations_bad_displayport.xml new file mode 100644 index 000000000000..8eeb1f58ef9e --- /dev/null +++ b/services/tests/servicestests/res/raw/input_port_associations_bad_displayport.xml @@ -0,0 +1,3 @@ +<ports> + <port display="a" input="USB1" /> +</ports>
\ No newline at end of file diff --git a/services/tests/servicestests/res/raw/input_port_associations_bad_xml.xml b/services/tests/servicestests/res/raw/input_port_associations_bad_xml.xml new file mode 100644 index 000000000000..cf6e12486239 --- /dev/null +++ b/services/tests/servicestests/res/raw/input_port_associations_bad_xml.xml @@ -0,0 +1,3 @@ +<ports> + <port Garbage data inside xml> +</ports>
\ No newline at end of file diff --git a/services/tests/servicestests/src/com/android/server/input/ConfigurationProcessorTest.java b/services/tests/servicestests/src/com/android/server/input/ConfigurationProcessorTest.java new file mode 100644 index 000000000000..636aa375a84c --- /dev/null +++ b/services/tests/servicestests/src/com/android/server/input/ConfigurationProcessorTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.input; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import android.content.Context; +import android.util.Pair; + +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.InputStream; +import java.util.List; + +/** + * Build/Install/Run: + * atest ConfigurationProcessorTest + */ +@RunWith(AndroidJUnit4.class) +public class ConfigurationProcessorTest { + + private Context mContext; + + @Before + public void setUp() throws Exception { + mContext = InstrumentationRegistry.getContext(); + } + + @Test + public void testGetInputPortAssociations() { + final int res = com.android.frameworks.servicestests.R.raw.input_port_associations; + InputStream xml = mContext.getResources().openRawResource(res); + List<Pair<String, String>> associations = null; + try { + associations = ConfigurationProcessor.processInputPortAssociations(xml); + } catch (Exception e) { + fail("Could not process xml file for input associations"); + } + assertNotNull(associations); + assertEquals(2, associations.size()); + assertTrue(associations.contains(Pair.create("USB1", "0"))); + assertTrue(associations.contains(Pair.create("USB2", "1"))); + } + + @Test + public void testGetInputPortAssociationsBadDisplayport() { + final int res = + com.android.frameworks.servicestests.R.raw.input_port_associations_bad_displayport; + InputStream xml = mContext.getResources().openRawResource(res); + List<Pair<String, String>> associations = null; + try { + associations = ConfigurationProcessor.processInputPortAssociations(xml); + } catch (Exception e) { + fail("Could not process xml file for input associations"); + } + assertNotNull(associations); + assertEquals(0, associations.size()); + } + + @Test + public void testGetInputPortAssociationsEmptyConfig() { + final int res = com.android.frameworks.servicestests.R.raw.input_port_associations_bad_xml; + InputStream xml = mContext.getResources().openRawResource(res); + try { + ConfigurationProcessor.processInputPortAssociations(xml); + fail("Parsing should fail, because xml contains bad data"); + } catch (Exception e) { + // This is expected + } + } +} diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java deleted file mode 100644 index 2e47c353d8c2..000000000000 --- a/services/tests/servicestests/src/com/android/server/wm/WindowTestUtils.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm; - -import static android.app.AppOpsManager.OP_NONE; -import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; - -import static com.android.server.wm.WindowContainer.POSITION_TOP; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.anyFloat; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; - -import android.app.ActivityManager; -import android.content.ComponentName; -import android.content.res.Configuration; -import android.graphics.Rect; -import android.os.Binder; -import android.os.IBinder; -import android.view.IApplicationToken; -import android.view.IWindow; -import android.view.SurfaceControl.Transaction; -import android.view.WindowManager; - -import org.mockito.invocation.InvocationOnMock; - -/** - * A collection of static functions that can be referenced by other test packages to provide access - * to WindowManager related test functionality. - */ -public class WindowTestUtils { - private static int sNextTaskId = 0; - - /** - * Creates a mock instance of {@link StackWindowController}. - */ - public static StackWindowController createMockStackWindowContainerController() { - StackWindowController controller = mock(StackWindowController.class); - controller.mContainer = mock(TestTaskStack.class); - - // many components rely on the {@link StackWindowController#adjustConfigurationForBounds} - // to properly set bounds values in the configuration. We must mimick those actions here. - doAnswer((InvocationOnMock invocationOnMock) -> { - final Configuration config = invocationOnMock.<Configuration>getArgument(7); - final Rect bounds = invocationOnMock.<Rect>getArgument(0); - config.windowConfiguration.setBounds(bounds); - return null; - }).when(controller).adjustConfigurationForBounds(any(), any(), any(), any(), - anyBoolean(), anyBoolean(), anyFloat(), any(), any(), anyInt()); - - return controller; - } - - /** Creates a {@link Task} and adds it to the specified {@link TaskStack}. */ - public static Task createTaskInStack(WindowManagerService service, TaskStack stack, - int userId) { - synchronized (service.mGlobalLock) { - final Task newTask = new Task(sNextTaskId++, stack, userId, service, 0, false, - new ActivityManager.TaskDescription(), null); - stack.addTask(newTask, POSITION_TOP); - return newTask; - } - } - - /** - * An extension of {@link TestTaskStack}, which overrides package scoped methods that would not - * normally be mocked out. - */ - public static class TestTaskStack extends TaskStack { - TestTaskStack(WindowManagerService service, int stackId) { - super(service, stackId, null); - } - - @Override - void addTask(Task task, int position, boolean showForAllUsers, boolean moveParents) { - // Do nothing. - } - } - - static TestAppWindowToken createTestAppWindowToken(DisplayContent dc) { - synchronized (dc.mService.mGlobalLock) { - return new TestAppWindowToken(dc); - } - } - - /** Used so we can gain access to some protected members of the {@link AppWindowToken} class. */ - public static class TestAppWindowToken extends AppWindowToken { - boolean mOnTop = false; - private Transaction mPendingTransactionOverride; - - private TestAppWindowToken(DisplayContent dc) { - super(dc.mService, new IApplicationToken.Stub() { - public String getName() {return null;} - }, new ComponentName("", ""), false, dc, true /* fillsParent */); - } - - TestAppWindowToken(WindowManagerService service, IApplicationToken token, - ComponentName activityComponent, boolean voiceInteraction, DisplayContent dc, - long inputDispatchingTimeoutNanos, boolean fullscreen, boolean showForAllUsers, - int targetSdk, int orientation, int rotationAnimationHint, int configChanges, - boolean launchTaskBehind, boolean alwaysFocusable, ActivityRecord activityRecord) { - super(service, token, activityComponent, voiceInteraction, dc, - inputDispatchingTimeoutNanos, fullscreen, showForAllUsers, targetSdk, - orientation, rotationAnimationHint, configChanges, launchTaskBehind, - alwaysFocusable, activityRecord); - } - - int getWindowsCount() { - return mChildren.size(); - } - - boolean hasWindow(WindowState w) { - return mChildren.contains(w); - } - - WindowState getFirstChild() { - return mChildren.peekFirst(); - } - - WindowState getLastChild() { - return mChildren.peekLast(); - } - - int positionInParent() { - return getParent().mChildren.indexOf(this); - } - - void setIsOnTop(boolean onTop) { - mOnTop = onTop; - } - - @Override - boolean isOnTop() { - return mOnTop; - } - - void setPendingTransaction(Transaction transaction) { - mPendingTransactionOverride = transaction; - } - - @Override - public Transaction getPendingTransaction() { - return mPendingTransactionOverride == null - ? super.getPendingTransaction() - : mPendingTransactionOverride; - } - } - - static TestWindowToken createTestWindowToken(int type, DisplayContent dc) { - return createTestWindowToken(type, dc, false /* persistOnEmpty */); - } - - static TestWindowToken createTestWindowToken(int type, DisplayContent dc, - boolean persistOnEmpty) { - synchronized (dc.mService.mGlobalLock) { - return new TestWindowToken(type, dc, persistOnEmpty); - } - } - - /* Used so we can gain access to some protected members of the {@link WindowToken} class */ - public static class TestWindowToken extends WindowToken { - - private TestWindowToken(int type, DisplayContent dc, boolean persistOnEmpty) { - super(dc.mService, mock(IBinder.class), type, persistOnEmpty, dc, - false /* ownerCanManageAppTokens */); - } - - int getWindowsCount() { - return mChildren.size(); - } - - boolean hasWindow(WindowState w) { - return mChildren.contains(w); - } - } - - /* Used so we can gain access to some protected members of the {@link Task} class */ - public static class TestTask extends Task { - boolean mShouldDeferRemoval = false; - boolean mOnDisplayChangedCalled = false; - private boolean mIsAnimating = false; - - TestTask(int taskId, TaskStack stack, int userId, WindowManagerService service, - int resizeMode, boolean supportsPictureInPicture, - TaskWindowContainerController controller) { - super(taskId, stack, userId, service, resizeMode, supportsPictureInPicture, - new ActivityManager.TaskDescription(), controller); - } - - boolean shouldDeferRemoval() { - return mShouldDeferRemoval; - } - - int positionInParent() { - return getParent().mChildren.indexOf(this); - } - - @Override - void onDisplayChanged(DisplayContent dc) { - super.onDisplayChanged(dc); - mOnDisplayChangedCalled = true; - } - - @Override - boolean isSelfAnimating() { - return mIsAnimating; - } - - void setLocalIsAnimating(boolean isAnimating) { - mIsAnimating = isAnimating; - } - } - - /** - * Used so we can gain access to some protected members of {@link TaskWindowContainerController} - * class. - */ - public static class TestTaskWindowContainerController extends TaskWindowContainerController { - - static final TaskWindowContainerListener NOP_LISTENER = new TaskWindowContainerListener() { - @Override - public void registerConfigurationChangeListener( - ConfigurationContainerListener listener) { - } - - @Override - public void unregisterConfigurationChangeListener( - ConfigurationContainerListener listener) { - } - - @Override - public void onSnapshotChanged(ActivityManager.TaskSnapshot snapshot) { - } - - @Override - public void requestResize(Rect bounds, int resizeMode) { - } - }; - - TestTaskWindowContainerController(WindowTestsBase testsBase) { - this(testsBase.createStackControllerOnDisplay(testsBase.mDisplayContent)); - } - - TestTaskWindowContainerController(StackWindowController stackController) { - super(sNextTaskId++, NOP_LISTENER, stackController, 0 /* userId */, null /* bounds */, - RESIZE_MODE_UNRESIZEABLE, false /* supportsPictureInPicture */, true /* toTop*/, - true /* showForAllUsers */, new ActivityManager.TaskDescription(), - stackController.mService); - } - - @Override - TestTask createTask(int taskId, TaskStack stack, int userId, int resizeMode, - boolean supportsPictureInPicture, ActivityManager.TaskDescription taskDescription) { - return new TestTask(taskId, stack, userId, mService, resizeMode, - supportsPictureInPicture, this); - } - } - - public static class TestIApplicationToken implements IApplicationToken { - - private final Binder mBinder = new Binder(); - @Override - public IBinder asBinder() { - return mBinder; - } - @Override - public String getName() { - return null; - } - } - - /** Used to track resize reports. */ - public static class TestWindowState extends WindowState { - boolean resizeReported; - - TestWindowState(WindowManagerService service, Session session, IWindow window, - WindowManager.LayoutParams attrs, WindowToken token) { - super(service, session, window, token, null, OP_NONE, 0, attrs, 0, 0, - false /* ownerCanAddInternalSystemWindow */); - } - - @Override - void reportResized() { - super.reportResized(); - resizeReported = true; - } - - @Override - public boolean isGoneForLayoutLw() { - return false; - } - - @Override - void updateResizingWindowIfNeeded() { - // Used in AppWindowTokenTests#testLandscapeSeascapeRotationRelayout to deceive - // the system that it can actually update the window. - boolean hadSurface = mHasSurface; - mHasSurface = true; - - super.updateResizingWindowIfNeeded(); - - mHasSurface = hadSurface; - } - } -} diff --git a/services/tests/wmtests/AndroidManifest.xml b/services/tests/wmtests/AndroidManifest.xml index 67acec689244..3f3b99692e9c 100644 --- a/services/tests/wmtests/AndroidManifest.xml +++ b/services/tests/wmtests/AndroidManifest.xml @@ -34,6 +34,8 @@ <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" /> <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> + <uses-permission android:name="android.permission.WAKE_LOCK" /> + <uses-permission android:name="android.permission.REORDER_TASKS" /> <application android:debuggable="true" android:testOnly="true"> diff --git a/services/tests/servicestests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java b/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java index a9071612a725..5556a150cf3a 100644 --- a/services/tests/servicestests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AnimatingAppWindowTokenRegistryTest.java @@ -19,12 +19,12 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions; + import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; - import android.platform.test.annotations.Presubmit; import androidx.test.filters.FlakyTest; diff --git a/services/tests/servicestests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java index 5e12a950c560..5e12a950c560 100644 --- a/services/tests/servicestests/src/com/android/server/wm/AppTransitionControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java diff --git a/services/tests/servicestests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java index 19d18cab931e..577859cf2107 100644 --- a/services/tests/servicestests/src/com/android/server/wm/AppTransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java @@ -24,13 +24,14 @@ import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; + import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.spy; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; diff --git a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenAnimationTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java index 4522494349a3..dcfb8797eaba 100644 --- a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenAnimationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenAnimationTests.java @@ -20,11 +20,12 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.SurfaceControl.Transaction; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; + import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.verify; import android.view.SurfaceControl; diff --git a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index 99abbf7b1f3a..8653bf96d984 100644 --- a/services/tests/servicestests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -34,14 +34,15 @@ import static android.view.WindowManager.TRANSIT_UNSET; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.spy; import android.graphics.Point; import android.graphics.Rect; @@ -118,7 +119,8 @@ public class AppWindowTokenTests extends WindowTestsBase { assertEquals(window1, mToken.findMainWindow()); window1.mAnimatingExit = true; assertEquals(window1, mToken.findMainWindow()); - final WindowState window2 = createWindow(null, TYPE_APPLICATION_STARTING, mToken, "window2"); + final WindowState window2 = createWindow(null, TYPE_APPLICATION_STARTING, mToken, + "window2"); assertEquals(window2, mToken.findMainWindow()); mToken.removeImmediately(); } @@ -156,7 +158,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.updateOrientationFromAppTokens(mDisplayContent.getOverrideConfiguration(), null, mDisplayContent.getDisplayId()); assertEquals(SCREEN_ORIENTATION_LANDSCAPE, mDisplayContent.getLastOrientation()); - appWindow.resizeReported = false; + appWindow.mResizeReported = false; // Update the orientation to perform 180 degree rotation and check that resize was reported. mToken.setOrientation(SCREEN_ORIENTATION_REVERSE_LANDSCAPE); @@ -164,7 +166,7 @@ public class AppWindowTokenTests extends WindowTestsBase { mDisplayContent.getDisplayId()); mWm.mRoot.performSurfacePlacement(false /* recoveringMemory */); assertEquals(SCREEN_ORIENTATION_REVERSE_LANDSCAPE, mDisplayContent.getLastOrientation()); - assertTrue(appWindow.resizeReported); + assertTrue(appWindow.mResizeReported); appWindow.removeImmediately(); } @@ -185,11 +187,11 @@ public class AppWindowTokenTests extends WindowTestsBase { // Set initial orientation and update. performRotation(spiedRotation, Surface.ROTATION_90); - appWindow.resizeReported = false; + appWindow.mResizeReported = false; // Update the rotation to perform 180 degree rotation and check that resize was reported. performRotation(spiedRotation, Surface.ROTATION_270); - assertTrue(appWindow.resizeReported); + assertTrue(appWindow.mResizeReported); appWindow.removeImmediately(); } @@ -221,7 +223,8 @@ public class AppWindowTokenTests extends WindowTestsBase { // Can not specify orientation if app isn't visible even though it fills parent. assertEquals(SCREEN_ORIENTATION_UNSET, mToken.getOrientation()); // Can specify orientation if the current orientation candidate is orientation behind. - assertEquals(SCREEN_ORIENTATION_LANDSCAPE, mToken.getOrientation(SCREEN_ORIENTATION_BEHIND)); + assertEquals(SCREEN_ORIENTATION_LANDSCAPE, + mToken.getOrientation(SCREEN_ORIENTATION_BEHIND)); } @Test @@ -247,7 +250,8 @@ public class AppWindowTokenTests extends WindowTestsBase { // Finish relaunching and ensure flag is now not reported mToken.finishRelaunching(); - assertFalse(mToken.containsShowWhenLockedWindow() || mToken.containsDismissKeyguardWindow()); + assertFalse( + mToken.containsShowWhenLockedWindow() || mToken.containsDismissKeyguardWindow()); } @Test diff --git a/services/tests/servicestests/src/com/android/server/wm/BoundsAnimationControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/BoundsAnimationControllerTests.java index 1c5391ed3a6c..1c5391ed3a6c 100644 --- a/services/tests/servicestests/src/com/android/server/wm/BoundsAnimationControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/BoundsAnimationControllerTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/DimmerTests.java b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java index a6415d1f2b1f..ee1c8dfdd319 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DimmerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DimmerTests.java @@ -16,16 +16,17 @@ package com.android.server.wm; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 43e10f0a5f06..3b8d71dd8176 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -29,6 +29,10 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.WindowContainer.POSITION_TOP; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; @@ -39,10 +43,6 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import android.annotation.SuppressLint; import android.content.res.Configuration; diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyInsetsTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyInsetsTests.java index 18bd2e45acd4..6767465f838c 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyInsetsTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyInsetsTests.java @@ -28,14 +28,11 @@ import android.platform.test.annotations.Presubmit; import android.view.DisplayInfo; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ErrorCollector; -import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) @SmallTest @Presubmit public class DisplayPolicyInsetsTests extends DisplayPolicyTestsBase { diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java index a91c5e79ccfc..b94f472965ab 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java @@ -46,15 +46,12 @@ import android.view.DisplayInfo; import android.view.WindowManager; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import com.android.server.wm.utils.WmDisplayCutout; import org.junit.Before; import org.junit.Test; -import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) @SmallTest @Presubmit public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java index 07d5fea334cd..8349ac7fc62c 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java @@ -42,12 +42,9 @@ import android.platform.test.annotations.Presubmit; import android.view.WindowManager; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Test; -import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) @SmallTest @Presubmit public class DisplayPolicyTests extends WindowTestsBase { diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java index 1d63c57e6cfe..1d63c57e6cfe 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayPolicyTestsBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTestsBase.java diff --git a/services/tests/servicestests/src/com/android/server/wm/DisplayWindowSettingsTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java index 7f390a55232d..8e881b54c422 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DisplayWindowSettingsTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java @@ -21,6 +21,12 @@ import static android.view.WindowManager.REMOVE_CONTENT_MODE_MOVE_TO_PRIMARY; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; @@ -28,11 +34,6 @@ import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import android.app.WindowConfiguration; import android.platform.test.annotations.Presubmit; diff --git a/services/tests/servicestests/src/com/android/server/wm/DockedStackDividerControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/DockedStackDividerControllerTests.java index a04bf16eaf1c..32062080a22c 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DockedStackDividerControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DockedStackDividerControllerTests.java @@ -30,12 +30,9 @@ import static org.junit.Assert.assertTrue; import android.platform.test.annotations.Presubmit; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; import org.junit.Test; -import org.junit.runner.RunWith; -@RunWith(AndroidJUnit4.class) @SmallTest @Presubmit public class DockedStackDividerControllerTests { diff --git a/services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java index ad293d963f3e..f1c6eab2143d 100644 --- a/services/tests/servicestests/src/com/android/server/wm/DragDropControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DragDropControllerTests.java @@ -20,13 +20,14 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; import android.content.ClipData; import android.graphics.PixelFormat; diff --git a/services/tests/servicestests/src/com/android/server/wm/InsetsSourceProviderTest.java b/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java index 241b987e58ba..c11e606386e6 100644 --- a/services/tests/servicestests/src/com/android/server/wm/InsetsSourceProviderTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/InsetsSourceProviderTest.java @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.view.InsetsState.TYPE_TOP_BAR; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; + import static org.junit.Assert.assertEquals; import android.graphics.Insets; @@ -25,14 +26,11 @@ import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.view.InsetsSource; -import org.junit.Test; -import org.junit.runner.RunWith; - import androidx.test.filters.FlakyTest; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; -@RunWith(AndroidJUnit4.class) +import org.junit.Test; + @SmallTest @FlakyTest(detail = "Promote once confirmed non-flaky") @Presubmit diff --git a/services/tests/servicestests/src/com/android/server/wm/InsetsStateControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java index 7505db103bbf..331622ce22a5 100644 --- a/services/tests/servicestests/src/com/android/server/wm/InsetsStateControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/InsetsStateControllerTest.java @@ -20,20 +20,18 @@ import static android.view.InsetsState.TYPE_IME; import static android.view.InsetsState.TYPE_NAVIGATION_BAR; import static android.view.InsetsState.TYPE_TOP_BAR; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import android.platform.test.annotations.Presubmit; import android.view.InsetsState; -import org.junit.Test; -import org.junit.runner.RunWith; - import androidx.test.filters.FlakyTest; import androidx.test.filters.SmallTest; -import androidx.test.runner.AndroidJUnit4; -@RunWith(AndroidJUnit4.class) +import org.junit.Test; + @SmallTest @FlakyTest(detail = "Promote once confirmed non-flaky") @Presubmit diff --git a/services/tests/servicestests/src/com/android/server/wm/PinnedStackControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/PinnedStackControllerTest.java index 1fae317f3af8..63d9fb9c17e9 100644 --- a/services/tests/servicestests/src/com/android/server/wm/PinnedStackControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/PinnedStackControllerTest.java @@ -18,14 +18,15 @@ package com.android.server.wm; import static android.view.Display.DEFAULT_DISPLAY; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; @@ -46,6 +47,8 @@ import org.mockito.MockitoAnnotations; @Presubmit public class PinnedStackControllerTest extends WindowTestsBase { + private static final int SHELF_HEIGHT = 300; + @Mock private IPinnedStackListener mIPinnedStackListener; @Mock private IPinnedStackListener.Stub mIPinnedStackListenerStub; @@ -70,8 +73,6 @@ public class PinnedStackControllerTest extends WindowTestsBase { reset(mIPinnedStackListener); - final int SHELF_HEIGHT = 300; - mWm.setShelfHeight(true, SHELF_HEIGHT); verify(mIPinnedStackListener).onShelfVisibilityChanged(true, SHELF_HEIGHT); verify(mIPinnedStackListener).onMovementBoundsChanged(any(), any(), any(), eq(false), diff --git a/services/tests/servicestests/src/com/android/server/wm/RecentsAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java index ee3bba73cd1e..cc6a58a81635 100644 --- a/services/tests/servicestests/src/com/android/server/wm/RecentsAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java @@ -21,6 +21,10 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.Display.DEFAULT_DISPLAY; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyNoMoreInteractions; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE; import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION; @@ -28,10 +32,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; import android.os.Binder; import android.os.IInterface; diff --git a/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java index fa5379576e8b..ad2a708b88d9 100644 --- a/services/tests/servicestests/src/com/android/server/wm/RemoteAnimationControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RemoteAnimationControllerTest.java @@ -18,13 +18,14 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyNoMoreInteractions; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; import android.graphics.Point; import android.graphics.Rect; @@ -143,8 +144,9 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { @Test public void testTimeout_scaled() throws Exception { mWm.setAnimationScale(2, 5.0f); - try{ - final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, "testWin"); + try { + final WindowState win = createWindow(null /* parent */, TYPE_BASE_APPLICATION, + "testWin"); final AnimationAdapter adapter = mController.createAnimationAdapter(win.mAppToken, new Point(50, 100), new Rect(50, 100, 150, 150)); adapter.startAnimation(mMockLeash, mMockTransaction, mFinishedCallback); @@ -163,7 +165,6 @@ public class RemoteAnimationControllerTest extends WindowTestsBase { } finally { mWm.setAnimationScale(2, 1.0f); } - } @Test diff --git a/services/tests/servicestests/src/com/android/server/wm/StackWindowControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/StackWindowControllerTests.java index ce5b13cab1a7..ce5b13cab1a7 100644 --- a/services/tests/servicestests/src/com/android/server/wm/StackWindowControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/StackWindowControllerTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java index 584f2695891b..83e7ee711831 100644 --- a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimationRunnerTest.java @@ -16,16 +16,17 @@ package com.android.server.wm; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeast; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.atLeastOnce; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import static java.util.concurrent.TimeUnit.SECONDS; diff --git a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java index e638a6accf7c..d14f30db8e9f 100644 --- a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/SurfaceAnimatorTest.java @@ -16,16 +16,17 @@ package com.android.server.wm; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verifyZeroInteractions; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; import android.platform.test.annotations.Presubmit; import android.view.SurfaceControl; diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskPositionerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java index 785b955863db..b996bfbf2101 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskPositionerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskPositionerTests.java @@ -52,8 +52,8 @@ public class TaskPositionerTests extends WindowTestsBase { private static final boolean DEBUGGING = false; private static final String TAG = "TaskPositionerTest"; - private final static int MOUSE_DELTA_X = 5; - private final static int MOUSE_DELTA_Y = 5; + private static final int MOUSE_DELTA_X = 5; + private static final int MOUSE_DELTA_Y = 5; private int mMinVisibleWidth; private int mMinVisibleHeight; @@ -315,7 +315,7 @@ public class TaskPositionerTests extends WindowTestsBase { // Drag all the way to the right and see the height also shrinking. mPositioner.resizeDrag(2000.0f, midY); final int w = mMinVisibleWidth; - final int h = Math.round((float)w / MIN_ASPECT); + final int h = Math.round((float) w / MIN_ASPECT); assertBoundsEquals(new Rect(r.right - w, r.top, r.right, r.top + h), mPositioner.getWindowDragBounds()); @@ -428,7 +428,7 @@ public class TaskPositionerTests extends WindowTestsBase { // Drag all the way to the right. mPositioner.resizeDrag(2000.0f, midY); w = mMinVisibleWidth; - h = Math.max(Math.round((float)w * MIN_ASPECT), r.height()); + h = Math.max(Math.round((float) w * MIN_ASPECT), r.height()); assertBoundsEquals(new Rect(r.right - w, r.top, r.right, r.top + h), mPositioner.getWindowDragBounds()); diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskPositioningControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java index 00b462954bd9..3991e06d6f96 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskPositioningControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskPositioningControllerTests.java @@ -18,14 +18,15 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.anyInt; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import android.platform.test.annotations.Presubmit; import android.view.InputChannel; diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotCacheTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java index 1c6afd545b1f..1c6afd545b1f 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotCacheTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotCacheTest.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java index 792e8a6f7582..792e8a6f7582 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotControllerTest.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java index b0eafeeae043..b0eafeeae043 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterLoaderTest.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java index 946ffb60c759..946ffb60c759 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotPersisterTestBase.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java index a569b9e6dd6f..624ef9ba1653 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskSnapshotSurfaceTest.java @@ -11,7 +11,7 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and - * limitations under the License + * limitations under the License. */ package com.android.server.wm; @@ -20,14 +20,15 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import android.app.ActivityManager.TaskSnapshot; import android.content.ComponentName; diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskStackContainersTests.java index f01e9f0662c9..f01e9f0662c9 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskStackContainersTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskStackContainersTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java index 7ac331829fb1..7ac331829fb1 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskStackTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskStackTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TaskWindowContainerControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskWindowContainerControllerTests.java index bbf508dd1630..bbf508dd1630 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TaskWindowContainerControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TaskWindowContainerControllerTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TestIWindow.java b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java index 432af0d7a469..432af0d7a469 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TestIWindow.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java diff --git a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java index 7b542cb4f2f7..ba81bd1c3b12 100644 --- a/services/tests/servicestests/src/com/android/server/wm/TestWindowManagerPolicy.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestWindowManagerPolicy.java @@ -19,8 +19,8 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import android.annotation.Nullable; import android.content.Context; @@ -46,7 +46,8 @@ import java.util.function.Supplier; class TestWindowManagerPolicy implements WindowManagerPolicy { private final Supplier<WindowManagerService> mWmSupplier; - boolean keyguardShowingAndNotOccluded = false; + int mRotationToReport = 0; + boolean mKeyguardShowingAndNotOccluded = false; private Runnable mRunnableWhenAddingSplashScreen; @@ -236,7 +237,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy { @Override public boolean isKeyguardLocked() { - return keyguardShowingAndNotOccluded; + return mKeyguardShowingAndNotOccluded; } @Override @@ -256,7 +257,7 @@ class TestWindowManagerPolicy implements WindowManagerPolicy { @Override public boolean isKeyguardShowingAndNotOccluded() { - return keyguardShowingAndNotOccluded; + return mKeyguardShowingAndNotOccluded; } @Override diff --git a/services/tests/servicestests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java index 9e22c0a86d96..612f9ad923d6 100644 --- a/services/tests/servicestests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/UnknownAppVisibilityControllerTest.java @@ -73,7 +73,7 @@ public class UnknownAppVisibilityControllerTest extends WindowTestsBase { public void testClear() { final AppWindowToken token = WindowTestUtils.createTestAppWindowToken(mDisplayContent); mDisplayContent.mUnknownAppVisibilityController.notifyLaunched(token); - mDisplayContent.mUnknownAppVisibilityController.clear();; + mDisplayContent.mUnknownAppVisibilityController.clear(); assertTrue(mDisplayContent.mUnknownAppVisibilityController.allResolved()); } diff --git a/services/tests/servicestests/src/com/android/server/wm/WallpaperControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java index 4ea6b3901f03..d07230ef2ca3 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WallpaperControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WallpaperControllerTests.java @@ -18,11 +18,12 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; + import static junit.framework.TestCase.assertNotNull; import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import android.graphics.Bitmap; import android.os.IBinder; diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowConfigurationTests.java index 3643457f061f..3643457f061f 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowConfigurationTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowContainerControllerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerControllerTests.java index 7592f1c1fca0..7592f1c1fca0 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowContainerControllerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerControllerTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java index e59afd656420..a2e0ed933bb9 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java @@ -22,6 +22,13 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyFloat; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.eq; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.WindowContainer.POSITION_BOTTOM; import static com.android.server.wm.WindowContainer.POSITION_TOP; @@ -30,13 +37,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyFloat; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import android.content.res.Configuration; import android.graphics.Rect; @@ -459,13 +459,13 @@ public class WindowContainerTests extends WindowTestsBase { @Test public void testGetOrientation_childSpecified() { testGetOrientation_childSpecifiedConfig(false, SCREEN_ORIENTATION_LANDSCAPE, - SCREEN_ORIENTATION_LANDSCAPE); + SCREEN_ORIENTATION_LANDSCAPE); testGetOrientation_childSpecifiedConfig(false, SCREEN_ORIENTATION_UNSET, - SCREEN_ORIENTATION_UNSPECIFIED); + SCREEN_ORIENTATION_UNSPECIFIED); } private void testGetOrientation_childSpecifiedConfig(boolean childVisible, int childOrientation, - int expectedOrientation) { + int expectedOrientation) { final TestWindowContainerBuilder builder = new TestWindowContainerBuilder(mWm); final TestWindowContainer root = builder.setLayer(0).build(); root.setFillsParent(true); @@ -704,7 +704,7 @@ public class WindowContainerTests extends WindowTestsBase { final TestWindowContainer root = builder.build(); final TestWindowContainer child = root.addChildWindow(); - child.setBounds(new Rect(1,1,2,2)); + child.setBounds(new Rect(1, 1, 2, 2)); final TestWindowContainer grandChild = mock(TestWindowContainer.class); @@ -742,7 +742,7 @@ public class WindowContainerTests extends WindowTestsBase { private static final Comparator<TestWindowContainer> SUBLAYER_COMPARATOR = (w1, w2) -> { final int layer1 = w1.mLayer; final int layer2 = w2.mLayer; - if (layer1 < layer2 || (layer1 == layer2 && layer2 < 0 )) { + if (layer1 < layer2 || (layer1 == layer2 && layer2 < 0)) { // We insert the child window into the list ordered by the mLayer. For same layers, // the negative one should go below others; the positive one should go above others. return -1; diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowContainerTraversalTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTraversalTests.java index fcde08e18a6f..4b666f538ea2 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowContainerTraversalTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTraversalTests.java @@ -21,9 +21,10 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; + import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import android.platform.test.annotations.Presubmit; diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java index 227eb00be7f7..b3e90debc84b 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java @@ -290,7 +290,7 @@ public class WindowFrameTests extends WindowTestsBase { w.mRequestedHeight = 300; w.mAttrs.gravity = Gravity.RIGHT | Gravity.TOP; w.computeFrameLw(); - assertFrame(w, 700, 0, 1000, 300); + assertFrame(w, 700, 0, 1000, 300); w.mAttrs.gravity = Gravity.RIGHT | Gravity.BOTTOM; w.computeFrameLw(); assertFrame(w, 700, 700, 1000, 1000); diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java index 9a13efb4c58b..4a99172160f5 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRule.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRule.java @@ -21,14 +21,15 @@ import static android.view.Display.DEFAULT_DISPLAY; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; import android.app.ActivityManagerInternal; import android.content.Context; @@ -100,6 +101,7 @@ public class WindowManagerServiceRule implements TestRule { mock(PowerManagerInternal.class)); final PowerManagerInternal pm = LocalServices.getService(PowerManagerInternal.class); + doNothing().when(pm).registerLowPowerModeObserver(any()); PowerSaveState state = new PowerSaveState.Builder().build(); doReturn(state).when(pm).getLowPowerState(anyInt()); @@ -146,8 +148,8 @@ public class WindowManagerServiceRule implements TestRule { final Display display = mService.mDisplayManager.getDisplay(DEFAULT_DISPLAY); final DisplayWindowController dcw = new DisplayWindowController(display, mService); - // Display creation is driven by the ActivityManagerService via ActivityStackSupervisor. - // We emulate those steps here. + // Display creation is driven by the ActivityManagerService via + // ActivityStackSupervisor. We emulate those steps here. mService.mRoot.createDisplayContent(display, dcw); } diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRuleTest.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRuleTest.java index 343d35959df4..343d35959df4 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowManagerServiceRuleTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceRuleTest.java diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java index 118ce8962259..7f7803463543 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java @@ -32,6 +32,12 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.never; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.reset; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.spy; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; + import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; @@ -43,11 +49,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.verify; import android.graphics.Insets; import android.graphics.Matrix; diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java index 3c877213a0e4..3bd9a89075c0 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestUtils.java @@ -16,6 +16,9 @@ package com.android.server.wm; +import static android.app.AppOpsManager.OP_NONE; +import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE; + import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyFloat; @@ -23,12 +26,21 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyInt; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doAnswer; import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import static com.android.dx.mockito.inline.extended.ExtendedMockito.when; +import static com.android.server.wm.WindowContainer.POSITION_TOP; +import android.app.ActivityManager; +import android.content.ComponentName; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; +import android.os.Binder; +import android.os.IBinder; import android.view.Display; +import android.view.IApplicationToken; +import android.view.IWindow; import android.view.Surface; +import android.view.SurfaceControl.Transaction; +import android.view.WindowManager; import org.mockito.invocation.InvocationOnMock; @@ -37,6 +49,7 @@ import org.mockito.invocation.InvocationOnMock; * to WindowManager related test functionality. */ public class WindowTestUtils { + private static int sNextTaskId = 0; /** An extension of {@link DisplayContent} to gain package scoped access. */ public static class TestDisplayContent extends DisplayContent { @@ -54,6 +67,14 @@ public class WindowTestUtils { return null; } + /** + * Stubbing method of non-public parent class isn't supported, so here explicitly overrides. + */ + @Override + DockedStackDividerController getDockedDividerController() { + return null; + } + /** Create a mocked default {@link DisplayContent}. */ public static TestDisplayContent create(Context context) { final TestDisplayContent displayContent = mock(TestDisplayContent.class); @@ -106,6 +127,17 @@ public class WindowTestUtils { return controller; } + /** Creates a {@link Task} and adds it to the specified {@link TaskStack}. */ + public static Task createTaskInStack(WindowManagerService service, TaskStack stack, + int userId) { + synchronized (service.mGlobalLock) { + final Task newTask = new Task(sNextTaskId++, stack, userId, service, 0, false, + new ActivityManager.TaskDescription(), null); + stack.addTask(newTask, POSITION_TOP); + return newTask; + } + } + /** * An extension of {@link TestTaskStack}, which overrides package scoped methods that would not * normally be mocked out. @@ -120,4 +152,233 @@ public class WindowTestUtils { // Do nothing. } } + + static TestAppWindowToken createTestAppWindowToken(DisplayContent dc) { + synchronized (dc.mService.mGlobalLock) { + return new TestAppWindowToken(dc); + } + } + + /** Used so we can gain access to some protected members of the {@link AppWindowToken} class. */ + public static class TestAppWindowToken extends AppWindowToken { + boolean mOnTop = false; + private Transaction mPendingTransactionOverride; + + private TestAppWindowToken(DisplayContent dc) { + super(dc.mService, new IApplicationToken.Stub() { + @Override + public String getName() { + return null; + } + }, new ComponentName("", ""), false, dc, true /* fillsParent */); + } + + TestAppWindowToken(WindowManagerService service, IApplicationToken token, + ComponentName activityComponent, boolean voiceInteraction, DisplayContent dc, + long inputDispatchingTimeoutNanos, boolean fullscreen, boolean showForAllUsers, + int targetSdk, int orientation, int rotationAnimationHint, int configChanges, + boolean launchTaskBehind, boolean alwaysFocusable, ActivityRecord activityRecord) { + super(service, token, activityComponent, voiceInteraction, dc, + inputDispatchingTimeoutNanos, fullscreen, showForAllUsers, targetSdk, + orientation, rotationAnimationHint, configChanges, launchTaskBehind, + alwaysFocusable, activityRecord); + } + + int getWindowsCount() { + return mChildren.size(); + } + + boolean hasWindow(WindowState w) { + return mChildren.contains(w); + } + + WindowState getFirstChild() { + return mChildren.peekFirst(); + } + + WindowState getLastChild() { + return mChildren.peekLast(); + } + + int positionInParent() { + return getParent().mChildren.indexOf(this); + } + + void setIsOnTop(boolean onTop) { + mOnTop = onTop; + } + + @Override + boolean isOnTop() { + return mOnTop; + } + + void setPendingTransaction(Transaction transaction) { + mPendingTransactionOverride = transaction; + } + + @Override + public Transaction getPendingTransaction() { + return mPendingTransactionOverride == null + ? super.getPendingTransaction() + : mPendingTransactionOverride; + } + } + + static TestWindowToken createTestWindowToken(int type, DisplayContent dc) { + return createTestWindowToken(type, dc, false /* persistOnEmpty */); + } + + static TestWindowToken createTestWindowToken(int type, DisplayContent dc, + boolean persistOnEmpty) { + synchronized (dc.mService.mGlobalLock) { + return new TestWindowToken(type, dc, persistOnEmpty); + } + } + + /* Used so we can gain access to some protected members of the {@link WindowToken} class */ + public static class TestWindowToken extends WindowToken { + + private TestWindowToken(int type, DisplayContent dc, boolean persistOnEmpty) { + super(dc.mService, mock(IBinder.class), type, persistOnEmpty, dc, + false /* ownerCanManageAppTokens */); + } + + int getWindowsCount() { + return mChildren.size(); + } + + boolean hasWindow(WindowState w) { + return mChildren.contains(w); + } + } + + /* Used so we can gain access to some protected members of the {@link Task} class */ + public static class TestTask extends Task { + boolean mShouldDeferRemoval = false; + boolean mOnDisplayChangedCalled = false; + private boolean mIsAnimating = false; + + TestTask(int taskId, TaskStack stack, int userId, WindowManagerService service, + int resizeMode, boolean supportsPictureInPicture, + TaskWindowContainerController controller) { + super(taskId, stack, userId, service, resizeMode, supportsPictureInPicture, + new ActivityManager.TaskDescription(), controller); + } + + boolean shouldDeferRemoval() { + return mShouldDeferRemoval; + } + + int positionInParent() { + return getParent().mChildren.indexOf(this); + } + + @Override + void onDisplayChanged(DisplayContent dc) { + super.onDisplayChanged(dc); + mOnDisplayChangedCalled = true; + } + + @Override + boolean isSelfAnimating() { + return mIsAnimating; + } + + void setLocalIsAnimating(boolean isAnimating) { + mIsAnimating = isAnimating; + } + } + + /** + * Used so we can gain access to some protected members of {@link TaskWindowContainerController} + * class. + */ + public static class TestTaskWindowContainerController extends TaskWindowContainerController { + + static final TaskWindowContainerListener NOP_LISTENER = new TaskWindowContainerListener() { + @Override + public void registerConfigurationChangeListener( + ConfigurationContainerListener listener) { + } + + @Override + public void unregisterConfigurationChangeListener( + ConfigurationContainerListener listener) { + } + + @Override + public void onSnapshotChanged(ActivityManager.TaskSnapshot snapshot) { + } + + @Override + public void requestResize(Rect bounds, int resizeMode) { + } + }; + + TestTaskWindowContainerController(WindowTestsBase testsBase) { + this(testsBase.createStackControllerOnDisplay(testsBase.mDisplayContent)); + } + + TestTaskWindowContainerController(StackWindowController stackController) { + super(sNextTaskId++, NOP_LISTENER, stackController, 0 /* userId */, null /* bounds */, + RESIZE_MODE_UNRESIZEABLE, false /* supportsPictureInPicture */, true /* toTop*/, + true /* showForAllUsers */, new ActivityManager.TaskDescription(), + stackController.mService); + } + + @Override + TestTask createTask(int taskId, TaskStack stack, int userId, int resizeMode, + boolean supportsPictureInPicture, ActivityManager.TaskDescription taskDescription) { + return new TestTask(taskId, stack, userId, mService, resizeMode, + supportsPictureInPicture, this); + } + } + + public static class TestIApplicationToken implements IApplicationToken { + + private final Binder mBinder = new Binder(); + @Override + public IBinder asBinder() { + return mBinder; + } + @Override + public String getName() { + return null; + } + } + + /** Used to track resize reports. */ + public static class TestWindowState extends WindowState { + boolean mResizeReported; + + TestWindowState(WindowManagerService service, Session session, IWindow window, + WindowManager.LayoutParams attrs, WindowToken token) { + super(service, session, window, token, null, OP_NONE, 0, attrs, 0, 0, + false /* ownerCanAddInternalSystemWindow */); + } + + @Override + void reportResized() { + super.reportResized(); + mResizeReported = true; + } + + @Override + public boolean isGoneForLayoutLw() { + return false; + } + + @Override + void updateResizingWindowIfNeeded() { + // Used in AppWindowTokenTests#testLandscapeSeascapeRotationRelayout to deceive + // the system that it can actually update the window. + boolean hadSurface = mHasSurface; + mHasSurface = true; + + super.updateResizingWindowIfNeeded(); + + mHasSurface = hadSurface; + } + } } diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowTestsBase.java b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java index 1eb46fb05b5e..b3f56e7ae99f 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowTestsBase.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowTestsBase.java @@ -37,7 +37,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; -import static org.mockito.Mockito.mock; +import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock; import android.content.Context; import android.content.res.Configuration; diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java index 3048f1a3487b..3048f1a3487b 100644 --- a/services/tests/servicestests/src/com/android/server/wm/WindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowTokenTests.java diff --git a/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java index 3dcea75b8ae5..3dcea75b8ae5 100644 --- a/services/tests/servicestests/src/com/android/server/wm/ZOrderingTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ZOrderingTests.java diff --git a/test-mock/api/current.txt b/test-mock/api/current.txt index 7842a1cd03b3..5b58dd5d758b 100644 --- a/test-mock/api/current.txt +++ b/test-mock/api/current.txt @@ -80,6 +80,7 @@ package android.test.mock { method public java.io.File getNoBackupFilesDir(); method public java.io.File getObbDir(); method public java.io.File[] getObbDirs(); + method public java.lang.String getOpPackageName(); method public java.lang.String getPackageCodePath(); method public android.content.pm.PackageManager getPackageManager(); method public java.lang.String getPackageName(); diff --git a/test-mock/api/test-current.txt b/test-mock/api/test-current.txt index f1ec000dfa6a..8b2c815432ea 100644 --- a/test-mock/api/test-current.txt +++ b/test-mock/api/test-current.txt @@ -1,9 +1,5 @@ package android.test.mock { - public class MockContext extends android.content.Context { - method public java.lang.String getOpPackageName(); - } - public deprecated class MockPackageManager extends android.content.pm.PackageManager { method public boolean arePermissionsIndividuallyControlled(); method public java.lang.String getDefaultBrowserPackageNameAsUser(int); diff --git a/tools/powermodel/src/com/android/powermodel/ActivityReport.java b/tools/powermodel/src/com/android/powermodel/ActivityReport.java new file mode 100644 index 000000000000..4a8f63370cda --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/ActivityReport.java @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.util.Collection; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import com.google.common.collect.ImmutableList; + +/** + * ActivityReport contains the summary of the activity that consumes power + * as reported by batterystats or statsd. + */ +public class ActivityReport { + private AppList<AppActivity> mApps; + + public ImmutableList<AppActivity> getAllApps() { + return mApps.getAllApps(); + } + + public ImmutableList<AppActivity> getRegularApps() { + return mApps.getRegularApps(); + } + + public List<AppActivity> findApp(String pkg) { + return mApps.findApp(pkg); + } + + public AppActivity findApp(SpecialApp specialApp) { + return mApps.findApp(specialApp); + } + + /** + * Find a component in the GLOBAL app. + * <p> + * Returns null if either the global app doesn't exist (bad data?) or the component + * doesn't exist in the global app. + */ + public ComponentActivity findGlobalComponent(Component component) { + final AppActivity global = mApps.findApp(SpecialApp.GLOBAL); + if (global == null) { + return null; + } + return global.getComponentActivity(component); + } + + public static class Builder { + private AppList.Builder<AppActivity,AppActivity.Builder> mApps = new AppList.Builder(); + + public Builder() { + } + + public ActivityReport build() { + final ActivityReport result = new ActivityReport(); + result.mApps = mApps.build(); + return result; + } + + public void addActivity(Component component, Collection<ComponentActivity> activities) { + for (final ComponentActivity activity: activities) { + addActivity(component, activity); + } + } + + public void addActivity(Component component, ComponentActivity activity) { + AppActivity.Builder app = mApps.get(activity.attribution); + if (app == null) { + app = new AppActivity.Builder(); + app.setAttribution(activity.attribution); + mApps.put(activity.attribution, app); + } + app.addComponentActivity(component, activity); + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/AppActivity.java b/tools/powermodel/src/com/android/powermodel/AppActivity.java new file mode 100644 index 000000000000..b87426ce0dc3 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/AppActivity.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.util.HashMap; + +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; + +public class AppActivity extends AppInfo { + + private ImmutableMap<Component, ComponentActivity> mComponents; + // TODO: power rails + // private ImmutableMap<Component, PowerRailActivity> mRails; + + private AppActivity() { + } + + /** + * Returns the {@link ComponentActivity} for the {@link Component} provided, + * or null if this AppActivity does not have that component. + * @more + * If there is no ComponentActivity for a particular Component, then + * there was no usage associated with that app for the app in question. + */ + public ComponentActivity getComponentActivity(Component component) { + return mComponents.get(component); + } + + public ImmutableSet<Component> getComponents() { + return mComponents.keySet(); + } + + public ImmutableMap<Component,ComponentActivity> getComponentActivities() { + return mComponents; + } + + // TODO: power rails + // public ComponentActivity getPowerRail(Component component) { + // return mComponents.get(component); + // } + // + // public Set<Component> getPowerRails() { + // return mComponents.keySet(); + // } + + public static class Builder extends AppInfo.Builder<AppActivity> { + private HashMap<Component, ComponentActivity> mComponents = new HashMap(); + // TODO power rails. + + public Builder() { + } + + public AppActivity build() { + final AppActivity result = new AppActivity(); + init(result); + result.mComponents = ImmutableMap.copyOf(mComponents); + return result; + } + + public void addComponentActivity(Component component, ComponentActivity activity) { + mComponents.put(component, activity); + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/AppInfo.java b/tools/powermodel/src/com/android/powermodel/AppInfo.java new file mode 100644 index 000000000000..208339e8e491 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/AppInfo.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +class AppInfo { + private AttributionKey mAttribution; + + protected AppInfo() { + } + + public boolean hasPackage(String pkg) { + return mAttribution.hasPackage(pkg); + } + + public AttributionKey getAttribution() { + return mAttribution; + } + + abstract static class Builder<APP extends AppInfo> { + private AttributionKey mAttribution; + + public Builder() { + } + + public abstract APP build(); + + protected void init(AppInfo app) { + if (mAttribution == null) { + throw new RuntimeException("setAttribution(AttributionKey attribution) not called"); + } + app.mAttribution = mAttribution; + } + + public void setAttribution(AttributionKey attribution) { + mAttribution = attribution; + } + + public AttributionKey getAttribution() { + return mAttribution; + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/AppList.java b/tools/powermodel/src/com/android/powermodel/AppList.java new file mode 100644 index 000000000000..19572fc1cf15 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/AppList.java @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +class AppList<APP extends AppInfo> { + private ImmutableList<APP> mAllApps; + private ImmutableList<APP> mRegularApps; + private ImmutableMap<SpecialApp,APP> mSpecialApps; + + private AppList() { + } + + public ImmutableList<APP> getAllApps() { + return mAllApps; + } + + public ImmutableList<APP> getRegularApps() { + return mRegularApps; + } + + public List<APP> findApp(String pkg) { + List<APP> result = new ArrayList(); + for (APP app: mRegularApps) { + if (app.hasPackage(pkg)) { + result.add(app); + } + } + return result; + } + + public APP findApp(SpecialApp specialApp) { + return mSpecialApps.get(specialApp); + } + + public static class Builder<APP extends AppInfo, BUILDER extends AppInfo.Builder<APP>> { + private final HashMap<AttributionKey,BUILDER> mApps = new HashMap(); + + public Builder() { + } + + public AppList<APP> build() { + final AppList<APP> result = new AppList(); + final ArrayList<APP> allApps = new ArrayList(); + final ArrayList<APP> regularApps = new ArrayList(); + final HashMap<SpecialApp,APP> specialApps = new HashMap(); + for (AppInfo.Builder<APP> app: mApps.values()) { + final AttributionKey attribution = app.getAttribution(); + final APP appActivity = app.build(); + allApps.add(appActivity); + if (attribution.isSpecialApp()) { + specialApps.put(attribution.getSpecialApp(), appActivity); + } else { + regularApps.add(appActivity); + } + } + result.mAllApps = ImmutableList.copyOf(allApps); + result.mRegularApps = ImmutableList.copyOf(regularApps); + result.mSpecialApps = ImmutableMap.copyOf(specialApps); + return result; + } + + public BUILDER get(AttributionKey attribution) { + return mApps.get(attribution); + } + + public BUILDER put(AttributionKey attribution, BUILDER app) { + return mApps.put(attribution, app); + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/AppPower.java b/tools/powermodel/src/com/android/powermodel/AppPower.java new file mode 100644 index 000000000000..283982b8eda6 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/AppPower.java @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.util.HashMap; +import java.util.Set; + +import com.google.common.collect.ImmutableMap; + +public class AppPower extends AppInfo { + private ImmutableMap<Component, ComponentPower> mComponents; + + private double mAppPowerMah; + + + private AppPower() { + } + + /** + * Returns the {@link ComponentPower} for the {@link Component} provided, + * or null if this AppPower does not have that component. + * @more + * If the component was in the power profile for this device, there + * will be a component for it, even if there was no power used + * by that component. In that case, the + * {@link ComponentPower.getUsage() ComponentPower.getUsage()} + * method will return 0. + */ + public ComponentPower getComponentPower(Component component) { + return mComponents.get(component); + } + + public Set<Component> getComponents() { + return mComponents.keySet(); + } + + /** + * Return the total power used by this app. + */ + public double getAppPowerMah() { + return mAppPowerMah; + } + + /** + * Builder class for {@link AppPower} + */ + public static class Builder extends AppInfo.Builder<AppPower> { + private HashMap<Component, ComponentPower> mComponents = new HashMap(); + + public Builder() { + } + + public AppPower build() { + final AppPower result = new AppPower(); + init(result); + result.mComponents = ImmutableMap.copyOf(mComponents); + + // Add up the components + double appPowerMah = 0; + for (final ComponentPower componentPower: mComponents.values()) { + appPowerMah += componentPower.powerMah; + } + result.mAppPowerMah = appPowerMah; + + return result; + } + + public void addComponentPower(Component component, ComponentPower componentPower) { + mComponents.put(component, componentPower); + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/BatteryStatsReader.java b/tools/powermodel/src/com/android/powermodel/BatteryStatsReader.java new file mode 100644 index 000000000000..595c6612dc3b --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/BatteryStatsReader.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.io.InputStream; +import java.io.IOException; +import com.android.powermodel.component.ModemBatteryStatsReader; + +public class BatteryStatsReader { + /** + * Construct a reader. + */ + public BatteryStatsReader() { + } + + /** + * Parse a powermodel.xml file and return a PowerProfile object. + * + * @param stream An InputStream containing the batterystats output. + * + * @throws ParseException Thrown when the xml file can not be parsed. + * @throws IOException When there is a problem reading the stream. + */ + public static ActivityReport parse(InputStream stream) throws ParseException, IOException { + final Parser parser = new Parser(stream); + return parser.parse(); + } + + /** + * Implements the reading and power model logic. + */ + private static class Parser { + final InputStream mStream; + final ActivityReport mResult; + RawBatteryStats mBs; + + /** + * Constructor to capture the parameters to read. + */ + Parser(InputStream stream) { + mStream = stream; + mResult = new ActivityReport(); + } + + /** + * Read the stream, parse it, and apply the power model. + * Do not call this more than once. + */ + ActivityReport parse() throws ParseException, IOException { + mBs = RawBatteryStats.parse(mStream); + + final ActivityReport.Builder report = new ActivityReport.Builder(); + + report.addActivity(Component.MODEM, ModemBatteryStatsReader.createActivities(mBs)); + + return report.build(); + } + } +} + diff --git a/tools/powermodel/src/com/android/powermodel/ComponentActivity.java b/tools/powermodel/src/com/android/powermodel/ComponentActivity.java new file mode 100644 index 000000000000..c1e2662b7b5f --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/ComponentActivity.java @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + + +/** + * Encapsulates the work done by an app (including synthetic apps) that costs power. + */ +public class ComponentActivity { + public AttributionKey attribution; + + protected ComponentActivity(AttributionKey attribution) { + this.attribution = attribution; + } + + // TODO: Can we refactor what goes into the activities so this function + // doesn't need the global state? + /** + * Apply the power profile for this component. Subclasses should implement this + * to do the per-component calculatinos. The default implementation returns null. + * If this method returns null, then there will be no power associated for this + * component, which, for example is true with some of the GLOBAL activities. + */ + public ComponentPower applyProfile(ActivityReport activityReport, PowerProfile profile) { + return null; + } +} + diff --git a/tools/powermodel/src/com/android/powermodel/ComponentPower.java b/tools/powermodel/src/com/android/powermodel/ComponentPower.java new file mode 100644 index 000000000000..b22ff8731d6f --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/ComponentPower.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +/** + * The hardware component that uses power on a device. + * <p> + * This base class contains the total power used by each Component in an app. + * Subclasses may add more detail, which is a drill-down, but is not to be + * <i>added</i> to {@link #powerMah}. + */ +public abstract class ComponentPower<ACTIVITY extends ComponentActivity> { + /** + * The app associated with this ComponentPower. + */ + public AttributionKey attribution; + + /** + * The app activity that resulted in the power usage for this component. + */ + public ACTIVITY activity; + + /** + * The total power used by this component in this app. + */ + public double powerMah; +} diff --git a/tools/powermodel/src/com/android/powermodel/PowerReport.java b/tools/powermodel/src/com/android/powermodel/PowerReport.java new file mode 100644 index 000000000000..76ba67235b0a --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/PowerReport.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import com.google.common.collect.ImmutableMap; + +/** + * PowerReport contains the summary of all power used on a device + * as reported by batterystats or statsd, based on the power profile. + */ +public class PowerReport { + private AppList<AppPower> mApps; + private double mTotalPowerMah; + + private PowerReport() { + } + + /** + * The total power used by this device for this PowerReport. + */ + public double getTotalPowerMah() { + return mTotalPowerMah; + } + + public List<AppPower> getAllApps() { + return mApps.getAllApps(); + } + + public List<AppPower> getRegularApps() { + return mApps.getRegularApps(); + } + + public List<AppPower> findApp(String pkg) { + return mApps.findApp(pkg); + } + + public AppPower findApp(SpecialApp specialApp) { + return mApps.findApp(specialApp); + } + + public static PowerReport createReport(PowerProfile profile, ActivityReport activityReport) { + final PowerReport.Builder powerReport = new PowerReport.Builder(); + for (final AppActivity appActivity: activityReport.getAllApps()) { + final AppPower.Builder appPower = new AppPower.Builder(); + appPower.setAttribution(appActivity.getAttribution()); + + for (final ImmutableMap.Entry<Component,ComponentActivity> entry: + appActivity.getComponentActivities().entrySet()) { + final ComponentPower componentPower = entry.getValue() + .applyProfile(activityReport, profile); + if (componentPower != null) { + appPower.addComponentPower(entry.getKey(), componentPower); + } + } + + powerReport.add(appPower); + } + return powerReport.build(); + } + + private static class Builder { + private AppList.Builder mApps = new AppList.Builder(); + + public Builder() { + } + + public PowerReport build() { + final PowerReport report = new PowerReport(); + + report.mApps = mApps.build(); + + for (AppPower app: report.mApps.getAllApps()) { + report.mTotalPowerMah += app.getAppPowerMah(); + } + + return report; + } + + public void add(AppPower.Builder app) { + mApps.put(app.getAttribution(), app); + } + } +} diff --git a/tools/powermodel/src/com/android/powermodel/RawBatteryStats.java b/tools/powermodel/src/com/android/powermodel/RawBatteryStats.java index d0c1790f4774..76c0482772f7 100644 --- a/tools/powermodel/src/com/android/powermodel/RawBatteryStats.java +++ b/tools/powermodel/src/com/android/powermodel/RawBatteryStats.java @@ -168,6 +168,80 @@ public class RawBatteryStats { public String lineType; } + @Line(tag="bt", scope=Scope.SYSTEM, count=Count.SINGLE) + public static class Battery extends Record { + // If which != STATS_SINCE_CHARGED, the csv will be "N/A" and we will get + // a parsing warning. Nobody uses anything other than STATS_SINCE_CHARGED. + @Field(index=0) + public int startCount; + + @Field(index=1) + public long whichBatteryRealtimeMs; + + @Field(index=2) + public long whichBatteryUptimeMs; + + @Field(index=3) + public long totalRealtimeMs; + + @Field(index=4) + public long totalUptimeMs; + + @Field(index=5) + public long getStartClockTimeMs; + + @Field(index=6) + public long whichBatteryScreenOffRealtimeMs; + + @Field(index=7) + public long whichBatteryScreenOffUptimeMs; + + @Field(index=8) + public long estimatedBatteryCapacityMah; + + @Field(index=9) + public long minLearnedBatteryCapacityMah; + + @Field(index=10) + public long maxLearnedBatteryCapacityMah; + + @Field(index=11) + public long screenDozeTimeMs; + } + + @Line(tag="gn", scope=Scope.SYSTEM, count=Count.SINGLE) + public static class GlobalNetwork extends Record { + @Field(index=0) + public long mobileRxTotalBytes; + + @Field(index=1) + public long mobileTxTotalBytes; + + @Field(index=2) + public long wifiRxTotalBytes; + + @Field(index=3) + public long wifiTxTotalBytes; + + @Field(index=4) + public long mobileRxTotalPackets; + + @Field(index=5) + public long mobileTxTotalPackets; + + @Field(index=6) + public long wifiRxTotalPackets; + + @Field(index=7) + public long wifiTxTotalPackets; + + @Field(index=8) + public long btRxTotalBytes; + + @Field(index=9) + public long btTxTotalBytes; + } + @Line(tag="gmcd", scope=Scope.SYSTEM, count=Count.SINGLE) public static class GlobalModemController extends Record { @Field(index=0) @@ -183,6 +257,154 @@ public class RawBatteryStats { public long[] txTimeMs; } + @Line(tag="m", scope=Scope.SYSTEM, count=Count.SINGLE) + public static class Misc extends Record { + @Field(index=0) + public long screenOnTimeMs; + + @Field(index=1) + public long phoneOnTimeMs; + + @Field(index=2) + public long fullWakeLockTimeTotalMs; + + @Field(index=3) + public long partialWakeLockTimeTotalMs; + + @Field(index=4) + public long mobileRadioActiveTimeMs; + + @Field(index=5) + public long mobileRadioActiveAdjustedTimeMs; + + @Field(index=6) + public long interactiveTimeMs; + + @Field(index=7) + public long powerSaveModeEnabledTimeMs; + + @Field(index=8) + public int connectivityChangeCount; + + @Field(index=9) + public long deepDeviceIdleModeTimeMs; + + @Field(index=10) + public long deepDeviceIdleModeCount; + + @Field(index=11) + public long deepDeviceIdlingTimeMs; + + @Field(index=12) + public long deepDeviceIdlingCount; + + @Field(index=13) + public long mobileRadioActiveCount; + + @Field(index=14) + public long mobileRadioActiveUnknownTimeMs; + + @Field(index=15) + public long lightDeviceIdleModeTimeMs; + + @Field(index=16) + public long lightDeviceIdleModeCount; + + @Field(index=17) + public long lightDeviceIdlingTimeMs; + + @Field(index=18) + public long lightDeviceIdlingCount; + + @Field(index=19) + public long lightLongestDeviceIdleModeTimeMs; + + @Field(index=20) + public long deepLongestDeviceIdleModeTimeMs; + } + + @Line(tag="nt", scope=Scope.UID, count=Count.SINGLE) + public static class Network extends Record { + @Field(index=0) + public long mobileRxBytes; + + @Field(index=1) + public long mobileTxBytes; + + @Field(index=2) + public long wifiRxBytes; + + @Field(index=3) + public long wifiTxBytes; + + @Field(index=4) + public long mobileRxPackets; + + @Field(index=5) + public long mobileTxPackets; + + @Field(index=6) + public long wifiRxPackets; + + @Field(index=7) + public long wifiTxPackets; + + // This is microseconds, because... batterystats. + @Field(index=8) + public long mobileRadioActiveTimeUs; + + @Field(index=9) + public long mobileRadioActiveCount; + + @Field(index=10) + public long btRxBytes; + + @Field(index=11) + public long btTxBytes; + + @Field(index=12) + public long mobileWakeupCount; + + @Field(index=13) + public long wifiWakeupCount; + + @Field(index=14) + public long mobileBgRxBytes; + + @Field(index=15) + public long mobileBgTxBytes; + + @Field(index=16) + public long wifiBgRxBytes; + + @Field(index=17) + public long wifiBgTxBytes; + + @Field(index=18) + public long mobileBgRxPackets; + + @Field(index=19) + public long mobileBgTxPackets; + + @Field(index=20) + public long wifiBgRxPackets; + + @Field(index=21) + public long wifiBgTxPackets; + } + + @Line(tag="sgt", scope=Scope.SYSTEM, count=Count.SINGLE) + public static class SignalStrengthTime extends Record { + @Field(index=0) + public long[] phoneSignalStrengthTimeMs; + } + + @Line(tag="sst", scope=Scope.SYSTEM, count=Count.SINGLE) + public static class SignalScanningTime extends Record { + @Field(index=0) + public long phoneSignalScanningTimeMs; + } + @Line(tag="uid", scope=Scope.UID, count=Count.MULTIPLE) public static class Uid extends Record { @Field(index=0) diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemAppActivity.java b/tools/powermodel/src/com/android/powermodel/component/ModemAppActivity.java new file mode 100644 index 000000000000..cb70051f1ae6 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemAppActivity.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import com.android.powermodel.ActivityReport; +import com.android.powermodel.AttributionKey; +import com.android.powermodel.Component; +import com.android.powermodel.ComponentActivity; +import com.android.powermodel.PowerProfile; +import com.android.powermodel.util.Conversion; + +/** + * Encapsulates the work done by the celluar modem on behalf of an app. + */ +public class ModemAppActivity extends ComponentActivity { + /** + * Construct a new ModemAppActivity. + */ + public ModemAppActivity(AttributionKey attribution) { + super(attribution); + } + + /** + * The number of packets received by the app. + */ + public long rxPacketCount; + + /** + * The number of packets sent by the app. + */ + public long txPacketCount; + + @Override + public ModemAppPower applyProfile(ActivityReport activityReport, PowerProfile profile) { + // Profile + final ModemProfile modemProfile = (ModemProfile)profile.getComponent(Component.MODEM); + if (modemProfile == null) { + // TODO: This is kind of a big problem... Should this throw instead? + return null; + } + + // Activity + final ModemGlobalActivity global + = (ModemGlobalActivity)activityReport.findGlobalComponent(Component.MODEM); + if (global == null) { + return null; + } + + final double averageModemPowerMa = getAverageModemPowerMa(modemProfile); + final long totalPacketCount = global.rxPacketCount + global.txPacketCount; + final long appPacketCount = this.rxPacketCount + this.txPacketCount; + + final ModemAppPower result = new ModemAppPower(); + result.attribution = this.attribution; + result.activity = this; + result.powerMah = Conversion.msToHr( + (totalPacketCount > 0 ? (appPacketCount / (double)totalPacketCount) : 0) + * global.totalActiveTimeMs + * averageModemPowerMa); + return result; + } + + static final double getAverageModemPowerMa(ModemProfile profile) { + double sumMa = profile.getRxMa(); + for (float powerAtTxLevelMa: profile.getTxMa()) { + sumMa += powerAtTxLevelMa; + } + return sumMa / (profile.getTxMa().length + 1); + } +} + diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemAppPower.java b/tools/powermodel/src/com/android/powermodel/component/ModemAppPower.java new file mode 100644 index 000000000000..f5531272d0b9 --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemAppPower.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import com.android.powermodel.Component; +import com.android.powermodel.ComponentPower; + +public class ModemAppPower extends ComponentPower<ModemAppActivity> { +} + diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemBatteryStatsReader.java b/tools/powermodel/src/com/android/powermodel/component/ModemBatteryStatsReader.java new file mode 100644 index 000000000000..6dbfbc24d1ef --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemBatteryStatsReader.java @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import java.util.ArrayList; +import java.util.List; +import com.android.powermodel.AttributionKey; +import com.android.powermodel.ComponentActivity; +import com.android.powermodel.RawBatteryStats; +import com.android.powermodel.SpecialApp; + +public class ModemBatteryStatsReader { + private ModemBatteryStatsReader() { + } + + public static List<ComponentActivity> createActivities(RawBatteryStats bs) { + final List<ComponentActivity> result = new ArrayList<ComponentActivity>(); + + // The whole system + createGlobal(result, bs); + + // The apps + createApps(result, bs); + + // The synthetic "cell" app. + createRemainder(result, bs); + + return result; + } + + private static void createGlobal(List<ComponentActivity> result, RawBatteryStats bs) { + final ModemGlobalActivity global + = new ModemGlobalActivity(new AttributionKey(SpecialApp.GLOBAL)); + + final RawBatteryStats.GlobalNetwork gn = bs.getSingle(RawBatteryStats.GlobalNetwork.class); + final RawBatteryStats.Misc misc = bs.getSingle(RawBatteryStats.Misc.class); + + // Null here just means no network activity. + if (gn != null && misc != null) { + global.rxPacketCount = gn.mobileRxTotalPackets; + global.txPacketCount = gn.mobileTxTotalPackets; + + global.totalActiveTimeMs = misc.mobileRadioActiveTimeMs; + } + + result.add(global); + } + + private static void createApps(List<ComponentActivity> result, RawBatteryStats bs) { + for (AttributionKey key: bs.getApps()) { + final int uid = key.getUid(); + final RawBatteryStats.Network network + = bs.getSingle(RawBatteryStats.Network.class, uid); + + // Null here just means no network activity. + if (network != null) { + final ModemAppActivity app = new ModemAppActivity(key); + + app.rxPacketCount = network.mobileRxPackets; + app.txPacketCount = network.mobileTxPackets; + + result.add(app); + } + } + } + + private static void createRemainder(List<ComponentActivity> result, RawBatteryStats bs) { + final RawBatteryStats.SignalStrengthTime strength + = bs.getSingle(RawBatteryStats.SignalStrengthTime.class); + final RawBatteryStats.SignalScanningTime scanning + = bs.getSingle(RawBatteryStats.SignalScanningTime.class); + final RawBatteryStats.Misc misc = bs.getSingle(RawBatteryStats.Misc.class); + + if (strength != null && scanning != null && misc != null) { + final ModemRemainderActivity remainder + = new ModemRemainderActivity(new AttributionKey(SpecialApp.REMAINDER)); + + // Signal strength buckets + remainder.strengthTimeMs = strength.phoneSignalStrengthTimeMs; + + // Time spent scanning + remainder.scanningTimeMs = scanning.phoneSignalScanningTimeMs; + + // Unaccounted for active time + final long totalActiveTimeMs = misc.mobileRadioActiveTimeMs; + long appActiveTimeMs = 0; + for (RawBatteryStats.Network nw: bs.getMultiple(RawBatteryStats.Network.class)) { + appActiveTimeMs += nw.mobileRadioActiveTimeUs / 1000; + } + remainder.activeTimeMs = totalActiveTimeMs - appActiveTimeMs; + + result.add(remainder); + } + } +} + diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemGlobalActivity.java b/tools/powermodel/src/com/android/powermodel/component/ModemGlobalActivity.java new file mode 100644 index 000000000000..a53b53eede2b --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemGlobalActivity.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import com.android.powermodel.ActivityReport; +import com.android.powermodel.AttributionKey; +import com.android.powermodel.ComponentActivity; +import com.android.powermodel.ComponentPower; +import com.android.powermodel.PowerProfile; + +/** + * Encapsulates total work done by the modem for the device. + */ +public class ModemGlobalActivity extends ComponentActivity { + /** + * Construct a new ModemGlobalActivity. + */ + public ModemGlobalActivity(AttributionKey attribution) { + super(attribution); + } + + /** + * Returns the total number of packets received in the whole device. + */ + public long rxPacketCount; + + /** + * Returns the total number of packets sent in the whole device. + */ + public long txPacketCount; + + /** + * Returns the total time the radio was active in the whole device. + */ + public long totalActiveTimeMs; +} + diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemRemainderActivity.java b/tools/powermodel/src/com/android/powermodel/component/ModemRemainderActivity.java new file mode 100644 index 000000000000..0e268c21d01d --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemRemainderActivity.java @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import com.android.powermodel.ActivityReport; +import com.android.powermodel.AttributionKey; +import com.android.powermodel.Component; +import com.android.powermodel.ComponentActivity; +import com.android.powermodel.PowerProfile; +import com.android.powermodel.util.Conversion; + +/** + * Encapsulates the work done by the remaining + */ +public class ModemRemainderActivity extends ComponentActivity { + /** + * Construct a new ModemRemainderActivity. + */ + public ModemRemainderActivity(AttributionKey attribution) { + super(attribution); + } + + /** + * Number of milliseconds spent at each of the signal strengths. + */ + public long[] strengthTimeMs; + + /** + * Number of milliseconds spent scanning for a network. + */ + public long scanningTimeMs; + + /** + * Number of milliseconds that the radio is active for reasons other + * than an app transmitting and receiving data. + */ + public long activeTimeMs; + + @Override + public ModemRemainderPower applyProfile(ActivityReport activityReport, PowerProfile profile) { + // Profile + final ModemProfile modemProfile = (ModemProfile)profile.getComponent(Component.MODEM); + if (modemProfile == null) { + return null; + } + + // Activity + final ModemRemainderPower result = new ModemRemainderPower(); + result.attribution = this.attribution; + result.activity = this; + + // strengthMah + // TODO: If the array lengths don't match... then? + result.strengthMah = new double[this.strengthTimeMs.length]; + for (int i=0; i<this.strengthTimeMs.length; i++) { + result.strengthMah[i] = Conversion.msToHr( + this.strengthTimeMs[i] * modemProfile.getTxMa()[i]); + result.powerMah += result.strengthMah[i]; + } + + // scanningMah + result.scanningMah = Conversion.msToHr(this.scanningTimeMs * modemProfile.getScanningMa()); + result.powerMah += result.scanningMah; + + // activeMah + result.activeMah = Conversion.msToHr( + this.activeTimeMs * ModemAppActivity.getAverageModemPowerMa(modemProfile)); + result.powerMah += result.activeMah; + + return result; + } +} + diff --git a/tools/powermodel/src/com/android/powermodel/component/ModemRemainderPower.java b/tools/powermodel/src/com/android/powermodel/component/ModemRemainderPower.java new file mode 100644 index 000000000000..7f38cd342e2f --- /dev/null +++ b/tools/powermodel/src/com/android/powermodel/component/ModemRemainderPower.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel.component; + +import com.android.powermodel.Component; +import com.android.powermodel.ComponentPower; + +public class ModemRemainderPower extends ComponentPower<ModemRemainderActivity> { + + public double[] strengthMah; + + public double scanningMah; + + public double activeMah; +} + diff --git a/tools/powermodel/src/com/android/powermodel/util/Conversion.java b/tools/powermodel/src/com/android/powermodel/util/Conversion.java index 9a79a2d48a59..e556c251a1c9 100644 --- a/tools/powermodel/src/com/android/powermodel/util/Conversion.java +++ b/tools/powermodel/src/com/android/powermodel/util/Conversion.java @@ -35,6 +35,10 @@ public class Conversion { return result; } + public static double msToHr(double ms) { + return ms / 3600.0 / 1000.0; + } + /** * No public constructor. */ diff --git a/tools/powermodel/test-resource/bs.csv b/tools/powermodel/test-resource/bs.csv new file mode 100644 index 000000000000..6e84120168ce --- /dev/null +++ b/tools/powermodel/test-resource/bs.csv @@ -0,0 +1,7 @@ +9,0,i,vers,32,177,PPR1.180326.002,PQ1A.181105.015 +9,0,i,uid,10139,com.google.android.gm +9,0,l,gn,108060756,17293456,4896592,3290614,97840,72941,6903,8107,390,105 +9,0,l,m,2590630,0,384554,3943868,5113727,265,2565483,0,16,0,0,0,0,192,25331,3472068,17,3543323,14,614050,0 +9,10139,l,nt,13688501,534571,13842,7792,9925,5577,30,67,190051799,27,0,0,5,3,126020,42343,13842,7792,207,167,30,67 +9,0,l,sgt,3066958,0,34678,1643364,7045084 +9,0,l,sst,2443805 diff --git a/tools/powermodel/test/com/android/powermodel/BatteryStatsReaderTest.java b/tools/powermodel/test/com/android/powermodel/BatteryStatsReaderTest.java new file mode 100644 index 000000000000..e7b2c3746c85 --- /dev/null +++ b/tools/powermodel/test/com/android/powermodel/BatteryStatsReaderTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.List; +import org.junit.Test; +import org.junit.Assert; + +import com.android.powermodel.component.ModemAppActivity; +import com.android.powermodel.component.ModemGlobalActivity; +import com.android.powermodel.component.ModemRemainderActivity; + +/** + * Tests {@link BatteryStatsReader}. + */ +public class BatteryStatsReaderTest { + private static InputStream loadCsvStream() { + return BatteryStatsReaderTest.class.getResourceAsStream("/bs.csv"); + } + + @Test public void testModemGlobal() throws Exception { + final ActivityReport report = BatteryStatsReader.parse(loadCsvStream()); + + final AppActivity global = report.findApp(SpecialApp.GLOBAL); + Assert.assertNotNull(global); + + final ModemGlobalActivity modem + = (ModemGlobalActivity)global.getComponentActivity(Component.MODEM); + Assert.assertNotNull(modem); + Assert.assertEquals(97840, modem.rxPacketCount); + Assert.assertEquals(72941, modem.txPacketCount); + Assert.assertEquals(5113727, modem.totalActiveTimeMs); + } + + @Test public void testModemApp() throws Exception { + final ActivityReport report = BatteryStatsReader.parse(loadCsvStream()); + + final List<AppActivity> gmailList = report.findApp("com.google.android.gm"); + Assert.assertEquals(1, gmailList.size()); + final AppActivity gmail = gmailList.get(0); + + final ModemAppActivity modem + = (ModemAppActivity)gmail.getComponentActivity(Component.MODEM); + Assert.assertNotNull(modem); + Assert.assertEquals(9925, modem.rxPacketCount); + Assert.assertEquals(5577, modem.txPacketCount); + } + + @Test public void testModemRemainder() throws Exception { + final ActivityReport report = BatteryStatsReader.parse(loadCsvStream()); + + final AppActivity remainder = report.findApp(SpecialApp.REMAINDER); + Assert.assertNotNull(remainder); + + final ModemRemainderActivity modem + = (ModemRemainderActivity)remainder.getComponentActivity(Component.MODEM); + Assert.assertNotNull(modem); + Assert.assertArrayEquals(new long[] { 3066958, 0, 34678, 1643364, 7045084 }, + modem.strengthTimeMs); + Assert.assertEquals(2443805, modem.scanningTimeMs); + Assert.assertEquals(4923676, modem.activeTimeMs); + } +} diff --git a/tools/powermodel/test/com/android/powermodel/PowerReportTest.java b/tools/powermodel/test/com/android/powermodel/PowerReportTest.java new file mode 100644 index 000000000000..1a61737a4b2f --- /dev/null +++ b/tools/powermodel/test/com/android/powermodel/PowerReportTest.java @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.powermodel; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.List; +import org.junit.Test; +import org.junit.Assert; + +import com.android.powermodel.component.ModemAppPower; +import com.android.powermodel.component.ModemRemainderPower; + +/** + * Tests {@link PowerReport}. + */ +public class PowerReportTest { + private static final double EPSILON = 0.001; + private static final double MS_PER_HR = 3600000.0; + + private static final double AVERAGE_MODEM_POWER = ((11+16+19+22+73+132) / 6.0); + private static final double GMAIL_MODEM_MAH = ((9925+5577) / (double)(97840+72941)) + * 5113727 * AVERAGE_MODEM_POWER * (1.0 / 3600 / 1000); + private static final double GMAIL_MAH + = GMAIL_MODEM_MAH; + + private static final double REMAINDER_MODEM_MAH + = (1.0 / 3600 / 1000) + * ((3066958 * 16) + (0 * 19) + (34678 * 22) + (1643364 * 73) + (7045084 * 132) + + (2443805 * 12) + + (4923676 * AVERAGE_MODEM_POWER)); + private static final double REMAINDER_MAH + = REMAINDER_MODEM_MAH; + + private static final double TOTAL_MAH + = GMAIL_MAH + + REMAINDER_MAH; + + private static InputStream loadPowerProfileStream() { + return PowerProfileTest.class.getResourceAsStream("/power_profile.xml"); + } + + private static InputStream loadCsvStream() { + return BatteryStatsReaderTest.class.getResourceAsStream("/bs.csv"); + } + + private static PowerReport loadPowerReport() throws Exception { + final PowerProfile profile = PowerProfile.parse(loadPowerProfileStream()); + final ActivityReport activity = BatteryStatsReader.parse(loadCsvStream()); + return PowerReport.createReport(profile, activity); + } + + @Test public void testModemApp() throws Exception { + final PowerReport report = loadPowerReport(); + + final List<AppPower> gmailList = report.findApp("com.google.android.gm"); + Assert.assertEquals(1, gmailList.size()); + final AppPower gmail = gmailList.get(0); + + final ModemAppPower modem = (ModemAppPower)gmail.getComponentPower(Component.MODEM); + Assert.assertNotNull(modem); + Assert.assertEquals(GMAIL_MODEM_MAH, modem.powerMah, EPSILON); + } + + @Test public void testModemRemainder() throws Exception { + final PowerReport report = loadPowerReport(); + + final AppPower remainder = report.findApp(SpecialApp.REMAINDER); + Assert.assertNotNull(remainder); + + final ModemRemainderPower modem + = (ModemRemainderPower)remainder.getComponentPower(Component.MODEM); + Assert.assertNotNull(modem); + + Assert.assertArrayEquals(new double[] { + 3066958 * 16.0 / MS_PER_HR, + 0 * 19.0 / MS_PER_HR, + 34678 * 22.0 / MS_PER_HR, + 1643364 * 73.0 / MS_PER_HR, + 7045084 * 132.0 / MS_PER_HR }, + modem.strengthMah, EPSILON); + Assert.assertEquals(2443805 * 12 / MS_PER_HR, modem.scanningMah, EPSILON); + Assert.assertEquals(4923676 * AVERAGE_MODEM_POWER / MS_PER_HR, modem.activeMah, EPSILON); + + Assert.assertEquals(REMAINDER_MODEM_MAH, modem.powerMah, EPSILON); + } + + @Test public void testAppTotal() throws Exception { + final PowerReport report = loadPowerReport(); + + final List<AppPower> gmailList = report.findApp("com.google.android.gm"); + Assert.assertEquals(1, gmailList.size()); + final AppPower gmail = gmailList.get(0); + + Assert.assertEquals(GMAIL_MAH, gmail.getAppPowerMah(), EPSILON); + } + + @Test public void testRemainderTotal() throws Exception { + final PowerReport report = loadPowerReport(); + + final AppPower remainder = report.findApp(SpecialApp.REMAINDER); + Assert.assertNotNull(remainder); + + Assert.assertEquals(REMAINDER_MAH, remainder.getAppPowerMah(), EPSILON); + } + + @Test public void testTotal() throws Exception { + final PowerReport report = loadPowerReport(); + + Assert.assertEquals(TOTAL_MAH, report.getTotalPowerMah(), EPSILON); + } +} + diff --git a/tools/processors/unsupportedappusage/src/android/processor/unsupportedappusage/UnsupportedAppUsageProcessor.java b/tools/processors/unsupportedappusage/src/android/processor/unsupportedappusage/UnsupportedAppUsageProcessor.java index 1d4c435939db..d368136c7081 100644 --- a/tools/processors/unsupportedappusage/src/android/processor/unsupportedappusage/UnsupportedAppUsageProcessor.java +++ b/tools/processors/unsupportedappusage/src/android/processor/unsupportedappusage/UnsupportedAppUsageProcessor.java @@ -28,6 +28,7 @@ import com.sun.tools.javac.util.Position; import java.io.IOException; import java.io.PrintStream; +import java.net.URLEncoder; import java.util.Map; import java.util.Set; import java.util.TreeMap; @@ -38,7 +39,9 @@ import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; +import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; /** @@ -108,10 +111,25 @@ public class UnsupportedAppUsageProcessor extends AbstractProcessor { "startline", "startcol", "endline", - "endcol" + "endcol", + "properties" ); } + private String encodeAnnotationProperties(AnnotationMirror annotation) { + StringBuilder sb = new StringBuilder(); + for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> e + : annotation.getElementValues().entrySet()) { + if (sb.length() > 0) { + sb.append("&"); + } + sb.append(e.getKey().getSimpleName()) + .append("=") + .append(URLEncoder.encode(e.getValue().toString())); + } + return sb.toString(); + } + /** * Maps an annotated element to the source position of the @UnsupportedAppUsage annotation * attached to it. It returns CSV in the format: @@ -137,7 +155,8 @@ public class UnsupportedAppUsageProcessor extends AbstractProcessor { lines.getLineNumber(pair.fst.pos().getStartPosition()), lines.getColumnNumber(pair.fst.pos().getStartPosition()), lines.getLineNumber(pair.fst.pos().getEndPosition(pair.snd.endPositions)), - lines.getColumnNumber(pair.fst.pos().getEndPosition(pair.snd.endPositions))); + lines.getColumnNumber(pair.fst.pos().getEndPosition(pair.snd.endPositions)), + encodeAnnotationProperties(unsupportedAppUsage)); } /** diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java index d0efbcffd0ae..dce65aa52516 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pManager.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pManager.java @@ -1216,6 +1216,38 @@ public class WifiP2pManager { } /** + * Create a p2p group with the current device as the group owner. This essentially creates + * an access point that can accept connections from legacy clients as well as other p2p + * devices. + * + * <p> An app should use {@link WifiP2pConfig#Builder} to build the configuration + * for a group. + * + * <p class="note"><strong>Note:</strong> + * This function would normally not be used unless the current device needs + * to form a p2p group as a Group Owner and allow peers to join it as either + * Group Clients or legacy Wi-Fi STAs. + * + * <p> The function call immediately returns after sending a group creation request + * to the framework. The application is notified of a success or failure to initiate + * group creation through listener callbacks {@link ActionListener#onSuccess} or + * {@link ActionListener#onFailure}. + * + * <p> Application can request for the group details with {@link #requestGroupInfo}. + * + * @param c is the channel created at {@link #initialize}. + * @param config the configuration of a p2p group. + * @param listener for callbacks on success or failure. Can be null. + */ + public void createGroup(@NonNull Channel c, + @Nullable WifiP2pConfig config, + @Nullable ActionListener listener) { + checkChannel(c); + c.mAsyncChannel.sendMessage(CREATE_GROUP, 0, + c.putListener(listener), config); + } + + /** * Remove the current p2p group. * * <p> The function call immediately returns after sending a group removal request |