Commit Graph

12245 Commits

Author SHA1 Message Date
Jeff Sharkey
f7b7e8bcab Merge changes from topic "oct11"
* changes:
  BroadcastQueue: Handle successor ProcessRecords.
  More robust ProcessRecord routing for resultTo.
2022-10-18 21:37:39 +00:00
Vladimir Komsiyski
cd8f204717 Merge changes from topic "virtual-device-context"
* changes:
  Add deviceId to Context and allow for creating Contexts with different deviceId.
  Open the visibility of VirtualDeviceManager and VirtualDeviceManager#getVirtualDevices.
  Add an API to get the details of all virtual devices.
2022-10-18 06:36:52 +00:00
Vladimir Komsiyski
7c1be3298d Add deviceId to Context and allow for creating Contexts with different deviceId.
Applications may create contexts associated with the default host device or with any virtual device. The only way to create a non-default device context for now is via an explcit createDeviceContext call.

Bug: 239152561
Test: atest FrameworksCoreTests:ContextTest
Change-Id: If18dc7661fb232b0bc40121c723673ba880be9d5
2022-10-17 17:45:53 +02:00
Vladimir Komsiyski
0050a51961 Open the visibility of VirtualDeviceManager and VirtualDeviceManager#getVirtualDevices.
Bug: 239152561
Test: n/a
Change-Id: Ib504a3bad36072730a527b139de945874ec4741a
2022-10-17 17:44:12 +02:00
Jeff Sharkey
a515632319 More robust ProcessRecord routing for resultTo.
To deliver a "resultTo" listener for a broadcast intent, we need to
know about the ProcessRecord we're returning the result to, so that
we can potentially unfreeze them and sequence the response through
their main thread.

Also offer to lookup the "system_server" process when the caller
provides an in-process resultTo instance; this smoothly handles
dozens of situations where the system sends broadcasts without
having easy access to its own ProcessRecord.

Bug: 251486235
Test: manual
Change-Id: I1ff58a0e918b620def25a056624f093d951667a6
2022-10-17 09:40:45 -06:00
Winson Chiu
b41437f51f Merge "Move SystemConfig to services.jar" 2022-10-14 20:06:56 +00:00
Winson Chiu
9efbc1352b Move SystemConfig to services.jar
Migrates getDefaultVrComponents used by SettingsProvider and
adds a flag for hidden API enforcement to ApplicationInfo.

This removes any dependency on SystemConfig from core/ and
so it can be moved into services/core and exposed as a
mainline API.

This was done instead of exposing all of the methods through
SystemConfigManager, as that is designed for use across
processes, and it's more efficient to expose SystemConfig
directly for modules running in the server process.

Although VrManager is a nullable service, so getDefaultVrComponents
had to live there to simplify the logic and maintain the existing
behavior.

Bug: 236389629

Change-Id: I4c2b14e1d34aaf439ceb1a3f9c8207e5d39fa6c2
2022-10-13 15:54:15 +00:00
Jackal Guo
9cbc89c25b Merge changes from topic "pre-commit-install"
* changes:
  Refactoring PackageInstallerSession (4/n)
  Handle pre-commit install session in PackageInstaller (3/n)
  Pre-commit install approval (2/n)
2022-10-12 23:57:39 +00:00
Yurii Zubrytskyi
ab3cb30aa0 Ensure no duplicates in ThemeKey
Some apps keep adding the same resources to their theme key
objects on e.g. switching dark mode. Need to be prepared to
limit the size of the arrays, otherwise theme switching gets
slower with each toggle

+ a bit more efficient native handling

Bug: 242005877
Test: manual, 10k of theme switches with no noticable slowdown
Change-Id: Icf74770bd41ebeb0a31f527ae3616de00f23b0ae
2022-10-11 12:23:42 -07:00
Winson Chiu
6d17ac0a33 Merge "Expose some package APIs for ART" 2022-10-11 15:35:47 +00:00
Anna Zhuravleva
4d05eedd75 Merge "Add Health Connect service to the StringDef." 2022-10-11 10:27:46 +00:00
Anna Zhuravleva
12c426c01a Add Health Connect service to the StringDef.
Bug: 251393380
Test: build
Change-Id: I031dadd324c5565cf3eb46aa1d9aa72a234d53f0
2022-10-10 17:23:28 +00:00
Brandon Liu
4146674d06 Have AssetFileDescriptor.AutoCloseInputStream use pread
Previously two AssetFileDescriptors pointing to the same file could be
using the same underlying file descriptor and reading from both would
provide unexpected results since they would both modify the file offset
in the kernel data structure.

Test: Added testTwoFileDescriptorsWorkIndependently() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest
Fix: 168310122

Change-Id: Ibf3c9ff0207544e3b227511aae93c8f4ddf52867

Override getChannel() in AssetFileDescriptor.AutoCloseInputStream

Previous fix do not have getChannel() handled which caused issues. This
is to override getChannel().

Test: Added testGetChannel() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest
Bug: 168310122

Change-Id: I472655c91491fd33ef0c2631d94fc0b8d0328404

Adding OffsetCorrectFileChannel help to correct offset

Test: Added testGetChannel() to
android.content.res.cts.AssetFileDescriptor_AutoCloseInputStreamTest
Test: atest AssetFileDescriptor_AutoCloseInputStreamTest

Bug: 168310122
Change-Id: I9ed584ac795cabbed6a4e297c61c224233b9575c
2022-10-08 17:37:03 +00:00
Winson Chiu
584867717f Expose some package APIs for ART
This was separated out to make review easier. Applies @SystemApi
to expose a subset of PackageState and its child type APIs.

Bug: 235462722
Bug: 246609797
Bug: 244444049
Bug: 229089418
Bug: 229090204
Bug: 229090094

Test: presubmit

Change-Id: Ifc0ee3584347a79fbb0e7815d42bac6d2c2f3a4a
2022-10-07 20:37:54 +00:00
Jackal Guo
0016ca0496 Refactoring PackageInstallerSession (4/n)
Move some minor changes into this smaller independent CL for better
reviewing.

Bug: 242677131
Test: atest CtsPackageInstallTestCases
Change-Id: I71db4c272c355c97251e812881f361ea32b7666f
2022-10-06 15:21:27 +08:00
Jackal Guo
b0ff86efa9 Pre-commit install approval (2/n)
Introduce a new mechanism to allow developers requesting the approval
from users for an install before committing the session and without
any of the APK file.

Bug: 242677131
Test: atest CtsPackageInstallTestCases
Change-Id: I38029d9dbf28f03b81e4988f1f864e552129c957
2022-10-06 15:18:29 +08:00
Matt Gilbride
01a8beee3f Merge "Add @PermissionName annotation to complement @PermissionMethod" 2022-10-04 15:41:17 +00:00
mattgilbride
af19a09a4f Add @PermissionName annotation to complement @PermissionMethod
For use by static analysis, @PermissionMethod documents
the methods in the platform that perform permission "checks" (e.g.
context.enforceCallingOrSelfPermission).

@PermissionName denotes that the annoated String is a permission name.
It is typically used to annotate the argument to a @PermissionMethod
that is the permission value.  This is consumed by static analysis, for
example when helper methods wrap @PermissionMethod calls to pass a hard
coded permission value e.g. "enforceAudioSettingsPermission".

See: go/enforcepermission-migration-design
Bug: 247537842
Test: Tested manually, ultimately will be tested in presubmit (atest
AndroidFrameworkLintCheckerTest, see b/240445172)

Change-Id: I811ae923de62046e782ec7b109a0f99483dab4b2
2022-10-03 14:59:38 +00:00
Helen Qin
20ff355163 Framework credential manager developer APIs definitions.
The CredentialManager module provides solution for developers to create
or get credential from a user that can be used to authenticate to the app.
It can potentially launch system level UI flows to collect user consent,
render a unified selector when more than one credential exists, and
perform anything else needed.

Check bug id for detailed design.

Note that this is still very early stage of productionizing the module
and proper test cases will be added subsequently when the service
gets more concrete business logic.

Bug: 246564035
CTS-Coverage-Bug: 246637346
Test: Local Build & Deployment
Change-Id: Ia5884a7f6a3908de3b8b4b29f154f98e25730bd7
2022-10-03 07:28:30 +00:00
Anna Zhuravleva
8b0ce1fbac Merge "Add HealthConnect system service scaffold." 2022-09-30 15:05:30 +00:00
Anna Zhuravleva
5bdd56de55 Add HealthConnect system service scaffold.
Setup scaffold for the Health Connect system service.
This service will provide system APIs to read and write
health data.

Bug: 249321392
CTS-Coverage-Bug: 248508112
Test: atest android.healthconnect.cts
Change-Id: I503c24a039c37d09895fc4f73a1de1a13eeb72b0
2022-09-29 16:03:25 +00:00
TreeHugger Robot
1df179f411 Merge "Introduce PreapprovalDetails class (1/n)" 2022-09-29 06:46:55 +00:00
TreeHugger Robot
fdfde64c82 Merge "Log resource api times to statsd" 2022-09-28 15:57:27 +00:00
Lee Shombert
1452bc759a Log resource api times to statsd
Bug: 246953799

Log resource api times to statsd.  Two APIs are logged:
getResourceValue() and retrieveAttributes().  Other APIs may be timed
by the runtime layer but these are not logged.

This fixes a bug in ResourceTimer.startTimer() that caused the class
to skip the first repeated publication point.

This change renames the two RecourceTimer instances in
android_util_AssetManager.cpp to "_timer" to be more explicit and to
avoid the use of the more generic "_tag".

Test: manual
Change-Id: I0c5e0906f79ff35db1e34593275b39fb7f2f179b
2022-09-27 10:47:02 -07:00
Ahaan Ugale
f531cf31c0 Merge "Add credential manager FEATURE_ constant to Package Manager Test: Manual. Built locally Bug: 248609653" 2022-09-27 15:12:03 +00:00
Matt Gilbride
f4ea4c04e6 Merge "Add @PermissionMethod annotation" 2022-09-27 14:55:21 +00:00
Jackal Guo
1840f826d3 Introduce PreapprovalDetails class (1/n)
In order to let developers to get the install approval from users
pre-download instead of post-commit for better UX, introduce the
new data class PreapprovalDetails to encapsulate all the necessary
data for the upcoming installation.

Bug: 242677131
Test: build
Test: atest CtsContentTestCases:PreapprovalDetailsTest
Change-Id: I29a364262f980d5e30c4800fa0cfb2caae8ffa79
2022-09-27 14:02:55 +08:00
Reema Bajwa
4e5c074c20 Add credential manager FEATURE_ constant to Package Manager
Test: Manual. Built locally
Bug: 248609653

Change-Id: I51e5bb298bc2683c9dd4eb6627cba889ebe3d24f
2022-09-26 19:11:23 +00:00
TreeHugger Robot
0f564cb808 Merge "10% improvement by changing FastNative to CriticalNative" 2022-09-26 10:06:33 +00:00
mattgilbride
75c72cec7f Add @PermissionMethod annotation
For use by static analysis, @PermissionMethod documents
the methods in the platform that perform permission "checks" (e.g.
context.enforceCallingOrSelfPermission).

Said methods either return in int of type @PermissionResult, or return
void and potentially throw a SecurityException.

There are currently two platform lints that care about this information.
ManualPermissionCheckDetector and PackageVisibilityDetector.

See: go/enforcepermission-migration-design
Bug: 247537842
Test: Tested manually, ultimately will be tested in presubmit (atest
AndroidFrameworkLintCheckerTest, see b/240445172)

Change-Id: Ia21ba748eab37b532b591edb2599bb78ea0c8c9d
2022-09-25 23:56:26 +00:00
Treehugger Robot
e1a71c0b76 Merge "Expand ownership to all package manager owners" am: b63b381eb1 am: f069df3de6 am: ddd4db1ab9 am: df0e997103 am: d740ad1baa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2227757

Change-Id: I6d5c21d1628f6be1bea718898844188e516685a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-23 07:25:40 +00:00
Treehugger Robot
d740ad1baa Merge "Expand ownership to all package manager owners" am: b63b381eb1 am: f069df3de6 am: ddd4db1ab9 am: df0e997103
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2227757

Change-Id: I9fc6b812cafe09d75cbf52f171f54e4b2409b955
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-22 20:13:44 +00:00
Patrick Baumann
0ef37c52ee Expand ownership to all package manager owners
Change-Id: I8608cd42f3fb737831f022b1e9ad6ea600eb9b2f
2022-09-22 16:05:06 +00:00
Pedro Loureiro
0b0d664ca6 Merge "Revert framework-res splits from apexes" 2022-09-22 09:52:59 +00:00
felkachang
3b589c8f90 10% improvement by changing FastNative to CriticalNative
This patch change native APIs from @FastNative to @CriticalNative.
From the benchmark, it gets 10% improvement.

The CriticalNative requires the native function can't access JNIEnv
and any jobject. nativeGetAttributeIndex can't apply CriticalNative
because it needs JNIEnv to transform Java String.

This patches move the 16 APIs from FastNative to CriticalNative.
* 11 APIs check the null document and throw NPE in native layer. They
  are change to return ERROR_NULL_DOCUMENT and throw NPE in java
  layer.
* 5 APIs just remove JNIEnv and jobject parameters.
  * nativeGetNamespace
  * nativeGetName
  * nativeGetText
  * nativeGetStyleAttribute
  * nativeGetSourceResId

Reference: ag/19992907
Bug: 173709508

Test: # for FastNative
     atest --iterations 20 \
       CorePerfTests:android.content.res.XmlBlockBenchmark \
       2>&1 > fn20.txt
Test: # for CriticalNative
     atest --iterations 20 \
       CorePerfTests:android.content.res.XmlBlockBenchmark \
       2>&1 > cn20.txt
Test: http://b/issues/173709508#comment2

Change-Id: I43ccd1177fa86df5cd4d432119cbd06d370e82d8
2022-09-22 12:44:13 +08:00
Lee Shombert
3e4d9f2007 Record resource access times
Bug: 246953799

Collect timing information for resource acquisition methods.  The
timing has nanosecond resolution and is collected inside the native
runtime code.  Timing values are accumulated in the runtime and are
periodically fetched and published by the java framework.  This
strategy means that normal resource methods incur a small runtime
overhead.  The longer time involved in publishing the values is
handled by an independent Java thread.

A public dumpTimers() method can be called from a dumpsys command, for
debug, but the dumpsys command is not hooked up in this commit.

No APIs are actually monitored in this commit, and the ResourceTimer
loop is not started.

Test: atest
 * androidfw_lib

Change-Id: I5995d3c6518ca2fa4c8ab9d3eb610167758c695d
2022-09-18 18:05:03 -07:00
Pedro Loureiro
ad7bf54043 Revert framework-res splits from apexes
Test: presubmit

Bug: 195732042
Change-Id: I64f1640f72b18dcbda43be5a673872fd6c12ab7e
2022-09-16 17:10:42 +00:00
Songchun Fan
1a32d6ed68 Merge "[pm] fix getPackageArchiveInfo" into tm-qpr-dev am: 9d198ade93
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19734691

Change-Id: I612ec1b9490d4ba39ece795d735b1073dacac3aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-13 16:47:46 +00:00
Songchun Fan
9d198ade93 Merge "[pm] fix getPackageArchiveInfo" into tm-qpr-dev 2022-09-13 16:43:45 +00:00
Songchun Fan
0079f9bcb4 [pm] fix getPackageArchiveInfo
BUG: 243479679
Test: atest android.content.pm.cts.PackageManagerTest#testGetPackageArchiveInfo
Change-Id: I3a353c9b0f05117b233888d74a42f1ed3cf26eb8
(cherry picked from commit 9407d10cd0)
Merged-In: I3a353c9b0f05117b233888d74a42f1ed3cf26eb8
2022-09-13 16:43:25 +00:00
Riddle Hsu
48d11607a9 Merge "Apply override scale from entry points on client" 2022-09-08 03:35:48 +00:00
TreeHugger Robot
1d9daf50c3 Merge "Added check for user info is not null" into tm-qpr-dev 2022-09-07 04:23:04 +00:00
Mayank Garg
0ad4f80cbb Added check for user info is not null
user's actual state might have changed by the time the broadcast is
received, so added a null check.

Bug: 237413499
Test: atest HandlerThreadingDomainTest LocationTimeZoneProviderControllerTest LocationTimeZoneProviderTest ZoneInfoDbTimeZoneProviderEventPreProcessorTest

Change-Id: I79087a3e83a51b81568bdb6ff5540ee78b51b91a
Merged-In: Ieacbb35e522b35353c96de1f162a8a71388b4b04
(cherry pick from commit 799c6528f5)
2022-09-07 03:59:14 +00:00
Vali Calinescu
7b083780be Merge "Adjust aspect ratio override portrait fullscreen" into tm-qpr-dev am: 5ba309cce6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19641194

Change-Id: Iccca3b8cad845f31b8a1fe8afb9e283bb39a1f53
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 11:11:12 +00:00
Mayank Garg
be5a320cd9 Merge "Added check for user info is not null" am: 1206d8d742 am: 97efff4696 am: 61b941566b am: 98dd375c18 am: 799c6528f5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2195236

Change-Id: I2d72689a3cc3c08f8e573cdb46d1b729b544b889
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 00:10:40 +00:00
Mayank Garg
799c6528f5 Merge "Added check for user info is not null" am: 1206d8d742 am: 97efff4696 am: 61b941566b am: 98dd375c18
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2195236

Change-Id: Ieacbb35e522b35353c96de1f162a8a71388b4b04
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 00:09:07 +00:00
Mayank Garg
1206d8d742 Merge "Added check for user info is not null" 2022-09-01 22:18:45 +00:00
Mayank Garg
a833ca3056 Added check for user info is not null
Bug: 237413499
Test: atest HandlerThreadingDomainTest LocationTimeZoneProviderControllerTest LocationTimeZoneProviderTest ZoneInfoDbTimeZoneProviderEventPreProcessorTest
Change-Id: I79087a3e83a51b81568bdb6ff5540ee78b51b91a
2022-09-01 19:42:28 +00:00
Riddle Hsu
a0530caa33 Apply override scale from entry points on client
This provides a sandbox-like scaled environment on client side.

- This prevents the metrics and config from being scaled multiple
  times because the entry points are only called from server side,
  there won't have reentrancy for applying the scale.
- App's configuration callback method can get scaled config.
- If override scale is enabled, the legacy compat mode will be
  skipped. That avoids mixing different approaches of scaling.
  - Legacy compat mode is to simulate a 320dp x 480dp screen
    size with density 160 (the surface scale and config scale
    are different).
  - Override scale is to downscale the app for better performance
    (the surface scale and config scale are the same).

Bug: 238416387
Bug: 240335717
Test: atest ActivityThreadTest#testOverrideScale
Test: atest CtsWindowManagerDeviceTestCases:CompatScaleTests
Test: am compat enable DOWNSCALED $pkg
      am compat enable DOWNSCALE_50 $pkg
Change-Id: I0ddf333996f229063511273f8aeb3867c9ba8bda
2022-08-31 17:49:24 +00:00
Vali Calinescu
0c66bf2399 Adjust aspect ratio override portrait fullscreen
We're defining a new compat framework change id that restricts
the other aspect ratio overrides for devices in portrait fullscreen.

Fix: 218959984
Test: As manual testing use 'adb shell am compat disable/enable OVERRIDE_MIN_ASPECT_RATIO_EXCLUDE_PORTRAIT_FULLSCREEN <package-name>'. For the unit tests run 'atest WmTests:SizeCompatTests'.
Change-Id: I84eaab4df045c93fb2c159a789852094caf9121a
Merged-In: I84eaab4df045c93fb2c159a789852094caf9121a
2022-08-31 11:20:50 +00:00