2069 Commits

Author SHA1 Message Date
Bryce Lee
8592407581 Merge "Fix ActivityRecordTests." into oc-dev 2017-04-05 18:00:33 +00:00
Tony Wickham
8fdf051346 Merge "Add AppWidgetManager#getInstalledProvidersForPackage()" into oc-dev 2017-04-05 17:37:15 +00:00
Phil Weaver
7a6cc9b5a7 Consolidate a11y unit tests and get them working
Moving tests for accessibility manager into the a11y
directory and getting them to use some of the newer
test infrastructure. Minor tweaks to
AccessibilityManager to make it testable.

Deleting the AccessibilityManagerService tests entirely.
This class is difficult to unit test with the current
infrastructure, but is covered in CTS tests to a large
degree. I wasn't able to get these working quickly, and
they rely on timeouts that make them run much slower than
the other tests. They also throw exceptions when their
mock accessibility services receive accessibility events,
which causes the system to blacklist those services, causing
the tests to fail differently until the system is reset.
I think it's better to focus on writing new, more robust
tests than on rewriting these tests to pass.

Bug: 36614219
Test: A11y unit tests now work.
Change-Id: I8effe44f22110d55ebb700dc46f59b7e7a1aa946
(cherry picked from commit 9213d23178183981c653714f8df5806aab458bb0)
2017-04-05 16:34:29 +00:00
Bryce Lee
3115bdf15a Fix ActivityRecordTests.
Tests are not guaranteed to run on the same thread as setup methods.
Therefore, we must ensure any loopers used are already created by the
time the test runs. We do this now by creating a HandlerThread and
referencing its Looper later. Loopers are initialized per
HandlerThread, which will allow us to both isolate its usage and
guarantee the Looper initialization by test time.

Change-Id: If15494783959e5c399375033253cef69b921ff84
Fixes: 36916522
Test: bit FrameworksServicesTests:com.android.server.am.ActivityRecordTests
2017-04-05 08:39:40 -07:00
Wale Ogunwale
ef3874ba91 Merge "Disable presubmit for ActivityRecordTests" into oc-dev 2017-04-05 03:34:07 +00:00
Wale Ogunwale
4cb9b96d59 Disable presubmit for ActivityRecordTests
Failing in CI

Test: ActivityRecordTests
Bug: 36916522
Change-Id: Id5571b722cc5c14f2897fcc65d52d35bf4a78105
2017-04-04 20:30:18 -07:00
Jeremy Joslin
f1acc1e811 Restore @VisibleForTesting on NetworkScorerAppManager.
The NetworkScoreService tests fail (Mockito doesn't work) without
those methods being public :/

Also removed a failing test from NetworkScoreServiceTest since a
recent CL changed the behavior of dump (no longer throws).

Test: runtest frameworks-services -c com.android.server.NetworkScoreServiceTest
Change-Id: Id3fb9451027db3685b16b659a00a6a52b7a1e523
2017-04-04 17:28:23 -07:00
Sudheer Shanka
9d3f668d09 Fix testWaitForNetworkStateUpdate.
Bug: 36899583
Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services
Change-Id: I9fd94bc74403b173770dd7ec2483780bf6698640
2017-04-04 15:33:37 -07:00
Sudheer Shanka
bce47223cb Don't populate a setting instead of defaulting to 0 when not set.
Currently in CoreSettingsObserver while populating settings, when a
setting is not found, it's value is defaulted to 0. Instead don't
populate the setting when it is not found.

Bug: 34735550
Test: runtest -c com.android.server.am.CoreSettingsObserverTest frameworks-services
Change-Id: I9d231330c6db2636e4aa2f0caae455ddfc3e63a2
2017-04-04 15:07:14 -07:00
Bryce Lee
92b7b65939 Do not try to restore a task id if it does not exist.
Previously, we were trying to restore the recent task regardless of
if it was found in recents or a stack. This would lead to
referencing a null object later.

Change-Id: I014a751d3254ad267c32ac0b54783b31b8d17e93
Test: bit FrameworksServicesTests:com.android.server.am.ActivityStackSupervisorTests
Fixes: 36688598
2017-04-04 14:45:26 -07:00
Tony Wickham
a41da04b2d Add AppWidgetManager#getInstalledProvidersForPackage()
This allows more fine-grained control than getting all installed
providers for a user, when you might only want to check for a particular
package. For instance, Launcher can use this API to surface widgets per
app without having to ask for all the widgets.

Test: Unit test on AppWidgetServiceImplTest
$ runtest --path=services/tests/servicestests/src/com/android/server/appwidget/AppWidgetServiceImplTest.java

Bug: 34940468
Change-Id: I182bf1c012d31182024422fc4a63f57f151c3ee5
2017-04-04 14:13:01 -07:00
TreeHugger Robot
0bbde28dd4 Merge "Migrate the NETWORK_SCORER_APP Setting." into oc-dev 2017-04-04 19:37:20 +00:00
Jeremy Joslin
b0fe21782f Migrate the NETWORK_SCORER_APP Setting.
Migrate the value of NETWORK_SCORER_APP to the USE_OPEN_WIFI_PACKAGE
Setting if the following conditions are true:
  * NETWORK_SCORER_APP has a value
  * An active scorer/recommender is present.
  * The active scorer specifies a valid UseOpenWifiActivity.
  * The NETWORK_SCORER_APP value matches the package name of the
    UseOpenWifiActivity or the active scorer.

Test: runtest frameworks-services -c com.android.server.NetworkScorerAppManagerTest
Bug: 36718516
Change-Id: I7d7a56c62b4a7f4a0e43824fbb2075e80d7a753b
2017-04-04 10:25:57 -07:00
Jorim Jaggi
1edadac465 Merge "Handle case when snapshot dimensions don't match" into oc-dev 2017-04-04 09:14:38 +00:00
Bryce Lee
9f467df804 Merge "Clean up activity/stack associations." into oc-dev 2017-04-04 03:01:50 +00:00
Bryce Lee
af691c0be7 Clean up activity/stack associations.
The stack currently holds a reference to resuming and pausing
activities. These are usually cleaned up when the activity ends or
the task is reparented. However, it is possible for an activity to
lose its reference to its task in other areas (such as
ActivityStarter), which can lead to the stack not being updated
correctly.

This changelist adds a method to the ActivityStack to disassociate
the stack from an ActivityRecord. In addition to places where this is
called when an activity ends, this method is invoked on the children
of a task when the task is reparented. The task member variable of
ActivityRecord is also now surrounded by a setter/getter, with the
setter always invoking the dissociation logic on a previous stack.

Test: bit FrameworksServicesTests:com.android.server.am.ActivityRecordTests
Change-Id: Iffeccdb6f011958896271673946acfed28856f53
Fixes: 36387417
2017-04-03 16:33:36 -07:00
TreeHugger Robot
6a7a967b71 Merge "Remove/fix broken test due to change to DUMP permission check." into oc-dev 2017-04-03 22:13:34 +00:00
Makoto Onuki
c4361e34ad Remove/fix broken test due to change to DUMP permission check.
Bug 36854321
Test: adb shell am instrument -e class 'com.android.server.pm.ShortcutManagerTest2' -w com.android.frameworks.servicestests

Change-Id: I80f2a326b70f8d0598246732510e3725a0c58871
2017-04-03 13:00:39 -07:00
Makoto Onuki
ef7dff2563 Merge "Revert "Push chooser targets to the shortcut manager."" into oc-dev 2017-04-03 19:45:18 +00:00
Andrii Kulian
2c93764bee Merge "Fix some WM unit tests" into oc-dev 2017-04-03 17:34:01 +00:00
Bryce Lee
7efe56b779 Merge "Add app bounds to configuration." into oc-dev 2017-04-03 14:30:49 +00:00
Jorim Jaggi
aea6b74e17 Handle case when snapshot dimensions don't match
If the snapshot starting window has different dimensions than the
snapshots we have taken, we do the following:

- Create a child Surface that has exactly the dimensions of the
snapshot.
- We fill the parent surface with the app background color, as well
as all screen background decorations (status bar background,
navigation bar background).
- We also clip of the status bar/navigation bar background in some
cases, as it looks ugly if it's not behind the system bars.
- Furthermore, we inherit all layout flags on the window and all
layout relevant SystemUI flags on the window such that it's very
likely that the size will match, and the system bars are drawn
correctly.
- In order to make the transition from the snapshot to the real
window a bit more predictable/less messy, we enforce a minimum
duration the snapshot is visible, which is slightly more than our
app transitions.

Test: TaskSnapshotSurfaceTest
Test: Open app, go home, go landscape, open app again
Test: Go to multi-window, open app from recents with a snapshot
taken in fullscreen.

Fixes: 36703868
Change-Id: Ia2d4add6971a18ab7aa2942d2b644d6e87a402af
2017-04-03 15:36:29 +02:00
Bryce Lee
7566d76c61 Add app bounds to configuration.
The system previously overrode the display size for a specific scope
(task/activity/etc.) by setting the associated Configuration's
screenWidthDp/screenHeightDp. This leads to two issues. First, the
conversion of screen size from pixels to display independent pixels
and then upconverting later on leads to rounding errors. Secondly,
the screenWidthDp and screenHeightDp values account for insets, such
as the status bar. These however are not reflected in the display
size when returned from Display#getMetrics/getSize.

This changelist addresses the issue by adding a Rect value to
Configuration which stores the app display bounds. This is always set
at the display level and overridden as appropriate. As the proper
app insets are accounted for at the root configuration, all overrides
(outside of specific exceptions) are the result of the intersection
between the requested bound and the parent bound.

Change-Id: I2c4fcd0bee92af12aabbca258de05b4ec061d0e1
Fixes: 34338931
Bug: 36812336
Bug: 36676979
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsAppTestCases android.app.cts.AspectRatioTests
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerDisplayTests
Test: bit FrameworksServicesTests:com.android.server.wm.AppBoundsTests
2017-03-31 21:34:30 -07:00
TreeHugger Robot
2f8f5ffc4b Merge "Handle disabled packages as removed." into oc-dev 2017-04-01 03:16:38 +00:00
Andrii Kulian
a95bfff746 Fix some WM unit tests
WindowFrameTests#testLayoutNonfullscreenTask and
sizes because test assumed that frame for window was always
bigger than screen size. Now we calculate all frames relative
to real display size.

TestWindowManagerPolicy used in WM unit tests reported incorrect
value from rotationHasCompatibleMetricsLw(), which lead to
DisplayContent#mAltOrientation set to "true" after any rotation
and resulted in shrinked display metrics.

DisplayContentTests#testDefaultDisplayOverrideConfigUpdate was
not restoring the config applied to default display because
it was trying update values in config from non-empty to empty,
which is considered a no-diff.

Test: com.android.server.wm.WindowFrameTests
Test: #testCalculatePolicyCrop
Test: #testLayoutNonfullscreenTask
Test: com.android.server.wm.AppWindowTokenTests
Test: #testLandscapeSeascapeRotationByApp
Test: com.android.server.wm.DisplayContentTests
Test: #testDefaultDisplayOverrideConfigUpdate
Change-Id: Ia0ed46307f67f6b47859209ebcf13253b59b8002
2017-03-31 19:00:57 -07:00
Makoto Onuki
82fb2eb057 Handle disabled packages as removed.
Bug 36600272
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I272334cef00337d5ba01ce4b878c799d9476432f
2017-03-31 16:58:26 -07:00
TreeHugger Robot
2af994ec03 Merge "Ensure we show the PiP menu in response to KEYCODE_WINDOW." into oc-dev 2017-03-31 23:07:23 +00:00
Makoto Onuki
99302b55c6 Revert "Push chooser targets to the shortcut manager."
This reverts commit 58fc95dc578244b7beb687a48184045dcce788b8.

Bug 36186790
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutHostTestCases
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -l INFO -m CtsShortcutManagerTestCases

Also all unit tests, except for the known failrues.
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: I733ee7e12a419ee7ea17ca67c56afe7b039d189a
2017-03-31 15:16:43 -07:00
Winson Chung
ac52f2892d Ensure we show the PiP menu in response to KEYCODE_WINDOW.
Bug: 36687605
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: #testWindowButtonEntersPip
Change-Id: I0bb35fd666eb6a438e4676267f6726b44bffb3db
2017-03-31 10:42:53 -07:00
TreeHugger Robot
554c5946ce Merge "Fix broken unit tests due to mockito upgrade." into oc-dev 2017-03-31 00:41:04 +00:00
Sudheer Shanka
20959b2d40 Merge "Don't increment procStateSeq if uid doesn't have internet permission." into oc-dev 2017-03-30 23:34:07 +00:00
Makoto Onuki
d0010c5ef1 Fix broken unit tests due to mockito upgrade.
Bug 36781317

Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest2 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest3 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest4 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest5 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest6 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest7 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest8 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest9 -w com.android.frameworks.servicestests
Test: adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest10 -w com.android.frameworks.servicestests

Change-Id: Ie9abcd8bdf5353c96ebade0e8489f667ef9904ee
2017-03-30 15:42:01 -07:00
Sudheer Shanka
ed25ce6d59 Fix flaky tests in NetworkPolicyManagerServiceTest.
Test: runtest -c com.android.server.NetworkPolicyManagerServiceTest frameworks-services
Change-Id: I0a6f0d11e3922bfeb2bd3784f23e10ae45e5e40c
2017-03-29 20:46:30 -07:00
Sudheer Shanka
f4923ea0b2 Don't increment procStateSeq if uid doesn't have internet permission.
Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services
      and manual

Change-Id: I02bfd86837813cc79f37301d91489485c6a1d056
2017-03-29 18:04:47 -07:00
Sudheer Shanka
686bb2d337 Add tests for verifying network availability on activity start.
Bug: 27803922
Test: runtest -c com.android.server.net.ConnOnActivityStartTest frameworks-services
Change-Id: I771e1fd9edbe14f1ff7a7a84c3896af6dd6f20a0
2017-03-29 01:00:37 +00:00
Ammar Aijazi
6ce48e25e5 NetworkPolicy gets updated due to CarrierConfigManager updates.
Bug: b/34385985
Test: Added unit tests to NetworkPolicyManagerServiceTest
Change-Id: I1d8249081c478e6484c8011d3eab73a53f105fac
2017-03-28 15:43:34 -07:00
Bryce Lee
27cec32496 Add configuration for maximum UI width.
This changelist adds config_maxUiWidth, a new system resource
configuration which specifies the maximum width the user interface
can operate in. If the physical or specified width is greater than
this value, dimensions and density are scaled down accordingly. The
native mode resolution can be still discovered through
Display.Mode#getPhysicalWidth/getPhysicalHeight.

Test: Defined override for development device and verified values.
Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests#testMaxUiWidth
Change-Id: I12e7ad52f2aa8014e143bc7e80b020c9b24ed9c8
Fixes: 25820708
2017-03-28 20:23:45 +00:00
TreeHugger Robot
77a1f7522e Merge "Parse NotificationChannel ID meta-data." 2017-03-28 00:46:57 +00:00
TreeHugger Robot
9d421ba050 Merge changes Ia971b2bc,I0001eb3d,I55a6951e
* changes:
  Remove framework-protos from SystemUI
  Disable proguard for PluginDummyLib
  Enable multidex for dx
2017-03-27 23:37:10 +00:00
Dmitry Dementyev
117e0c9b5a Merge "Add cache for Account Visibility values." 2017-03-27 22:14:34 +00:00
Sudheer Shanka
995d1c97ea Merge "Uncomment a test." 2017-03-27 20:40:37 +00:00
Dmitry Dementyev
71fa5261d3 Add cache for Account Visibility values.
Test: cts
Bug: 36485175
Change-Id: I075b81f8b287199d51ea09dc1108748310ab846c
2017-03-27 13:22:58 -07:00
David Stevens
e259c2c42b Merge "Compute the focused window in display focus order" 2017-03-27 19:59:58 +00:00
David Stevens
4693956388 Compute the focused window in display focus order
A WindowContainer's children are sorted so the focused child is at the
end of the list, so RootWindowContainer needs to iterate from end to
start when looking for the focused window.

Bug: 36590788
Test: DisplayContentTests#testFocusedWindowMultipleDisplays
Change-Id: I56e6b7d2054bc1e74b54a4f99706a08d278fa2e1
2017-03-27 11:07:22 -07:00
Wale Ogunwale
5e5a68dc06 Fixed issue with SCREEN_ORIENTATION_BEHIND not working correctly
If an app specifies SCREEN_ORIENTATION_BEHIND, then use the orientation
of the app behind it regardless of the visibility state of the app
behind.

Fixes: 35281868
Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerTests
Test: bit FrameworksServicesTests:com.android.server.wm.AppWindowTokenTests
Test: bit FrameworksServicesTests:com.android.server.wm.TaskStackTests
Change-Id: Ieba4e4bb1a7f47cd6f082491d37fcabcf5bd5199
2017-03-27 11:02:54 -07:00
Sudheer Shanka
deeb08fdcb Uncomment a test.
It was commented earlier because of a crash. Since that issue has been
fixed, uncomment the test.

Bug: 27803922
Test: runtest -c com.android.server.am.ActivityManagerServiceTest frameworks-services
Change-Id: I5f2b1b0bffe032633f42c8c34ed8a7ae5a3dfc10
2017-03-27 10:57:01 -07:00
Sudheer Shanka
d292c15558 Merge "Update AMS to use NetworkManagementInternal.isNetworkRestrictedForUid." 2017-03-25 08:01:13 +00:00
Sudheer Shanka
c9d150dcbd Merge "Add NetworkManagementInternal.isNetworkRestrictedForUid." 2017-03-25 08:00:39 +00:00
Amin Shaikh
d601360904 Parse NotificationChannel ID meta-data.
- Add this new meta-data field on NetworkRecommendationProvider to NetworkScorerAppData

Bug: 36571359
Test: runtest frameworks-services
Change-Id: Ic8c594bea406fc5183a4919b808bce5159912650
2017-03-24 16:08:32 -07:00
TreeHugger Robot
84acb2e042 Merge "Added support for maxAspectRatio manifest attribute." 2017-03-24 22:42:16 +00:00