268 Commits

Author SHA1 Message Date
Etienne Ruffieux
a8530fe5b5 SQLiteWrapper cleanup, removed unused checks.
Removed requery as it was unused, removed out-of-date
memory checks. All functionalities stay the same.
This change was initially made to prevent hidden APIs
usage in the library.

Tag: #feature
Bug: 190441152
Test: atest android.telephony.cts.MmsTest
NoNonSdkCheck: API usage is inside the class and removed with CL
Change-Id: I7498b0cd9e9955158094348acc2c94e0b2552b0d
2021-12-21 14:32:55 +00:00
Sooraj Sasindran
81be082283 Provide last known cell id for emergency call
Provide last known cell id to connection service
for emergency calls.

Bug: 198533763
Test: unit test
Change-Id: I8b660c0b5fbe095e3b9b67129b7404ebd7ec5ccd
2021-12-06 12:52:31 -08:00
Sooraj Sasindran
4219d77a4d Add non dangerous read phone state permission
Add non dangerous read phone state permission

Bug: 198535473
Test: CTS.
Change-Id: Ic6cbaf7113e09d618eb54e9f40fa033d803421c9
2021-12-02 17:06:47 -08:00
Baligh Uddin
2034ab84b2 Add visibility for packages/modules/Bluetooth/android/app
The code residing in packages/modules/Bluetooth/android/app is
migrated from packages/apps/Bluetooth and requires the same
visibility rules for frameworks source code.

This path currently does not exist, but will be required for
migration.  Soong build rules do not enforce path existence, which
allows us to add the new path now and not during migration.

Added visibility along with migrated code in a local tree and
performed a local build (bramble-userdebug)

BUG: 196026708
Test: TH
Change-Id: I66cac592489fc1689d45a7b6427bc58c40a824e2
2021-11-21 17:44:16 +00:00
Rahul Sabnis
5adc7bc196 Merge "Added filegroup mms with packages/apps/Bluetooth visibility" am: 8070a302cc am: cb11fc9e79
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1778008

Change-Id: Ia669a9cab588dad5cba50b0171a6b091dc834b61
2021-07-27 21:22:28 +00:00
Etienne Ruffieux
6c63f985ee Added filegroup mms with packages/apps/Bluetooth visibility
Added all java sources under telephony/common/com/google/
android/mms as filegroup with packages/apps/Bluetooth
visibility in order to remove unsupported usage calls
outside Bluetooth.

Tag: #feature
Bug: 190441152
Test: atest BluetoothInstrumentationTests
Change-Id: I662f5a6e17d753259bf6056dddac7062bb65733e
2021-07-27 09:18:44 +00:00
Amit Mahajan
0445be53de Add validity check to detect invalid PDUs.
Test: manual
Bug: 181382933
Change-Id: I32cdca12c279bf0514a8b7d102d5b4b6b0d76314
2021-05-12 17:43:33 -07:00
Anton Hansson
8acd3a8e2b Merge "Fix incorrect package in PackageChangeReceiver" am: 0ee8641209 am: 03c08d1f14 am: 3da1090ce6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1699739

Change-Id: Ib3596c8941803cfc7e55d47e2099d38857ade59c
2021-05-11 10:48:48 +00:00
Anton Hansson
6c4de79bcc Fix incorrect package in PackageChangeReceiver
This class is  meant to be internal but accidentally had the wrong
package name set. Rectify that to avoid it appearing in documentation.

Test: diff docs with internal filter applied, verify PCR is gone.
Change-Id: I498d460a524c878aafdf4f1a4497fcc51979c343
2021-05-10 12:16:32 +01:00
Amit Mahajan
3d802f564e Avoid spurious logging for read device identifier denial.
The change is to avoid reporting failure if the check is done
as part of an intermediate step.

Test: manual
Bug: 151875019
Change-Id: Id181063a34d311adfd09912d1ecb3508c444e798
2021-05-05 13:36:00 -07:00
Hall Liu
6d3455e488 Make LocationAccessQuery's builder safer to use
Add new methods on LocationAccessQuery.Builder to make it harder to
screw up when using. Changes include:
* Mandatory specification of min sdk levels for enforcing both fine and
coarse permission
* Mandatory "are-you-sure" check when both fine and coarse are above the
base level (i.e. when there are api levels that are left unprotected)

Also adapt TelephonyRegistry's permission checks to follow these new
requirements on the builder.

Fixes: 157170257
Test: CTS, unit tests, manual
Merged-In: Ica8779dff4c671352b917a3ccc02cdd0e1c5856d
Change-Id: Ica8779dff4c671352b917a3ccc02cdd0e1c5856d
(cherry picked from commit d7c2351676fb4791cba780b2fec9e27c258b20be)
2021-05-05 19:33:40 +00:00
Brad Ebinger
bc75177c71 Merge "Add the ability to get Accept-Contact header params" am: 71a05ba2b4 am: 0c5b322274 am: 1c5ed5e364
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1690090

Change-Id: Ibb8e787a5acdc66049e175954376141efab9e75d
2021-04-30 20:26:26 +00:00
Brad Ebinger
7f4e2af723 Add the ability to get Accept-Contact header params
- Add the ability to get tag param from from and to headers
- Add the ability to parse Accept-Contact header feature
tags that start with "+" for session tracking.

Test: CtsTelephonyTestCase:SipDelegateManagerTest TeleServiceTests
Bug: 173828358
Change-Id: I29aca0911a6600b99bc462ea816bdd283751ea00
2021-04-28 22:27:16 +00:00
Treehugger Robot
6ac5508707 Merge "Expose parsing util methods for telephony validation" am: 5092ae8c8b am: 2bf2f964d7 am: ad03a4a172
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1665959

Change-Id: I9116d44ad96ac2a4af5631541c6b27fe1813c81d
2021-04-28 02:51:42 +00:00
Brad Ebinger
3cccf87d80 Expose parsing util methods for telephony validation
Bug: 173828358
Test: atest TeleServiceTests
Change-Id: I271a36bcecb332c30f04e7fb22c45098384bc634
2021-04-26 19:33:05 +00:00
TreeHugger Robot
a212d74f3e Merge "Refactor Telephony phone number access checks to LegacyPermissionMgr" into sc-dev 2021-04-21 04:37:41 +00:00
Michael Groover
2947561500 Refactor Telephony phone number access checks to LegacyPermissionMgr
The TelephonyPermissions phone number access check can require several
interactions with the system_server to obtain the targetSdkVersion
and check the required permissions / appops for the requesting
package. This commit refactors all of these checks into the
LegacyPermissionManager (similar to what was previously done for the
device identifier access checks), requiring only a single request
to the system_server to check all non-subscriber access requirements.

Fixes: 159662444
Test: atest TelephonyPermissionsTest
Test: atest LegacyPermissionManagerServiceTest
Test: atest SmsManagerTest
Test: atest PhoneNumberTest
Test: atest SubscriptionControllerTest
Test: atest TelephonyManagerTest
Change-Id: I6c5cdbeecc2c4a2e200dcc33eedcb9213376f1ad
2021-04-20 17:15:59 -07:00
Amit Mahajan
fc8f430092 Add null check before trying to give appOps to package.
Test: none
Bug: 164209140
Change-Id: I64184e9d035be538684c42c85c869f09b048069f
2021-04-15 23:54:21 +00:00
Nathan Harold
41105e5721 s/enforece/enforce/
Because.

Bug: 157768478
Test: compilation
Change-Id: I8559564a5a68fee4ed8b0543cc91ea3ca7dc36ee
2021-04-07 00:34:44 +00:00
Nathan Harold
7cb9b5b45b s/enforece/enforce/
Because.

Bug: 157768478
Test: compilation
Merged-In: I8559564a5a68fee4ed8b0543cc91ea3ca7dc36ee
Change-Id: I8559564a5a68fee4ed8b0543cc91ea3ca7dc36ee
2021-04-06 17:21:09 -07:00
Treehugger Robot
9864e155a8 Merge "[LSC] Add LOCAL_LICENSE_KINDS to frameworks/base" am: 7226ad3729 am: a087245e03 am: 3dd40d172b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1661581

Change-Id: I99cb5fd94c4ee02688709ad00e3ffbc3e2f388e7
2021-04-01 13:47:07 +00:00
Bob Badour
de423b7a58 [LSC] Add LOCAL_LICENSE_KINDS to frameworks/base
Added SPDX-license-identifier-Apache-2.0 to:
  drm/java/Android.bp
  graphics/java/Android.bp
  identity/Android.bp
  identity/java/Android.bp
  keystore/java/Android.bp
  location/java/Android.bp
  location/tests/Android.bp
  lowpan/java/Android.bp
  media/mca/effect/java/Android.bp
  media/mca/filterfw/java/Android.bp
  media/mca/filterpacks/java/Android.bp
  mime/java/Android.bp
  mms/java/Android.bp
  opengl/java/Android.bp
  rs/java/Android.bp
  sax/java/Android.bp
  services/tests/servicestests/test-apps/PackageParsingTestManifests/Android.bp
  telecomm/java/Android.bp
  telephony/common/Android.bp
  tests/FlickerTests/test-apps/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  telephony/java/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I2ee0af9ce8f74de2172b359b41d2c52a8b8f7e6c
2021-03-31 19:55:25 -07:00
Anton Hansson
5013902a24 Merge changes I97086e30,Ic55df4cf,I81a08c29 am: 4199ef90b9 am: 4bc578052d am: ec1f981309
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1655736

Change-Id: I5d242cf5b18c4b556105cfcfe78df2ac18a8544e
2021-03-31 18:01:32 +00:00
Anton Hansson
9b2c4a650b Move framework java filegroups into subdirectories
All the java code used to build the framework jar and run metalava
was previously defined in the toplevel Android.bp files. Move these
into the subdirs where the source actually lives.

This simplifies the rules themselves (no path and needless prefix) and
declutters the top level Android.bp.

Test: m
Change-Id: I97086e309eacb879d16facb8497d9940fa5ddaf6
2021-03-30 12:26:55 +01:00
Brad Ebinger
9c2effce24 Merge "Parse params needed for SipDelegate routing" am: 9a13fb1dbf am: b81ca0dc24 am: 9a0a35f947
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1616689

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Idf695e8d9823448900a116a4d72d4162292ab03d
2021-03-05 05:20:28 +00:00
Brad Ebinger
9a13fb1dbf Merge "Parse params needed for SipDelegate routing" 2021-03-05 01:11:02 +00:00
Brad Ebinger
3215beb9e0 Parse params needed for SipDelegate routing
Add getViaBranchParameter and getCallId parameter to SipMessage
API in order to allow the SipDelegate to quickly route SipMessages
without requiring the app to peak into the headers.

Bug: 181591815
Test: atest CtsTelephonyTestCases
Change-Id: Iac94f73335ac5caa634b31c10a675aaf91c13af7
2021-03-04 02:06:28 +00:00
Brad Ebinger
29dfa1cd76 Define new permission to perform IMS RCS Reg actions and integrate ACCESS_IMS_SINGLE_REGISTRATION into APIS
Move from MODIFY_PHONE_STATE to ACCESS_IMS_SINGLE_REGISTRATION
as per design doc.

Bug: 149426399
Bug: 173652571
Bug: 168923956
Test: atest CtsTelephonyTestCases
Merged-In: I6d4ae879d9d2b347f6576ea20f9e42454b39936b
Merged-In: Idabfda6853ec2a24544da5253ad0e43c47a6cc69
Change-Id: Ie0e1198c8b9cfa0bab90407c8d35273159f63302
2021-03-02 11:39:02 +08:00
Brad Ebinger
63a1579abc Integrate ACCESS_IMS_SINGLE_REGISTRATION into APIS
Move from MODIFY_PHONE_STATE to ACCESS_IMS_SINGLE_REGISTRATION
as per design doc.

Bug: 149426399
Bug: 173652571
Bug: 168923956
Test: atest CtsTelephonyTestCases
Change-Id: Ie0e1198c8b9cfa0bab90407c8d35273159f63302
2021-02-17 23:59:11 +00:00
Brad Ebinger
481b1a7ab7 Merge "Parse SIP Messages for Transaction ID in SIP transport" am: ee0220039e am: 356c83613a am: 4a81036783
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1545324

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I261100ef4a479a2bc489b0b0fdc5526d5534adae
2021-01-15 14:02:28 +00:00
Brad Ebinger
5a9d8c495a Parse SIP Messages for Transaction ID in SIP transport
In cases where the framework/ImsService is not available,
locally extract the transaction ID from the SipMessage in order
to call the appropriate error method back to the caller.

Bug: 173828358
Test: atest FrameworksTelephonyTests:SipMessageParsingUtilsTest
Change-Id: I4ff5ed9ad4492e817c4a687e90d3a294e5514d8b
2021-01-12 22:13:47 +00:00
Meng Wang
9990ecec93 Allow platform app to use USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER permission
This permission is intended for 3rd party apps only with appops,
but it's not allowed to say 'appop' without 'signature' as
android:protectionLevel. So also honor platform key signed app using
this permission.

Bug: 174263375
Test: `atest android.telephony.cts.TelephonyManagerTest#testTelephonyManager` pass on crosshatch
Change-Id: I889c9342cae09ffeeb028cede30f59f2b35b4ea7
2020-12-23 15:43:10 -08:00
Nathan Harold
770e20a1f2 Merge "Move getTargetSdk to common location" am: 9be6c4500f am: 044e52ef59 am: 861a168777
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521058

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6f575db84203b210862981c65b99246f620ce23a
2020-12-16 21:39:23 +00:00
Hai Zhang
85b53955ff Send legacy default SMS change broadcast in SmsApplication.
We are moving RoleManagerService into mainline, so we can't reference
SmsApplication there without making it an API, and we can't simply
send the broadcast in RoleManagerService because the logic isn't
simple. Instead, we can simply register a role change listener in
SmsApplication for sending the broadcast, similar to how it is already
listening to package changes.

Bug: 158736025
Test: presubmit
Change-Id: I10e440499003f0ec34142a56e715caf452dbfa50
2020-12-14 22:31:02 -08:00
Nathan Harold
6ab80ad675 Move getTargetSdk to common location
Bug: 148559042
Test: compilation
Change-Id: Ib5d5e3591919287de819c4e329bacbda7befe76f
2020-12-11 16:59:10 -08:00
Hai Zhang
e7d707ceb0 Move a subset of PermissionManager APIs into LegacyPermissionManager.
And move their implementation from PermissionManagerService to
LegacyPermissionService.

The DefaultPermissionGrantPolicy related methods are not APIs, and
are thus moved to LegacyPermissionManager and their usages are updated
to use LegacyPermissionManager.

The checkDeviceIdentifierAccess() method is also moved into
LegacyPermissionManager, because it's merely an application of
permission checking, not the permission management infra itself, and
there isn't great benefit in updating it. However since it is an API,
we still have to keep a delegate for it on PermissionManager, and make
the delegated method @SystemApi.

Bug: 158736025
Test: presubmit
Test: LegacyPermissionManagerServiceTest
Change-Id: Ic838f3685427217c8e0477551c3373258408983f
2020-12-10 16:19:01 -08:00
Meng Wang
dae8db3eb2 Introduce new App Ops permission USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER
Bug: 174263375
Test: `atest android.telephony.cts.TelephonyManagerTest#testTelephonyManager` pass on crosshatch
Change-Id: Ic0e919d953be0422bf78477b8de13691b25b6cc3
2020-12-08 15:33:12 -08:00
Hall Liu
f78e46ae0a Merge "Move usage of Runnable::run to TelephonyUtils" am: 9f52302f07 am: e4a53f30bb am: e9f06ec2af am: 663fa0dd9a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1496999

Change-Id: I61189a89cdcfb9fbdf865390744b5931ada9eaf3
2020-11-12 20:33:30 +00:00
Hall Liu
9f52302f07 Merge "Move usage of Runnable::run to TelephonyUtils" 2020-11-12 19:11:58 +00:00
Hall Liu
564084cbdb Move usage of Runnable::run to TelephonyUtils
Using Runnable::run in com.android.internal.telephony from this
directory will conflict with any usages from frameworks/opt/telephony
since the compiles apparently scopes method references at the package
level. Move it to TelephonyUtils (which is in the .util sub-package) to
avoid the conflict.

Bug: 156779270
Test: build
Change-Id: I3471162eecde869aea66533de0355b3214859098
2020-11-11 19:02:47 -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
Treehugger Robot
a2699a02e8 Merge "cleanup the isUpdatedSystemApp" am: f86cf6fb6c am: 2635bb28b4 am: 9149eab591 am: 853858890b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1359902

Change-Id: I986e476cfb549ebb6e37fc81f79722b42a98361f
2020-10-30 10:37:55 +00:00
Treehugger Robot
f86cf6fb6c Merge "cleanup the isUpdatedSystemApp" 2020-10-30 08:38:43 +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 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6.

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
Jeff Sharkey
2d2e07e2ff Tighten up Binder.clearCallingIdentity() usage.
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
2020-10-06 11:18:09 -06:00
Hall Liu
0b7bf46c4d Rename RoleManager#getDefaultSmsPackage
Rename to getSmsRoleHolder

Fixes: 169447001
Test: atest RoleManagerTest
Change-Id: I69382d460b6178e1bc229cfe5d0a613fa7bf0895
2020-09-28 10:13:02 -07:00
Nathan Harold
42f5c3e326 Create Central Version of dataStateToString()
There are currently two slightly-different copies of
dataStateToString().
-TelephonyManager#dataStateToString()
-TelephonyRegistry#dataStateToString()

The TelephonyRegistry version doesn't have a string for the
DISCONNECTING state. In order to have a single copy that can
be accessed from TelephonyRegistry (not mainline) and TelephonyManager
(mainline), move both copies to TelephonyUtils.

Bug: 149717408
Test: make; atest TelephonyRegistryTest
Merged-In: I36945a8a432f7b4f0c449f7414996372e852b5b8
Change-Id: I36945a8a432f7b4f0c449f7414996372e852b5b8
(cherry picked from commit b640b1c62bdb90e81b8e21d89d658da4ba1c0f5e)
2020-09-23 21:47:00 -07:00
Songchun Fan
937eb58169 [telephony] system_server should not call non forUser Settings.Secure.get* methods
BUG: 166312046
Test: builds
Change-Id: Ib30eb22c23c7fd60ff498845a4d1876de2bb7799
2020-09-14 23:41:55 +00:00