Commit Graph

63 Commits

Author SHA1 Message Date
Eugene Susla
421eabcd37 Clarify type of EXTRA_DEVICE in javadoc
We have this in guide but not in javadoc, but it would make
sense to have it in javadoc as well.

Test: presubmit
Change-Id: I585248cc40c44bfa90828f04e4b5bd34694c36fd
Bug: 139376317
2020-06-30 00:36:26 +00:00
Yao, Yuxing
10ae617783 Fix BLE scan result filtering in CompanionDeviceManager.
Retrieve the Advertised service UUIDs out of ScanResult.ScanRecord.

Switching to ScanFilter.match() increases the filtering criteria but
it's the right method to use.

Test: flashed build locally with an experimental app.
Bug: 158243042

Change-Id: I814ec7058862a059bda4a1961843287430216877
2020-06-04 15:57:30 -07:00
Paul Murphy
515729d964 Update CompanionDeviceManager javadoc to include the
COMPANION_APPROVE_WIFI_CONNECTIONS_PERMISSION

Change-Id: I07b5ea07ccd0d28e589b586dd6fbf4816f035679
Test: None, this is strictly a javadoc update
Bug: 151311975
2020-03-17 16:53:17 -07:00
Eugene Susla
ad5e4920e0 Make WifiDeviceFilter.Builder.setSsid's arg @NonNull
Fixes: 143653080
Test: presubmit
Change-Id: Ia7715fe98c6a1f3a2d7e5cc702fadda1761e0f8e
(cherry picked from commit 133d12a770)
2020-03-05 23:56:31 +00:00
Eugene Susla
5f88b7bee5 Make companion callback calls oneway
These were never meant to be 2way, and are calling application callbacks,
from system server which can potentially take long time.

Thses should not be sensitive to ordering with any other IPCs, so moving them
from 2way to 1way should be safe.

Fixes: 147705675
Test: presubmit
Change-Id: Ie4e8941fba2c8a388697c3a42ad6ef76512eba9f
2020-02-12 15:02:04 -08:00
Etan Cohen
77c0640bcc [CDM][WIFI] Provide a permission for Wi-Fi association approval for companion apps
Rename API to make it explicit to Wi-Fi.

Bug: 135211972
Test: atest android.os.cts.CompanionDeviceManagerTest
Change-Id: I75b6d13432407a4e2804b57dcf6956055c9cefb6
2020-01-22 10:25:04 -08:00
Daulet Zhanguzin
ce45b72770 Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Change-Id: I1634f81bd92d9a93ac8c8f39c218e8002cbaf497
2019-12-30 16:09:29 +00:00
TreeHugger Robot
fb3ddfc41d Merge "Use ServiceConnector and @DataClass in companion service" 2019-12-21 01:37:44 +00:00
Eugene Susla
b45b15a701 Use ServiceConnector and @DataClass in companion service
Refactor CompanionDeviceManagerService away from hand-rolled
ServiceConnection management in favor of ServiceConnector

Test: using toy app, ensure companion API still works
Change-Id: I90f937adf4e6f9af2137c77de91ba5cf93fa2212
2019-12-20 15:50:11 -08:00
Artur Satayev
e23a0eb5ee Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I6ab53570aca580fbee1fcc927871caa09780f58f
2019-12-18 16:15:02 +00:00
Rahul Sabnis
693269e6e2 Merge "Refactor methods to access/modify BluetoothDevice alias and name" am: 67bef6ab92 am: 90a45d63bc
am: a00cb4b8b0

Change-Id: I587f4c0d9aea8114ff4a71259001b399447b40c0
2019-11-15 16:06:31 -08:00
Rahul Sabnis
24ad4b561c Refactor methods to access/modify BluetoothDevice alias and name
Bug: 142352567
Test: Manual
Change-Id: I86bb69faed1c6d46ac668816e6081bd1673fbf85
2019-11-14 12:58:48 -08:00
Artur Satayev
fc46be7dbd Add @UnsupportedAppUsage annotations for greylist.
go/cleanup-greylist-txt

These have already been greylisted, however due to bugs/omissions in the tooling have been kept in go/greylist-txt instead of being annotated in the code.

Bug: 137350495
Test: m

Change-Id: Id6c1f5e403a0e66edb1102ee45f3bf19f244fb09
Merged-In: Id6c1f5e403a0e66edb1102ee45f3bf19f244fb09
2019-11-08 16:17:13 +00:00
Eugene Susla
e62958cb98 Add CDM system api to check for association presence
Per agreement with wifi team, wifi stack will call into CDM when wifi
connection is requested, treating CDM record similarly to the previously
approved networks records, i.e. skipping UI when association exists.

Test: atest android.os.cts.CompanionDeviceManagerTest
Fixes: 143572863
Change-Id: I28b44076e594fb9357b5a543176d285414ef06f8
2019-10-30 18:08:00 +00:00
TreeHugger Robot
4218fd8ffa Merge "Add CDM API to filter by BSSID bitmask" 2019-10-29 05:36:35 +00:00
Eugene Susla
0fadff7761 Link to CDM guide from CDM javadoc
The guide is apparently somewhat hard to find, so this adds another way
to discover it.

Test: presubmit
Change-Id: I838d6b0ca312c46aac501b696bda1eecccef0bda
2019-10-25 20:30:17 +00:00
Eugene Susla
f51f6c0d91 Add CDM API to filter by BSSID bitmask
Per recommendation from wifi team, this is an important filter to provide

Test: manual
Fixes: 143313206
Change-Id: Ifcad0f6ce5134854114aa9df97b2c44ece858a30
2019-10-24 23:45:02 +00:00
Eugene Susla
5f6bf64107 Document condition when CDM looks at bonded devices
As reported in attached bug, there's been some confusion around which
specific kind of request does or does not include bonded devices when
searching.

This mentions the exact condition, and explains the use case when user
might want to take advantage of it.

Fixes: 139376317
Test: presubmit
Change-Id: I98501a235a044a0e184dcbb2363c158cc0d0882c
2019-08-14 10:51:04 -07:00
Artur Satayev
fa05ca260a Add @UnsupportedAppUsage annotations.
This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 137350495
Test: m
Change-Id: I55c7845cb7c22808a85dd5185eccfe93c2064b76
2019-08-01 13:44:37 +01:00
Neil Fuller
a76674f153 resolve merge conflicts of fe9b32e4be to qt-dev-plus-aosp
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Exempt-From-Owner-Approval: Merge conflict resolution for approved change
Change-Id: I39bda8417f709f86b5b389a75ff34df8a28a3d8d
2019-04-11 18:09:18 +00:00
Neil Fuller
b5d1c15ec2 Switch from Byte.toHexString() to HexEncoding
Switch from Byte.toHexString() to HexEncoding equivalents.

Bug: 124232146
Test: build only
Exempt-From-Owner-Approval: Cherry-picking OWNERS approved internal version
Merged-In: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
Change-Id: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
2019-04-11 09:27:45 +00:00
Neil Fuller
5c3f8c6562 Switch from Byte.toHexString() to HexEncoding
Switch from Byte.toHexString() to HexEncoding equivalents.

Bug: 124232146
Test: build only
Change-Id: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
2019-04-08 14:55:29 +01:00
Andrei Onea
fbc8cfdc94 Add @UnsupportedAppUsage annotations
For packages:
  android.companion
  android.filterfw
  android.hardware.camera2.utils
  android.inputmethodservice
  android.net.nsd
  android.os
  android.preference
  android.security.keymaster
  android.service.dreams
  android.telecom
  android.telephony.ims.compat.feature
  android.telephony
  android.util
  android.view.accessibility
  android.media.effect

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Merged-In: I9c2f8347952f3cc65759472b0e1a2717b285e44e
Change-Id: I14793863cf815fa3383fec6c6bf5a9365c2e17eb
2019-03-22 11:43:11 +00:00
Andrei Onea
e30e3928f9 Add @UnsupportedAppUsage annotations
For packages:
  android.companion
  android.filterfw
  android.hardware.camera2.utils
  android.inputmethodservice
  android.net.nsd
  android.os
  android.preference
  android.security.keymaster
  android.service.dreams
  android.telecom
  android.telephony.ims.compat.feature
  android.telephony
  android.util
  android.view.accessibility
  android.media.effect

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I9c2f8347952f3cc65759472b0e1a2717b285e44e
2019-03-21 14:04:57 +00:00
TreeHugger Robot
0582c28fd7 Merge "Fix NPE in companion device filter matching" 2019-03-02 02:49:54 +00:00
Eugene Susla
7151642b52 Fix NPE in companion device filter matching
Fixes: 124830832
Test: presubmit
Change-Id: I50da6682052cf01c3100f2cbde227245776d5295
2019-03-01 15:34:24 -08:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Mathew Inwood
464044f350 Add @UnsupportedAppUsage annotations
For packages:
  android.companion

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I10d15bf0f4f0aa4be4f60273bc15d2c075f140e0
Merged-In: Iae49e94fe8cffc1922b5e9cbd0cb9deaeae09b57
2018-08-09 15:35:32 +01:00
Mathew Inwood
70e89d569b Add @UnsupportedAppUsage annotations
For packages:
  android.companion

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Iae49e94fe8cffc1922b5e9cbd0cb9deaeae09b57
2018-08-09 15:27:52 +01:00
Eugene Susla
41ae7839db [Companion] Don't promise call back on javadoc
We only stop scanning on timeout but don't limit the time the
user has to select a device.
So timeout != failure. Cleaning that up from javadoc to avoid confusion

Fixes: 74080737
Test: proofread
Change-Id: I36b2d96f85c3c15c20742b954a0b34956f23d6f8
2018-03-01 14:46:15 -08:00
Jeff Sharkey
ce8db99114 Add more IntDef prefixes for auto-documenting.
Test: builds, boots
Bug: 70177949
Exempt-From-Owner-Approval: annotation-only changes
Change-Id: I76dde6054e06f52240bd4b1a0f196dcb74623608
2017-12-13 20:05:36 -07:00
TreeHugger Robot
a7d4e1d2f6 Merge "[Companion] Synchronize state access in CallbackProxy" 2017-08-18 20:56:50 +00:00
Jeff Sharkey
67f9d5070a Fix broken javadocs.
Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
2017-08-06 07:37:08 -06:00
Eugene Susla
08727b02f6 [Companion] Synchronize state access in CallbackProxy
Fixes: 63383044
Test: Ensure companion pairing still works
Change-Id: I5493d37acbcc6f4128d2c2aaf87d0b69f491d0f6
2017-07-12 17:19:43 -07:00
Eugene Susla
3a74c7ac8e [Companion] Prevent NPE in CallbackProxy
Fixes: 63383044
Test: Ensure all fields of CompanionDeviceManager.CallbackProxy are
null-checked in onSuccess and onFailure
Change-Id: If95a46686f74d184bccfcb2d8c8195add4747a07
2017-07-10 22:17:49 +00:00
TreeHugger Robot
2eacbac8c3 Merge "[Companion] Fix notification access dialog being in new task" into oc-dev 2017-06-20 22:23:05 +00:00
Eugene Susla
d149a08544 [Companion] Fix notification access dialog being in new task
Fixes: 62678460
Test: Tap recents while the dialog is shown and ensure it's not in a
separate task
Change-Id: I0572ddc84d76643ac8a373939273c221ff20676f
2017-06-19 17:51:01 -07:00
TreeHugger Robot
ba003a97f8 Merge "[Companion] Fix NPE in associate" into oc-dev 2017-06-19 21:52:19 +00:00
Eugene Susla
0435e5e79f [Companion] Fix NPE in associate
The root cause of the exception was that the activity destroy listener was
reacting to any activity being destroyed instead of just the one used with
the CompanionDeviceManager

Fixes: 62549525
Test: Ensure the attached bug no longer reproduces
Change-Id: I2f977e9ac9176247f5be9d08d19b3875f2b4a703
2017-06-16 17:22:04 -07:00
Eugene Susla
0c4a926626 Support associating with an already-paired device
This is required for migration scenario, where device(s) are already
paired(and thus no longer discoverable) but didn't go through companion
flow.
This also fixes a bug with filtering by mac address, which is also relevant to
the use-case of associating a specific device

Test: Pair with a device first, and call associate with a filter with its MAC
address and single device requested. Ensure the device is found.
Ensure only that device is ever returned when filtering by MAC address.
Bug: 62487084
Change-Id: Ic7cc6affc0648ad85b15620e8c3aba4b9fc91aa1
2017-06-12 16:21:51 -07:00
Jeff Sharkey
d86b8fea43 Annotate @SystemApi with required permissions.
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
2017-06-05 13:27:11 -06:00
Eugene Susla
6fd0ce3616 Avoid activity leak via Companion callback
Test: invoke associate() API and ensure it still works
Change-Id: I9aedb043b4b1f0d77f076d8753cd60ff7c98a7d6
2017-05-11 13:58:28 -07:00
Eugene Susla
20bd9fc81e API fixes for Companion renaming
Test: Ensure renaming still works
Fixes: 37748634
Change-Id: I6a863200b1f12db857c308e3b935b0f27f20c85b
2017-04-28 16:07:50 -07:00
Eugene Susla
722463ff95 Follow acronym convention for Companion BLE filter
Test: Ensure no compilation error
Fixes: 37514177
Change-Id: I4c255cf6b3c62d762755a9822928561371ecd88d
2017-04-25 14:42:35 -07:00
Eugene Susla
b0f9740057 Add javadoc about APIs requiring uses-feature
Bug: 37629514
Test: Ensure no compilation error; proofread
Change-Id: Ia250c95da1edb20017bc13a4504ead092eb24fff
2017-04-24 13:31:31 -07:00
Eugene Susla
a7717e3072 StopScan before each new Companion device scan
Fixes: 37356792
Test: Call associate many times rapidly with alternaring request value
Ensure no stale result is displayed
Change-Id: Icaa230d9ad468119e20b3de89f19c36531c2c60f
2017-04-19 11:20:06 -07:00
Eugene Susla
cf00adebec API for notification listener for Companioon apps
Test: 1. Trigger the confitrmation dialog.
Ensure it looks exactly like the one from settings.
2. Call an API without associating the appa first
Ensure exception is thrown with a message mentioning the need to associate 1st
Change-Id: I94d4116e1988db869ed445ae3fd018c50590e3f4
2017-04-14 19:01:53 -07:00
Eugene Susla
75fb821029 [DO NOT MERGE] Add an opnion to use advertised name for renaming
Test: Use new API, make sure renaming works
Change-Id: I9251c5db24495b8594fadce2beab3347a1aec884
2017-04-14 23:19:42 +00:00
Eugene Susla
200c37f413 [DO NOT MERGE] Stop scan on device chooser activity backgrounded
This effectively treats chooser activity pause event as cancel.

Bug: 30932767
Test: Install two toy apps and call associate API from both.
  Ensure foreground app always end up showing fresh data.

Change-Id: I7f5742e9878245550f678efd244bf84c427baef3
2017-04-14 23:17:04 +00:00
Eugene Susla
3c9aa1767c [DO NOT MERGE] Fix a bug with filtering by raw bytes
(when such filter is not provided)
See change in BluetoothDeviceFilterUtils

Bug: 30932767
Test: Call API with a BLE filter with no raw bytes filter, matching some device.
Ensure that the device eventually shows up.

Change-Id: I4397fa33dd0c48771c8a754791a171f2d0bd64eb
2017-04-14 23:10:20 +00:00