Commit Graph

1118 Commits

Author SHA1 Message Date
Neil Fuller
01d1dd28f1 Merge "Remove dead code from SystemServer"
am: 05eeef4188

Change-Id: I910fb0ac35c8de8fd500b3df0253c65b6b201fb4
2019-11-25 06:12:57 -08:00
Neil Fuller
05eeef4188 Merge "Remove dead code from SystemServer" 2019-11-25 13:53:15 +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
Neil Fuller
4b03c07cc7 Remove dead code from SystemServer
Remove dead code from SystemServer that obstensively protects devices
from negative (< 1970) system clock times, but does not.

In reality, SystemServer calls SystemClock.setCurrentTimeMillis(), which
calls through to the AlarmManager.setTime() binder call. When the code
runs the system server hasn't started any services yet, so this would
always fail.

AlarmManager has similar protections in place that do work: if the
device is earlier than a "build time", then the device's clock is forced
forward. That provides the protection that the code being removed from
SystemServer was trying to achieve.

Test: Added logging to SystemClock to prove AlarmManager is null /
manual debugging

Change-Id: I87dca1062829bc1a10202804fa7ee31e0a6f03a3
2019-11-21 17:30:03 +00:00
Kenny Root
53bb6db434 Merge "Move RecoverySystemService into its own package"
am: 9164399321

Change-Id: Iaa931ad488b059c981646fc6684c782e47a1edf3
2019-11-20 16:04:50 -08:00
Kenny Root
f96836ed3a Move RecoverySystemService into its own package
This helps reviewing the refactor of the RecoverySystemService in which it
is made a bit more testable.

Test: make && emulator
Change-Id: Ifc5a658fe68ed10ab400f43d1d3967c0acccbd11
2019-11-20 10:53:39 -08:00
Andrei Onea
8579ddfb23 Merge "Initialize AppCompatCallbacks in system server"
am: 2773409cac

Change-Id: I493671298a3a976e45542f7c192b7f7861ba6be0
2019-11-01 16:02:05 -07:00
Andrei Onea
0611dbc7a6 Initialize AppCompatCallbacks in system server
This ensures that any calls made (intentionally or not) in the system
server using the Compatibility (in-app process) gating APIs will always
return true, and log the gated feature.

Bug: 143591326
Test: m
Merged-In: I96792cf852f4167fc39d5055704f8617efaae25e
Change-Id: I96792cf852f4167fc39d5055704f8617efaae25e
2019-10-31 11:49:50 +00:00
Xin Li
6f48900f50 DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
Bug: 142003500
Change-Id: If5056a73ede668b0048ca107b686413695e5b3b6
2019-10-30 14:33:01 -07:00
atrost
ff948d8a2f Add a native aidl API.
Introduce a platform_compat_native service that just calls the
platform_compat service.
The new service is needed as it needs a slightly different (more
limited, no ApplicationInfo in cpp) aidl API, and a class can only
extend one stub.

Test: Call the service from dumpsys.cpp (http://aosp/1142055)
Bug: 138275545
Change-Id: Ic46cc34b4c1dd4ebc6bcc996fb3f8503607214ac
Merged-In: Ic46cc34b4c1dd4ebc6bcc996fb3f8503607214ac
2019-10-22 18:54:13 +00:00
Roshan Pius
622547b553 NetworkStackClient: Refactor network stack process interaction
Refactor NetworkStackClient class to move the module service binding &
network stack process death monitoring to a separate class. This class
will only instantiated in the SystemServer process.
The new class |SystemServerToNetworkStackConnector| will be used from
the client classes corresponding to each module running on the network
stack process (NetworkStackClient, WifiStackClient, etc)

This has 2 main advantages:
a) Reduces code duplication (Otherwise the various Client classes need
to replicate the service bindding & process death monitoring).
b) Central crash recovery for the network stack process (Otherwise the
various Client classes will trigger multiple recovery for a single
network stack process crash).

Bug: 135679762
Bug: 140006229
Test: Device boots up & connects to wifi networks.
(cherry-picked from 7e6f5f5e08 & applied
aosp/977048)

Change-Id: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
Merged-In: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
2019-08-26 10:43:21 -07:00
Kiyoung Kim
9b9ed234cb Revert "Merge "NetworkStackClient: Refactor network stack process interaction""
This reverts commit 049c9b40ba.

Reason for revert: b/140006229

Change-Id: I4cd4cd6919c0206b6023f744fe889fa0404365d6
2019-08-26 05:25:22 +00:00
Roshan Pius
049c9b40ba Merge "NetworkStackClient: Refactor network stack process interaction"
am: 764a90c200

Change-Id: Ib6cc552495c8b76f71f158b7f46525d1ff89c357
2019-08-25 21:08:56 -07:00
Xin Li
a770df1d2e DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master
Bug: 139893257
Change-Id: I94fce9c5c0b35cbb88ee27fa4cd037927964d2cd
2019-08-24 05:22:23 +00:00
Roshan Pius
f061a709b6 NetworkStackClient: Refactor network stack process interaction
Refactor NetworkStackClient class to move the module service binding &
network stack process death monitoring to a separate class. This class
will only instantiated in the SystemServer process.
The new class |SystemServerToNetworkStackConnector| will be used from
the client classes corresponding to each module running on the network
stack process (NetworkStackClient, WifiStackClient, etc)

This has 2 main advantages:
a) Reduces code duplication (Otherwise the various Client classes need
to replicate the service bindding & process death monitoring).
b) Central crash recovery for the network stack process (Otherwise the
various Client classes will trigger multiple recovery for a single
network stack process crash).

Bug: 135679762
Test: Device boots up & connects to wifi networks.
Change-Id: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
Merged-In: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
(cherry picked from commit 7e6f5f5e08)
(cherry picked from commit b51c428f41)
2019-08-23 19:04:48 +00:00
Roshan Pius
15b5a03ef6 NetworkStackClient: Refactor network stack process interaction
Refactor NetworkStackClient class to move the module service binding &
network stack process death monitoring to a separate class. This class
will only instantiated in the SystemServer process.
The new class |SystemServerToNetworkStackConnector| will be used from
the client classes corresponding to each module running on the network
stack process (NetworkStackClient, WifiStackClient, etc)

This has 2 main advantages:
a) Reduces code duplication (Otherwise the various Client classes need
to replicate the service bindding & process death monitoring).
b) Central crash recovery for the network stack process (Otherwise the
various Client classes will trigger multiple recovery for a single
network stack process crash).

Bug: 135679762
Test: Device boots up & connects to wifi networks.
(cherry-picked from 7e6f5f5e08 & applied
aosp/977048)

Change-Id: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
Merged-In: I673581b0067b9a3f72dd68a3ab622c18183ebd2e
2019-08-23 10:40:07 -07:00
Anna Trostanetski
911c6ffd6a Merge "Start platform compat service eariler." into stage-aosp-master am: 4535b04b33 am: f3fe588229
am: 0755524354

Change-Id: Ic4c4d904df1484844fbaea740674ace0be1d0491
2019-08-20 02:53:39 -07:00
Anna Trostanetski
f3fe588229 Merge "Start platform compat service eariler." into stage-aosp-master
am: 4535b04b33

Change-Id: Ie41d2286e869bf84362919a183f4bad348dfc945
2019-08-20 02:25:13 -07:00
atrost
499d4bff66 Start platform compat service eariler.
It's needed by ActivityManager and PackageManager.
Also use a constant in Context for the name.

Test: flashed device with ag/9025572 and ag/9204795 and the platfrom
compat was accessible.
Bug: 137769727

Change-Id: Ie1130a3f0bdd1769fe0755db0089702ea64d9db6
Merged-In: Ie1130a3f0bdd1769fe0755db0089702ea64d9db6
2019-08-19 16:10:47 +00:00
atrost
8266ae32ba Start platform compat service eariler.
It's needed by ActivityManager and PackageManager.
Also use a constant in Context for the name.

Test: flashed device with ag/9025572 and ag/9204795 and the platfrom
compat was accessible.
Bug: 137769727
Change-Id: Ie1130a3f0bdd1769fe0755db0089702ea64d9db6
Merged-In: Ie1130a3f0bdd1769fe0755db0089702ea64d9db6
2019-08-19 16:10:31 +00:00
Felipe Leme
b27cd42b1a Merge "Don't start intelligence services that are not provided by the OEM." into qt-qpr1-dev
am: 4e8070890a

Change-Id: Iba93086430c52c23828d0899b1440b1724e14d81
2019-08-13 15:50:33 -07:00
Felipe Leme
496638bb04 Don't start intelligence services that are not provided by the OEM.
Bug: 135218095

Test: adb shell service check content_suggestions
Test: adb shell service check app_prediction
Test: atest CtsContentSuggestionsTestCases CtsAppPredictionServiceTestCases # on Automotive

Merged-In: I07f9873a7ad0c6dd1c1a0d6a0e5e05681bfc67fc
Change-Id: I07f9873a7ad0c6dd1c1a0d6a0e5e05681bfc67fc
2019-08-09 09:09:01 -07:00
Svet Ganov
359a9d999b [DO NOT MERGE] Don't drop restricted permissions on upgrade
Restricted permissions cannot be held until whitelisted. In
a P -> Q upgrade we grandfather all restricted permissions.
However, the whitelisting code runs after the internal update
of permission happens for the first time resulting in a
revocation of the restricted permissions we were about to
grandfather.

The fix is to not deal with restricted permission when updating
the permissions state until the permission controller has run
the grandfathering logic and once the latter happens we do run
the permission update logic again to properly handle the
restricted permissions.

Bug: 138263882

Test: atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest
      P -> Q upgrade preserves grandfathered restricted permissions
      P -> Bad Q build -> Q fixes up broken fixed restricted permissions

Change-Id: Iaef80426bf50181df93d1380af1d0855340def8e
(cherry picked from commit 0b41c8940a)
2019-07-28 22:26:05 +00:00
Svet Ganov
09658011eb [DO NOT MERGE] Don't drop restricted permissions on upgrade
am: 0b41c8940a

Change-Id: I0a32e4481ffd026c8a338b1500f70109983b21a5
2019-07-27 21:41:56 -07:00
Svet Ganov
0b41c8940a [DO NOT MERGE] Don't drop restricted permissions on upgrade
Restricted permissions cannot be held until whitelisted. In
a P -> Q upgrade we grandfather all restricted permissions.
However, the whitelisting code runs after the internal update
of permission happens for the first time resulting in a
revocation of the restricted permissions we were about to
grandfather.

The fix is to not deal with restricted permission when updating
the permissions state until the permission controller has run
the grandfathering logic and once the latter happens we do run
the permission update logic again to properly handle the
restricted permissions.

Bug: 138263882

Test: atest CtsPermissionTestCases
      atest CtsPermission2TestCases
      atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest
      P -> Q upgrade preserves grandfathered restricted permissions
      P -> Bad Q build -> Q fixes up broken fixed restricted permissions

Change-Id: Iaef80426bf50181df93d1380af1d0855340def8e
2019-07-27 19:28:43 +00:00
Andrei Onea
4fd8dabd52 resolve merge conflicts of 130e0ade7b to stage-aosp-master
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Change-Id: Ie8cfba397930a1bd5ec947f4834478bb629fa640
Merged-In: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
2019-07-25 18:17:30 +00:00
Andrei Onea
6cd9d4d18e Make PlatformCompat a Binder class
This allows PlatformCompat to be called from anywhere in the platform.
In follow-up CLs, we'll define permissions for each method and/or
filtering rules to prevent abuse from apps.

Test: m
Bug: 137769727
Change-Id: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
Merged-In: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
2019-07-25 12:38:04 +00:00
Andrei Onea
df301b8887 Make PlatformCompat a Binder class
This allows PlatformCompat to be called from anywhere in the platform.
In follow-up CLs, we'll define permissions for each method and/or
filtering rules to prevent abuse from apps.

Test: m
Bug: 137769727
Change-Id: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
Merged-In: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
2019-07-25 10:58:53 +00:00
Patrick Baumann
a848a8ec14 Call ActivityManagerService.enterSafeMode
This fixes the accidental removal (change ID
If2e6afe21f6efcb141f3a4428ff9154b68f08a1d)
of a call to ActivityManagerService.enterSafeMode, ensuring that
when the rest of the device is in safe mode, ActivityManagerService
and PackageManagerService are made aware of it and properly filter
app launches.

Fixes: 137052912
Test: manual; safe mode correctly blocks 3p apps
Change-Id: Ie2caf6d2fd74b241927a245393fb31658201962f
Merged-In: Ie2caf6d2fd74b241927a245393fb31658201962f
2019-07-12 19:51:06 +00:00
Neil Fuller
8f8f4da0ca Merge "Remove the ability to turn off TimeDetectorService"
am: 71fd6f0113

Change-Id: I8b32782038657c504d30a2c4b1db1c4985546ed3
2019-07-03 17:20:50 -07:00
Neil Fuller
e9efed97f7 Remove the ability to turn off TimeDetectorService
Remove the ability to turn off TimeDetectorService. After
http://r.android.com/1000492 it will be required in all cases.

Also remove [Old|New]NetworkTimeUpdateService as the expected
changes have not been implemented.

Bug: 133492648
Test: build only
Merged-In: Iad7ff59b19fa54750831819c68b7b733e5763902
Change-Id: Iad7ff59b19fa54750831819c68b7b733e5763902
2019-07-02 12:04:24 +00:00
TreeHugger Robot
cfa47f6183 Merge "Call ActivityManagerService.enterSafeMode" into qt-dev 2019-06-30 02:33:16 +00:00
Patrick Baumann
876a733e71 Call ActivityManagerService.enterSafeMode
This fixes the accidental removal (change ID
Ibe849f56f5fe8af1415dc6c85b484d0edca518ec)
of a call to ActivityManagerService.enterSafeMode, ensuring that
when the rest of the device is in safe mode, ActivityManagerService
and PackageManagerService are made aware of it and properly filter
app launches.

Fixes: 129781631
Test: manual; safe mode correctly blocks 3p apps
Change-Id: Ie2caf6d2fd74b241927a245393fb31658201962f
2019-06-28 19:41:04 +00:00
Zimuzo
ab2fc348fd Pause watchdog triggering on the main thread during package scan
Similar to I3876c41e6d0e41d044a5b1d5e57f894c7fb4fb0e and
I69067fbbb8be4e421918c18b67269044fab51b3e where we pause
the watchdog because dexopting and moving A/B artifacts can take a while,
here scanning packages can take a long time depending on the number of
apps installed on the device.

Bug: 135103243
Test: Manually tested by adding an artificial sleep in
PackageManagerService#main and verified that watchdog was not triggered

Change-Id: Ia5b2b5741194a33f7cd09e79c0904696ce546026
Merged-In: Ia5b2b5741194a33f7cd09e79c0904696ce546026
2019-06-14 16:07:51 +00:00
Zimuzo
f3c4614d1f Pause watchdog triggering on the main thread during OtaDexoptService
Similar to I3876c41e6d0e41d044a5b1d5e57f894c7fb4fb0e where we pause
the watchdog because dexopting can take a while, here moving A/B
artificats can take a long time.

Bug: 134062700
Test: Manually tested by adding an artificial sleep in
OtaDexoptService#main and verified that watchdog was not triggered

Change-Id: I69067fbbb8be4e421918c18b67269044fab51b3e
2019-05-31 12:46:12 +01:00
TreeHugger Robot
70e0438d59 Merge "Force system ApplicationInfo update and notify DisplayManager" into qt-dev 2019-05-20 19:12:20 +00:00
Hayden Gomes
013a7f8dce Removing emulator check for starting BluetoothService
This check was intended to be removed once we had the ability to add the
Bluetooth systemFeature check. Removing it now so emulator can enable
bluetooth

Bug: 132627197
Test: Built and ran emulator locally to confirm BTService running
Change-Id: I3e0606e0e4154299e65e5f62d8a1720922d796ad
2019-05-14 18:48:30 -07:00
Zimuzo Ezeozue
3dc28cb1dc Merge "Allow pausing Watchdog on the current thread" into qt-dev 2019-05-14 14:55:06 +00:00
Rubin Xu
c3c30eefb2 Merge "Bump several device admin notifications to high priority" into qt-dev 2019-05-13 10:30:25 +00:00
William Hester
a47584af34 Merge "Start THM outside of the frp block" into qt-dev 2019-05-10 20:31:04 +00:00
Zimuzo
2a05039b44 Allow pausing Watchdog on the current thread
Since we start the watchdog early during boot, we may have some false
positives where the watchdog thinks a thread is blocked but it
is just running a long task. This cl enables us pause the watchdog
triggering for the current thread and resume the triggering after
the long running task. An alternative would be pausing for a specified
duration without an explicit resume but that may be difficult
to find an upper bound for tasks across all devices.

For now the primary long running task is dexopting which happens on
the main thread during boot. We pause the watchdog triggering on the
main thread and resume afterwards.

Test: Verified with logs that pausing the Watchdog pauses triggering
and resuming resumes triggering
Bug: 132076426

Change-Id: I3876c41e6d0e41d044a5b1d5e57f894c7fb4fb0e
2019-05-10 16:46:38 +01:00
Rubin Xu
897750a79b Bump several device admin notifications to high priority
The following device admin related events now generate interruptive notifications:
1. Admin-triggered remote bug report collections (requires user action)
2. Remote work profile wipe - post wipe notification
3. The enabling of Network logging
4. Admin remotely installs/removes an APK
5. Work profile needs unlocking after boot

Test: manual
Change-Id: If5a51123c05b15e544a31ac7ec6b42ec831a1ccc
Fix: 130623009
Fix: 120770584
Fix: 118810015
2019-05-09 16:35:16 +01:00
Mohammad Samiul Islam
bdccb7501b Revert "Populate active apexes cache in a background thread"
This reverts commit 97fc6d9c29.

Reason for revert: b/132236259

Change-Id: I5270140580ebad16a9dc1db6b2e5f9faa977f54a
Bug: 132236259
2019-05-08 14:44:15 +00:00
William Hester
bbfd15a957 Start THM outside of the frp block
Starting TestHarnessModeService outside of the FRP block will allow OEMs
to provide their own implementation of
PersistentDataBlockManagerInternal in LocalServices, which will allow
them to satisfy all CTS requirements even without supporting Factory
Reset Protection.

Bug: 131439285
Test: make && adb shell cmd testharness enable
Change-Id: If3ea192a22105716cab1dbed832f8c20b51058b7
(cherry picked from commit 87ac4ea4a5)
2019-05-07 22:55:02 +00:00
Winson
72dbe7e6f3 Force system ApplicationInfo update and notify DisplayManager
Propagates any changes to the display config made inside any
framework overlay. Notably any display cutout adjustments.

Partial revert of ag/I844de9e09eb1464ae112e1b480d21cf662a026e0
with the OMS method moved into AMS.

Bug: 130444380

Test: manual test with simulated cutout on blueline device
Change-Id: Ifa24954352fa5e92816baa8d669b9abedc4f4ab8
2019-05-06 11:23:52 -07:00
Nikita Ioffe
97fc6d9c29 Populate active apexes cache in a background thread
* Split populateActivePackagesCacheIfNeeded into populateApexFilesCache
  and parseApexFiles.
* populateApexFilesCache does an IPC to apexd , while parseApexFiles
  does the heavy lifting of parsing apex files and extracting signature;
* Split is required because during PackageManagerService boot-sequence
  we need to know list of apex packages, and in order to get that
  information we don't need to parse apex files.
* Both populateApexFilesCache and parseApexFiles are enquened to run in
  ApexManagers own HandlerThread so that they don't block other tasks in
  system servers boot sequence.
* Changed ApexManager to use CountDownLatches instead of locks to
  synchronize between thread, as they are more modern and easier to use.

Also did some perf testing on blueline by running
atest google/perf/boottime/boottime-test:

Without https://googleplex-android-review.git.corp.google.com/q/Ic7e5e14ed2d02d3685fd39bb70bc9423ae78f18e:
SystemServerTiming_StartPackageManagerService_avg: 2767.2

With what is currently in qt-dev:
SystemServerTiming_StartPackageManagerService_avg: 3728.4444444444443

Without splitting into populateApexFilesCache and parseApexFiles:
SystemServerTiming_StartPackageManagerService_avg: 3247.5

This change:
SystemServerTiming_StartPackageManagerService_avg: 2894.7

Test: device boots
Test: atest CtsStagedInstallHostTestCases
Bug: 131611765
Change-Id: I980700cd785c22d7f1ace294bb5456056d68baaa
2019-04-30 17:52:03 +01:00
Zimuzo
b065b15a90 Start Watchdog early during boot
The system server can deadlock without making progress during early
boot. If this happens without crashing, no rollback mechanisms will be
triggered because there's no crash. With this change, if the system
server deadlocks early during boot, the Watchdog will crash the
system server, frequent enough crashes (4 in 4 mins) will trigger
the native watchdog and cause apexd to rollback any staged mainline updates.

Bug: 129597207
Test: Boots fine and logs indicate threads and monitors are registered
properly. Also adding an artificial sleep to the PackageManagerService
during boot crashes the system_server. At the moment, this is not
detected by the native watchdog because the default_timeout of 60
seconds before crashing the system_server never triggers the native
watchdog crash frequency threshold. Will fix in later cl.

Change-Id: I956a263e96d17d55bc512a5eab905cd2a14a7abb
2019-04-25 18:39:12 +01:00
Tim Murray
263e639229 Merge "DO NOT MERGE: disable iorap in q" into qt-dev 2019-04-18 15:18:48 +00:00
Peiyong Lin
c95354bc9c [GPU Service] Implement GPU service.
GPU Service is used to monitor all GPU and graphics driver related features.
This patch implements GPU service into System Server, and implements
functionality to extract the whitelist out of game driver package when the
package is upgraded or removed. This will move the whitelist processing off
critical path when app launches.

BUG: 123290424
Test: Build, flash and boot. Verify by upgrading game driver apk.
Change-Id: I563a138bfe0c4c1bb17ed28dab5d6a8df244021d
Merged-In: I563a138bfe0c4c1bb17ed28dab5d6a8df244021d
2019-04-17 20:18:09 -07:00