Commit Graph

571543 Commits

Author SHA1 Message Date
Bernardo Rufino
9293dca91c Synchronize in LazyValue.get()
When we use Bundle's copy constructor we perform a shallow copy of the
underlying map, so lazy values are the same across the original and the
clone. So, if we're accessing the same item backed by a lazy value in 2
different threads, each one accessing a different bundle (the original
and the clone), both would have to synchronize on a common lock.

Although Bundle is not thread-safe, we should keep the expectation that
the client only needs to properly synchronize access to one bundle, not
more. To achieve this, we synchronize on the original parcel held by
LazyValue in get(), this removes the need for the above.

Note that after we produce the lazy values and put them in the map, we
don't have a reference to mParcelledData anymore inside the Bundle, the
only objects holding a reference to that parcel are the lazy values.

Also fixed some stuff in LazyValue:
* Fixed condition inside LazyValue that used mObject == null as
  signal for "not deserialized" state since mObject can be null, so
  switched to mSource != null.
* Made mSource volatile and adjusted operations to always check it
  before, ensuring visibility of itself and mObject via happens-before.
  This works because after checking mSource, if that's null, mObject is
  guaranteed to be visible and valid, if it's not null, we can use it
  since we're in the serialized state and this works even if another
  thread deserializes in between as long as we hold on to a reference of
  mSource in a local because the parcel is still valid.
* Remove the recycling of mValueParcel, otherwise we'd need locking to
  ensure whatever was using it was still using a valid object. Decided
  to just remove recycling for now since the plan is to remove
  mValueParcel entirely when we add comparison and hasFileDescriptor()
  methods that operate on a range to Parcel.

Bug: 195622897
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest
      android.os.BundleTest android.os.ParcelTest
Test: More tests coming
Change-Id: I501c91f505950338b23e7837e55f89b2f63ff93a
2021-09-22 11:58:24 +01:00
Treehugger Robot
9acfdcf214 Merge changes I8c36f5af,I800bc352
* changes:
  AudioEffect: fix racy access to callback data
  Analyze native crash in AudioEffect via event listener
2021-09-15 23:26:15 +00:00
Mikhail Naganov
9690a02f80 AudioEffect: fix racy access to callback data
Since the EffectCallback in android::AudioEffect can
keep an instance of the latter alive for a longer time
than Java AudioEffect is alive, the callback need to
ensure that it's not trying to use deallocated objects
and deleted JVM references.

Bug: 178363662
Test: manual using EffectsTest app
Test: atest CtsMediaTestCases:AudioEffectTest
Test: atest CtsMediaTestCases:BassBoostTest
Test: atest CtsMediaTestCases:DynamicsProcessingTest
Test: atest CtsMediaTestCases:EnvReverbTest
Test: atest CtsMediaTestCases:EqualizerTest
Test: atest CtsMediaTestCases:LoudnessEnhancerTest
Test: atest CtsMediaTestCases:PresetReverbTest
Test: atest CtsMediaTestCases:VisualizerTest
Change-Id: I8c36f5af4a1a2b14e81b1344570d2f8746ffa91e
2021-09-15 13:58:30 -07:00
Austin Shin
61c3d559c8 Merge "Fix onStateChanged issue." 2021-09-15 03:57:16 +00:00
Roopa Sattiraju
2ef5e10f45 Merge "Changing BluetoothHeadset APIs from @hide to @SystemApi" 2021-09-15 01:12:09 +00:00
Mikhail Naganov
7d6d9bd6c3 Analyze native crash in AudioEffect via event listener
Add repro code to the EffectsTest app. Steps:
 1. Start playback on the "Environmental Reverb Test",
    memorize the session id.
 2. Enter the session id on the "Bass Boost Test" or
    the "Visualizer" tab.
 3. Press "Hammer on release()" multiple times and check
    if the app crashes. Currently this happens for
    the Bass Boost effect.

Bug: 178363662
Test: see above
Change-Id: I800bc352fc8bc7073d1523c837008dc6fcfb957a
2021-09-14 17:55:36 -07:00
Treehugger Robot
a78fa61ba8 Merge "MediaCodecInfo: do not alter performance points for 32-bit processes (2)" 2021-09-14 23:21:32 +00:00
Treehugger Robot
37677f40d0 Merge "Fix typos in IdentityCredential.java javadoc" 2021-09-14 22:06:33 +00:00
Treehugger Robot
bca93eafe5 Merge "New API for getting enabledcomponent" 2021-09-14 18:18:30 +00:00
Seth Moore
fab34c1adc Fix typos in IdentityCredential.java javadoc
"byt" -> "but"
"readerAuth" -> "readerSignature"

Test: N/A
Change-Id: Ie8e8c4fa4479d3694871fe00bb0d99698fa05966
2021-09-14 11:01:28 -07:00
Elliott Hughes
1353c41379 Merge "Set $TMPDIR as well as java.io.tmpdir." 2021-09-14 16:49:24 +00:00
wescande
29dbede144 New API for getting enabledcomponent
Bluetooth can no longer call SystemConfig and need to use the manager.

Bug: 190440540
Bug: 199279027
Test: Manual
Tag: #refactor
Change-Id: I065ab407c83cd2edf2244e4170496b0979ac562c
2021-09-14 16:11:19 +00:00
Jakub Pawlowski
baea19f18f Merge "csip: Add Coordinated Set Identification Profile" 2021-09-13 20:40:31 +00:00
Łukasz Rymanowski
58ad9295c7 csip: Add Coordinated Set Identification Profile
Tag: #feature
Test: atest CsipSetCoordinatorStateMachineTest CsipSetCoordinatorServiceTest
Bug: 150670922
Sponsor: jpawlowski@
Merged-In: I67536ddcc32ace82d63e19426dce19f2bc69cdea
Change-Id: I67536ddcc32ace82d63e19426dce19f2bc69cdea
2021-09-13 19:02:10 +00:00
Treehugger Robot
49dcfea031 Merge "Fix typo contail->contain" 2021-09-11 04:47:09 +00:00
Ray Essick
24ae84e900 Fix typo contail->contain
Bug: 199238217
Test: compilation
Change-Id: I401e590cd27bfab2d09c9e2552f11f6f16360b8c
2021-09-10 20:25:24 -07:00
Treehugger Robot
d3f9cdd5be Merge "Deep copy service state object" 2021-09-10 21:43:00 +00:00
Benedict Wong
831f78825b Merge "Always trigger safe mode callbacks" 2021-09-10 18:39:27 +00:00
Dmitri Plotnikov
a84bdc93a8 Merge "Add OWNERS for BatteryStats related files" 2021-09-10 18:04:36 +00:00
Dmitri Plotnikov
9fca835a97 Add OWNERS for BatteryStats related files
Test: N/A

Change-Id: I6b17062eaf538849389528619067504f18e7b2ab
2021-09-09 18:24:17 -07:00
Treehugger Robot
99f31b981d Merge "Avoid Bluetooth gets turned on by enableBle" 2021-09-10 01:03:29 +00:00
Dmitri Plotnikov
542aace5fc Merge "Add OWNERS for BatteryStats related JNI files" 2021-09-10 00:37:10 +00:00
Jack Yu
aa150426de Deep copy service state object
The entire service state should be deep copied, instead of shallow
copied to the other object.

Fix: 174306612
Test: Manual
Merged-In: Ib6ad4ba26653ce5faad1e118a28d8be51435676c
Change-Id: Ib6ad4ba26653ce5faad1e118a28d8be51435676c
(cherry picked from commit 579f130ee3)
2021-09-09 16:23:39 -07:00
Roopa Sattiraju
943ac64f97 Changing BluetoothHeadset APIs from @hide to @SystemApi
For isInbandringing API - it is used in the call journey and would
change the behavior(undeterministic) of the call if not used.

Stop/StartScoUsingVirtualVoiceCall is used in the BluetoothShim layer
specifically for testing and mocking in the Android Apps. Seems
reasonable to keep this as a SystemAPI given that it has no params and
unlikely to be changed.

Bug: 195160939
Tag: #feature
Test: Manual
Merged-In: I02b2e7e5e0be3b462f7c25b655e669e2c7fe47eb
Change-Id: I02b2e7e5e0be3b462f7c25b655e669e2c7fe47eb
2021-09-09 15:48:15 -07:00
Dmitri Plotnikov
ce877b8474 Add OWNERS for BatteryStats related JNI files
Test: N/A
Change-Id: I2dee35c5b2e852c3abfcbcc4a52f0d7f245b43ca
2021-09-09 15:42:13 -07:00
Bill Yi
56cff2cee0 Merge "Merge RQ3A.210905.001 to aosp-master - DO NOT MERGE" 2021-09-09 21:27:24 +00:00
Shawn Lien
d673dddb01 Merge "Support Free Shortcode for TracFone Customer Service" 2021-09-09 17:58:27 +00:00
Bernardo Rufino
730b6cfbc1 Merge "Use appendFrom in LazyValue.writeToParcel()" 2021-09-09 09:48:13 +00:00
Ping Fan
167d4a3c33 Fix onStateChanged issue.
[Description]
inputState will override by wrong state
when call onStateChaned directly.

[Test Report]
Test pass

Bug: 196189979

Change-Id: I13377407c9ea9f4f0727edea5d57135c6569cba0
2021-09-09 11:07:06 +08:00
Sarah Chin
2823967c2d Merge "Support getSlicingConfig() API for 5G Slicing Configuration" 2021-09-09 01:57:46 +00:00
Bill Yi
505f138725 Merge RQ3A.210905.001 to aosp-master - DO NOT MERGE
Merged-In: If0c6aebc7ecb401d0f68a00a746f7ae337e4bb86
Merged-In: Ic4c9fc8a62966b7b171d4ff2185e3d3232dea2e0
Merged-In: Ic4c9fc8a62966b7b171d4ff2185e3d3232dea2e0
Change-Id: Ife6d981ebcc9d55b8b7f0089ef9af09a51ae87c5
2021-09-08 18:01:22 -07:00
Treehugger Robot
a9f7998ff4 Merge "Refactor: Remove unused branch." 2021-09-09 00:20:59 +00:00
Treehugger Robot
882bac800d Merge "ServiceManager: doc comment" 2021-09-08 23:44:36 +00:00
Anthony Stange
68e875719b Merge "Correct ranges for pitch and roll" 2021-09-08 21:34:34 +00:00
Elliott Hughes
d5ccb038f6 Set $TMPDIR as well as java.io.tmpdir.
This helps functions like tmpnam() and tmpfile() to "just work", like
their Java equivalents.

Bug: https://issuetracker.google.com/36991167
Bug: http://b/174682340
Test: atest FrameworksCoreTests:android.app.activity.ActivityThreadTest
Change-Id: Ife785f0ca69a34ba2c6b5d1e8e23f8b883d8fc8f
2021-09-08 12:31:25 -07:00
Steven Moreland
dc7cae65cf ServiceManager: doc comment
A couple words on this for ya!

Fixes: 197629711
Test: N/A
Change-Id: I4fbaacb6e123c042919c03f11a0403e041d23a56
2021-09-08 11:34:38 -07:00
Sarah Chin
e34b1b8735 Merge "Expose requestModemActivityInfo" 2021-09-08 16:12:28 +00:00
Shawn Lien
0dff9ff3bd Support Free Shortcode for TracFone Customer Service
TracFone informed that the short code "611611" is owned by TracFone and this is for the free messages for the TracFone customers.

TracFone webpage for 611611 use cases: https://dsweb.tracfone.com/611611/help/

BUG: 198667013
Test: ShortCodes are tested in the USA by leesung@google.com.

Change-Id: I6addc2c6a25e774cf9ba905b837e15caaed3c9bc
Signed-off-by: Shawn (Yu-Hsiang) Lien‬ <shawnlien@google.com>
2021-09-08 14:02:17 +00:00
Bernardo Rufino
5e5d776906 Use appendFrom in LazyValue.writeToParcel()
Due to lazy bundle, we can now have bundles touching the original parcel
(used to create the bundle in the first place) during serialization.
This can lead to races within the same bundle or across bundles when
the same is copied.

Both these cases happen in notification manager when it's about to post
notification for its listeners. In summary, it notifies all the
listeners in oneway calls and the listeners make a call back to
system_server to retrieve the notification. These calls back can race
and lead to the bug observed in http://b/198355758#comment12.

In order to avoid that we use appendFrom(mSource, mPosition) in
LazyValue.writeToParcel() since that method doesn't change or use the
cursor of mSource. We only ever write to mSource before creating all the
LazyValues, so there can't be any r/w races.

Test: 1. Attach debugger to system server and put log breakpoints in
         racy lines in Parcel$LazyValue.writeToParcel
      2. atest -d CtsHostsideNetworkTests:com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testDozeModeMetered_enabledButWhitelistedOnNotificationAction
      3. Observe no crashes
Test: 1. Attach debugger as in previous "Test:" line
      2. Create a notification with a parcelable extra, post it
      3. Observe no crashes
Bug: 195622897
Bug: 198355758
Test: atest -d android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Change-Id: I02f890d22910c69e29e791b55d3655962a6dddfd
2021-09-08 09:19:58 +01:00
Ugo Yu
6370606bee Avoid Bluetooth gets turned on by enableBle
BluetoothHandler was not able to tell whether the MESSAGE_ENABLE was
from enable() or enableBle(), which sometimes lead to Bluetooth gets
turned to STATE_ON by an enableBle() call.

Fix this problem by adding a BLE specific argument in the message to
differ the calls.

Bug: 191404687
Test: Manual
Change-Id: Ic9df612ec0e396932df2fb3bf3a5874bd4e7443c
Merged-In: Ic9df612ec0e396932df2fb3bf3a5874bd4e7443c
2021-09-08 16:10:03 +08:00
Treehugger Robot
42d6f9b7b2 Merge "Fix guide link to bg execution limits" 2021-09-08 06:20:52 +00:00
Darwin Huang
8303c17229 Refactor: Remove unused branch.
`filename` must be `null` at this point, as it's recently been set to that value, and hasn't adopted any other value yet. 

Refactoring change only. No functional changes intended.

Change-Id: I29a28872efc8c12c0da3c9f7c0a92d6aff465410
2021-09-08 00:33:11 +00:00
Steven Moreland
0f2729a96e Merge "Parcel: markForBinder" 2021-09-08 00:29:29 +00:00
Jeff Sharkey
c8eb0a1df7 Merge "RESTRICT AUTOMERGE: [MTE] Update manifest IDs to align with NDK." 2021-09-07 22:48:27 +00:00
Hongbo Zeng
9ee89f17e6 Support getSlicingConfig() API for 5G Slicing Configuration
- add getSlicingConfig() API in TelephonyManager and ITelephony
- add Parcelable implmentations for RouteSelectionDescriptor,
  SlicingConfig, and UrspRule
- remove @hide and @SystemApi for TrafficDescriptor and
  NetworkSliceInfo to make them public

Bug: 178075247
Test: .
(1) run "atest TelephonyManagerTest#testGetSlicingConfig" for CTS result
[22/121] android.telephony.cts.TelephonyManagerTest#testGetSlicingConfig: PASSED (956ms)
(2) run "atest RILTest#testGetSlicingConfig" for RILTest result
[17/111] com.android.internal.telephony.RILTest#testGetSlicingConfig: PASSED (1ms)

Change-Id: I0addc2b22c11b13759e890d88f51490993fb72e1
Merged-In: I0addc2b22c11b13759e890d88f51490993fb72e1
2021-09-07 15:37:21 -07:00
Hall Liu
1c8976b843 Expose requestModemActivityInfo
Expose requestModemActivityInfo in TelephonyManager using the Executor +
Consumer pattern, and modify clients to use it.

Test: atest TelephonyManagerTest#testRequestModemActivityInfo
Fixes: 170427831
Change-Id: I7e8134c8058017b888c324a9f85d473fc3cdd8f5
Merged-In: I7e8134c8058017b888c324a9f85d473fc3cdd8f5
2021-09-07 15:30:36 -07:00
Sarah Chin
c892758881 Merge "Update and expose ModemActivityInfo" 2021-09-07 21:57:26 +00:00
Hall Liu
f4fe3ac665 Update and expose ModemActivityInfo
Update ModemActivityInfo to present a nicer API surface and expose it as
a SystemApi. Also change clients in BatteryStats to match the new
surface.

This is part 1. Part 2 will modify the methods in TelephonyManager to
use a more up-to-standards threading model.

Bug: 170427831
Test: atest ModemActivityInfoTest
Change-Id: I762ed949342861c75d94eafce88335e7bd8c9139
Merged-In: I762ed949342861c75d94eafce88335e7bd8c9139
2021-09-07 11:40:55 -07:00
Christopher Tate
7ad31eb3f4 Fix guide link to bg execution limits
Bug: 157788333
Test: m offline-sdk-docs
Change-Id: I9258aeaa549b63960669d4bed9ea8fb03392146b
2021-09-07 11:36:20 -07:00
Brad Ebinger
733dd0f1e9 Merge "Update API docs for InCallService." 2021-09-07 17:28:24 +00:00