Commit Graph

424706 Commits

Author SHA1 Message Date
Jean-Michel Trivi
3ecc7eeaa1 FocusRequester: refactor handleFocusLoss
Break out the checks to see if a focus loss is handled by the
framework in a separate method, and reorder the if statements
for code clarity.

Annotate PlayerFocusEnforcer methods for nullability, add
javadoc

Test: atest AudioFocusTest
Change-Id: I9aaab804c78a2e2627ddbd7b9bd41fdec47d2b57
Merged-In: I9aaab804c78a2e2627ddbd7b9bd41fdec47d2b57
2019-09-10 12:56:02 -07:00
Treehugger Robot
b5cc2bfea0 Merge "Re-enable testAppZygoteServices in pre-submit." 2019-09-10 18:48:31 +00:00
Treehugger Robot
980681e525 Merge "Reconcile Zygote process name code with Q release." 2019-09-10 18:48:31 +00:00
Treehugger Robot
003eee49d4 Merge changes If2b3b414,I1039748d,Ib3cd38f5
* changes:
  AudioService: fix disconnect/connect of A2DP device
  audioservice: re send BT_SCO parameter to HAL when audioserver restarts
  audioservice: fix hasMediaDynamicPolicy() for loopback and render policies
2019-09-10 17:39:16 +00:00
Treehugger Robot
70532e5231 Merge "Refactor SoundEffectsHelper for asynchronous loading" 2019-09-10 17:35:25 +00:00
Treehugger Robot
728c58725e Merge "AudioService: factor out sound effects handling" 2019-09-10 17:29:46 +00:00
Jean-Michel Trivi
e8b184be30 Merge "Use sendVolumeKeyEvent API instead of sendKeyEvent API" 2019-09-10 16:43:00 +00:00
Christian Wailes
79a1b3a333 Merge "Don't clear the output array if it failed to open the proc status file" 2019-09-10 16:40:18 +00:00
Jean-Michel Trivi
b3580a89da AudioService: fix disconnect/connect of A2DP device
Due to the expected BECOMING_NOISY behavior associated
with a device disconnection, the disconnection is handled
asynchronously after a fixed delay. This delay caused an
inversion of commands in the processing order of the
disconnection of a device closely followed by connection
of the same device.
 The fix consists in:
- overriding the equals() operator for BtDeviceConnectionInfo
 so messages for a given device in the message queue
 can be checked / removed.
- when AudioDeviceBroker receives a command for A2DP
 connection or disconnection, remove all upcoming connection
 and disconnection commands in the queue for this device
 (see postBluetoothA2dpDeviceConnectionStateSuppressNoisyIntent)
- remove AudioDeviceBroker.handleSetA2dpSinkConnectionState, which
 was only used in BtHelper.onA2dpProfileConnected() with
 a CONNECTED state, and have this method perform a regular device
 connection (just like when coming from AM->AS).
- in AudioDeviceInventory.onSetA2dpSinkConnectionState(), support
 receiving a connection event for an already connected device,
 to support codec changes.

This change also includes modifications to the classes involved
in the device connection to make them support mocking/spying
to reproduce the bug conditions (see AudioDeviceBrokerTest).

Bug: 134932649
Test: atest AudioDeviceBrokerTest
Change-Id: If2b3b41409c77467a181a2f9b42310db9b9de8c5
Merged-In: If2b3b41409c77467a181a2f9b42310db9b9de8c5
2019-09-10 15:47:17 +00:00
Eric Laurent
0ea0da634e audioservice: re send BT_SCO parameter to HAL when audioserver restarts
Fix omission in AudioDeviceBroker.onAudioServerDied() where parameter
"BT_SCO=on|off" must be send to HAL according to current forced usage
for communication.

Bug: 135512789
Test: killaudio server during call over BT SCO
Change-Id: I1039748db5591321869f70c3dc589fbc62d41c31
Merged-In: I1039748db5591321869f70c3dc589fbc62d41c31
2019-09-10 15:46:57 +00:00
Eric Laurent
159b427652 audioservice: fix hasMediaDynamicPolicy() for loopback and render policies
Exclude mixes with LOOPBACK + RENDER flags when looking for dynamic
policies matching media usage. As this is only used in the context
of sending becoming noisy intent we want to send the intent when playback
capture is active.

Bug: 137055231
Test: enable live caption and disconnect headset while music is playing
Change-Id: Ib3cd38f58c2ff78a2f2f13c5c22b637f9701e345
Merged-In: Ib3cd38f58c2ff78a2f2f13c5c22b637f9701e345
2019-09-10 15:46:42 +00:00
Mikhail Naganov
7324049f9a Refactor SoundEffectsHelper for asynchronous loading
Use a dedicated thread for all SoundPool and MediaPlayer
operations. This ensures that the client (AudioService) doesn't
get blocked or delayed. This also removes the need to use
locking as all access to data happens on the same thread.

Simplify the implementation of the mapping between UI effect IDs
and SoundPool sample IDs.

Add event logging for sound effects loading.

Bug: 135763139
Test: normal scenario
      media volume responsiveness with stuck SoundPool
      behavior when declared sound assets are missing
Change-Id: Ie5a1684a2cabe05ff53270ad97cab161a87a59f9
Merged-In: Ie5a1684a2cabe05ff53270ad97cab161a87a59f9
2019-09-10 15:46:25 +00:00
Mikhail Naganov
96b3acd780 AudioService: factor out sound effects handling
Move the code related to sound effects loading and playback
into a separate class SoundEffectsHelper.

Bug: 135763139
Test: make and run phone
Change-Id: I30a7d897d740b02943c68924074f14fae3c3eff8
Merged-In: I30a7d897d740b02943c68924074f14fae3c3eff8
2019-09-10 15:46:12 +00:00
Amy
dcf1a84842 Use sendVolumeKeyEvent API instead of sendKeyEvent API
sendKeyEvent API always forwards the key control to the TV.
But for volume keys, we want it to be forwarded to the audio system if
system audio mode is on and if we are not a audio system itself.
sendVolumeKeyEvent can handle this logic.

Test: manual
Bug: 129116245
Change-Id: I6b81072ab49c092fac65cd542c19e611fc939cea
Merged-In: I6b81072ab49c092fac65cd542c19e611fc939cea
(cherry picked from commit ada40f59b63fe613448278a7cfbb7055146f8ccd)
2019-09-10 15:45:33 +00:00
Mathieu Chartier
f7335ffb9a Merge "Rename profileSystemServer to shouldProfileSystemServer" 2019-09-10 15:34:18 +00:00
Jean-Michel Trivi
dab4c89c00 Merge "AudioService: Add the AudioDeviceBroker's message queue to the dump" 2019-09-10 15:20:52 +00:00
Neil Fuller
07dcc4bc0f Merge "Simplify APIs exposed for time zone lookups" 2019-09-10 10:49:27 +00:00
Neil Fuller
21316e0b65 Simplify APIs exposed for time zone lookups
The libcore.timezone APIs may form the basis for some
new SystemApis. Before starting that process the API
surface is being rationalized to establish the core
use cases.

Test: Treehugger
Bug: 139091367
Change-Id: I6c8b791524d16223c414612913b22f4d70c27d61
Merged-In: I6c8b791524d16223c414612913b22f4d70c27d61
(cherry picked from commit 400efa36ef)
2019-09-10 10:08:19 +01:00
Treehugger Robot
69f11ef333 Merge "Revert "Fix: vendor public libraries are accessible via System.loadLibrary"" 2019-09-10 05:50:56 +00:00
Jiyong Park
bc099b6d59 Revert "Fix: vendor public libraries are accessible via System.loadLibrary"
This reverts commit cfe38cdb1c.

The CL 8f712189dfc02285573337e2b4ab17678011db14 in libcore project avoids
the need for adding the new paths in LoadedApk. With the CL, a classloader
does not give up even when loader.findLibrary() has failed due to some
paths are not added to it. Instead, the classloader converts the given
libname into a filename (e.g. foo -> libfoo.so) then calls dlopen()
with the filename. The classloader reports failure only when the dlopen()
call has failed. Therefore, manually adding these paths to the classloader
is no longer needed and thus removed.

Bug: 109720125
Test: System.loadLibrary("adsprpc") is successful in Pixel (because
libadsprpc.so is in Pixel's vendor public lib list)
Test: atest cts/tests/tests/jni

Merged-In: I1970eba7e732728699042a36b89571915ec81451
(cherry picked from commit 37131e1ee6)
Change-Id: I1970eba7e732728699042a36b89571915ec81451
2019-09-10 12:51:26 +09:00
Mikhail Naganov
fc23ee6453 AudioService: Add the AudioDeviceBroker's message queue to the dump
Clogged queue means device-related requests will not be served.

Example dump snippet:

AudioDeviceBroker:
  Message handler (watch for unhandled messages):
    Handler (com.android.server.audio.AudioDeviceBroker$BrokerHandler) {753fed2} @ 359741
      Looper (AudioDeviceBroker, tid 115) {ed3aba3}
        (Total messages: 0, polling=true, quitting=false)

Bug: 135763139
Test: adb shell dumpsys audio
Change-Id: If2130a4bd8bd9536df01656fe1a8f94548912ab9
Merged-In: If2130a4bd8bd9536df01656fe1a8f94548912ab9
2019-09-09 17:50:07 -07:00
Treehugger Robot
e1b6771680 Merge "AudioService: Add the service's message queue to the dump" 2019-09-10 00:05:26 +00:00
Treehugger Robot
102b795b61 Merge "audioservice: do not show volume panel when system audio is on" 2019-09-10 00:03:18 +00:00
Mikhail Naganov
2a0ce11924 AudioService: Add the service's message queue to the dump
Clogged queue means UI and other commands can not reach
the service and will cause volume controls to malfunction.

Example dump snippet:

Message handler (watch for unhandled messages):
  Handler (com.android.server.audio.AudioService$AudioHandler) {a904698} @ 61825
    Looper (AudioService, tid 118) {6808ef1}
      Message 0: { when=-52s689ms what=25 ... }
      Message 1: { when=-52s8ms what=8 ... }
      Message 2: { when=-52s4ms what=8 ... }
      ...
      Message 35: { when=-2s436ms what=0 ... }
      (Total messages: 36, polling=false, quitting=false)

This indicates that the command queue is not being processed
because the handler got stuck. Checking stacks of the system_server
can help in figuring out the reason.

Bug: 135763139
Test: adb shell dumpsys audio
Change-Id: I02009720668af218edb38d5a5948a5964b72c685
Merged-In: I02009720668af218edb38d5a5948a5964b72c685
2019-09-09 14:08:04 -07:00
Mathieu Chartier
3b05e4d74c Rename profileSystemServer to shouldProfileSystemServer
Makes it clearer and addresses previous CR comment.

Bug: 139883463
Test: make
Change-Id: I7c1a1d99cf307b89ee8f2c5c906168d196b35d0e
2019-09-09 13:05:31 -07:00
Mathieu Chartier
62b8a2a216 Merge "Add phenotype property for profiling system server" 2019-09-09 19:47:55 +00:00
Eric Laurent
255b2d690a audioservice: do not show volume panel when system audio is on
Do not show volume panel on TVs when system audio mode is ON.

Bug: 130524216
Test: make
Change-Id: Id8730455ee79f0ea3fa4c23e0a8b6bd2791eb2d3
Merged-In: Id8730455ee79f0ea3fa4c23e0a8b6bd2791eb2d3
(cherry picked from commit db961d82edee13b7f2a1e83f451c4f20430f8fce)
2019-09-09 12:42:53 -07:00
Treehugger Robot
59566aba2e Merge "Fix regression in PFD#fromData" 2019-09-09 19:21:04 +00:00
Treehugger Robot
4ed6876df1 Merge "Add TelephonyManager APIs to take physical slotIndex - getSimCardState - getSimApplicationState" 2019-09-09 17:58:52 +00:00
Mathieu Chartier
77aca50b6f Add phenotype property for profiling system server
Added the property profilesystemserver in the RUNTIME_NATIVE_BOOT
namespace. This property is overrides the system one if it is
present.

Bug: 139883463
Test: set the property manually and verify that system server is started
Test: with profiling

(cherry picked from commit 7b31c74ddb)

Merged-In: Ifd69530e52a717a381b3f91b15a74329614906f2
Change-Id: I00594949b845a75152c7ab3c94aa84a55b072776
2019-09-09 16:25:35 +00:00
Martijn Coenen
3b8ca2e7ac Reconcile Zygote process name code with Q release.
Some Zygote code that was pushed to AOSP master is different from the
pushed Q release. In particular, a call to set the process name for a
Zygote child was missing, causing an app zygote test to fail.

Bug: 139535125
Test: atest android.app.cts.ServiceTest#testAppZygoteServices
Change-Id: I53b0bc0116f1573cb1e52a998e10346bd5601f67
Merged-In: I2bce277ff8f2de4614e19d5385fe6712b076f9c9
2019-09-09 02:39:26 +00:00
Ian Kasprzak
aa766608b9 Re-enable testAppZygoteServices in pre-submit.
Code that caused it to fail was fixed.

Bug: 139535125
Test: atest android.app.cts.ServiceTest#testAppZygoteServices

Change-Id: I5f8eed38d4a8a56e750a6bb7fa7d397d9cd4c13d
Merged-In: I2bce277ff8f2de4614e19d5385fe6712b076f9c9
Exempt-From-Owner-Approval: Re-enabling fixed TEST_MAPPING tests
for AOSP after Q push.
2019-09-09 02:39:06 +00:00
Treehugger Robot
036ea39d96 Merge "Crash app on foreground service notification error." 2019-09-07 04:47:45 +00:00
Patrick Huang
9f2c596505 Add TelephonyManager APIs to take physical slotIndex
- getSimCardState
- getSimApplicationState

Bug: 134627366
Test: Manual test on device
Change-Id: I72612afb9f8ff3d898db99afaaee0c0d3654f754
Merged-In: I72612afb9f8ff3d898db99afaaee0c0d3654f754
2019-09-06 16:30:24 -07:00
qiwang
ae32f7e599 Don't clear the output array if it failed to open the proc status file
According to the original documentation, the functions in Process.java
should return -1 when the process doesn't exist,this should be detected
by Process.readProcLine() when it fails to open the /proc/<pid>/status
file. Unfortunately readProcLine() zeroes-out the output array before
attempting to open the file, so the expected return value -1 is changed
to be 0  when the process doesn't exist. It's inconsistent with the
interface description definition, so correct it.

Test: try to use Process.getUidForPid(int pid) api to read a non-existent
process pid's uid, it will return -1 instead of 0.

Merged-In: Ic2ac7defea8b15dd65f907d04e168a1283a4f621
Change-Id: Ic2ac7defea8b15dd65f907d04e168a1283a4f621
Signed-off-by: qiwang <wangqi_a@xiaomi.com>
2019-09-06 14:14:33 -07:00
Treehugger Robot
a2b218db06 Merge "[view compiler] Add test coverage for layouts compiled from APK" 2019-09-06 20:40:22 +00:00
Brad Ebinger
f4cd3de77a Merge "Re-deprecating Capabilities in ImsFeature" 2019-09-06 18:55:17 +00:00
Pengquan Meng
156f347db4 Merge "Support maximum wait time for Cell broadcast" 2019-09-06 17:15:28 +00:00
Da Xing
70876ce13f Crash app on foreground service notification error.
Resolved issue 118612296.

On any notification error, the NMS silently cancels the notification,
including foreground service notifications. Thus, an app could pass in a
garbage notification deliberately and start a foreground service silently.

This patch resolved this issue by judging the notification's flag, and if
it is a foreground notification, still crash the app as previous platforms,
and if it is a normal notification, don't crash the app.

Background: In 3ad4cdd1, which was merged into Android 9 release, the crash
behaviour is removed. But it is an important rule that foreground services
guaranteed to show an ongoing notification.

Test: Run the sample apk provided in the issue, it's main thread received
 a RemoteServiceException: Bad notification posted from package...
as intended behaviour.

Bug: 118612296
Merged-In: I94d9de50bb03c33666471e3dbd9c721e9278f7cb
Change-Id: Ice6faab055e2dacd3d2d12803fcf51e13d3b0f21
2019-09-06 04:39:57 +00:00
Pengquan Meng
9f677a0790 Support maximum wait time for Cell broadcast
Geo-Fencing Maximum Wait Time a device shall allow to determines it
location meeting operator policy. If the device is unable to determine
its position meeting operator policy within the GeoFencing Maximum Wait Time,
it shall present the alert to the user and discontinue further positioning
determination for the alert.

Bug: 139022202
Test: manual
Merged-In: If3d8d7915f2d86da20c63e99bee01f30e3ea89c0
Change-Id: If3d8d7915f2d86da20c63e99bee01f30e3ea89c0
(cherry picked from commit 02d6ac0f20)
2019-09-05 15:27:31 -07:00
Eric Holk
06a213820d [view compiler] Add test coverage for layouts compiled from APK
The existing LayoutCompilerTest only covered compiled layouts generated from
text XML files. It did not cover layouts that were extracted from the APK. This
is an important area to cover.

This test works by calling `pm compile --compile-layouts` on the test APK, and
then directly loads the `compiled_view.dex` file. From there, it pulls out the
compiled layouts and executes their inflater. This makes sure the generated DEX
files validate and execute without error.

Bug: 111895153
Merged-In: Ifc6719c2f438474b5474def02422ef68eee800b2
Change-Id: I7024069bb4d77a81871366f259fb34ae54a55aac
2019-09-05 11:20:05 -07:00
Brad Ebinger
98c0e000eb Re-deprecating Capabilities in ImsFeature
Readding the @deprecated javadoc to Capabilities as it is valid
to @hide a superclass of a @SystemApi.

Bug: 138990145
Test: manual
Change-Id: I1749aa3f09b7782fd0d665238be4c288a33536ea
2019-09-05 11:18:37 -07:00
Xin Li
d191463bb0 Merge "DO NOT MERGE - Merge Android 10 into master" 2019-09-05 16:53:23 +00:00
Lucas Lin
3f275ca900 Merge "Fix flaky test - testPartialConnectivity" 2019-09-05 11:40:01 +00:00
lucaslin
fe39f0a777 Fix flaky test - testPartialConnectivity
This timing issue is happened when test case already verified
NetworkMonitor#setAcceptPartialConnectivity() before
NetworkAgent send the CONNECTED state to ConnectivityService.
This test case expects that the
NetworkMonitor#setAcceptPartialConnectivity() will be invoked
when network state is CONNECTED in
ConnectivityService#updateNetworkInfo().

NetworkAgent communicates with ConnectivityService by
AsyncChannel. Before they connect to each other, the thread of
NetworkAgent is keeping idle, so waitForIdle cannot handle this
kind of case. Although they have connected to each other, but
they don't communicate with each other, waitForIdle() still
cannot handle this case. It means waitForIdle() can only handle
the case that NetworkAgent already connected to
ConnectivityService and NetworkAgent is communicating with
ConnectivityService. So, that's why waitForIdle() sometimes
doesn't work in this case, and the most simplest and right way
to fix this case is to wait the available callback then verify
the method.

Bug: 140306320
Test: atest FrameworksNetTests: \
      ConnectivityServiceTest#testPartialConnectivity \
      --generate-new-metrics 500

Change-Id: I64bfecbfe3c5776bd5c347a821f9127e79539c48
2019-09-05 11:39:20 +00:00
Treehugger Robot
4339cf3402 Merge "Add NetIdManagerTest" 2019-09-05 06:39:43 +00:00
Treehugger Robot
324d724fd7 Merge "Add ConnectivityServiceIntegrationTest" 2019-09-05 05:26:34 +00:00
Xin Li
e199ca954d DO NOT MERGE - Merge Android 10 into master
Bug: 139893257
Change-Id: I9e3c4fe5406c9913d50fe3b07d7f7cef7a246b96
2019-09-04 13:33:59 -07:00
Jay Patel
9e89d13906 Merge "Set SAM To Disabled On HdmiControl Disabled"
am: 1bc876bb5b

Change-Id: If9d1bda003ca03f6579559b7d13acbadba486dcd
2019-09-04 10:53:16 -07:00
Jay Patel
1bc876bb5b Merge "Set SAM To Disabled On HdmiControl Disabled" 2019-09-04 17:25:08 +00:00