654994 Commits

Author SHA1 Message Date
Aaron Huang
4f3a425346 Have buildTemplateMobileWithRatType take metered parameter
To support unmetered 5g, have buildTemplateMobileWithRatType take
metered parameter to build a template which could be used to filter
an unmetered network.

Bug: 183776809
Test: atest FrameworksNetTests:NetworkStatsServiceTest
Change-Id: Ia310d90eceeb572a35ce9518de02b198cae16705
Merged-In: Ia310d90eceeb572a35ce9518de02b198cae16705
2021-10-25 15:10:15 +00:00
Aaron Huang
d951da2203 Respect metered filter in matchesMobile*
In old design, only metered mobile network would be matched,
which means that only metered stats could be read if callers
query the mobile stats.

Currently, the caller in NetworkPolicyManagerService was updated
to use the NetworkTemplate constructor with metered parameter in
aosp/1563312 which means that the template will be created by a
given meteredness. Thus, the hardcode metered can be removed.

Remove the metered check from matches method will cause a
different behavior. Therefore, to keep the original behavior,
if the match rule is MATCH_MOBILE or MATCH_MOBILE_WILDCARD,
it should pass METERED_YES to the constructor to build a
metered template.

Also, if a caller creates a template by calling the constructor
with metered as a parameter, the behavior will also be changed.
Therefore, if the caller expects to get metered stats then it
should change to pass METERED_YES. If the caller expects to get
both metered and unmetered stats then it should remain METERED_ALL
and it would be a bug that been fixed by this patch.

Bug: 183776809
Bug: 202092687
Test: atest FrameworksNetTests:NetworkStatsServiceTest
      manually test by generating traffic and check the data counts
      from "adb shell dumpsys netstats --uid" almost equal to the
      result from "adb shell cmd stats pull-source 10082"
Change-Id: I66dd51b020f6d895cd002acc05bef6b6315cd447
Merged-In: I66dd51b020f6d895cd002acc05bef6b6315cd447
2021-10-25 15:09:21 +00:00
Snild Dolkow
a5f3ca1a06 Update display mode when setting mAlwaysRespectAppRequest
setShouldAlwaysRespectAppRequestedMode() is called from tests to make
DisplayModeDirector.getDesiredDisplayModeSpecs() to ignore non-app
votes. However, the set boolean will have no effect until something
triggers a call to that getter.

This caused MatchContentFrameRateTest#testMatchContentFramerate_Auto to
fail on devices with a lower-than-max peak_refresh_rate setting (or the
fallback resource config_defaultPeakRefreshRate): its setFrameRate()
call doesn't trigger a call to updateRefreshRateSettingLocked() or any
other vote update, so the lower peak value is still in effect in parts
of the system.

Notify the 'desired specs' listener when changing the bool will allow
the new mAlwaysRespectAppRequest value to properly take effect.

Any multi-refresh-rate device should be able to reproduce like so:

$ adb shell 'settings put system peak_refresh_rate 60'

On userdebug, you can overlay config_defaultPeakRefreshRate instead:

$ adb root
$ adb shell 'settings put system peak_refresh_rate ""' # remove setting
$ adb shell cmd overlay fabricate --target android \
      --name DefaultPeak60 \
      android:integer/config_defaultPeakRefreshRate 0x10 60
$ adb shell cmd overlay enable com.android.shell:DefaultPeak60
$ adb shell stop
$ adb shell start # so system_server loads the new resource value
$ adb shell cmd overlay lookup android \
      android:integer/config_defaultPeakRefreshRate # should output "60"

Bug: 204048977
Test: run cts -m CtsGraphicsTestCases -t android.graphics.cts.MatchContentFrameRateTest#testMatchContentFramerate_Auto
Change-Id: Ic6c2024ab1067ad7ba821190fe05009dac79b929
2021-10-25 16:40:44 +02:00
Wilson Wu
a6d6623fc0 Update settingslib input method OWNER list
Add wilsonwu into OWNER list

Bug: 204043011
Test: presubmit
Change-Id: Ifde32eab323992523f69bf1d9cf6af53d97b9d7b
2021-10-25 10:14:41 +00:00
Cheng Shi
150a887780 [Bugfix] Fix the issue of transition animation splash screen in split screen mode.
When an app enters split-screen mode, the mAnimatingActivityRegistry of the current Activity still comes from the app's Task, but the mAnimatingActivityRegistry of the newly opened Activity comes from the split-screen Task, so there is no guarantee that the animation-leash of the transition animation will be destroyed at the same time.
So we ensure that the mAnimatingActivityRegistry of ActivityRecord under the same Task is the same after entering split screen mode, so as to ensure that the transition animation of activity opening and closing ends at the same time, thereby avoiding splash screen.

Bug: 204024254
Test: Above scenario
Change-Id: Ibf0fccecefaa8768b4e10f69a064a4b7452dcaa9
Signed-off-by: shicheng <shicheng@xiaomi.com>
2021-10-25 09:14:12 +00:00
Harshad Ulhas Dhabu
55750ca1df Rectify comment in getCurrentAgEvents
Bug: 143946839
Bug: 199827901
Test: IOP and BCST
Tag: #refactor
Change-Id: I1c91d941f5383e8682e2b664120ffe6de4dfdef4
(cherry picked from commit 8d4c5fbf98e7d44cb9367c2d8b05bbd56ac9f3ae)
2021-10-25 04:48:50 +00:00
Jiyong Park
0c103dcde9 Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same ndk backend.

Bug: 161456198
Test: m
Merged-In: I674244ff9b873d3779d3d649822389ad441fa0af
Change-Id: I674244ff9b873d3779d3d649822389ad441fa0af
(cherry picked from commit 672b1349c86f4ae024e71587fc05bf8af046a53d)
2021-10-25 08:46:24 +09:00
Hao Ke
4875dd14eb Adding typed Parcel read APIs 2
Added typed read APIs of `readArray`, `readArrayList`,
`readParcelableArray` and `readSparseArray`.

To avoid unexpected types of objects being unparcelled,
ideally clients would use the readTypedXXX() methods that
take the parcelable creator. However, this won’t be an option
for use cases involving deserializing children objects
inherited from non-final parcelable or serializable objects.
Currently out of ~4k parcelable classes, only ~1.5k
are marked as “final” in the platform. Hence it would be
necessary to introduce new replacements that take
an extra Class<T> parameter and before deserializing
we check that the class written on the wire is the
same or a descendant from the one provided as argument.

Doing so could enhance the security of Parcel deserialization,
More details can be found at go/safer-parcel.

Test: atest -d android.os.cts.ParcelTest
Bug: 195622897
Change-Id: Iaba24c35a0c0acc77ae2d22ac77c5a90efd93329
2021-10-23 01:41:42 +00:00
Chris Li
e563bef9fd Merge "Unregister configuration listener after the WindowProcessController was disallowed to be overridden." 2021-10-23 01:41:10 +00:00
Lucas Dupin
0f7d293cd8 Merge "Specify per-file owner for dimens_car.xml" 2021-10-22 15:16:52 +00:00
Yifan Hong
27c03c7f68 Merge "Add OWNERS for BatteryService" 2021-10-22 05:40:22 +00:00
bkchoi
a6d0be3d24 Specify per-file owner for dimens_car.xml
Bug: 202314754

Test: No need

Change-Id: If0042d64c55484ae361fc08e785e74c026247553
2021-10-21 22:40:58 +00:00
Etienne Ruffieux
d372361fe3 Adding @SystemApi annotation to Bluetooth energy stats.
Added @SystemApi annotation to BluetoothActivityEnergyInfo
and UidTraffic getters for mainline compatibility. Replaced
raw array by List. Deleted unused constructors.

Tag: #feature
Bug: 200201373
Test: Manual
Change-Id: Id93215f48bf08d31ac269af9e064cf598f50b6d3
2021-10-21 20:39:31 +00:00
Lajos Molnar
daa879ac68 media: allow excluding arbitrary codecs from REGULAR_CODECS list.
This can be done by adding the 'special-codec' feature as a required
feature to media_codecs.xml, e.g.

<MediaCodec name="..." type="...">
  ...
  <Feature name"special-codec" required="true" />
</MediaCodec>

This feature is not exposed to applications, and is only used to
exclude a codec from the REGULAR_CODECS list.

Bug: 197577115
Bug: 196518411
Bug: 191944087
Test: CtsVideoTestCases and manual testing with a modified media_codecs.xml
Change-Id: Ica5510bbe7e781f25ca329535d2ba771afbdb263
2021-10-21 10:57:43 -07:00
xshu
0d889ae932 Adding wifi nearby permission to DefaultPermissionGrantPolicy
Grant this by default with the other nearby permission.

Bug: 197776854
Test: compiles
Change-Id: Iff1894a545889230c08578d8ae163116152ab28a
Merged-In: Iff1894a545889230c08578d8ae163116152ab28a
2021-10-21 17:42:18 +00:00
Bernardo Rufino
6a793fe262 Merge "Change out value type for Parcel::hasFileDescriptorsInRange()" 2021-10-21 10:13:15 +00:00
Lucas Lin
528c63e564 Merge "Set underlying networks into NetworkCapabilities directly" 2021-10-21 08:33:29 +00:00
Yifan Hong
08e2895ade libandroid_runtime_vm_headers is recovery_available.
This is needed by libbinder.

Test: builds
Bug: 170338625
Change-Id: I761515bfd91c0cb7bbc72401787c5988b6b9f05a
2021-10-20 21:48:47 -07:00
Yifan Hong
7e5913e73e Remove usage of healthd.
Healthd is no longer installed on the device. Drop
usages of it.

Test: pass
Bug: 203245871
Change-Id: Iaafb75ee413bd579e5d0264b5a383ce442659c4b
2021-10-21 01:57:06 +00:00
Jing Ji
8787386e84 Merge "Fix potential race condition due to missing lock" 2021-10-20 23:58:28 +00:00
Dave McCloskey
8c168ff244 Adds OWNERS files for files related to Attestation Verification
Framework.

Bug: 201696614
Test: N/A
Change-Id: Id1758282963875de5c4909ab6ffff92df4e0d30f
2021-10-20 14:46:53 -07:00
Nathan Harold
1fe18a79d5 Ensure that ScanInfo is cached before callbacks fire
Fixes a regression that was introduced in aosp/1312940.

There is a critical section in requestNetworkScan after the scanId
has been generated and before the ScanInfo is added to the cache.
If during this time a callback fires on a separate thread, it will
not yet find the ScanInfo record, and due to strict checking, this
causes a RuntimeException. This CL re-expands the synchronized block
to cover the critical section, and clarifies a little bounds checking.

Note: this change is not ideal. This means that all callbacks for all
scans will be blocked while a request for a new scan is being made,
which was the motivation behind the change that introduced this
regression. But, a narrow performance hit is better than a crash, and
it's not worth the complexity of a bigger fix.

Bug: 200634560
Test: compilation
Change-Id: I4670da109256170121ceb6d8fbad0efda310335f
2021-10-20 14:00:46 -07:00
Treehugger Robot
b0914ffd45 Merge "Fix queryRawContactEntity api" 2021-10-20 20:25:15 +00:00
Jing Ji
7ee3a1fec3 Fix potential race condition due to missing lock
Bug: 194991626
Test: atest ProcStatsValidationTests
Test: atest ProcessStatsDumpsysTest
Test: CtsIncidentHostTestCases:ProcStatsProtoTest
Change-Id: I1dc7c03d031248fb945dc2cf9dd47ad590ec672c
Merged-In: I1dc7c03d031248fb945dc2cf9dd47ad590ec672c
2021-10-20 13:19:08 -07:00
Treehugger Robot
d51c3f3a2c Merge "AbsoluteVolume change custom call to official API" 2021-10-20 20:09:14 +00:00
Yifan Hong
99bc2d42a2 Add OWNERS for BatteryService
... to point to owners of health HAL. BatteryService
contains large usage of the health HAL.

Test: pass
Bug: 177269435
Change-Id: I38e7ec9e2ab25dec67ab674e9f169360f4690f1e
2021-10-20 12:53:53 -07:00
Treehugger Robot
c12df4f3b1 Merge "Add accessibility framework team to the owners for UiAutomation. Bug:159651900 Test: n/a" 2021-10-20 18:45:13 +00:00
Anton Hansson
4863931934 Change the default docs build to use module stubs
The two are almost identical, and the target using sources as input
can be deleted.

The diffs that remain are minor and as far as I can tell OK:
- A few constants are removed from the metadata.zip. It looks to
  me like metalava was previously including @SystemApi constants in the
  public SDK's metadata. This bug is now worked around by only feeding
  metalava the public APIs.
- There are some very minor diffs in the docs of a few APIs.

Bug: 186197911
Test: build sdk before/after and diff
Change-Id: Iac7de64f353bc1467fc4b249e531f034ef702d51
2021-10-20 18:52:21 +01:00
Treehugger Robot
09b947cd02 Merge "Migrate Connectivity modules to use modules-utils" 2021-10-20 13:43:58 +00:00
Bernardo Rufino
68a6b0d1a3 Change out value type for Parcel::hasFileDescriptorsInRange()
Test: atest -d android.os.cts.ParcelTest
Change-Id: Idfcad04de35750d291f3351378e8420e5b890abf
2021-10-20 11:22:52 +01:00
Neil Fuller
5b274f5eef Merge "Add android.net tests to postsubmit" 2021-10-20 09:48:52 +00:00
Neil Fuller
8f15a06f5a Merge "Fix error prone warnings" 2021-10-20 09:35:44 +00:00
xshu
b4933d744e Add new wifi nearby devices app-ops
(cherry-picked from internal master)
This will be part of nearby devices permission group

Bug: 197776854
Test: compiles
Change-Id: I6002edfd951322d959cd8f4c7a06381badfd1660
Merged-In: I6002edfd951322d959cd8f4c7a06381badfd1660
2021-10-19 16:26:38 -07:00
Patrick Baumann
8255f5f4c0 Consolidating PM owner definition and adding new owners.
Change-Id: If4b080755701452c53d55f26380e887dc3944dbf
2021-10-19 21:06:56 +00:00
xshu
a8395ffa3a New runtime permission NEARBY_WIFI_DEVICES
(cherry-picked from internal master)
This will be added to the nearby devices permission group.

Bug: 197776854
Test: compile
Change-Id: I3f827be6219b5bb1595744e20b316d2b968e022d
Merged-In: I3f827be6219b5bb1595744e20b316d2b968e022d
2021-10-19 13:25:55 -07:00
William Escande
5b4de494a0 Fix queryRawContactEntity api
Bug: 203535224
Tag: #refactor
Test: build
Change-Id: Id2e4be7a7985c47e81b6bafee5c35d0df3f33d8f
2021-10-19 21:21:48 +02:00
Treehugger Robot
f637a0d63d Merge changes I6d3584f3,Ifdaada39
* changes:
  Fix SntpClient 2036 issue (2/2)
  Fix SntpClient 2036 issue (1/2)
2021-10-19 18:58:55 +00:00
Neil Fuller
a0db5578fc Fix error prone warnings
Fix warnings introduced by previous commits and add @RunWith annotation
to new tests for consistency with existing tests.

Bug: 199481251
Test: Treehugger only
Change-Id: Iaec4caa80b15112bce84268adc6d763198f0ff61
2021-10-19 18:45:14 +01:00
Neil Fuller
c9bbe6b59e Fix SntpClient 2036 issue (2/2)
Fix issue with SntpClient after the end of NTP era 0 (2036).

This is the second of two commits. This commit makes the actual fixes
and makes tests pass.

Before this change SntpClient converted to Unix epoch times too eagerly.
NTP 64-bit timestamps are lossy: they only hold the number of seconds /
factions of seconds in the NTP era and the era is not transmitted. The
existing code assumed the era was always era 0, which ends in 2036.

As explained at https://www.eecis.udel.edu/~mills/y2k.html,
the lossiness of the type is not an issue providing that the maths is
implemented carefully: the NTP timestamps are only ever subtracted from
each other, are always assumed to be in the same or adjacent NTP eras,
and are used to calculate offsets that are applied to client Unix epoch
times.

This commit:

+ Switches to use a dedicated Timestamp64 type, avoiding the use
of the Unix epoch.
+ Switches to use a dedicated Duration64 type for holding the
32-bit signed difference between two Timestamp64 instances.
+ Simplifies the readTimeStamp() and writeTimeStamp() methods.
+ Adds missing validation covered by a TODO. The code was randomizing
the lower bits of the client transmit timestamp, but then not checking
the result as it should, presumably because it was difficult to know
what value was sent. Easily fixed with a dedicated type.
+ Stops randomizing the lower bits of various other timestamps
unnecessarily.
+ Fixes some naming to add clarity.

Bug: 199481251
Test: atest core/tests/coretests/src/android/net/sntp/Timestamp64Test.java
Test: atest core/tests/coretests/src/android/net/sntp/Duration64Test.java
Test: atest core/tests/coretests/src/android/net/SntpClientTest.java
Merged-In: I6d3584f318b0ef6ceab42bb88f20c73b0ad006cb
Change-Id: I6d3584f318b0ef6ceab42bb88f20c73b0ad006cb
2021-10-19 18:22:43 +01:00
Neil Fuller
f663ab4276 Fix SntpClient 2036 issue (1/2)
Fix issue with SntpClient after the end of NTP era 0 (2036).

This commit is 1/2. It makes some refactoring changes, lint fixes, adds
tests and introduces types that will be used in 2/2. Some of the added
tests fail and demonstrate the issue being fixed with the current
implementation.

-----

Failures that demonstrate the bug:

android.net.SntpClientTest#testRequestTime_era1ClientEra1Server

STACKTRACE:
junit.framework.AssertionFailedError: expected=5, actual=-4294967295995, allowedSlop=1
	at junit.framework.Assert.fail(Assert.java:50)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at android.net.SntpClientTest.assertNearlyEquals(SntpClientTest.java:502)
	at android.net.SntpClientTest.checkRequestTimeCalcs(SntpClientTest.java:215)
	at android.net.SntpClientTest.testRequestTime_era1ClientEra1Server(SntpClientTest.java:201)

android.net.SntpClientTest#testRequestTime_era0ClientEra1Server: FAILED (145ms)

STACKTRACE:
junit.framework.AssertionFailedError: expected=1139293696005, actual=-3155673599995, allowedSlop=1
	at junit.framework.Assert.fail(Assert.java:50)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at android.net.SntpClientTest.assertNearlyEquals(SntpClientTest.java:502)
	at android.net.SntpClientTest.checkRequestTimeCalcs(SntpClientTest.java:215)
	at android.net.SntpClientTest.testRequestTime_era0ClientEra1Server(SntpClientTest.java:174)

android.net.SntpClientTest#testNonMatchingOriginateTime: FAILED (116ms)

STACKTRACE:
junit.framework.AssertionFailedError
	at junit.framework.Assert.fail(Assert.java:48)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at junit.framework.Assert.assertFalse(Assert.java:34)
	at junit.framework.Assert.assertFalse(Assert.java:41)
	at android.net.SntpClientTest.testNonMatchingOriginateTime(SntpClientTest.java:384)

------

This commit:

+ Introduces a dedicated Timestamp64 type + test for holding NTP
timestamps.
+ Introduces a dedicated Duration64 type + test for holding the
32-bit signed difference between two Timestamp64 instances.
+ Fixes some naming to add clarity / addresses lint issues.
+ Adjusts tests

Tests are NOT expected to pass with just this commit. See 2/2.

Bug: 199481251
Test: atest core/tests/coretests/src/android/net/sntp/Timestamp64Test.java
Test: atest core/tests/coretests/src/android/net/sntp/Duration64Test.java
Test: atest core/tests/coretests/src/android/net/SntpClientTest.java
Merged-In: Ifdaada39298b05c48a3207fe6c0fad71c8a0a252
Change-Id: Ifdaada39298b05c48a3207fe6c0fad71c8a0a252
2021-10-19 18:22:16 +01:00
Ian Hua
bae244ddd1 Merge "Add nnapi_native flag namespace." 2021-10-19 15:53:21 +00:00
Neil Fuller
563ecfccb1 Add android.net tests to postsubmit
Add android.net tests to postsubmit. The tests / annotations will
be added in a separate commit.

Bug: 199481251
Test: Treehugger / inspection
Change-Id: I17cb464979535c767bbb8ee22fd7456ff08bae6c
2021-10-19 15:57:01 +01:00
Treehugger Robot
fdc344e6b6 Merge "Removed Bluetooh ScanFilter hidden API usage." 2021-10-19 14:41:30 +00:00
wescande
e312b160f4 AbsoluteVolume change custom call to official API
BT mainline effort to remove hidden api:
`avrcpSupportsAbsoluteVolume` only inform for a new volume behavior and
AudioManager already provide such method.

Bug: 190422401
Tag: #refactor
Test: Manual: Start bluetooth, play music and change volume from speaker/phone
Change-Id: I935df5e0f5632cd4144343bdb1bc2b9d7bc61c01
2021-10-19 14:32:50 +02:00
Alan Stokes
b372220251 More OWNERS refactoring
Make ownership of dex-related files in pm/ the same as the files in
pm/dex/.

Also grant ownership to related tests.

Test: N/A
Change-Id: I47cd50e7f5ea512e286394a77bafb02f42c8e5bb
2021-10-19 12:12:44 +01:00
Alice Ryhl
7845ea4a85 Rename isHandlingTransaction to isDirectlyHandlingTransaction
The change in aosp/1806594 is adding a method to the binder ndk called
isHandlingTransaction, but that method behaves differently from this
method when HIDL gets involved, as getCurrentServingCall returns
HWBINDER in that case.

Test: m
Change-Id: Ie2812943d1e98e99a1c361475965a2c75214724a
2021-10-19 08:51:59 +00:00
Jakub Pawlowski
10d9b01f61 Merge "settingslib/media: Add LeAudio support" 2021-10-19 05:19:37 +00:00
Jordan Liu
78a8259df5 Merge "Do not strip trailing F's of test ICCID" 2021-10-18 23:33:54 +00:00
Treehugger Robot
b20dc98bfa Merge "Add a method to get rawContact" 2021-10-18 22:14:39 +00:00
Treehugger Robot
e722500621 Merge "Removed BluetoothDevice#prepareToEnterProcess" 2021-10-18 21:37:57 +00:00