Commit Graph

7172 Commits

Author SHA1 Message Date
Jorim Jaggi
d915fc7025 Merge "Automatically clean up flicker test data" 2019-12-09 14:14:54 +00:00
Nataniel Borges
9f2ad75a6e Automatically clean up flicker test data
Currently the flicker tests leave data on the /sdcard/flicker directory. We now clean up this data after the test.

The logs are still available in the atest results directory.

Test: atest FlickerTests
Change-Id: Ia83cbedff3104964e3d4be14a7c035f2193d36a8
2019-12-04 10:38:42 +01:00
Paul Hu
6be69420df Merge "Replace the permission of internal connectivity checks" 2019-12-04 05:59:59 +00:00
paulhu
59148b7938 Replace the permission of internal connectivity checks
A number of connectivity checks that protect system-only methods
check for CONNECTIVITY_INTERNAL, but CONNECTIVITY_INTERNAL is a
signature|privileged permission. We should audit the permission
checks, and convert checks that protect code that should not be
called outside the system to a signature permission. So replace
all CONNECTIVITY_INTERNAL to other proper permissions.

Bug: 32963470
Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I8f2dd1cd0609056494eaf612d39820e273ae093f
Merged-In: I8f2dd1cd0609056494eaf612d39820e273ae093f
2019-12-04 11:44:45 +08:00
Treehugger Robot
87bf9bc09c Merge changes Ie756b9aa,I38110f3a
* changes:
  [NS A19] Inline updateCapabilities in rematch.
  [NS A18] Reverse listens and request-availables
2019-12-04 02:07:45 +00:00
Treehugger Robot
2b65793cd6 Merge "Merge Android10 QPR1 into AOSP master" 2019-12-03 23:15:02 +00:00
Chalard Jean
b6ec076ac0 Disable a flaky test
Bug: 145513323
Test: FrameworkNetTests
Change-Id: I66e02fdaab2969b77db4a0f0e6fb8b1a981d9350
2019-12-03 16:13:22 +09:00
Chalard Jean
28e6b26c11 [NS A18] Reverse listens and request-availables
This is a long standing bug that happens to now be trivial
to fix, and also be beneficial for refactoring

Test: FrameworksNetTests NetworkStackTests
Change-Id: I38110f3a4a75936ea755788e7f9fee67863e14be
2019-12-02 18:44:10 +09:00
Chalard Jean
f477d5c4c6 Merge changes I0613c23f,Ibeab8d0a,I8bd668ad,I7d3a16be
am: 5cf5b30990

Change-Id: Ibe34e78e53a15e987042703fdd27d6393e4e7d59
2019-12-01 21:26:44 -08:00
Chalard Jean
5cf5b30990 Merge changes I0613c23f,Ibeab8d0a,I8bd668ad,I7d3a16be
* changes:
  [NS A14] Move code notifying battery stats in its right place
  [NS A13] Move legacy broadcast handling after rematch.
  [NS A12] Move some legacy type tracker handling to a function
  Add tests for ConnectivityService → BatteryStats messages
2019-12-02 05:17:39 +00:00
Chalard Jean
bbaa33e1d3 [NS A14] Move code notifying battery stats in its right place
This should be done once every time an interface comes online.
Doing this in updateLinkProperties guarantees this happens every
time a new interface comes online, but it doesn't do it more
often than needed.

Test: FrameworksNetTests NetworkStackTests
Change-Id: I0613c23f44192944266d76107308da8d1c541d1c
2019-12-02 13:02:38 +09:00
markchien
6b828d2915 [Tether07] Migrate Tethering into module
am: 0df2ebc43d

Change-Id: I1aaa034e91eae2d6e9abcbbd70741a54a18b3ddc
2019-11-30 04:25:57 -08:00
Mark Chien
e8401aff92 Merge changes from topic "tether_migrate"
* changes:
  [Tether10]Remove UserManagerInternal usage in Tethering
  [Tether07] Migrate Tethering into module
  [Tether07] Clean up build rule for libtetheroffloadjni
2019-11-30 12:17:47 +00:00
markchien
0df2ebc43d [Tether07] Migrate Tethering into module
Now tethering would be run in dedicated service.
TetheringManager is the interface used to communicate with
TetheringService. The new call flow would be: ConnectivityManager
-> ConnectivityService -> TetheringManager -> TetheringService.
Note: the return value of #tether(), #untether() and #setUsbTethering()
APIs would always be no error. Client can use #getLastTetherError()
or #getTetheredIfaces or listen tether state change to check
status of corresponding interface.

Bug: 136040414
Bug: 144742179
Test: -build, flash, boot
      -atest TetheringTests
      -atest FrameworksNetTests

Change-Id: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
Merged-In: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
2019-11-30 10:03:08 +00:00
Chalard Jean
587758bea6 Add tests for ConnectivityService → BatteryStats messages
Test: ConnectivityServiceTest
Bug: 113554781
Change-Id: I7d3a16be76f606872f8edb84647b9ef94f36cba1
2019-11-29 16:59:30 +09:00
Hugo Benichi
04cad88eee Merge "BitUtils: support packing/unpacking negative long values"
am: 9e5de85e21

Change-Id: Ibd0c4756fb0f888a506111bb2f33c60debe33d57
2019-11-27 07:46:56 -08:00
Treehugger Robot
9e5de85e21 Merge "BitUtils: support packing/unpacking negative long values" 2019-11-27 15:34:46 +00:00
Hugo Benichi
7157c8e7af BitUtils: support packing/unpacking negative long values
Bug: None
Test: Compiled. New unit tests.
Change-Id: Ia543285e206b0bbc7d64458da10e68a951f9eec1
2019-11-27 11:00:32 +09:00
Nataniel Borges
fcc1ef2d7d Merge "Include janky runs on flicker rotation tests"
am: 3341bbefea

Change-Id: I05d509ca9ceb0d14725c25f90de4381fd1ff5241
2019-11-26 08:37:23 -08:00
Treehugger Robot
3341bbefea Merge "Include janky runs on flicker rotation tests" 2019-11-26 16:29:45 +00:00
Chiachang Wang
a6e8219c59 Merge "Refactor based on new NetworkMonitor"
am: 0d7ed7932d

Change-Id: I6f2f42dee11b2ee3db9e52817cd7aa871539aaed
2019-11-26 04:03:47 -08:00
Chiachang Wang
0d7ed7932d Merge "Refactor based on new NetworkMonitor" 2019-11-26 10:52:33 +00:00
Nataniel Borges
8e65a898ec Include janky runs on flicker rotation tests
Sometimes the tests crash because all runs are janky. Our checks are so far robust to jank, so we will consider janky runs too

Test: atest FlickerTests
Change-Id: I20303d530e1a9cc266230530c6f7fa1cecd51020
2019-11-26 11:46:42 +01:00
Chiachang Wang
3532e86487 Refactor based on new NetworkMonitor
Bug: 130325409
Test: atest NetworkStackIntegrationTests
Change-Id: I4426be339cb9990c05b3f4fb5666bd70bcd0f78e
2019-11-26 09:10:45 +08:00
Paul Hu
e0ddf49e0b Merge "Fix hasUseBackgroundNetworksPermission issue."
am: 85e8fd5a24

Change-Id: I6f378dcbbecb9848d02112b2d33c5a0f2d5c9d1f
2019-11-25 06:05:32 -08:00
Lucas Lin
124bb5c9ff Merge "Fix title of PRIVATE_DNS_BROKEN notification when connecting VPN"
am: 82f0c22598

Change-Id: I2df410b6ceb0f9a28ee0f171bb2ff7cadd4cdefb
2019-11-25 05:56:29 -08:00
Bill Lin
00190cf8a6 Merge changes from topic "migrate_CtsStagedInstallTest_RollbackTest"
am: 63e6d6af01

Change-Id: I362c1a03a1f8c106f684cd6a28fe63fbd5532d9c
2019-11-25 05:36:35 -08:00
Richard Uhler
5a6df15108 Increase timeout in testNativeWatchdogTriggersRollback
am: 5f01cb9246

Change-Id: I4677f053787074ef445bba8d18ace8ad66c711ff
2019-11-25 05:36:26 -08:00
Richard Uhler
79e8fcb4ae Fix flaky testEnableRollbackTimeoutFailsRollback test
am: 1d66bf8c48

Change-Id: Id8c792c9a0926fbd7b8e287c6547eb250caca5fb
2019-11-25 05:36:13 -08:00
Oli Lan
170a519878 Wait for available rollbacks in RollbackTest.
am: 77a40731f8

Change-Id: I83b8f07f333e318bb7fd31b2bec3f868b1848c6c
2019-11-25 05:35:57 -08:00
Richard Uhler
a39bd708e4 Update to new RollbackUtils.sendCrashBroadcast API.
am: 3e7ef5ae0b

Change-Id: I518d37f8d2eef80f63c88530ed4aa581c27b9e75
2019-11-25 05:33:56 -08:00
Gavin Corkery
4bcb79bb71 Extend ROLLBACK_COMMITTED broadcast for the multi-user case
am: e92720ddb9

Change-Id: I28bb0d0574c80df5f6d6628bc6026d99770faaf5
2019-11-25 05:33:06 -08:00
Richard Uhler
01178b4f9d Cleanup some obsolete TODOs and unused code.
am: cda1a17516

Change-Id: I56bce126042670678002ddbbfcf14ff9f94860c3
2019-11-25 05:24:46 -08:00
Paul Hu
85e8fd5a24 Merge "Fix hasUseBackgroundNetworksPermission issue." 2019-11-25 08:41:05 +00:00
Lucas Lin
82f0c22598 Merge "Fix title of PRIVATE_DNS_BROKEN notification when connecting VPN" 2019-11-25 08:14:09 +00:00
Bill Lin
63e6d6af01 Merge changes from topic "migrate_CtsStagedInstallTest_RollbackTest"
* changes:
  Add multi-user test for the general non-staged case
  Increase timeout in testNativeWatchdogTriggersRollback
  Fix flaky testEnableRollbackTimeoutFailsRollback test
  Wait for available rollbacks in RollbackTest.
  Include NewRollbacks in result of getAvailableRollbacks.
  Rename RollbackData to Rollback.
  Remove INSTALLED_USERS extra from ACTION_PACKAGE_ENABLE_ROLLBACK.
  Update to new RollbackUtils.sendCrashBroadcast API.
  Extend ROLLBACK_COMMITTED broadcast for the multi-user case
  Fix NullPointerException.
  Cleanup some obsolete TODOs and unused code.
  Test Native Watchdog triggers RollbackManager rollback
  Uninstall testapps before running SecondaryUserRollbackTest
  delete ENABLING rollback if we can't get session info for it.
  Add test for rollback of userdata with multiple rollbacks
  Load rollback data in RollbackManagerServiceImpl constructor.
  Use "commit" for rollbacks instead of "execute".
  Add TestApi to block the RollbackManagerHandlerThread.
  Use Slog in RollbackManager, not Log
  Make setRequestDowngrade @TestApi
  Migrate RollbackTest and StagedRollbackTest to cts utils
  Add .apex suffix to apex files during validation
  Add host side test for secondary user rollback
  Reduce ENABLE_ROLLBACK timeout to 0 for timeout test.
2019-11-25 02:56:10 +00:00
paulhu
86e23ebb47 Fix hasUseBackgroundNetworksPermission issue.
PermissionMonitor#hasUseBackgroundNetworksPermission only uses
the first package name of the uid for checking permission.
This is incorrect since each package declared different
permissions. So using the mApps which already checked both
network and using restricted network permissions. If uid is in
the mApps list that means uid has one of permission at least.

Bug: 135897744
Test: atest FrameworksNetTests
Change-Id: I3500a03ce06b5b822311ad0c67b606ce4039216a
2019-11-24 22:27:32 +08:00
Remi NGUYEN VAN
8a72e3d3b4 Merge "Move shared packages to NetworkStack project"
am: 27253f29ad

Change-Id: I17068de9e9b4388b8ec025ce3e1dc722e471ccbb
2019-11-21 23:15:29 -08:00
Remi NGUYEN VAN
27253f29ad Merge "Move shared packages to NetworkStack project" 2019-11-22 06:50:22 +00:00
lucaslin
ccab250a55 Fix title of PRIVATE_DNS_BROKEN notification when connecting VPN
NetworkNotificationManager will only get the first transport
type from the NetworkCapabilities of network, and if the device
connects to a VPN and its underlying network is wifi, then the
first finding transport type will be TRANSPORT_WIFI. So, if the
private DNS is broken when device connected to VPN,
NetworkNotificationManager will try to get the SSID for the
title of notification but failed. For this kind of case, the
title of PRIVATE_DNS_BROKEN notification will show
"null has no internet access".

Bug: 143340533
Test: 1. Build pass.
      2. Connect to VPN and let private DNS to be broken, check
      title of PRIVATE_DNS_BROKEN notification.
      3. atest FrameworksNetTests

Change-Id: I1ed018cc8774d4fce4b94854f8e8703a28818463
2019-11-22 12:46:32 +08:00
Gavin Corkery
1a6ea95489 Add multi-user test for the general non-staged case
This test makes assertions about the case where there are two
users running a test application. It verifies that each user can
have its own unique userdata for the same app, and that upgrades
and downgrades are applicable for all users on the device.

Test: atest MultiUserRollbackTest
Test: atest RollbackTest
Bug: 140401995
Change-Id: I77a18cf99ec8d7f30696119919dae8859f9fb25b
Merged-In: I5e5c154758b3f0e4731696c813519ac798fbbae9
2019-11-21 17:53:11 +08:00
Richard Uhler
5f01cb9246 Increase timeout in testNativeWatchdogTriggersRollback
Bumps a timeout from 1 minute to 5 minutes, because in practice a lot
more needs to happen in that time window than we expect to fit in 1
minute.

Bug: 140223710
Test: atest StagedRollbackTest:com.android.tests.rollback.host.StagedRollbackTest#testNativeWatchdogTriggersRollback
Change-Id: I2e937f8e1f87356815a834241ad5e9ec1e953892
Merged-In: I2a98e71102fc1cbf6ea712e070d6db49cdb05cba
2019-11-21 17:52:54 +08:00
Richard Uhler
1d66bf8c48 Fix flaky testEnableRollbackTimeoutFailsRollback test
We no longer block on the handler thread in getAvailableRollbacks. That
means it is possible we see an available rollback left over from a
previous test run. Update the test to ensure previous rollbacks are
removed and give sufficient time to make a new rollback available before
concluding that no rollback will be made available in this case.

Test: atest RollbackTest:com.android.tests.rollback.RollbackTest#testEnableRollbackTimeoutFailsRollback
Change-Id: I8b22320bb3ee60152ab808706913eff43ab7cc9f
Merged-In: Id94d5452836b07d6f802758bd0dfdd3c276a3c05
2019-11-21 17:52:02 +08:00
Oli Lan
77a40731f8 Wait for available rollbacks in RollbackTest.
This changes RollbackTest to retry checks for available rollbacks for
a certain period of time, using a new RollbackUtils method
waitForAvailableRollbacks.

Currently many of the tests in RollbackTest are flaky due to race conditions
between checking for available rollbacks and the installer onFinished callback.
This CL should fix all of those issues.

The previous attempt to resolve this by adding NewRollbacks speculatively to
the results of getAvailableRollbacks was not successful. This CL reverts that
change so that getAvailableRollbacks once again only returns rollbacks that are
actually available.

Bug: 136548146
Test: atest RollbackTest run on cuttlefish on acloud repeatedly
Change-Id: I0389ef2413e7642fe2f6ef1a33aef218dd1896ed
Merged-In: I27e2513b34f49af2f41cd627a5d2550541831e11
2019-11-21 17:51:11 +08:00
Richard Uhler
3e7ef5ae0b Update to new RollbackUtils.sendCrashBroadcast API.
Bug: 139108668
Test: atest StagedRollbackTest:com.android.tests.rollback.host.StagedRollbackTest#testBadApkOnly
2
Merged-In: Iaaa728aa58d894ba546677e8295faba2ebfc5e64

Change-Id: I877a2d5ee00a2d58fa748c45d4eaffd54b3b0127
2019-11-21 17:14:00 +08:00
Gavin Corkery
e92720ddb9 Extend ROLLBACK_COMMITTED broadcast for the multi-user case
For the case where there are multiple users on the device,
the ROLLBACK_COMMITTED broadcast should be sent to all
users for which the package is being rolled back.

Test: atest RollbackTest
Test: atest SecondaryUserRollbackTest
Bug: 139060321
Change-Id: I901ff8a3331c7a8a8585c855a0caead347321d5d
Merged-In: I8e20da321f52ebf9e6d584a8c59d2a3106a32212
2019-11-21 17:13:59 +08:00
shafik
7ef8104354 Test Native Watchdog triggers RollbackManager rollback
Test flow:
    * Staged install com.google.android.modulemetadata
    * Crash a native process (apexd) enough times to trigger a rollback
    * Wait for device reboot (automatically)
    * Assert rollback of com.google.android.modulemetadata has been
    committed

Test: atest StagedRollbackTest#testNativeWatchdogTriggersRollback
Bug: 135864628
Change-Id: I5176cc7890e251e7ccc10abdfcfee3a5190721b2
Merged-In: Ibe726c140939190adb3db9c18b3b442ba59548a3
2019-11-21 17:10:56 +08:00
shafik
b9f1521715 Uninstall testapps before running SecondaryUserRollbackTest
Add target_preparer for uninstalling TestApp.A and TestApp.B before
running SecondaryUserRollbackTest.
Also, fix the tearDown command after each case to uninstall the right
apps.

Test: atest SecondaryUserRollbackTest ; atest SecondaryUserRollbackTest
Bug: 136538996
Change-Id: I35edde58eb8b520f167bace7848956d091155158
Merged-In: I3d5decae03bf9d2f9d78a534399214da05a6d372
2019-11-21 17:10:56 +08:00
Gavin Corkery
bcf89b81f5 Add test for rollback of userdata with multiple rollbacks
This test ensures that if a staged install is abandoned, and then
staged again, the userdata snapshot will match the correct rollback.
Since there will be multiple rollbacks in the ENABLING state for the
same package, it is important to ensure that the userdata for the
abandoned rollback is not used.

Test: atest StagedRollbackTest
Bug: 134035054
Change-Id: Ic977e747103c9a9a44592846de73287788cbac6d
Merged-In: Icae7226dfb393c5ffc31dd0116f61141e84f5a42
2019-11-21 17:08:32 +08:00
Richard Uhler
0c48af84fe Add TestApi to block the RollbackManagerHandlerThread.
To eliminate flakiness when testing timeout conditions for
RollbackTest.testEnableRollbackTimeoutFailsRollback.

Test: atest RollbackTest.testEnableRollbackTimeoutFailsRollback in a loop
Bug: 134373106
Change-Id: I2d1de148a83231f3fd48cc05b7320fa5fdf091ce
Merged-In: I01f3e769711ffa51fa714ff4bc81e70887f427ad
2019-11-21 16:58:45 +08:00