7145 Commits

Author SHA1 Message Date
sqian
22f5749ccc Make getPackagesWithPriviligesForAllActiveSubscriptions system API
Test: build
Bug: 145550382
Change-Id: Ia7efb9e4b22b24f3c87c7cd631548c7254b28926
Merged-In: Ia7efb9e4b22b24f3c87c7cd631548c7254b28926
(cherry picked from commit 6f27c5769d8c5b5c76d143f590a8c4d1c5d8ccee)
2019-12-06 12:07:57 -08:00
Neil Fuller
6e3020490d Merge "TimeDetector improvements" 2019-12-06 11:53:14 +00:00
Neil Fuller
63d5f12489 Merge "Add suggestManualTimeZoneSuggestion to the client" 2019-12-05 13:51:34 +00:00
Neil Fuller
106f18a666 Add suggestManualTimeZoneSuggestion to the client
Add TimeZoneDetector.suggestManualTimeZone() to set the time zone
"manually" and switch the device policy manager code over to using
it.

Add RequiredPermission annotations to TimeZoneDetector while there.

Bug: 140712361
Test: treehugger only
Test: atest services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
Change-Id: Id247fddfdd793732dd88294ee215eda37cd0be4c
2019-12-05 12:12:14 +00:00
atrost
23886e7b2c Add descriptions to compat changes.
Capture the comment above a definition of a compat change and make it
the description.
Next: make sure existing changes use supported format (only /**
comments, only above the annotations), and use in developer UI.

Bug: 144927670
Test: atest com.android.server.compat.CompatConfigTest
Change-Id: Ib23f341baa171599654c351693e4b0ddf4b2515c
2019-12-04 17:17:16 +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
2b65793cd6 Merge "Merge Android10 QPR1 into AOSP master" 2019-12-03 23:15:02 +00:00
Neil Fuller
0db51fc310 TimeDetector improvements
TimeDetector improvements for production code and tests. Many of these
are based on feedback given for TimeZoneDetector and to improve
consistency across the two.

1) Add a builder for PhoneTimeSuggestion, making it immutable (except
for debug info that doesn't affect behavior).
2) Improve debug logging.
3) Improve comments / annotations.

Test: atest android.app.timedetector
Test: atest com.android.server.timedetector
Bug: 140712361
Change-Id: Ibd0d357c536d512ffe4995c4e6560e483a260ae5
2019-12-03 20:22:05 +00:00
Neil Fuller
7fcab2dba8 Merge "Add a manual path for setting time zone" 2019-12-03 20:17:09 +00:00
Neil Fuller
77d5009778 Merge "Make TimeDetectorService / Strategy consistent" 2019-12-03 19:26:07 +00:00
Neil Fuller
2c6d510e45 Add a manual path for setting time zone
Add a mechanism for suggesting the "manual" time zone setting to the
TimeZoneDetectorStrategy, e.g. for the settings app to use. This
involves various changes / renames to TimeZoneDetectorStrategy to
introduce a distinction between 3 things:
1) General detection code, applicable for anything that changes device
time zone.
2) Phone detection code, applicable for setting the device time zone
from phone signals.
3) Automatic detection code, applicable for setting the device time zone
automatically (of which telephony signals is currently the only example,
but could be joined by new things in future).

Adds tests for the new ManualTimeZoneSuggestion and makes improvements
to the existing tests for PhoneTimeZoneSuggestionTest.

Test: atest android.app.timezonedetector
Test: atest com.android.server.timezonedetector
Bug: 140712361
Change-Id: I9c3a18e47b157cccabda74855e5c91b45fa93b92
2019-12-03 16:38:03 +00:00
Dario Freni
c7a4eec435 Merge changes from topic "aosp-apk-in-apex"
* changes:
  DO NOT MERGE: Fixes NPE when preparing app data during init
  Support privileged apps installed in APEX.
  Support non-privileged APKs in APEX.
  Refactors initial directory scan to be dryer
2019-12-03 11:45:55 +00:00
Neil Fuller
7d8a624085 Merge "Add a new time zone detection service" 2019-12-03 08:40:07 +00:00
Kenny Root
cec994c03f Merge "Convert LockSettingsService tests to JUnit4"
am: 78056c77f3

Change-Id: Ia3e6556eaebc346434abc84ee9d76287f77a7130
2019-12-02 11:25:12 -08:00
Treehugger Robot
78056c77f3 Merge "Convert LockSettingsService tests to JUnit4" 2019-12-02 19:18:23 +00:00
Neil Fuller
3352cfce2f Add a new time zone detection service
Add a new time zone detection service. Much of the code is from
frameworks/opt/telephony with some changes for naming, threading and
to modify the interaction with the "Callback" class.

Overall goal:

Implementing the service in the system server means it will be easier to
add new time zone detection logic unrelated to telephony in future.

Bug: 140712361
Test: atest com.android.server.timezonedetector
Test: atest android.app.timezonedetector
Change-Id: I89505fc4fecbd3667b60f8e1479b8f177eaa60ae
Merged-In: I89505fc4fecbd3667b60f8e1479b8f177eaa60ae
(cherry picked from commit 3e3b5405b6c5e77a640ad9450eb1cac5b7c80ff1)
2019-11-28 13:27:55 +00:00
Neil Fuller
40cf2957e4 Make TimeDetectorService / Strategy consistent
Make TimeDetectorService / Strategy consistent with time zone detection
code, improve logging and generally tidy up.

1) Turn off debug logging / shorten log tags.
2) Add LocalLog for recording time changes.
3) Move to using FgThread for calls that can be done async / change
synchronization model (responsibility moves from service to strategy).
4) Move responisibility for determining current auto-time state to the
strategy.
5) Rename the strategy test to be correct(!)

Bug: 140712361
Test: atest services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorServiceTest.java
Test: atest services/tests/servicestests/src/com/android/server/timedetector/SimpleTimeDetectorStrategyTest.java
Change-Id: I4902f6b360c168ec16a1595359153488a310a91a
2019-11-28 12:11:17 +00:00
Patrick Baumann
ecccf009ea Refactors initial directory scan to be dryer
This change collapses a bunch of manual calls to scanDir with a map and
a loop. This makes things a little more readable and easier to update
going forward.

Bug: NA
Test: boots without issue.
Merged-In: I81fb7a9474894d0bceecb6b0ef7a64d047a40c14
Change-Id: I81fb7a9474894d0bceecb6b0ef7a64d047a40c14
2019-11-28 18:26:05 +08:00
Neil Fuller
b07f90adb8 Merge "Add a new method to set time"
am: 5f01cb6ddc

Change-Id: If92a40f84971a663f99d7d764cd45e8d3510bfda
2019-11-28 00:54:46 -08:00
Neil Fuller
5f01cb6ddc Merge "Add a new method to set time" 2019-11-28 08:47:32 +00:00
Jay Aliomer
d175be5ebe Merge "Update NotificationRecord of snooze even after it is cancelled"
am: 10f4d427cd

Change-Id: Ibd4367f14ee326acfba3bb54ee701e8b0265aebf
2019-11-27 10:16:51 -08:00
Koji Fukui
7bb4802a03 Update NotificationRecord of snooze even after it is cancelled
Symptom:
If a snoozed notification is cancelled and new notification that has
same key is registered, the system continue to snooze the
notification. But the notification won't be notified when the snoozing
period expires.

Root cause:
SnoozeHelper doesn't update NotificationRecord if the existing record
has already been cancelled. SnoozeHelper continue to use existing
cancelled record. So SnoozeHelper doesn't repost notification when the
snoozing period expires.

Solution:
SnoozeHelper updates NotificationRecord even if the existing record
has been cancelled.

Fixes: 140462813
Change-Id: I4b58aed20eec08819e36dac9dda250ac046205b8
2019-11-27 17:38:22 +00:00
Neil Fuller
3aedd49238 Add a new method to set time
Before this change there are a various components that set the system
clock by directly calling AlarmManager.setTime(). This change exposes a
new method on TimeDetector to use when setting the device time manually
(e.g. via settings) and modifies some callers to use it.

The intent is to later restrict the number of distinct processes that
can manipulate the device system clock directly so that all time changes
go through the time detector service, which can enforce policy, log
the reasons for changes, and so on.

Bug: 140712361
Test: atest com.android.server.timedetector
Change-Id: I9300dba868ed61249d0848b0dd4b953996161bda
Merged-In: I9300dba868ed61249d0848b0dd4b953996161bda
(cherry picked from commit e376756b0c0e3164300c3fd624f9221181e82553)
2019-11-27 16:34:53 +00:00
Anna Trostanetski
aa7b68930a Merge "Add Listeners to PlatformCompat"
am: e14d7099a9

Change-Id: Id187394dc3f52f560faac6b9c73dea40119a5eff
2019-11-27 06:20:13 -08:00
Anna Trostanetski
e14d7099a9 Merge "Add Listeners to PlatformCompat" 2019-11-27 14:09:59 +00:00
Neil Fuller
e02dcaa9d1 Merge "Allow for empty time suggestions"
am: a241a15ccc

Change-Id: Ib6e1ddbba9c474f06475a666d025ab8e0f98189b
2019-11-27 02:04:56 -08:00
Neil Fuller
a241a15ccc Merge "Allow for empty time suggestions" 2019-11-27 09:45:53 +00:00
Sudheer Shanka
1381de466a Merge "Fix NetworkPolicyManager unit tests."
am: da3518bc6b

Change-Id: I4caf3995143b5dc63925e64a05dd9dd94deec636
2019-11-26 19:05:41 -08:00
Sudheer Shanka
2d1ab90aa2 Fix NetworkPolicyManager unit tests.
Bug: 137859686
Test: atest core/tests/coretests/src/android/net/NetworkPolicyManagerTest.java
Test: atest services/tests/servicestests/src/com/android/server/net/NetworkPolicyManagerServiceTest.java
Change-Id: I38a935c71bfb1f78739d508b400e43dc1b52bef5
Merged-In: I38a935c71bfb1f78739d508b400e43dc1b52bef5
(cherry picked from commit 6ec3caf21811ce40e188b7a43c744c0057cd54af)
2019-11-27 02:50:03 +00:00
Kenny Root
d01bb41b93 Convert LockSettingsService tests to JUnit4
In preparation for adding more tests to LockSettingsService, convert the
existing JUnit3 tests to JUnit4 like the tests in the
recoverablekeystore subdirectory.

(cherry-picked from commit e7178a2358a457922ecb35c5f418903a3de363ab)

Test: atest FrameworksServicesTests:CachedSyntheticPasswordTests \
            FrameworksServicesTests:LockSettingsServiceTests \
            FrameworksServicesTests:LockSettingsShellCommandTest \
            FrameworksServicesTests:LockSettingsStorageTests \
            FrameworksServicesTests:LockscreenFrpTest \
            FrameworksServicesTests:PasswordSlotManagerTests \
            FrameworksServicesTests:SP800DeriveTests
Test: atest FrameworksServicesTests:SyntheticPasswordTests \
            FrameworksServicesTests:WeaverBasedSyntheticPasswordTests
Bug: 145144304
Merged-In: Iaf280718d4c28966b60c76dda90a4674a24f26c6
Change-Id: Iaf280718d4c28966b60c76dda90a4674a24f26c6
2019-11-26 08:48:53 -08:00
atrost
0be238b455 Add Listeners to PlatformCompat
This allows doing more work except killing the app upon change override.
Up to one listener per change id is allowed. Currently intended for
SeLinux usecase only (for data relabeling, see http://ag/9635653).

Test: atest FrameworksServicesTests
Bug: 143539591

Change-Id: Ib2110a31d4f521fc8054620a9edf902fa5bba501
2019-11-25 18:19:08 +00:00
Richard Uhler
b646e555e8 Rename RollbackData to Rollback.
am: 91fc4db14e

Change-Id: I01d1329b3c49deee6b54ae77100cdaf71c3bbf55
2019-11-25 05:34:58 -08:00
Oli Lan
682e501c2a Remove INSTALLED_USERS extra from ACTION_PACKAGE_ENABLE_ROLLBACK.
am: 87a504d1fc

Change-Id: I8636d29038d10d3f4182e130de08ad8efa294a8e
2019-11-25 05:34:25 -08: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
Xin Li
9ae3822f83 DO NOT MERGE - Merge QQ1A.191205.011 into stage-aosp-master
Bug: 144955631
Merged-In: I86c741f7ede242568aab436f673000c9f0da5813
Change-Id: Ia6a3a55023e4e66811c4ef7c6ccd05c5db3e5944
2019-11-24 05:17:08 +00:00
Kenny Root
1b506101de Merge "Make RecoverySystemService more testable"
am: 49af39e751

Change-Id: I79d712e2c8739212c4a62e9db6deddf28091fafc
2019-11-22 08:27:49 -08:00
Kenny Root
d508e1e61f Make RecoverySystemService more testable
This allows the RecoverySystemService to be instantiated outside of its
lifecycle events and mocked connections to be injected during the tests.

Test: atest FrameworksServicesTests:RecoverySystemServiceTest
Merged-In: If75632b8dc16c916f3fa90853d6c1863b75d2c64
Change-Id: If75632b8dc16c916f3fa90853d6c1863b75d2c64
2019-11-21 23:54:05 +00:00
David Su
c4df6668bb Merge "NetworkKey: migrate from ScanResult.wifiSsid to SSID"
am: 1124e240c0

Change-Id: Ia0c92f1db33b0a884da7388cd31b33d51df29288
2019-11-21 11:50:57 -08:00
David Su
1124e240c0 Merge "NetworkKey: migrate from ScanResult.wifiSsid to SSID" 2019-11-21 18:44:46 +00:00
Richard Uhler
91fc4db14e Rename RollbackData to Rollback.
Because "Data" doesn't add anything useful to the name.

Also prefer the variable name "rollback" over "data" and "rd" for
instances of Rollback.

Test: builds.
Change-Id: Ibaa3326660345a763c67c573368ba1da11c0a830
Merged-In: I5ae3866753d6badcdf019525b40522937568dee5
2019-11-21 17:49:25 +08:00
Oli Lan
87a504d1fc Remove INSTALLED_USERS extra from ACTION_PACKAGE_ENABLE_ROLLBACK.
This changes RollbackManagerServiceImpl to use the list of installed users
that is passed in to snapshotAndRestoreUserData for the purpose of snapshotting.

With this change, it is no longer necessary for the list of installed users to be
added as an extra to the ENABLE_ROLLBACK intent, so that extra
(EXTRA_ENABLE_ROLLBACK_INSTALLED_USERS) is removed.

Bug: 139181444
Test: atest RollbackTest
Test: atest AppDataRollbackHelperTest
Exempt-From-Owner-Approval: Already approved in
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/9168506

Change-Id: Iff42f4e5b2d02d1124d64a5fedc659a41cddd5fc
Merged-In: Iffd63977a7498e3cba20d2039af623c921d38f57
2019-11-21 17:41:10 +08:00
David Su
e51ae1566b NetworkKey: migrate from ScanResult.wifiSsid to SSID
wifiSsid is an @hide field, migrate to getter method.

Bug: 144311098
Test: atest NetworkKeyTest
Change-Id: Ic689e12b8de4af52fae26c25bc90c8eb093ad3fe
Merged-In: Ic689e12b8de4af52fae26c25bc90c8eb093ad3fe
2019-11-20 10:41:59 -08:00
Dario Freni
62637979e4 Merge changes from topic "apks_in_apex"
am: a8ce56e23f

Change-Id: I0373f86833f35ed61c3138d8f26d63667db03d7f
2019-11-20 08:07:42 -08:00
Neil Fuller
568fd897eb Allow for empty time suggestions
Allow for empty time suggestions in the TimeDetectorService. The empty
suggestions are currently ignored but are likely to be used in future
time detector strategy implementations.

Bug: 140712361
Test: atest android.app.timedetector.PhoneTimeSuggestionTest
Test: atest com.android.server.timedetector
Change-Id: Ifb219702fa8bc53665a0d74752e06d851d86f8bb
2019-11-20 16:04:37 +00:00
Dario Freni
a8ce56e23f Merge changes from topic "apks_in_apex"
* changes:
  PackageAbiHepler no longer modifies Package
  Adds scan unit tests
2019-11-20 15:43:57 +00:00
Beverly
e9e1e8290a Merge "Update equals and hashCode methods of NoMan.Policy"
am: e3d6061a67

Change-Id: I723e70a5e6c856ecd693d9b6eb8c592303fe9f11
2019-11-18 13:53:33 -08:00
Beverly
3fe3e8195a Update equals and hashCode methods of NoMan.Policy
Test: atest AudioManagerTest#testPriorityOnlyChannelsCanBypassDnd
Fixes: 142643922
Change-Id: I15835f784ba73b40eccf92a0a430905d28647669
Merged-In: I15835f784ba73b40eccf92a0a430905d28647669
(cherry picked from commit 4f8b0224e12037f5c41200722d689e1c8e0d8e1e)
2019-11-18 13:55:43 -05:00
Patrick Baumann
235e52eace PackageAbiHepler no longer modifies Package
Bug: 137881067
Test: atest ScanTests
Exempt-From-Owner-Approval: Already approved in
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/8884794

Change-Id: I50f7c200bc97f08e49f33158bf1df7881b9b231a
Merged-In: I060f2d1395886a9eebce703bd80149559f9c39bb
2019-11-16 22:38:49 +08:00
Patrick Baumann
f62817e86e Adds scan unit tests
This change adds much needed unit tests to the scanPackageOnlyLI method
in PackageManagerService. As part of the change, the abi-deriving /
parsing code that is heavily device state dependant has been extracted
into an interface that can be mocked.

Test: atest ScanTests
Bug: 137881067
Bug: 137961986
Exempt-From-Owner-Approval: Already approved in
https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/7844466

Change-Id: If99330c63658ff21c799712f99c9bb5eba35b960
Merged-In: Ib0b17bffa02570451bd2ad6a649791832c9edd65
2019-11-16 22:38:26 +08:00
Howard Chen
a0dc5e8e10 Merge "Use the new gsid interface"
am: c68c069db7

Change-Id: I7d8d96c8de5089360302deef783cf617a94a7abc
2019-11-15 04:04:57 -08:00