Commit Graph

426 Commits

Author SHA1 Message Date
Chloe Dai
e733e5a379 Merge changes from topic "Backport: tag availability checking mechanism" into sc-v2-dev-plus-aosp am: 40a364f284
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17046201

Change-Id: I14e5e6e0b7bd6d8333ed8d35557ff3dcf7d01fbf
2022-03-08 02:40:03 +00:00
chloedai
aab937aba8 [automerge] Add null checking to fix NullPointerException while creating mock tag 2p: d52c4c3e83
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17046201

Bug: 221452261
Change-Id: Ibd6b72aba6b8755d38524cda66ed5fce0f4c8aab
2022-03-07 03:08:43 +00:00
chloedai
d52c4c3e83 Add null checking to fix NullPointerException while creating mock tag
Bug: 221452261
Test: Test pass
Change-Id: Ie64df0d8d291468b258f92524af10da504c7dade
Merged_In: Ie64df0d8d291468b258f92524af10da504c7dade
(cherry picked from commit dbdc1bd3c7)
2022-03-07 03:08:33 +00:00
Presubmit Automerger Backend
cea18d7f27 [automerge] Add tag availability checking mechanism 2p: 113f3a4a1d
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16730930

Bug: 199291025
Change-Id: Ib99e5fe19b020154867910bbaeb513be277a81cd
Merged-In: Iabaab1f6d2d22e15966d31dd79099369d828f4c6
2022-03-07 03:08:20 +00:00
chloedai
113f3a4a1d Add tag availability checking mechanism
Set a cookie to the tag objects when they are constructed, the
cookie could be used to check the availability before returning
the tag service

Bug: 199291025
Test: test with some reader apps, test pass
Merged-In: Iabaab1f6d2d22e15966d31dd79099369d828f4c6
Change-Id: Iabaab1f6d2d22e15966d31dd79099369d828f4c6
2022-03-07 03:08:06 +00:00
Treehugger Robot
43fb9c1dd2 Merge "Add an optional extra field description for ACTION_CHANGE_DEFAULT" am: 2b65ebc340 am: 8f7978d676 am: c65ee54bcb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2000590

Change-Id: Ia8749bb7d273af93c310a10e101511ec2db0fbd7
2022-03-03 03:36:59 +00:00
Jack Yu
a053fa8d46 Add an optional extra field description for ACTION_CHANGE_DEFAULT
Add the description using Intent.EXTRA_USER to pass the UserHandle of
the user that owns the app.

Bug: 215300017
Test: build pass
Change-Id: Ieeaf0876b19cae60743cbf279e5c937a457165c9
2022-03-01 03:05:40 +00:00
Treehugger Robot
a1d64e1394 Merge "Remove EXTRA_USERID from NFC CardEmulation" am: 1a11b7b5d5 am: f5d51cb655 am: 37e2084dce
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1984767

Change-Id: I34632e1f8ba0d71f36dd10dfef95c8fa6dc89fc2
2022-02-22 02:50:09 +00:00
Jack Yu
c5942cc293 Remove EXTRA_USERID from NFC CardEmulation
Based on suggestion, use existing Intent.EXTRA_USER to pass the UserHandle
as the extra field of ACTION_CHANGE_DEFAULT.

Bug: 215300017
Test: manual
Change-Id: I15c5032f0229e8049fa1ef3741638974189ac3cf
2022-02-15 13:54:44 +08:00
Chloe Dai
dda723993a Merge "Add tag availability checking mechanism" 2022-01-26 02:58:10 +00:00
chloedai
49f7afe68b Add tag availability checking mechanism
Set a cookie to the tag objects when they are constructed, the
cookie could be used to check the availability before returning
the tag service

Bug: 199291025
Test: test with some reader apps, test pass
Change-Id: Iabaab1f6d2d22e15966d31dd79099369d828f4c6
2022-01-20 06:23:41 +00:00
Bernardo Rufino
1a5cb387d6 Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 331be9a643.

Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).

Original commit message:

Migrate unsafe parcel APIs in framework-minus-apex

Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
2022-01-19 11:13:18 +00:00
Bernardo Rufino
331be9a643 Revert "Migrate unsafe parcel APIs in framework-minus-apex"
This reverts commit 90bb3709dc.

Reason for revert: b/214053959

Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
2022-01-12 17:44:44 +00:00
Bernardo Rufino
90bb3709dc Migrate unsafe parcel APIs in framework-minus-apex
Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Test: TH passes
Change-Id: I11a27b9bdab7959ee86e90aa1e1cbebd7aaf883c
2021-12-15 18:21:38 +00:00
Jack Yu
fd53b477cd NFC-F support in work profile
Add one function to get NfcF service based on user id.

Bug: 202367033
Test: mauanl tests
Change-Id: I15f3ef84198b0af40d33fd16f457fb9b6cb7ca32
2021-11-04 12:47:51 +00:00
Jack Yu
c39a7ac618 NFC support in work profile
Add new constant userId extra for ACTION_CHANGE_DEFAULT.

Bug: 202367033
Test: mauanl tests
Change-Id: I4ce95f3939a8bb80b77926f111f34d084be8fb3e
2021-10-29 08:00:29 +00:00
Jack Yu
2341866fec NFC support in work profile
Add one function to get service based on user id.
Add one function to set deafult for next tap based on user id.

Bug: 202367033
Test: mauanl tests
Change-Id: Ib5bd36528c0d398215b078dbbd4f19305ce1402c
2021-10-29 07:59:58 +00:00
George Chang
0e61ff0344 Merge "Fix getSelectionModeForCategory" am: be74a9f6ba am: 057beb9bda
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1719130

Change-Id: Ieeee702d0a3dd1f55151354ab2f04ba1f1885572
2021-05-27 17:54:41 +00:00
George Chang
b039c1fa4f Fix getSelectionModeForCategory
NFC_PAYMENT_DEFAULT_COMPONENT is not accessable for market apps
Check if default payment name already registered in settings by NfcService.
Add a new AIDL interface isDefaultPaymentRegistered in INfcCardEmulation.aidl

Bug: 189178386
Test: atest CtsNfcTestCases
Merged-In: I0a09c9763d39c8e0b9b28df85603bdc7f281669d
Change-Id: I0a09c9763d39c8e0b9b28df85603bdc7f281669d
2021-05-26 16:27:38 +00:00
George Chang
4366d81730 Fix getSelectionModeForCategory
NFC_PAYMENT_DEFAULT_COMPONENT is not accessable for market apps
Check if default payment name already registered in settings by NfcService.
Add a new AIDL interface isDefaultPaymentRegistered in INfcCardEmulation.aidl

Bug: 189178386
Test: atest CtsNfcTestCases
Change-Id: I0a09c9763d39c8e0b9b28df85603bdc7f281669d
2021-05-26 18:17:40 +08:00
Treehugger Robot
198741831a Merge "Update register and unregisterControllerAlwaysOnListener" am: 16019ad77d am: 925778283c am: 270ca9b85e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1686685

Change-Id: Ib847254e7ccf35aa0050bcb1893fa9924899af97
2021-04-28 04:47:19 +00:00
George Chang
3b317f9134 Update register and unregisterControllerAlwaysOnListener
Don't register listener if Nfc ControllerAlwaysOn is not supported

Bug: 186172688
Test: atest NfcManagerTests
Test: atest android.permission.cts.NfcPermissionTest
Change-Id: I0e2a4ad372754c56f72296fdbaed8c98c06e1c56
2021-04-26 23:04:55 +08:00
George Chang
b1031e1054 Merge changes from topic "nfcc_aon_listener" am: 2195e2b514 am: 2f336d3401 am: e3cba3971a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669508

Change-Id: I3a234b2714f8254df7f4082b909b1f960b5d03f7
2021-04-15 17:14:40 +00:00
George Chang
84ca324df6 Update ControllerAlwaysOnStateCallback to ControllerAlwaysOnListener am: 78fad0d6d3 am: 9aa1fc83e5 am: 5293a03622
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675631

Change-Id: Ib6e7a448fcc62cc9af7600a2fb8df640ee7e9606
2021-04-15 17:14:23 +00:00
George Chang
60c693aa8d Add NfcManagerTests
Bug: 184837312
Test: atest NfcManagerTests
Change-Id: I1838a8232a34d9b2f35941408c499f59c68aa5e7
2021-04-15 02:24:16 +08:00
George Chang
78fad0d6d3 Update ControllerAlwaysOnStateCallback to ControllerAlwaysOnListener
Bug: 182979907
Test: atest NfcNciInstrumentationTests
Test: atest android.permission.cts.NfcPermissionTest
Change-Id: Iba0e3881b1bdb7ce080c15ae52f454912dc66ec9
2021-04-15 02:23:34 +08:00
George Chang
a613e853de Merge "Add callbacks to indicate NFC setControllerAlwaysOn state changed" am: cfc798e793 am: c5e292c9aa am: 9ef0cdbbc3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1657764

Change-Id: I64403a77aa63acb4cf0b35f6b72e82c518fa8040
2021-04-07 13:09:50 +00:00
George Chang
3562c9a505 Add callbacks to indicate NFC setControllerAlwaysOn state changed
remove unused android.nfc.action.ALWAYS_ON_STATE_CHANGED broadcast

Bug: 182979907
Test: atest NfcNciInstrumentationTests
Change-Id: I1032ee16d4d4e3f9d1b0c84f33ac70264ecda2b3
2021-04-01 21:36:57 +08:00
George Chang
03259bf7a4 Merge changes from topic "update_NFCC_Always_on" am: 7b7b809587 am: 6a6d92ff09 am: f5dcd90370
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1655107

Change-Id: I57b2db68bb05750718298d776ba2d365bea44a8b
2021-03-30 03:59:15 +00:00
George Chang
5052189dd8 Update SetAlwaysOn to SetControllerAlwaysOn
Bug: 182979907
Test: atest NfcNciInstrumentationTests
Change-Id: I6b794259ec597e5d7f86e94705017b8fe169a102
2021-03-28 22:20:52 +08:00
George Chang
abd045e95c Add new permission to set NFC always on states
Bug: 182979907
Test: atest NfcNciInstrumentationTests
Change-Id: I9a82c37f0b6716e68dc4c2d7e0f171d892f09112
2021-03-28 22:06:34 +08:00
Jack Yu
3c2fc6f742 Add attr for nfc applications to configure support power states
Use requireDeviceUnlock and requireDeviceScreenOn to configure the power
state for the AIDs of the nfc applications.

Bug: 171460473
Test: build pass
Merged-In: I03bd537082117e595a7badfb2d8ca6ee7cae08cf
Change-Id: I03bd537082117e595a7badfb2d8ca6ee7cae08cf
2021-02-01 06:41:04 +00:00
Treehugger Robot
d687007f8b Merge "Added setAlwaysOn feature" am: 66e56014df am: 0eda082f6a am: 2baabee7bb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1477323

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I92a8bf54ce320942e83563b5fc16fc7ea6198510
2021-01-20 20:32:58 +00:00
Treehugger Robot
387a6e35ce Merge "Fix typo in comment in android/nfc/tech/Ndef.java" am: 87bc42389d am: d7788c1cd5 am: b7640bf2ed
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1554496

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iff58656da800f3429ec91e3e3d5a48f01bfd9fe3
2021-01-20 20:31:31 +00:00
Treehugger Robot
66e56014df Merge "Added setAlwaysOn feature" 2021-01-20 19:13:43 +00:00
George Chang
17d77b41f6 Merge "Add REQUIRE_UNLOCK_FOR_NFC broadcast to notify SystemUI" am: c76df1366c am: 8feaa187be am: 8418eaba20
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1552500

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4bf7335e312a59346842a1c503e2fce5ac198b17
2021-01-20 18:54:13 +00:00
Treehugger Robot
87bc42389d Merge "Fix typo in comment in android/nfc/tech/Ndef.java" 2021-01-20 18:53:40 +00:00
Jakub Pawlowski
90dc908098 Fix typo in comment in android/nfc/tech/Ndef.java
Bug: 150104448
Test: none
Change-Id: I4a0c2c8020d42396e5a142d93d24d754a5b32930
2021-01-20 10:38:54 +01:00
George Chang
a0f9f4b73b Added setAlwaysOn feature
Add setAlwaysOn() system api.
This API is used to request that the NFC service
shall kept controller state on.

Add isAlwaysOnEnabled() system api.
This API is used to check setAlwaysOn is enabled or not.

Add isAlwaysOnSupported() system api.
This API is used to check setAlwaysOn is supported or not.

Bug: 176212892
Test: manual
Change-Id: If7ece9730c57838d870bb70cb2725919e75ef6c2
2021-01-20 03:18:06 +00:00
George Chang
994b5753c1 Add REQUIRE_UNLOCK_FOR_NFC broadcast to notify SystemUI
Bug: 177041874
Test: manual
Change-Id: I1ba9bac867fae8d3d22eb895acbe0f46cb8d76a0
2021-01-17 14:38:56 +00:00
Jack Yu
ad9223f687 Add attr for nfc applications to configure support power states
Use requireDeviceUnlock and requireDeviceScreenOn to configure the power
state for the AIDs of the nfc applications.

Bug: 171460473
Test: build pass
Change-Id: I03bd537082117e595a7badfb2d8ca6ee7cae08cf
2020-12-16 19:52:43 +08:00
Jeff Sharkey
0ab7007631 resolve merge conflicts of 358f0d4fc8 to master
Bug: 174932174
Test: I solemnly swear I tested this conflict resolution.
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Change-Id: I9262a08ffc1ccede8e519d0eed90ed2bfcf0232c
2020-12-08 11:01:05 -07:00
Jeff Sharkey
fab0ab3c9c Improve OWNERS coverage across frameworks/base/.
As general background, OWNERS files expedite code reviews by helping
code authors quickly find relevant reviewers, and they also ensure
that stakeholders are involved in code changes in their areas.

Some teams under frameworks/base/ have been using OWNERS files
successfully for many years, and we're ready to expand them to cover
more areas.  Here's the historical coverage statistics for the last
two years of changes before these new OWNERS changes land:

-- 56% of changes are fully covered by OWNERS
-- 17% of changes are partially covered by OWNERS
-- 25% of changes have no OWNERS coverage

Working closely with team leads, we've now identified clear OWNERS on
a per-package basis, and we're using "include" directives whenever
possible to to simplify future maintenance.  With this extensive
effort, we've now improved our coverage as follows:

-- 98% of changes are fully covered by OWNERS
-- 1% of changes are partially covered by OWNERS
-- 1% of changes have no OWNERS coverage

This specific change is automatically generated by a script from
detailed ownership information confirmed by team leads.

Bug: 174932174
Test: manual
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Merged-In: I9789c97c1de8e5d962b48c29c57d82fe83729eba
Change-Id: I9789c97c1de8e5d962b48c29c57d82fe83729eba
2020-12-08 08:36:27 -07:00
Treehugger Robot
da4c23ba01 Merge changes Ifcb0f60e,I09ecdff9 am: 5bc68e02a0 am: 6f4a8baa7a am: 00f3d0f52b am: 149c95c766
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498599

Change-Id: Ie5a84ef28e386e6f7d44171b0376ae5ff646a9eb
2020-11-18 04:45:14 +00:00
Jack Yu
3217255a4d Nfc adapter randomly returns null on devices having Nfc
Try to get NfcAdapter from NfcManager only when nfc service interface is
ready.

Bug: 173184157
Test: manaul test
Change-Id: Ifcb0f60e23f01cafd8b6b5f6bc8522773ece23a6
2020-11-13 18:34:42 +08:00
Jack Yu
cb2a677767 Improve NfcAdapter APIs to report correct nfc state
For enable and disable and state checking APIs, retry once if we found
nfc service is dead.

Bug: 173077348
Test: manual tests
Change-Id: I09ecdff9b0b7071569a854e7ace42a46b62a464f
2020-11-12 12:07:38 +08:00
Mathew Inwood
5d123b6775 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
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00: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
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
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