Commit Graph

85 Commits

Author SHA1 Message Date
Eugene Susla
205637383c API for CDM wake-up opt-in
Bug: 168052577
Test: presubmit
Change-Id: I1cd1728099ddf374db4cf0e59f748ea3b655e1ba
2020-12-10 18:57:17 -08:00
Eugene Susla
151da5b2bc Store CDM device profile and apply role when device is connected
Test: manual - ensure role privileges are granted/revoked when device is connected/disconnected
Bug: 165951651
Change-Id: Id24a4b3a3510781d9105763b1722f44583a7fd7c
2020-12-04 15:56:50 -08:00
Eugene Susla
abe605b1da Add OWNERS to CDM and some utils I manitain
Test: presubmit
Change-Id: I26a7f810c6edff8f96b32887acd6e4613a91c7ef
2020-11-23 09:59:56 -08:00
Eugene Susla
1fc34a0784 Merge "CDM profile API" 2020-11-06 19:45:14 +00:00
Eugene Susla
df69bbaf29 Add API for CDM keep-awake service
Test: presubmit
Bug: 168052577
Change-Id: I9adcd9b6a33f23564ce1b8cddad36a3df047ba3a
2020-11-05 12:12:06 -08:00
Eugene Susla
10864c6764 CDM profile API
This introduces API for devs to request a "watch" profile,
as well as an optional "persistent CDM grants", e.g. for devices
with wifi/LTE.

This also introduces a permission that will be mandatory for apps
to declare in the manifest when opting into the above

CTS-Coverage-Bug: 172290699
Bug: 165951651
Test: presubmit
Change-Id: Ie5016c92855f33edb46fa8eb7ae2a9226e29cdda
2020-11-04 16:02:06 -08:00
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
286c33a5c5 Merge "Revert "Add maxTargetSdk restriction to unused APIs."" 2020-10-28 23:58:21 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Eugene Susla
38a7be67e8 Merge "Propagate callingPackage explicitly within CDM" 2020-10-28 18:55:50 +00:00
Eugene Susla
2a7a57711e Propagate callingPackage explicitly within CDM
Activity.getCallingPackage seems to be returning null in come cases

Fixes: 170461416
Test: manual
Change-Id: I507b9434e792f79e7905f1983879a062d1a6fec7
2020-10-27 15:56:50 -07:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Eugene Susla
6e5b3f6885 Merge "Make CDM call from sys server oneway" 2020-10-21 00:14:31 +00:00
Anton Hansson
586a3cf229 Remove @TestApi from @SystemApi symbols
I ran these commands:
    cd frameworks/base
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@SystemApi[\s\n]+(\@\w+[\s\n]+)?\@TestApi/\@SystemApi\1/gs'
    grep -rl '@TestApi' --include '*.java' | xargs perl -i -p0e \
        's/\@TestApi[\s\n]+(\@\w+[\s\n]+)?\@SystemApi/\1\@SystemApi/gs'

Bug: 171179806
Test: m checkapi
Change-Id: I772790b783b0a8730b8bf680c9e569a886b8d789
2020-10-20 09:04:03 +01:00
Eugene Susla
9fb3c13718 Make CDM call from sys server oneway
Fixes: 147704777
Test: presubmit; ensure no behavior change
Change-Id: Ia10d73ed4a51465c0488512716807e133322a9fb
2020-10-19 14:48:13 -07:00
Treehugger Robot
f45fd17c6d Merge "Minor grammar fix in CompanionDeviceManager javadoc." am: f052b7bf91 am: c713a670c9 am: 8bac874a53 am: b30fe6f42d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1462962

Change-Id: If257eb57c8f6619a46cd684cc46835a263b977be
2020-10-16 04:59:52 +00:00
Treehugger Robot
c713a670c9 Merge "Minor grammar fix in CompanionDeviceManager javadoc." am: f052b7bf91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1462962

Change-Id: I08c8cc48d74b0fbd472784cf16519ed1bd8e14fb
2020-10-16 04:16:36 +00:00
Taylor Bessette
fbf3cc233c Minor grammar fix in CompanionDeviceManager javadoc.
Change-Id: I57cd5ccc14a26ad2d97dddefa1952651a0ce7b82
2020-10-15 19:00:12 +00:00
Roman Kalukiewicz
24403f7ef2 Add @Nullable annotation to the parameter of Object.equals() methods.
Those annotations could be inferred by some tools (like Kotlin), but the
https://checkerframework.org/ doesn't check inherited annotations
complaining about all equals() invocations that get nullable argument.

The change was generated by running

find . -name \*.java | xargs sed -i 's/public boolean equals(Object /public boolean equals(@Nullable Object /'

in the frameworks/base directory and by automatically adding and
formatting required imports if needed. No manual edits.

Bug: 170883422
Test: Annotation change only. Should have not impact.
Exempt-From-Owner-Approval: Mechanical change not specific to any component.
Change-Id: I5eedb571c9d78862115dfdc5dae1cf2a35343580
2020-10-15 10:48:01 -07:00
Eugene Susla
991e8eed4f Expose syspem API for querying CDM associations
We want to restrict some BT capabilities(e.g. unpair device) to only the package's
associated device.
Since BT will become a mainline module, this needs to be exposed as a @SystemApi

Test: ateast android.os.cts.CompanionDeviceManagerTest#testGetAllAssociations
Bug: 165951651
Change-Id: Iab0da9352671e0b82ac855f91a6625c810946d17
2020-09-14 13:49:42 -07:00
Colin Cross
082aec6c84 Revert "Snap for 6793014 from bbbccc3c2b7fc7c5780f6c415c4223e1d0..."
Revert "Snap for 6793014 from 44725f06b7f7d6407b5ee82d989bdd6c7a..."

Revert "Snap for 6793014 from f22ad3164937a8f2e309965c102b6366d5..."

Revert "Snap for 6793014 from 11467102abddb6026aaa164c1361439c2d..."

Revert "Snap for 6793014 from 265280bf5cb4bc14e132c3a35ae5f7ae65..."

Revert "Snap for 6793014 from f2989f9c65556d5155dbd57f82f0c93a16..."

Revert "Snap for 6793014 from 8b8bf0a07b0521bbe8483fbbab1222ffd6..."

Revert "Snap for 6793014 from 3777d883a3857b1a1589181c436d9018d7..."

Revert "Snap for 6793014 from 3157b4ee4325286f0c2ab0f26528460c8b..."

Revert "Snap for 6793014 from a43295d1825da62af038d345a7a861ed7a..."

Revert "Snap for 6793014 from 2076be4d27078d6ebc0a6b5e5ceb386109..."

Revert "Snap for 6793014 from d0e31526c62b2aeb35c293ac96feb180fc..."

Revert "Snap for 6793014 from 7a3a8c6351d5167a6ae0b33bc376efabd2..."

Revert "Snap for 6793014 from 41471cb21bb16b5c3bcc92f84293b79684..."

Revert "Snap for 6793014 from 42e5cca3cfb829690c9d8c6aca57a8e7d5..."

Revert "Snap for 6793014 from 4f81304963d19f4511b1e8e7d0aad87a67..."

Revert "Snap for 6793014 from 07602cdacf5bcc835db41f7eaa24af9964..."

Revert "Snap for 6793014 from 14cb57e107a3abce8b14937b1f92c28d18..."

Revert "Snap for 6793014 from ab1e4a81d09a540a5f927059e5bc03a606..."

Revert "Snap for 6793014 from 8c65adad0bcdfb3acc561063b4048dca24..."

Revert "Snap for 6793014 from b3061942700265e2bf04af9997775dcbbb..."

Revert "Snap for 6793014 from 551c5953fc62e339e4ee884ec2cd0ac3be..."

Revert "Snap for 6793014 from 4919273b2ac5c6347a18e17c5ec70d8da6..."

Revert "Snap for 6793014 from 988d4244914e0c749655e8cb6db18ba44f..."

Revert submission 12465146-release-request-6b259cbc-1f45-4b05-bc7e-c9b893b79d68-for-git_main-busytown-release-6793014

Reason for revert: b/166531456
Reverted Changes:
I5ff7a6c0d:Snap for 6793014 from f2989f9c65556d5155dbd57f82f0...
I77bdff943:Snap for 6793014 from a43295d1825da62af038d345a7a8...
I2ac5c520a:Snap for 6793014 from c3f124cca05579acf0a6cb589ebd...
I023b9702f:Snap for 6793014 from 98756d6d3e2bb0ba28eb125caa7a...
Ibc7893d72:Snap for 6793014 from fd1ad6750ef332d3f50f218f4d5d...
Ic27847bee:Snap for 6793014 from 8c65adad0bcdfb3acc561063b404...
If20bc9352:Snap for 6793014 from 7a3a8c6351d5167a6ae0b33bc376...
I6542d17e8:Snap for 6793014 from 3777d883a3857b1a1589181c436d...
I66e6bb8a9:Snap for 6793014 from 8b8bf0a07b0521bbe8483fbbab12...
I3cd190b6b:Snap for 6793014 from 424180bdc4aa18249e678daebfd0...
If92db7402:Snap for 6793014 from ab1e4a81d09a540a5f927059e5bc...
Iaced03c87:Snap for 6793014 from d0e31526c62b2aeb35c293ac96fe...
I5d28c6b4b:Snap for 6793014 from 4f81304963d19f4511b1e8e7d0aa...
I30d07bea3:Snap for 6793014 from 7594ec6384c4da320726def34f47...
I473205f48:Snap for 6793014 from 551c5953fc62e339e4ee884ec2cd...
I0656b41af:Snap for 6793014 from 44725f06b7f7d6407b5ee82d989b...
I0f9796067:Snap for 6793014 from 4919273b2ac5c6347a18e17c5ec7...
I9a38cda8f:Snap for 6793014 from 2076be4d27078d6ebc0a6b5e5ceb...
I876a82f51:Snap for 6793014 from 11467102abddb6026aaa164c1361...
I749d7d023:Snap for 6793014 from 41471cb21bb16b5c3bcc92f84293...
I038daea41:Snap for 6793014 from 07602cdacf5bcc835db41f7eaa24...
I47aa3131c:Snap for 6793014 from 14cb57e107a3abce8b14937b1f92...
I32dba8a95:Snap for 6793014 from 3157b4ee4325286f0c2ab0f26528...
I2ebc9f9db:Snap for 6793014 from 988d4244914e0c749655e8cb6db1...
Iae7c3370f:Snap for 6793014 from 9ffb8852294e06e2d387dc1fb868...
I6467a7f1b:Snap for 6793014 from 42e5cca3cfb829690c9d8c6aca57...
I8c6375203:Snap for 6793014 from b3061942700265e2bf04af999777...
I843b2e1f3:Snap for 6793014 from 265280bf5cb4bc14e132c3a35ae5...
Ie254f7079:Snap for 6793014 from f22ad3164937a8f2e309965c102b...
I01e0974ed:Snap for 6793014 from bbbccc3c2b7fc7c5780f6c415c42...

Change-Id: I9160aa1ae5523d8e92c618ae1922576bb70a7ac8
2020-08-27 04:12:26 +00:00
Eugene Susla
b8b53f3b39 Fix duplicate devices when multiple mediums scanning requested
The dedupuing logic was already in place, but there was a race
due to managin the list of devices from different threads.

Test: using wear app ensure dup device reproduses without CL, and not with it
Fixes: 160870456
Change-Id: I1526199e8e4fb4b8f7d7f306e9e676359cdca516
2020-08-03 18:40:04 +00:00
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