During composition switch, some host PCs are taking more
time in processing the disconnect of previous functions and
enumerating the new functions. This causes the delay in
receiving the CONNECTED uevent which triggers the fallback
to default composition. Prevent this by increasing the
debounce time from 1s to 3s (which is the average time
taken by these PCs to enumerate the new functions) for
device mode state update, while keeping the debounce time
for host mode as is at 1s.
Bug: 176779207
Test: Verified enumeration of device with the delay
Change-Id: I7ff58a1a9755939ccb26dad61969902ec91f2225
Related changes are introducing new TypedXmlSerializer and
TypedXmlPullParser interfaces which offer efficient access to
primitive attributes.
This change is a purely mechanical refactoring to prepare for
upcoming data format shifts, and has no behavior changes.
Bug: 171832118
Test: manual
Exempt-From-Owner-Approval: trivial no-op refactoring
Change-Id: Ib8045ddba489c254641d6331b64355709c3f6dd7
USB Gadget V1.2 HAL include:
1. support NCM function
2. add api to inquiry USB speed
3. add api to inquiry HAL version
Bug: 168282708
Test: build pass and functions are working normally
Change-Id: Idd07c55f4610740c0cf9023391125a86ba39ddee
We've been writing many new framework-specific Error Prone checkers
to help detect obscure platform bugs, and this change starts enabling
those checkers for more packages across the platform.
Bug: 155703208
Test: manual
Exempt-From-Owner-Approval: trivial blueprint changes
Change-Id: I1db3412b0be40f6f78c68331ae01756887192071
Some careful spot-checking has revealed common cases where it's
reasonable to blanket apply the new FLAG_IMMUTABLE option to newly
created PendingIntents. Specifically these situations:
-- Simple notification content clicks are immutable; there's no need
to communicate customized data back to the creator
-- Simple notification action clicks are immutable; there's no need
to communicate customized data back to the creator
-- Broadcast intents sent by AlarmManager are immutable; the system
dispatches them without customization.
Bug: 170165227, 170424283, 170425388, 170425877
Bug: 169791183, 170771965, 170226088, 170224928, 170767530
Test: none
Change-Id: I5ed68710d2ccad4635a30fd91136a9e6ad76a01d
This is a third CL in a chain that adjusts existing malformed code
to follow AndroidFrameworkBinderIdentity best-practices.
Specifically, if a thread clears an identity they need to restore it
to avoid obscure security vulnerabilities. In addition, the relevant
"try" block must start immediately after the identity is cleared to
ensure that its restored if/when any exceptions are thrown.
Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I74cb958b68d55a647547aae21baff6ddc364859b
The recently added AndroidFrameworkBinderIdentity Error Prone checker
examines code to ensure that any cleared identities are restored to
avoid obscure security vulnerabilities.
This change is a purely mechanical refactoring that adds the "final"
keyword to the cleared identity to ensure that it's not accidentally
modified before eventually being cleared. Here's the exact command
used to generate this CL:
$ find . -name "*.java" -exec sed -Ei \
's/ (long \w+ = .+?clearCallingIdentity)/ final \1/' \
{} \;
Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I832c9d70c3dfcd8d669cf71939d97837becc973a
Every time when user is switched the `UsbSettingsManager` creates a new
instance of settings object for the new user. It leads to creating
several receivers and subscribing to some broadcast messages. Then
system is switched on other user, settings for the old user are removed
from the internal container, but receivers are not unsubscribed. As a
result, the number of receivers for the `system_server` process is
continuously increased and may exceed the allowed limit.
It is proposed to explicitly unscribe receivers before remove settings.
Test: flash a DUT with user build and then run:
> run cts -m CtsDevicePolicyManagerTestCases
at least two times, check that DUT is not in the recovery mode;
or switch user ~1000 times:
$ adb shell am switch-user 0
$ adb shell am switch-user 10
and check that logcat doesn't contain a line:
E SystemServiceManager: java.lang.IllegalStateException: \
Too many receivers, total of 1000, registered
Change-Id: I4bb9feb408ce7c321a56d0e573c45c8794ed6860
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
Broadcast intents on below control request
Log both the request and response for 51 control request (Get Protocol)
Log both the request and response for 52 control request (Identifying information)
Log both the request and response for 53 control request (Start accessory mode)
bug: 139264039
Test: Check the broadcast intent could be received
Change-Id: I7c8db41ee05398200e235cf10dde96ba89b306e8
Over the years we've had several obscure bugs related to how SDK level
comparisons are performed, specifically during the window of time
where we've started distributing the "frankenbuild" to developers.
Consider the case where a framework developer shipping release "R"
wants to only grant a specific behavior to modern apps; they could
write this in two different ways:
1. if (targetSdkVersion > Build.VERSION_CODES.Q) {
2. if (targetSdkVersion >= Build.VERSION_CODES.R) {
The safer of these two options is (2), which will ensure that
developers only get the behavior when *both* the app and the
platform concur on the specific SDK level having shipped.
Consider the breakage that would happen with option (1) if we
started shipping APKs that are based on the final R SDK, but are
then installed on earlier preview releases which still consider R
to be CUR_DEVELOPMENT; they'd risk crashing due to behaviors that
were never part of the official R SDK.
Bug: 64412239
Test: ./build/soong/soong_ui.bash --make-mode services RUN_ERROR_PRONE=true
Exempt-From-Owner-Approval: trivial blueprint changes
Change-Id: Ia20181f8602451ac9a719ea488d148e160708592
Use an explicit intent and set PendingIntent.FLAG_IMMUTABLE to prevent
someone from modifying the intent from PendingIntent.send(...).
Bug: 153356209
Test: atest AdbNotificationsTest
Test: In bug, install and launch the PoC apk and give it notification
permissions. Then, with USB/Wifi debugging enabled, disconnect and connect
the device to create the adb notification. the PoC apk should not have
permission to display information from
content://com.android.settings.files/my_cache/NOTICE.html.
Change-Id: Ie49aa3cf9b33168cf1435fc2427e95aac7f4609b
(cherry picked from commit 2c038814591d7e3d73b2b277db504a5555732456)
Exempt-From-Owner-Approval: approved in master
One can select USB function in Settings->System->
Developer options->Default USB configuration without
a cable connected, and the selected function will be
the default function after re-connecting. However, this
function might be restored to NONE due to ENUMERATION_TIMEOUT
if one selected the function without a cable connected.
When the device is not connected to a host, we should not
queue the ENUMERATION_TIMEOUT while switching function.
Fix it by checking connected status and also make it switch
to corresponding function if an user has selected one in the
Default USB configuration.
Bug: 150422683
Test: Switch functions from Default USB configuration for the
both cases cable connecting and disconnecting. And also try it
while there is the secure lock.
Signed-off-by: Puma Hsu <pumahsu@google.com>
Change-Id: I1933c098e47496b8d6813a5a4e295bcf12027401
There's some weird state where if persist.sys.usb.config=none,adb, then
adbd won't get started. Give back adbd start permissions to
UsbDeviceManager to see if that fixes the issue.
Bug: 150130503
Test: adb shell su 0 setprop persist.sys.usb.config none,adb; adb reboot
adb should be online after.
Change-Id: I36c6ef4b20d58570a2d51ed70088ae5c54d6687d
Merged-In: I36c6ef4b20d58570a2d51ed70088ae5c54d6687d
Exempt-From-Owner-Approval: Fix adbd offline failure
There's some weird state where if persist.sys.usb.config=none,adb, then
adbd won't get started. Give back adbd start permissions to
UsbDeviceManager to see if that fixes the issue.
Bug: 150130503
Bug: 150116813
Test: adb shell su 0 setprop persist.sys.usb.config none,adb; adb reboot
adb should be online after.
Change-Id: I36c6ef4b20d58570a2d51ed70088ae5c54d6687d
Exempt-From-Owner-Approval: Fix adbd offline failure
(cherry picked from commit 7a3800993df55f87ce6493bf304730b9ffd91ad5)
This CL has a couple of notable changes:
- Add communication layer between adbd, system server, and Settings UI
- Add system notification (Wireless debugging connected) when at least
one device is connected.
- Add trusted networks (BSSID) to the keystore.
- Changed the keystore format to:
<keyStore version="1">
<adbKey ... />
<wifiAP ... />
</keyStore>
- Currently, trusted networks don't have a expiration time. Also, only
way to clear it is by blowing up the keystore (revoke permissions).
- Add pairing mechanism:
- Using libadbwifi_pairing_connection C++ library to pair a device
using SPAKE2 protocol over TLS.
- Register MDNS service for client discovery.
- Removed ability to ctl.start/stop adbd from UsbDeviceManager
- AdbService now controls when to do this
Bug: 111434128, 119490154, 119492574
Test: Manual. From developer options:
1) USB debugging off, WiFi Debugging off
- Ensure both transports are disabled by trying to connect via WiFi and
USB.
2) USB debugging on, WiFi Debugging off
- Connections via USB are available, WiFi is disabled
3) USB debugging off, WiFi Debugging on
- Connections via WiFi are available (IP + port), USB is not available
4) USB debugging on, WiFi Debugging on
- Check both transports work
Change-Id: I9f87679d195da99a55b6faf7131da1f1af65fe01
Exempt-From-Owner-Approval: approved in aosp master
(cherry picked from commit a5969b5a1d9fe08783c32ea23bead56252a74383)
This CL has a couple of notable changes:
- Add communication layer between adbd, system server, and Settings UI
- Add system notification (Wireless debugging connected) when at least
one device is connected.
- Add trusted networks (BSSID) to the keystore.
- Changed the keystore format to:
<keyStore version="1">
<adbKey ... />
<wifiAP ... />
</keyStore>
- Currently, trusted networks don't have a expiration time. Also, only
way to clear it is by blowing up the keystore (revoke permissions).
- Add pairing mechanism:
- Using libadbwifi_pairing_connection C++ library to pair a device
using SPAKE2 protocol over TLS.
- Register MDNS service for client discovery.
- Removed ability to ctl.start/stop adbd from UsbDeviceManager
- AdbService now controls when to do this
Bug: 111434128, 119490154, 119492574
Test: Manual. From developer options:
1) USB debugging off, WiFi Debugging off
- Ensure both transports are disabled by trying to connect via WiFi and
USB.
2) USB debugging on, WiFi Debugging off
- Connections via USB are available, WiFi is disabled
3) USB debugging off, WiFi Debugging on
- Connections via WiFi are available (IP + port), USB is not available
4) USB debugging on, WiFi Debugging on
- Check both transports work
Change-Id: I9f87679d195da99a55b6faf7131da1f1af65fe01
Merged-In: I9f87679d195da99a55b6faf7131da1f1af65fe01
Exempt-From-Owner-Approval: already approved
Since wireless debugging can be enabled without usb debugging enabled,
we'll need to differentiate between which transport is enabled.
Also added the internal AdbManager stubs for wireless debugging. Adding
implementation in separate CL to get around merge conflict with a SysUI
CL in the stack.
BUG: b/111434128
Test: make
Exempt-From-Owner-Approval: already approved
Change-Id: I4e1ae6398f291f321e61e7eb119564ebd5e54c2e
As part of statsd becoming a Mainline module in R, autogenerated
StatsLog.write() calls are going away and replaced by
*StatsLog.java
that is autogenerated for each module.
This CL replaces some usages of StatsLog with
FrameworkStatsLog.
Bug: 145952197
Test: m
Change-Id: Ic3b9d02ee33e8d94fdbe4e324ceb6db13fe3d2dc