Commit Graph

9836 Commits

Author SHA1 Message Date
TreeHugger Robot
bcf16c151e Merge "Remove PackageManager.getResourcesForApplicationAsUser API" 2020-10-23 05:52:01 +00:00
Felka Chang
91581bf1bb Merge "Remove PackageManager.getResourcesForApplicationAsUser API" 2020-10-22 13:01:35 +00:00
Rhed Jao
81cecc5035 Merge "Renames EXTRA_REMOVED_BY_SYSTEM to EXTRA_USER_INITIATED" 2020-10-22 04:26:37 +00:00
Rhed Jao
5224aafbf6 Merge "Deprecates GET_INTENT_FILTERS in the PackageManager" 2020-10-22 02:12:09 +00:00
Felka Chang
3e1776c67c Remove PackageManager.getResourcesForApplicationAsUser API
To switch another user to do something should create the context of the
specified user by using Context.createContextAsUser rather than call
*AsUser API directly.

Replacing PackageManager.getResourcesForApplicationAsUser with
context.createContextAsUser(...) applys in not only ShortcutService
but also the related ShortcutManager test.

Test: TEST_NAME="FrameworksServicesTests"; \
    PACKAGE_NAME="com.android.server.pm.ShortcutManagerTest"; \
    MODULE_LIST="CtsShortcutHostTestCases CtsShortcutManagerTestCases"; \
    for i in `seq 1 11`; \
    do\
      MODULE_LIST="${MODULE_LIST} ${TEST_NAME}:${PACKAGE_NAME}${i}"; \
    done; \
    atest $MODULE_LIST
Test: make -j droid cts gts vts
Test: make -j docs
Test: atest SystemUITests \
    FrameworksServicesTests:com.android.server.pm
Bug: 170928809
Change-Id: I5a4acce42b0d71e405412f84aaa73c0dfbb610e4
2020-10-22 08:28:47 +08:00
TreeHugger Robot
05e768ced6 Merge "Do not allow to install S+ apps with cross cert permissions" 2020-10-22 00:14:32 +00:00
Philip P. Moltmann
22d2486c1f Do not allow to install S+ apps with cross cert permissions
I.e. permissions and permission groups should stay inside a cert-group
so that there cannot be accidential security bugs in apps.

Test: atest CtsPermissionTestCases
            CtsPermission2TestCases
	    CtsAppSecurityHostTestCases
Fixes: 146211400 (No backport possible, all changes are for S+ apps
only)
Change-Id: I19c2f3e216ea57a9e25c65e276f87425aeb1c038
2020-10-21 18:58:16 +00:00
Jeff Sharkey
1992cdb4de Merge changes from topic "oct16c"
* changes:
  Apply fixes for EfficientStrings.
  Apply fixes for EfficientStrings.
  Apply fixes for EfficientStringsChecker.
  Apply fixes for EfficientCollections.
  Trivial refactor for consistent naming.
  Expand formatSimple() to support widths.
  Refinement of EfficientStringsChecker.
2020-10-21 15:27:15 +00:00
Tiger Huang
9e2c966d61 Merge "Don't dispatch legacy insets to client" 2020-10-21 15:23:27 +00:00
Tiger Huang
2bf8c796c5 Don't dispatch legacy insets to client
The server won't dispatch the legacy content insets, stable insets, and
visible insets to the client. The insets would be computed from the
insets state by the client.

This CL also fixes the insets scaling issue in compatible mode.

Bug: 149813814
Fix: 169940916
Fix: 165412978
Test: atest WindowAddRemovePerfTest InsetsAnimationControlImplTest
            ActivityRecordTests DisplayPolicyLayoutTests
            InsetsPolicyTest InsetsStateControllerTest
Change-Id: I83570973f587a6abf887752494f750b46e3e484d
2020-10-21 20:20:21 +08:00
Jeff Sharkey
c603ca2dd8 Apply fixes for EfficientStrings.
Refactoring to avoid StringBuffer synchronization overhead.

Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ibf843ed780c1202d5d96a11eaca889e592f19263
2020-10-20 22:00:20 -06:00
Jeff Sharkey
f18719bb73 Apply fixes for EfficientStrings.
Refactoring to avoid paying the cost of extra StringBuilder that are
quickly disposed.

Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Icd914a63cdadf8123c1e5a5073f85245f0791f0b
2020-10-20 22:00:18 -06:00
Jeff Sharkey
1c08f48253 Apply fixes for EfficientStringsChecker.
The recently-built Error Prone checker has found many instances where
we're always paying the cost of StringBuilder concatenation, even in
the typical cases where preconditions are successfully met.

Benchmarks have shown that even when replacing these with varargs
formatter strings, the default case is 20x faster.

Bug: 170978902
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: If8c00bc73467bfb91ec16c162969c9d26ca53646
2020-10-20 22:00:16 -06:00
Jeff Sharkey
df8dc2b4a5 Apply fixes for EfficientCollections.
Drop-in replacements suggested for inefficient collections.  Also
annotate a handful of places where we're unable to update.

Bug: 155703208
Test: none
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: I48b600508df8160ac9b40fea7afca974b2c972f6
2020-10-20 21:57:00 -06:00
Rhed Jao
940cd5ae33 Deprecates GET_INTENT_FILTERS in the PackageManager
This constant has never been used. The platform does not support
getting intent filters for the package.

Bug: 73780749
Test: Build
Change-Id: I907077b2a07e4a88aa8994ed3c25991b6d1172b4
2020-10-21 11:52:42 +08: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
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
Felka Chang
3d67a9ed88 Remove PackageManager.getResourcesForApplicationAsUser API
To switch another user to do something should create the context of the
specified user by using Context.createContextAsUser rather than call
*AsUser API directly.

Test: make -j droid cts gts vts
Test: make -j docs
Test: atest SystemUITests \
    FrameworksServicesTests:com.android.server.pm
Fix: 170928809
Bug: 72863210
Change-Id: Ie1999ba9cf61a4e85b7172240cb198111389ab73
2020-10-16 20:40:30 +08:00
Rhed Jao
2cf9810d0f Renames EXTRA_REMOVED_BY_SYSTEM to EXTRA_USER_INITIATED
Bug: 170705231
Test: atest CtsAppSecurityHostTestCases:EphemeralTest
Change-Id: Icac72129ca595a95101177b5788e18dedc7fba17
2020-10-16 15:35:26 +08: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