When resolving activtities for the USB device/accessory connection UI a
special intent that allows to switch between profiles get added. This
also gets added if there is no activity in the secondary profile that
can be started.
Fixes: 36544815
Test: Added work profile. Add USB handling app only to personal profile
and plugged in USB device -> no crash anymore
Change-Id: I311ddd53b3ff0c8406e62bac57972d4b790ebddc
This change introduces new methods on DumpUtils that can check if the
caller has DUMP and/or PACKAGE_USAGE_STATS access. It then moves all
existing dump() methods to use these checks so that we emit
consistent error messages.
Test: cts-tradefed run commandAndExit cts-dev -m CtsSecurityTestCases -t android.security.cts.ServicePermissionsTest
Bug: 32806790
Change-Id: Iaff6b9506818ee082b1e169c89ebe1001b3bfeca
All the trivial cases, plus some fixes to try to
mitigate collisions with the complex ones.
Complex services to follow in another CL,
Bug: 32584866
Test: make framework services
Change-Id: Ie9663600171d8ede11676e9d66f009dbb06def03
If DISALLOW_USB_FILE_TRANSFER is set while the device is
connected via USB and data transfer is enabled, restart
the USB stack to make sure that data cannot be transferred any more
Fix: 34487750
Bug: 34054991
Test: Checked that files cannot be transferred any more as soon as the user restriction is set
Test: cts-tradefed run cts-dev --module DevicePolicyManager --test com.android.cts.devicepolicy.UserRestrictionsTest
Change-Id: I129c226e57da2d0be356f93436b36b3303cb604c
persist OEM specific functions across boot using overlays when
ro.bootmode is NOT unknown
i.e. when phone boots up into a predefined Oem mode.
The overlay tuple has 4 columns instead of three where the fourth column
is optional. When the fourth column is present, the functions mentioned
there would be persisted across reboot along with adb(if enabled).
The fourth column is read during USB device manager set up
@readOemUsbOverrideConfig.
When trySetEnabled function is called, the override function is applied
and the actual oem functions are persisted in
persist.sys.usb.<bootmode>.config.
This property is used in an "on boot" property trigger to set up the
persistent function early in the boot.
(Similar to the way persist.sys.usb.config is used to setup the
USB functions during normal boot).
persist.sys.usb.<bootMode>.func tracks the functions without override.
For example, when the following tuple,
usbradio:adb:diag,serial_cdev,rmnet_gsi,adb:diag,serial_cdev,rmnet_gsi
when ro.bootmode is usbradio, and mCurrentFunctions is adb,
the actual functions enabled would be diag,serial_cdev,rmnet_gsi,adb
(sys.usb.config) and diag,serial_cdev,rmnet_gsi would be
persisted across reboots through persist.sys.usb.usbradio.config and
the functions would be saved in persist.sys.usb.usbradio.func
Bug: 31947358
Change-Id: Ifaef17f6943c1e70721cdc8489f17e3ece03bbfc
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: pass
Bug: 33844934
Change-Id: I7c1691daf029fb426873be79553a235c43df9f42
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.
Cherry-pick: https://android-review.googlesource.com/#/c/338266/
Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.
Cherry-pick: https://android-review.googlesource.com/#/c/338265/
Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
Before N, when MTP device is connected to Android, it opened the
activity selector for applications that could handle the MTP device.
For N, we updated the behavior to make it consistent with other storage
devices like USB mass storage. In N, the system showed the notification
first, then showed the activity selector after a user taps the
notification.
The N behavior causes a problem that the user always needs to tap the
MTP notification even after the user select a default application for
the MTP device.
The CLs tweaks the behavior for O so that the system can skip the MTP
notification if the system has the default app for the connected MTP
device.
The default app is one of them:
* App selected by a user by clicking "Always use" in the activity
selector
* System app that is an only application which can handle the MTP
device in the system
* App that is an only application which can handle the MTP device in
the system where config_disableUsbPermissionDialogs=true.
Bug: 32119378
Test: Connecting MTP device to Android, which automatically opens system
app. Connecting PTP device to Android, which shows a notification.
Tapping the notifiction opens the acitivity selector.
Change-Id: I51f1d55e8c7d1db87d91ddf966631d275a171546
Adapts all notifications used by system services to use channels.
Channels are initialized by SystemServer after the NotificationService
has started.
Test: runtest systemui-notification
Change-Id: I25c45293b786adb57787aeab4c2613c9d7c89dab
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.
Test: boots
Test: hidl_test
Bug: 33844934
Change-Id: I5774469712d70de4b2629258fe54d7f8c280d9d0
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.
Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.
Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
Type-c ports can quickly toggle between connected/disconnected
states. Introduce debounce to prevent sending spurious notifications.
Bug: 34972898
Test: notification should not be queued for a pixel-c charger not connected
to the power outlet.
Change-Id: I4aa19f9f864fe5b77e65f6a07a3184d8aba1f5fc
UsbPort.POWER_ROLE_SINK is orthogonal to the type of the charger
attached. POWER_ROLE_SINK would be the case for AC charging and
USB charging. Therefore query BatteryManager for the charger
type.
Bug: 34972898
Test: Charging notification should not show for pixel-c chargers.
Change-Id: I8dddcd7727b6af973bd173d2c6e325aa4be2ca3a
Broadcasts are not sent until BOOT_COMPLETED is received.
When the device boots with usb plugged, the UPDATE_STATE
for connted and configured would be received way before
BOOT_COMPLETED is received. Since, devices can continue
to stay in same usb configuration(set through persistent
property trigger), check and send a usb state broadcast
if needed.
BUG: 34451258
Test: Manually checked to verify the broadcasts sent.
Change-Id: I8eca5f241ad758f5c4f1afa6c9807868dfd6195a