Commit Graph

1728 Commits

Author SHA1 Message Date
Florian Mayer
1584d1813d Add callback for atom for MTE state
Bug: 266706806
Change-Id: Ia1fc6ce8b16d61fccb1b67b3aae0353ee40672b1
2023-03-01 00:24:54 +00:00
Neil Fuller
1b3159f48e Merge "Add a new NetworkTimeHelper impl" 2023-02-14 15:30:57 +00:00
Martin Stjernholm
70b8b5519f Merge "Fix ART Service initialization order problems." 2023-02-09 15:25:18 +00:00
Brian Julian
906767d5f1 Merge "Backports implementation for AltitudeService to T." am: 026325fe68 am: bfbf79b408 am: d03e3da89b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2416929

Change-Id: I26f8d7a9dc9b087d62dce10483b37456b0fe3ca0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-08 19:38:08 +00:00
Brian Julian
bfbf79b408 Merge "Backports implementation for AltitudeService to T." am: 026325fe68
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2416929

Change-Id: Ide3cd85a103c67b9f9c541a95c73005c14bfadf7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-08 18:51:22 +00:00
Neil Fuller
bd64b8d543 Add a new NetworkTimeHelper impl
Add a new NetworkTimeHelper impl and changes to support it in the
time detector service code.

Background:

When the location code that became NtpNetworkTimeHelper was first
written, Android devices were not guaranteed to be requesting the time
regularly from network time sources: it was only done if the user had
enabled automatic time detection.

That changed a few releases ago, and so the location code should always
be able to ask the time detector for the latest network time signal.

This is part of a wider goal to remove several dependencies in the
Android platform on low-level NTP client code (NtpTrustedTime class).
The NTP protocol usage should be an implementation detail, not something
that is widely known to unrelated classes that want an accurate time.

With the new impl, the SDK SystemClock.currentNetworkTimeClock() call
will ask the time detector service for the latest network time too, and
not interact with the NTP client singleton directly as it does today. It
currently needs to use the NTP client because both the location code and
time detector use the NtpTrustedTime singleton independently and it is
therefore the closest thing on Android today to an authority of "what is
the latest network time the device has obtained?".

Once the time detector is the authority on "latest network time", it
will allow the platform to apply stringent checks to things like time
sync accuracy, which is currently not well checked and heavily dependent
on network round-trip time and network delay symmmetry.

This refactoring is also potentially important for form factors like
Wear, which disable NetworkTimeUpdateService and therefore won't trigger
NtpTrustedTime while attempting to sync. There's a good chance the
location time sync is also broken on Wear (if present) because of the
unusual networking constraints. The API
SystemClock.currentNetworkTimeClock(), which was added to the public SDK
in Android T, may be unreliable or broken on Wear. In future, Wear could
call suggestNetworkTime() on the time detector service from its own
equivalent of NetworkTimeUpdateService and restore
SystemClock.currentNetworkTimeClock() behavior, while also supporting
the location stack's needs (if that is also used on Wear).

Centralizing network sync under NetworkTimeUpdateService will mean that
fewer components on devices will be syncing time for their own ends,
potentially reducing load on time servers too.

This centralization also supports options for changing how "network
time" is obtained in future, e.g. allowing easier integration of newer
protocols like NTS or Roughtime, or partner plug-ins to support
proprietary protocols.

New implementation details:

The TimeZoneDetectorNetworkTimeHelper implementation retrieves the
latest network time suggestion from the TimeDetectorInternal API. It
attempts to pass time to the GNSS code as often as the original
implementation, even when a new time signal isn't available and its
potentially repeating itself, in case GNSS code has become reliant on
that. Generally, it's hard to tell what the contract should be,
particularly with the unusual behavior around "on demand" Vs "periodic"
and the historic bug there.

The new implementation should become the default when it is considered
safe to do so, i.e. after testing when we are confident that
NetworkTimeUpdateService is behaving as well as the old
NtpNetworkTimeHelper impl when detecting connectivity, etc. This can be
done with a single boolean compile-time flag.

Other changes:

The time detector is now a dependency of the location stack, so the
SystemServer service bootstrap ordering has been adjusted.

Bug: 222295093
Test: atest services/robotests/src/com/android/server/location/gnss/TimeDetectorNetworkTimeHelperTest.java
Test: atest services/tests/servicestests/src/com/android/server/timedetector/TimeDetectorStrategyImplTest.java
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/TimeZoneDetectorStrategyImplTest.java
Change-Id: I2f9a14776e9fafe426213df7cb0307a3fe541fad
2023-02-08 14:29:29 +00:00
Brian Julian
eba77a86c5 Backports implementation for AltitudeService to T.
Test: VtsHalAltitudeServiceTargetTest
Bug: 265013616
Change-Id: I793d22fcfdd43c6d8ff2e4be52e3fb4a247fdf84
2023-02-08 00:04:04 +00:00
Karthik Mahesh
a19b311091 Merge "Start ODP system service." 2023-02-06 18:49:44 +00:00
Karthik Mahesh
2f5148c9e5 Start ODP system service.
Bug: 236174677
Test: TH, manual test
Change-Id: I0912fe369b6b643e04d0e439b091b545e3111288
2023-02-03 22:29:55 -08:00
repo sync -c -j48
71c8ea7da6 Add config_wearServiceComponent to start the WearService from system server.
Also Cp'ing changes in ag/19338309 together.

Test: tested locally, service starting as expected.
Bug: 267404564

Change-Id: Idf26fd9408290263f791b8eb23689368064459db
2023-02-03 22:49:23 +00:00
Adam Bookatz
e5a06ca619 HsumBootUserInitializer creates MainUser earlier
Previously, on first boot, an HSUM device would unlock the system user,
then create the MainUser (if needed), and then switch to the boot user,
all at around the same time.

This cl reorders these events and spreads them out:
* first, early on (just prior to PHASE_SYSTEM_SERVICES_READY), the
  MainUser is created (if needed)

* later (after PHASE_THIRD_PARTY_APPS_CAN_START), the system user is
  unlocked

* then we promptly switch to the boot user. This needs to be after
  PHASE_THIRD_PARTY_APPS_CAN_START since special apps may designate a
  different boot user.

This will ensure that the MainUser can be retrieved much earlier on by
system services whose operations may depend on it.

Also, the structure of BootUserInitializer is renamed to better reflect
its role, and its structure is modified slightly to allow SystemServer
to use it more easily.

Bug: 262438904
Bug: 266098768
Test: flashed HSUM and confirmed that MainUser was created as needed
Test: atest FrameworksMockingServicesTests:com.android.server.pm.UserManagerServiceTest
Change-Id: Ic84b1be538234b2bfde3ae792c9a923ace55f24c
2023-02-02 10:38:29 -08:00
Martin Stjernholm
48b9a472f6 Fix ART Service initialization order problems.
- Move ArtManagerLocal initialization before the boot compilation step
  (UpdatePackagesIfNeeded).
- Delay scheduling the background dexopt job because the job scheduler
  hasn't been started at that point.

Test: Boot with dalvik.vm.useartservice=true and check logcat that ART
  Service starts up and a first-boot dexopt runs without errors.
Bug: 266028904
Change-Id: I108b877f2a99c69c20f7209339cd193c2d41e7ea
2023-01-27 20:11:42 +00:00
Nikolas Havrikov
0a8a91f7ca Merge "Remove moot synchronization on shutdown" 2023-01-23 16:37:05 +00:00
Nikolas Havrikov
e28177e9f8 Merge "Introduce isTv to adapt services to Android TV uses" 2023-01-20 09:37:26 +00:00
Martin Stjernholm
b1a79007d1 Use ART Service to clear app profiles when it is enabled.
Changed system server initialization order: ArtManagerLocal needs to be
initialized before mPackageManagerService.systemReady() is called,
because that calls CarrierAppUtils.disableCarrierAppsUntilPrivileged,
which may call ApplicationPackageManager.setSystemAppState to set
SYSTEM_APP_STATE_UNINSTALLED, which ends up calling ArtManagerLocal to
clean up any app profiles.

Test: Boot with dalvik.vm.useartservice=true and verify that calls to
      clearAppProfilesLIF and destroyAppProfilesLeafLIF during boot
      are handled by ART Service.
Bug: 251903639
Change-Id: I8a3a16ce85f315a28fa8459325470cfe5f32ca8c
2023-01-18 16:22:43 +00:00
Nikolas Havrikov
8dc7517d8c Introduce isTv to adapt services to Android TV uses
This variable is intended to be used as part of the startOtherServices
method of the system server much like `isWatch` is used now in order
to selectively skip starting system services, which are not relevant to
the operation of Android TV.

Test: make
Bug: 264411203
Change-Id: Ife21ac60e11d6669954dc0f77b2c85d0149d2d7b
2023-01-18 11:35:24 +01:00
Alan Stokes
89e9ae171d Merge "Move NetworkManagementService into com.android.server.net" 2023-01-11 16:57:31 +00:00
Martin Stjernholm
0a44ec0b33 Merge "Use ART Service OptimizePackageDoneCallback." 2023-01-11 13:16:00 +00:00
Martin Stjernholm
5a1787b3d3 Use ART Service OptimizePackageDoneCallback.
Add the callback when the ART Manager is initialized, and move the
CompilerStats code into it.

This moves the ART Manager initialization code from SystemServer to
DexOptHelper to keep it more contained, and it also fixes a small bug
where an ArtManagerLocal instance was created and registered even when
ART Service shouldn't be in use.

Also remove TODO for controlDexOptBlocking handling when ART Service is
in use. It got marked with LegacyDexoptDisabledException, so it's moot
to support in that mode.

Test: Boot
Bug: 251903639
Bug: 260072740
Change-Id: Id0995ef9f24ee007207ee0d1f7d2108fa81b15aa
2023-01-10 22:39:47 +00:00
Nikolas Havrikov
7af36afe5f Remove moot synchronization on shutdown
Currently, the call to rebootOrShutdown is synchronized on the
Runnable.this instance, and thus there is no way for any other thread
to contend on the same lock.

Change-Id: Idaacda47031431435598dfd45840b1344c5938e6
Test: manually
2023-01-09 15:09:29 +00:00
Jiakai Zhang
e4ed9c5501 Pass Context to DexUseManagerLocal and notify it about boot complete.
Bug: 249984283
Test: Presubmit
Change-Id: Ib9c13f13dcbb100b1ee216974dcdcdd64b81ae8b
2023-01-06 13:45:22 +00:00
Jiakai Zhang
ea257b6625 Merge "Fix the boot time regression caused by DexUseManagerLocal init." 2022-12-23 11:56:46 +00:00
Jiakai Zhang
1b7dda73e0 Fix the boot time regression caused by DexUseManagerLocal init.
See details in the bug.

Before:
D SystemServerTiming: DexUseManagerLocal
I system_server: Waiting for a blocking GC ClassLinker
I system_server: Background concurrent copying GC freed 207020(9016KB) AllocSpace objects, 21(896KB) LOS objects, 49% free, 12MB/25MB, paused 56us,21us total 209.779ms
I system_server: WaitForGcToComplete blocked ClassLinker on Background for 177.623ms
V SystemServerTiming: DexUseManagerLocal took to complete: 182ms

After:
D SystemServerTiming: ArtModuleServiceInitializer
V SystemServerTiming: ArtModuleServiceInitializer took to complete: 3ms
...
D SystemServerTiming: DexUseManagerLocal
V SystemServerTiming: DexUseManagerLocal took to complete: 20ms

Bug: 263373204
Test: manual - See above.
Change-Id: I81e517fd3c18ccd3490947b16e36e7d43b2fc07c
2022-12-22 17:04:42 +00:00
Calvin Pan
d2dff29fb5 Merge changes from topic "configuration_gender"
* changes:
  Fix test case fail
  Add a new field in Configuration and persist the field
  Add a system service for grammatical gender
2022-12-22 13:59:00 +00:00
Pedro Loureiro
5fedb58a76 Merge "Handle device config service(s) in platform and mainline" 2022-12-22 10:35:42 +00:00
Calvin Pan
fdaffd24f7 Add a system service for grammatical gender
Add getApplicationGender()/setApplicationGender() API to allow
app set the application's grammatical gender

Bug: 259175720
Test: atest and get/set the API

Change-Id: I83842eadd8cdaa7c148acf6dfb37df32564e241d
2022-12-22 01:49:09 +08:00
Pedro Loureiro
75960f771b Handle device config service(s) in platform and mainline
Test: manual

Bug: 261723346

Change-Id: Ie3b61d2dc8ddf6b6b83261d3a5f84c46aecd785d
2022-12-21 10:55:00 +00:00
Martin Stjernholm
e5773c3ffd Merge "Use a separate timing tracer for DexUseManagerLocal." 2022-12-20 13:15:50 +00:00
Guangjie Shi
5c90ad35c0 Add flag to guard the Credential Manager system service.
Bug: 262460667
Test: locally tested.
Change-Id: I929b78b4e5d3bf6fefc2517b6cbf33b56a6b5cf3
2022-12-19 23:05:53 +00:00
Thiébaud Weksteen
b4dec6e919 Move NetworkManagementService into com.android.server.net
Move NetworkManagementService and NetworkManagementInternal from the
com.android.server package to com.android.server.net. Update
TEST_MAPPING to include NetworkManagementServiceTest in presubmit.

Bug: 259341026
Test: atest (triggering TEST_MAPPING execution)
Change-Id: Ibdff9c19c264ff54b9039e1f0aa4186641d5b302
2022-12-19 22:56:45 +00:00
Martin Stjernholm
78ba605352 Use a separate timing tracer for DexUseManagerLocal.
It shouldn't be compounded with StartPackageManagerService.

Bug: 262666863
Test: m droid
Change-Id: I0d93450a49e69ffa73634c0ce72da18f1c2dbd7d
2022-12-19 22:44:37 +00:00
Martin Stjernholm
b0e4012c0a Merge "Call through to ART Service in notifyDexLoad if it is enabled." 2022-12-15 00:57:29 +00:00
Martin Stjernholm
f138c7b6b6 Call through to ART Service in notifyDexLoad if it is enabled.
Move the ArtManagerLocal initialization to a place where it can access
PackageManagerLocal but still is early enough to precede binder calls
to notifyDexLoad.

Test: Build with dalvik.vm.useartservice=true, boot, launch an app, and
      check with temporary logging that
      ArtManagerLocal.notifyDexContainersLoaded gets called.
Bug: 254043366
Change-Id: I97d59f9c15402648627006dde874a068b0706157
2022-12-13 18:00:08 +00:00
Hai Zhang
c8a46e1455 Start AccessCheckingService in SystemServer.
The service constructor and onStart() only does trivial work and its
start time is also tracked by TimingsTraceAndSlog. The new app op and
permission implementation will only be active when they are later
selected inside the existing permission and app op system services and
that selection will happen behind a feature flag disabled by default.

Bug: 182523293
Test: presubmit
Change-Id: I2d678ef2d5747440afebc92868f92c4a02565856
2022-12-11 22:52:44 -08:00
Seth Moore
690554e0d6 Merge "Add remote_provisioning system service" am: 222a476ac5 am: 9430c5fed0 am: d6405bf424
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2263722

Change-Id: I09e0681e2c980a148dc265e15f58beda67515214
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-08 16:39:21 +00:00
Seth Moore
d6405bf424 Merge "Add remote_provisioning system service" am: 222a476ac5 am: 9430c5fed0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2263722

Change-Id: Id71268d27836111005aa1678c180c4a9081363a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-08 16:11:30 +00:00
Seth Moore
9430c5fed0 Merge "Add remote_provisioning system service" am: 222a476ac5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2263722

Change-Id: If44dd0e853f47267f37656ef0095894294e140cf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-08 15:49:00 +00:00
Seth Moore
0277b66f9e Add remote_provisioning system service
This service is callable by system components like keystore2. This
service calls into a mainline module API to do all the work for remote
provisioning.

Also include new OWNERS for the RemoteProvisioning implementation.

Bug: 254112668
Test: Locally modify keystore to call the new service
Change-Id: I6708d0b415798c78a4d66f279589d9def552ae78
2022-12-06 17:30:26 -08:00
Charlie Wang
ac20732c92 Enable WearableSensingService.
This change includes:
1. Enabling WearableSensingManager to be retrievable.
2. Starts WearableSensingService from system server.
3. Introduces WearableSensingShellComamnd for testing.

Bug: 249135378, 244181656
Test: Builds.
Ignore-AOSP-First: to prevent new feature leak.
Change-Id: I4ffaac37c0fe8874ae8b0ae6fec086e4cd27b2f1
2022-12-02 09:52:52 -08:00
Martin Stjernholm
9789a45e19 Remove the internal DexLoadReporter for system server's own dex loads.
System server can only be compiled and signed by odrefresh in early
boot, so it is no use capturing dex load events for it.

Test: Build & boot
Bug: 254043366
Change-Id: If27569b784aeb882d3a20bd21a30137e6530e663
2022-11-22 13:14:49 +00:00
TreeHugger Robot
5a7f703be3 Merge changes from topic "art-module-service-manager"
* changes:
  Revert "Expose ServiceManager.waitForService as system API."
  Register ArtModuleServiceManager on system server initialization.
2022-11-21 20:31:46 +00:00
Devin Moore
9d601f128a Merge "Register new AIDL SensorManager" am: 0b703be0c5 am: 4ab7a43f65 am: efe53075fd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2292559

Change-Id: I71299fd6cbb290e3a34134bd8b3fa9d45db0d8da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 20:11:36 +00:00
Devin Moore
efe53075fd Merge "Register new AIDL SensorManager" am: 0b703be0c5 am: 4ab7a43f65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2292559

Change-Id: Iaef62a9773b693aa509d9b2afc9e0c27bf28ac95
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 20:04:23 +00:00
Devin Moore
4ab7a43f65 Merge "Register new AIDL SensorManager" am: 0b703be0c5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2292559

Change-Id: I1d1734cd16e7ecf0206bb90912b22db7c6d678e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-18 19:41:23 +00:00
Jiakai Zhang
30f8af2503 Register ArtModuleServiceManager on system server initialization.
Bug: 233915142
Test: adb shell pm art get-optimization-status com.google.android.youtube
Change-Id: I4e410e6ca47f70959e9c56f05d51d30d66735d8d
2022-11-18 18:12:48 +00:00
Josh Yang
33f5206cae Fix Wear OS boot issue.
Start status bar manager service but not register global actions
provider on watches.

Bug: 257861786
Test: device can boot
Test: atest StatusBarManagerServiceTest
Change-Id: Ib9a13f159084f8970628a5eb89ca9aa88b2d050e
2022-11-16 18:36:55 +00:00
Eric Biggers
43148289e3 Merge "Allow migration to SP to be rolled back by filesystem checkpoint" 2022-11-14 22:16:49 +00:00
Devin Moore
5b187ec931 Register new AIDL SensorManager
For now we can register both HIDL and AIDL sensorservice, and the vendor
can choose which one to use.

Test: atest VtsHalSensorManagerTargetTest
Bug: 205764765

Change-Id: I26ee176baea59f86281ae3a46ea580443064b5ef
2022-11-11 19:16:31 +00:00
Eric Biggers
ff116c879e Allow migration to SP to be rolled back by filesystem checkpoint
On upgrade from Android 13 or earlier, LockSettingsService is creating a
synthetic password (SP) for all users that didn't have one before, and
re-encrypting the user's CE key with the SP.  Currently this happens at
PHASE_BOOT_COMPLETED, since Weaver is not yet guaranteed to be available
at the previous phase, PHASE_THIRD_PARTY_APPS_CAN_START.

An issue with using PHASE_BOOT_COMPLETED is that during an upgrade,
PHASE_BOOT_COMPLETED happens after the userdata filesystem checkpoint
has already been committed.  Therefore, if a problem occurs with the
migration to SP, the changes won't be rolled back and the device will be
left in a broken state, recoverable only via a factory reset.

Important migrations like this should happen before the checkpoint is
committed.  Therefore, replace the use of PHASE_BOOT_COMPLETED with a
direct call into LockSettingsService in an appropriate place, similar to
the existing LockSettingsService.systemReady() call.

I also considered creating a PHASE_THIRD_PARTY_APPS_STARTED boot phase.
However, any new boot phase would become part of the services API
(services/api/current.txt), which is more than I'd like to do here.

Test: Made an intentionally broken build with
      LockSettingsService.onThirdPartyAppsStarted() changed to throw a
      RuntimeException at the end, crashing system_server.  Tested an
      OTA from tm-qpr2-release to that build, on a device that didn't
      have a lockscreen credential set on user 0 (so that user 0 was
      migrated to SP-based credentials just before the crash).  The OTA
      failed as expected and successfully rolled back to the original
      build, with user 0's data still accessible (this was not possible
      before this change).
Bug: 232452368
Change-Id: I77d30f9be57de7b7c4818680732331549ecb73c8
2022-11-09 05:48:18 +00:00
Antonio Kantek
bc0bb0da46 Add config for device specific IMMS
Bug: 245798405
Test: m
Change-Id: I337e2804871ce66553306696d6819b21e3307081
2022-11-08 20:00:43 +00:00