Commit Graph

9819 Commits

Author SHA1 Message Date
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
Songchun Fan
5c2ad1c98c Merge "Revert "Revert "[pm/incremental/api] exposing package state names and reasons""" 2020-10-20 01:12:08 +00:00
Songchun Fan
4377d446ce Revert "Revert "[pm/incremental/api] exposing package state names and reasons""
This reverts commit cf4c99720b.

Reason for revert: not related to launcher changes

Test: will add CTS tests.
BUG: 162600626
CTS-Coverage-Bug: 168925819
Change-Id: I5a6832ef7907c2be90758a553514fb0dedb8c8e1
2020-10-19 22:58:28 +00:00
Makoto Onuki
b1cfbc85b5 Expose BAL related APIs as @SystemApi
... Because the permission is already privileged and used by unbundled APKs.

Bug: 171062986
CTS-Coverage-Bug: 171196794
Test: build
Change-Id: Ibd6f961094fab8af71cfa26f54d97e69496633e2
2020-10-19 15:11:52 +00:00
Greg Kaiser
db1a1524b5 Merge changes I2f7b198f,I229b39ce,Iaf8e2c07
* changes:
  Revert "[incremental/pm] LauncherApps APIs for loading state and progress"
  Revert "[pm/incremental/api] exposing package state names and reasons"
  Revert "Fix LauncherAppsService queryIntentLauncherActivities"
2020-10-16 16:57:02 +00:00
TreeHugger Robot
2ef3f14284 Merge "Add WindowLayoutAffinity attribute." 2020-10-16 16:54:56 +00:00
Greg Kaiser
69475be847 Revert "[incremental/pm] LauncherApps APIs for loading state and progress"
This reverts commit 0173a44f3d.

Bug: 170959052
Test: Locally confirmed two reverts together fix app tray
Change-Id: I2f7b198f77b54be671c7f02bc2b67838bf99d28b
2020-10-16 07:34:43 -07:00
Greg Kaiser
cf4c99720b Revert "[pm/incremental/api] exposing package state names and reasons"
This reverts commit c6924e6861.

Bug: 170959052
Test: Locally confirmed two reverts together fix app tray
Change-Id: I229b39ceb90dffc3e4b932223305ab3f126b9a7f
2020-10-16 07:33:59 -07:00
Adam Wright
a528fd7014 Revert "Fix LauncherAppsService queryIntentLauncherActivities"
This reverts commit e0b6a4df83.

Reason for revert: Testing a fix for b/171027242 - this doesn't imply this revert will be needed, or the commit is at fault.

Change-Id: Iaf8e2c075f188df95c68824b71362629c6adabfc
2020-10-16 07:12:57 -07:00
Roman Kalukiewicz
34573d564a Merge "Add @Nullable annotation to the parameter of Object.equals() methods." 2020-10-16 01:25:15 +00:00
TreeHugger Robot
e30572f4bf Merge "Fix LauncherAppsService queryIntentLauncherActivities" 2020-10-15 21:46:04 +00:00
TreeHugger Robot
e0e1cda42d Merge "Second refactoring for BasePermission." 2020-10-15 19:20:23 +00:00
Songchun Fan
e0b6a4df83 Fix LauncherAppsService queryIntentLauncherActivities
ag/12640480 accidentally changed the logic of
`queryIntentLauncherActivities`. Fixing it and
adding a few polish.

Test: atest NexusLauncherOutOfProcTests
BUG: 170963871
BUG: 170959052
Change-Id: I9a69ac15aba4d67fc03a581c381ead3cc3eae073
2020-10-15 18:18:09 +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
Songchun Fan
8306129ffc Merge "[incremental/pm] LauncherApps APIs for loading state and progress" 2020-10-15 14:03:24 +00:00
Hai Zhang
96f0ef490e Second refactoring for BasePermission.
- Made all fields private.
- Replaced ParsedPermission usage with PermissionInfo.

The BasePermission class was using ParsedPermission and PermissionInfo
to keep track of the same set of information. Since we only need to
support getPermissionInfo(), we can keep track of the information with
PermissionInfo alone, dropping dependency on ParsedPermission which
isn't and won't be an API.

The logic of addToTree() and updateDynamicPermission() became a bit
weird/broken after the package parser refactoring regarding how the
new ParsedPermission/PermissionInfo was derived, so Pie BasePermission
implementation was taken as a reference for what the intended behavior
actually was.

Bug: 158736025
Test: presubmit
Change-Id: I414d43c3e98e9267d74de35eb62b7d1b6524a13f
2020-10-14 19:45:15 -07:00
Songchun Fan
c6924e6861 [pm/incremental/api] exposing package state names and reasons
We would like to expose package states and unstartable reasons to public
APIs. Two main users will be:
1) sys UI, which will display alert windows on top of a foreground app
when the package becomes unstartable, with different contents in the alert
window based on the reason code.

2) Play Store, which will collect package state change information which
will be used to determine future package delivery strategies.

Test: will add CTS tests.
BUG: 162600626
CTS-Coverage-Bug: 168925819
Change-Id: I71bafb36b230ea93b34e8556b57563e4ba3b837d
2020-10-14 20:18:08 +00:00
Garfield Tan
c8f947ac9b Add WindowLayoutAffinity attribute.
Bug: 157149018
Test: WindowLayoutAffinity shows up for activities that set this
attribute (android:windowLayoutAffinity in layout).

Change-Id: I36bce99e146992b6ecf6c7be1065ae1603a0fae7
2020-10-14 11:13:39 -07:00
Darryl L Johnson
76b1f31b9a Add binder interface to DeviceStateManagerService.
Test: None
Bug: 159401801

Change-Id: Ia37bb555d2baf43de8d1415731eb0ce5064da907
2020-10-13 14:43:04 -07:00
Songchun Fan
0173a44f3d [incremental/pm] LauncherApps APIs for loading state and progress
Exposing package state changes and progress changes via LauncherApps
and LauncherActivityInfo as public APIs.

BUG: 165841645
Test: builds (will add CTS tests)
CTS-Coverage-Bug: 168925573
Change-Id: I2b5ea698799f9a762b7d9c79d62636d3db187c1f
2020-10-13 13:12:08 -07:00
Nick Moukhine
4c3ecce019 Merge "Add system service for music recognition." 2020-10-09 07:35:34 +00:00
TreeHugger Robot
23606d44e8 Merge "Improve the documentation of the paramters passed to noteOp" 2020-10-09 03:12:56 +00:00
Philip P. Moltmann
8c22ae2a0c Improve the documentation of the paramters passed to noteOp
Test: Docs only changes
Change-Id: I10bac140182db2de43399b45da683c45435ed828
2020-10-08 17:48:10 -07:00
TreeHugger Robot
36a56888f5 Merge "Using new API to obtain apk checksum." 2020-10-08 23:13:13 +00:00
Alex Buynytskyy
458f53551a Using new API to obtain apk checksum.
Fixes: 168260114
Test: refactoring, manually enabled security logs, compared with the previous version
Change-Id: I36f4939386b57130767860c13ea2816873f9f46a
2020-10-08 13:37:49 -07:00
Jeff Sharkey
f76ffeaff1 Merge changes from topic "oct6"
* changes:
  Upgrade AndroidFrameworkBinderIdentity to fatal.
  Tighten up Binder.clearCallingIdentity() usage.
  Tighten up Binder.clearCallingIdentity() usage.
  Tighten up Binder.clearCallingIdentity() usage.
2020-10-08 18:50:22 +00:00
TreeHugger Robot
26e228da83 Merge "Should not switch to a user with removal in progress" 2020-10-08 05:43:29 +00:00
Jeff Sharkey
b93712f623 Tighten up Binder.clearCallingIdentity() usage.
This is a third CL in a chain that adjusts existing malformed code
to follow AndroidFrameworkBinderIdentity best-practices.

Specifically, if a thread clears an identity they need to restore it
to avoid obscure security vulnerabilities.  In addition, the relevant
"try" block must start immediately after the identity is cleared to
ensure that its restored if/when any exceptions are thrown.

Bug: 155703208
Test: make
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I74cb958b68d55a647547aae21baff6ddc364859b
2020-10-07 21:24:05 -06:00
Mayank Garg
84181f7db7 Should not switch to a user with removal in progress
Fix: 144506286
Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerServiceUserInfoTest
Change-Id: I465ea4c70421e5e84bbfcb50c3c6a87ae9ef2012
2020-10-07 20:41:02 +00:00
Rhed Jao
d03db99731 Merge changes from topic "intent_extra_automatic"
* changes:
  Send extra when automatically removing packages (2/2)
  Send extra when automatically removing packages (1/2)
2020-10-07 08:06:24 +00:00
TreeHugger Robot
0572a76bc1 Merge "Addressing API review comments." 2020-10-06 15:24:53 +00:00
Sergey Nikolaienkov
48e47d1a2c Teach PackageManager to handle <required-(not-)feature>
Introducing 'required-feature' and 'requred-not-feature' tags that could
be used "inside" 'uses-permission' elements.
Elements of both types should have non-empty 'android:name' attribute to
specify the name of the feature.
If the 'uses-permission' element contains 'required-feature' and/or
'required-not-feature' elements, the permission will only be "requested"
if the system supports all the 'required-feature's and does not support
any of the 'required-not-feature's.
The new elemets are "replacement" of the existing
'android:required(Not)Feature' attributes that can be optionally added
to 'uses-permission' elements, but allow to specify only 1 feature each.
However the 'android:required(Not)Feature' attributes remain supported
for compatibility and will be treated similarly to the
'require-(not-)feature' elements.

Bug: 168079571
Test: make && flash
Test: atest CtsContentTestCases:PermissionFeatureTest
Change-Id: Id3043530ebac6bd11805a611cebbf08b45e12f68
2020-10-06 06:55:16 +00:00
Todd Kennedy
acbe943d64 Send extra when automatically removing packages (1/2)
Introduce a new extra field for ACTION_PACKAGE_REMOVED intent to
signal that the application was removed automatically without the
user-initiated action.

If the system automatically prunes a package [eg. an instant app], we
mark the broadcast with that information. Launchers or other applications
can use this information to potentially alter their behaviour.

Bug: 111318529
Test: atest CtsAppSecurityHostTestCases:EphemeralTest
Change-Id: I3a4690d7df6e2dce10b246fe20a627ba2eed5da0
2020-10-06 14:09:36 +08:00
Alex Buynytskyy
c40b4f2851 Addressing API review comments.
Fixes: 169153620
Fixes: 168601298
Test: atest ChecksumsTest
Change-Id: Ibe593ccd388ad56f01ba0e3f58fb5a17c86e5e5c
2020-10-05 20:39:39 -07:00
Steven Moreland
0acafec609 incremental: Move AIDL file to declared package.
There was a regression in the AIDL compiler recently that removed the
requirement that, like in Java, .aidl unstructured parcelables (these
parcelable declarations) are in directories and files which match their
packages and file names. This CL moves relevant files to the correct
directory required by their type.

Bug: N/A
Test: build
Change-Id: I5fd112f1bcd0d1fc3be3c8dc7f1959242d43858e
2020-10-05 21:04:27 +00:00
Chris Li
ccf45834e2 Merge "Reverse the requested orientation on DisplayAreaGroup" 2020-10-05 16:30:06 +00:00
Chris Li
2d560e6976 Reverse the requested orientation on DisplayAreaGroup
When the DisplayAreaGroup has a different orientation from the Display,
reverse the app requested orientation.

As a result, when the display rotates to the reversed orientation, the
DAG and the requested app will be in the requested orientation.

For example, if the display is 1200x900 (landscape), and this DAG is
600x900 (portrait).
When an app below this DAG is requesting landscape, it should actually
request the display to be portrait, so that the DAG and the app will be
in landscape.

Bug: 155431879
Test: manual: test with dual display area policy
Test: atest WmTests:DisplayAreaGroupTest
Change-Id: Ie6874413ca0f6fa999632fb26f27e9913ccaee0d
2020-10-02 15:40:35 -07:00
Songchun Fan
587ecc88b8 Merge "[incremental/pm] app states and transitions" 2020-10-02 18:14:40 +00:00
Songchun Fan
3309398cbf [incremental/pm] app states and transitions
Based on go/incremental-states-design with basic
setter/getters.

Defines IncrementalStates class which handles state transitions.

New (internal) Intent actions: PACKAGE_FULLY_LOADED, PACKAGE_STARTABLE,
PACKAGE_UNSTARTABLE.

BUG: 168043976
Test: unit tests
Change-Id: I7b0ec2dd9f028ee620a9307a1e71ddf12ea5a9af
2020-10-01 16:36:25 -07:00
Evan Severson
3b7af77649 Merge changes from topic "BackgroundMicCamera"
* changes:
  Do not show rationale when permission is restricted
  Add role allowlist for restricted permissions
  Add documentation to APIs using non-inclusive lanuage
  Treat background mic/camera normally
  Introduce new permissionFlag
  Split camera and microphone for background modes
  Add background microphone and camera permission
2020-09-30 16:46:57 +00:00
Nick Moukhine
cf47bdd888 Add system service for music recognition.
The client submits a RecognitionRequest via MusicRecognitionManager.  System server opens an audio stream based on the request and sends it to a MusicRecognitionService (which is exposed by a system app).  The result is passed back through system server to the original caller.

Test: tracked in b/169662646
Bug: 169403302
Change-Id: I4c7fd9d9d72ddd5678867fd037cab6198bff2c2d
2020-09-30 14:44:01 +00:00
Neil Fuller
02d943f44d Get ready to add System APIs for use by SUW
This commit introduces the TimeManager API class. It is intended to
provide access to the time and time zone detector services, which
historically have had their own (internal) API classes to access them.

This commit contains various fixes to the listener handling logic
noticed while testing the APIs.

The first APIs on TimeManager are being exposed for use by SetUp Wizard,
which requires System APIs.

The APIs enable the calling app to determine the capabilities for /
config of the current user that affect time zone detection and then
alter them.

The primary usecase:

The rules for who can do what and when for time zone detection are
becoming more complicated, and device and user capabilities will be
affected by compile time constants, device config (resources) and device
hardware. By exposing this API, the complex logic can be encoded in one
place (the system server), rather than duplicating them in multiple
client apps.

These APIs are also intended for use by SettingsUI (and the various form
factor versions of that), but settings apps do not currently require
them to be marked with @SystemApi.

Bug: 159891384
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/
Test: atest android.app.time
Change-Id: I9b59099748e2391c180e124edf83fa521beb1b51
2020-09-30 13:34:05 +01:00
vadimt
8f16a6c96f Implementing Lock contention API
This API allows the test to create
contention on AM, PM and/or WM locks.

Test: a prototype lock contention test
Bug: 168630376
Change-Id: I656b6b412d517cb3b3b16367d8712f78ccbc33d8
2020-09-24 13:18:12 -07:00
Evan Severson
c1e6e73e52 Add role allowlist for restricted permissions
Test: Manual
Bug: 158311343
Change-Id: If14c9c667b98a92e3e29efd572567f5ea3cc61d3
2020-09-23 14:20:27 -07:00
Evan Severson
ee7b9310aa Add documentation to APIs using non-inclusive lanuage
Test: Build

Change-Id: Ib887c85cfce827f085fbe65892ded88a5e1a8b11
2020-09-23 14:20:27 -07:00
Evan Severson
d7087b25ce Introduce new permissionFlag
The new permission flag is for restricted permissions which the
installer is not able to exempt.

Test: Install test app
Bug: 158311343
Change-Id: I7340948690ea69750ef479d1b8f0ac8a6177c98c
2020-09-23 14:06:06 -07:00
Patrick Baumann
92e912e8d2 Merge "Expose grantImplicitAccess in IPackageManager" into rvc-qpr-dev am: e530998c9e am: 0e914bd102
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12294962

Change-Id: Ic11d011d8ae228c1558fab3f0dc5ebc7ea79d470
2020-09-23 20:02:28 +00:00
Patrick Baumann
0e914bd102 Merge "Expose grantImplicitAccess in IPackageManager" into rvc-qpr-dev am: e530998c9e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12294962

Change-Id: I31db3a2016da589f2c0b7f4bc955a870ebc384c5
2020-09-23 18:28:16 +00:00
Patrick Baumann
e530998c9e Merge "Expose grantImplicitAccess in IPackageManager" into rvc-qpr-dev 2020-09-23 17:48:57 +00:00
Jackal Guo
1f484774e2 Merge "Prevent arbitrary installers installing apps as instant" 2020-09-23 01:16:54 +00:00