Commit Graph

10513 Commits

Author SHA1 Message Date
Hani Kazmi
ad4244ec44 Merge "BaseBundle.java: Adding tests for 'Recycle underlying parcel for bundle'" into tm-dev am: 6b07af5e83 am: c388f2b9d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18929334

Change-Id: Iee33adbe2a5efcdad1b18bac03b2cae81ebda658
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-29 11:42:12 +00:00
Hani Kazmi
621dc99968 BaseBundle.java: Adding tests for 'Recycle underlying parcel for bundle'
Follow up to ag/18795008. Adding tests for new behaviour.

As it is not possible to directly check on the bundle if the parcel has been recycled,
we inject a spy into it. Mocking static methods is not possible in
FrameworkCoreTests, so we introduce a new test class in
FrameworksMockingCoreTests which is run when any parcel or bundle source
file changes.

Bug: 233216232
Test: atest BundleRecyclingTest

Change-Id: If691b68a8db1f0110d131ec620935f566cc9367b
2022-06-24 12:07:29 +00:00
Hani Kazmi
2b13efde11 BaseBundle.java: Recycle underlying parcel when bundle is cleared. am: 2685de9862 am: 28752b7242
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18795008

Change-Id: I799f8cda2fc1c794bfdfa7b945306a7f73709107
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-14 12:43:49 +00:00
Hani Kazmi
2685de9862 BaseBundle.java: Recycle underlying parcel when bundle is cleared.
Lazy Bundles, (aosp/1787847), introduced a change in behavior where a Parcel
created as part of initializing a Bundle is dependent on the next ART GC run to be
recycled, causing a short term memory-leak.

To land this in T, we are making the change targetted and allowing
consumers to opt into the parcel being immediately cleared by calling
.clear() on the bundle.

As part of the unparcel() in clear(), mParcelledData is set to null, and
mMap may or may not still contain references through lazy values,
depending on if the lazy valyes have been unmarshalled.  As
such, we keep a weak reference to mParcelledData we can use to recycle it.

The mParcelledData reference could have been copied to other bundles in
a few operations:
new Bundle(Bundle o)
bundle.deepCopy()
bundle.putAll()

In this case we can not recycle the parcel yet as other bundles may
still require it. If so, we will skip the recycle and rely on the later GC pass

Bug: 233216232
Test: Reproduced linked bug on-device
Test: atest android.os.cts.ParcelTest android.os.cts.BundleTest android.os.BundleTest android.os.ParcelTest
Change-Id: Ic26eceaa1c11da67866af0963f760423d41d54bc
2022-06-14 09:10:53 +00:00
Sanjana Sunil
ad494b49bb Merge "Set correct volume storage path for SDK sandbox" into tm-dev am: 0b28d29298 am: 49f81abcbe
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17983856

Change-Id: I2f605ab06441b647bd46eb80271509090aa8e336
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 21:59:50 +00:00
TreeHugger Robot
5e287d77d9 Merge "Improve javadoc for Wi-Fi related policies" into tm-dev am: e51b62b2a3 am: 46c447841b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18374443

Change-Id: I1116841f8b67c8fc0859e02af4c21dae18c922bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 21:53:35 +00:00
TreeHugger Robot
41bfea28c0 Merge "Check sleep reason and time before cancelling vibrations" into tm-dev am: 79dc62bfef am: 7aff58a3f9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18280949

Change-Id: I9915fca86dc75f3a0a6a1a4051a37ca8536565b6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 21:53:22 +00:00
Sanjana Sunil
0b28d29298 Merge "Set correct volume storage path for SDK sandbox" into tm-dev 2022-05-17 15:40:12 +00:00
TreeHugger Robot
e51b62b2a3 Merge "Improve javadoc for Wi-Fi related policies" into tm-dev 2022-05-16 22:04:37 +00:00
Sanjana Sunil
79241ae7d9 Set correct volume storage path for SDK sandbox
Context.getDataDir() for SDK sandbox incorrectly returns /data volume
path even if the actual storage is on another volume. This CL sets the
correct storage path by checking the uuid from the ApplicationInfo of
the client app and setting it to the same value.

Bug: 229736419
Test: atest
SdkSandboxStorageHostTest#testSdkSharedStorage_DifferentVolumeIsUsable

Change-Id: Ib72ea559363cdeb4b7cfcc2f48ca8ddace96e352
Merged-In: Ib72ea559363cdeb4b7cfcc2f48ca8ddace96e352
2022-05-16 15:43:37 +00:00
Rubin Xu
1638b20f44 Improve javadoc for Wi-Fi related policies
Bug: 226128486
Test: none
Change-Id: I21f0f0eb1f9a4754d42f4ae3c8e8a36865d58afa
2022-05-16 15:38:14 +00:00
Lais Andrade
c558857fc7 Check sleep reason and time before cancelling vibrations
Add a method PowerManagerInternal.getLastGoToSleep(), similar to
existing method getLastWakeup(), to retrieve global values for last go
to sleep events, including system uptime and reason.

Retrieve this data in VibratorManagerService before cancelling ongoing
vibrations by the broadcast of ACTION_SCREEN_OFF intents to indicate
that the screen was turned of when the vibration was still playing. This
new logic allows vibrations to continue in the following cases:

- the broadcasted event was triggered before the vibration started;
- there is already a wakeup event triggered by the time the screen off
  broadcast is being processed by the vibrator service;
- the screen off reason is in allowlist, indicating it's an
  automatically triggered event (screen timeout or user inattentive);

This should handle the following scenarios:

- delayed broadcasts of screen off events, that should not cancel
  vibrations that started when the screen was already off (e.g.
  notification or ringtone that are allowed to vibrate in that state);

- race conditions when the screen automatically turns off right after a
  ringtone/notification vibration starts, before the notification
  acquires a screen lock;

Fix: 219849350
Test: VibrationSettingsTest
Change-Id: I358327192196989a7d4fc49a96b2ab92ec677302
2022-05-13 19:53:43 +01:00
Samiul Islam
43be403330 Merge "Disallow external storage access without restricting other api calls" into tm-dev am: 5f0c868b6a am: c545627a16
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17940795

Change-Id: I4a63904db958fc3222402ce2b8656cec19e33e61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-06 15:40:58 +00:00
Samiul Islam
5f0c868b6a Merge "Disallow external storage access without restricting other api calls" into tm-dev 2022-05-05 13:39:34 +00:00
Adam Bookatz
7a5725bfe6 Merge "Ensure getUserName cannot return null" into tm-dev am: 1503b56202 am: 10b45a2107
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18126297

Change-Id: Ib4bc41d74d8f486e79e43e7b332c93a2051c562b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 17:58:46 +00:00
Adam Bookatz
1503b56202 Merge "Ensure getUserName cannot return null" into tm-dev 2022-05-04 17:20:45 +00:00
Robert Horvath
4d3c2b3b3e Merge changes I6a3f56bd,Ib5f39eb1 into tm-dev am: 1999fa1097 am: 7d58f8562f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17888925

Change-Id: I27355b6f1a0a429edd2a0a90d23022a849e1ff48
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 13:29:10 +00:00
Adam Bookatz
cd2466ee30 Ensure getUserName cannot return null
A user can be created with an explicitly null name, as happens in tests.
But getUserName claims to never return null. So we must do a null-check
here to prevent it.

Bug: 227624966
Test: atest UserManagerTest
Change-Id: Iea0e7b6292c6dd49df1bebc5467091a82ddaedb5
2022-05-02 20:18:54 +00:00
Robert Horvath
d112201586 Batch log access requests from same client
For multiple log access requests from the same client
(same UID + package name) within a short timeframe, show only one
confirmation prompt to the user.

When access has been approved/denied, further requests will
automatically be approved/denied until another timeout expires, after
which a new request will show a prompt again.

If the prompt is shown but the request isn't approved or denied within a
certain time, the client will automatically be denied access.

Moved the approve/decline methods out of ILogcatManagerService into a
local service, so that they can only be called from within the system
server.

Bug: 229976778
Test: atest FrameworksServicesTests:LogcatManagerServiceTest
Change-Id: I6a3f56bdcbb84e64b1b24e73476bd24f32b75f24
2022-05-02 15:19:43 +02:00
Samiul Islam
db9e238ec7 Disallow external storage access without restricting other api calls
Currently, sandbox cannot call any apis from StorageManager that checks
calling package has same uid as calling uid. This CL fixes that by using
pm.isSameApp() api.

Additionally, since Environment.java fetches the initial application
context, the uid for that does not fall under the sandbox uid range. It
falls under app uid range. We fix the problem by checking for
PROPERTY_NO_APP_DATA_STORAGE flag on the application.

Bug: 228424287
Test: atest CtsSdkSandboxInprocessTests (see ag/17657742)
Change-Id: I8d9fca369cfbed47b40a42a44a40ff73acb712ec
2022-04-28 15:39:26 +01:00
Trevor Black
c794a11edc Merge "Add Vulkan 1.2 and 1.3 to getVulkanVersion()" into tm-dev am: 3f598fadcd am: b976b9b638
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17891135

Change-Id: Icfedb73b68a1cc95f3071d476d532c53a61fa583
Ignore-AOSP-First: this is an automerge
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-25 05:41:47 +00:00
Trevor David Black
bf22232e3c Add Vulkan 1.2 and 1.3 to getVulkanVersion()
Bug: 191881132
Test: build
Change-Id: I73d18850180f2d7a627fb3879e4653d0e470d6fb
2022-04-21 18:03:07 +00:00
Kedar Chitnis
c60e7c4119 Guest mode updates to resolve privacy concerns in guest mode
- Add API in IUserManager to allow setting ephemeral user flag
- Implement and export this API in UserManagerService and UserManager
- Set guest as ephermal by default when createGuest in UserManager is called
- Handle guest user switching in UserSwitcherController for the case
  of dynamic change of ephemeral state
- Add persistant notification when in guest mode to indicate
  - if guest session is new or previously used.
  - if guest session will be cleared on exit or not
- Add buttons in persistant notification to reset or exit guest
- Add flags to enable/disable this feature

Bug: 214031645
Screenshots: go/ephemeral-guest-b-214031645-ux
Test: Manual test using sunfish, atest SystemUITests, atest SettingsRoboTests

Relands ag/16545010 after resolving post submit issues

Revert "Revert "Guest mode updates to resolve privacy concerns in guest mode""
This reverts commit dd5c440802.

Change-Id: I46b8ab527bab8fe665114ed0fffbb06a59d49a77
Merged-In: I46b8ab527bab8fe665114ed0fffbb06a59d49a77
2022-04-14 09:47:35 +00:00
Yurii Zubrytskyi
f453228161 frameworks/base - Tiramisu is now 33 #2
Set current API level

Test: Build and boot
Bug: 225745567
Change-Id: If135d9795e812cc286c720b9351eaf6be621fd5b
2022-04-12 12:35:04 -07:00
Lee Shombert
ead48cc667 Merge "Helper classes for IpcDataCache clients" into tm-dev 2022-04-12 14:32:31 +00:00
Lee Shombert
529a49ee3d Helper classes for IpcDataCache clients
Bug: 227653108

This adds a helper class that can reduce much of the boilerplate in
code that uses IpcDataCache (or the internal-only variant,
PropertyInvalidatedCache).  See the changes to DevicePolicyManager for
example usage.

Two PropertyInvalidatedCaches APIs are exposed for testing.  The
method createPropertyName() is changed so that apis like "Foo" are
converted to "foo", not "_foo".

Unit tests for the new behavior are added to IpcDataCacheTest.

This was manually tested by dumping the cache info from builds with
and without this change.  Special attention is paid to the
DevicePolicyManager caches.  The same caches were found (as identified
by their key and api) and the caches were enabled/disabled the same.

In the course of testing, multiple instances of DevicePolicyManager
caches were observed.  Cache performance is better if the caches are
static; making them static will be addressed in b/228452829.

Test:
 * atest FrameworksCoreTests:IpcDataCacheTest
 * atest FrameworksCoreTests:PropertyInvalidatedCacheTests
 * atest FrameworksServicesTests:DevicePolicyConstantsTest
 * atest FrameworksServicesTests:DevicePolicyEventLoggerTest
 * atest FrameworksServicesTests:DevicePolicyManagerServiceMigrationTest
 * atest FrameworksServicesTests:DevicePolicyManagerTest
 * atest FrameworksServicesTests:EnterpriseSpecificIdCalculatorTest
 * atest FrameworksServicesTests:OverlayPackagesProviderTest
 * atest FrameworksServicesTests:OwnersTest
 * atest FrameworksServicesTests:PolicyVersionUpgraderTest
 * atest FrameworksServicesTests:SecurityEventTest
 * atest FrameworksServicesTests:SystemUpdatePolicyTest
 * atest FrameworksServicesTests:TransferOwnershipMetadataManagerTest
 * atest MixedDeviceOwnerTest#testIsDeviceOrganizationOwnedWithManagedProfile
 * atest MixedDeviceOwnerTest#testSetKeyguardDisabledFeatures
 * atest MixedManagedProfileOwnerTest#testIsDeviceOrganizationOwnedWithManagedProfile
 * atest MixedManagedProfileOwnerTest#testNetworkLoggingDelegate
 * atest MixedManagedProfileOwnerTest#testSetKeyguardDisabledFeatures
 * atest OrgOwnedProfileOwnerTest#testIsDeviceOrganizationOwnedWithManagedProfile
 * atest OrgOwnedProfileOwnerTest#testNetworkLoggingDelegate
 * atest OrgOwnedProfileOwnerTest#testSetKeyguardDisabledFeatures
 * atest android.devicepolicy.cts.DevicePolicyManagerTest
 * atest android.devicepolicy.cts.NetworkLoggingTest
 * atest com.android.cts.devicepolicy.DeviceOwnerTest#testAdminActionBookkeeping

Change-Id: I2f4fe4ed25db5fb3100334b9d2ce748ee928c10d
2022-04-11 07:27:16 -07:00
Michael Wright
52f1d5eca6 Merge "DO NOT MERGE Remove PWLE APIs from T" into tm-dev 2022-04-08 10:57:11 +00:00
Eric Biggers
256a0b563f Merge changes Idc218e5f,I26c3fafc am: 7e3c5382cc am: fb4c1822a8 am: 4d4ababae0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2052056

Change-Id: I6c0ee77edf164ecf5a285afe4dff7cec85e9d668
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-08 02:11:26 +00:00
Eric Biggers
4d4ababae0 Merge changes Idc218e5f,I26c3fafc am: 7e3c5382cc am: fb4c1822a8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2052056

Change-Id: Ib029dddb2fd26fa33f231b7ae87c3a1fee737a55
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-08 01:36:12 +00:00
Michael Wright
38dc7aa55c DO NOT MERGE Remove PWLE APIs from T
Fixes: 228529016
Test: build
Change-Id: Icfd576f3dff0850f464be32c5a3315e723c3d380
2022-04-07 23:26:18 +00:00
Eric Biggers
bd13f84152 Remove more FDE methods from StorageManager
Now that these methods are no longer called, and none of them are a
public API or have @UnsupportedAppUsage, they can be removed.

inCryptKeeperBounce() actually had one known app user via reflection,
despite the method not having @UnsupportedAppUsage.  However, that user
only made the call if Build.VERSION.SDK_INT < VERSION_CODES.P, so it is
not being used anymore.

Bug: 208476087
Change-Id: Idc218e5f355bb61257b07cf5b5b6df5f4c6ece11
2022-04-07 16:38:36 +00:00
TreeHugger Robot
b6ac4a054b Merge "Parcel: recycle recycles" into sc-v2-dev am: c4ca84a2b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17525716

Change-Id: I74935ed1dab8dc6923f58ec237e0884e85380829
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-06 17:15:24 +00:00
Stephanie Bak
73b3dc4fb4 Merge "Expand Javadoc for DISALLOW_WIFI_TETHERING" into tm-dev 2022-04-05 10:13:39 +00:00
Stephanie Bak
52cf82d495 Expand Javadoc for DISALLOW_WIFI_TETHERING
Bug: 226126768
Test: atest UserManagerTest
Change-Id: I1a1e166b4238ff20f30dfd7a2664d9a33dbe020c
2022-04-04 18:51:21 +00:00
Ling Ma
5b37044c20 Merge "setProperty check for byte limit" am: 18b4802337 am: 4cd991467f am: 39709e6beb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2004952

Change-Id: I777beb8d3d8731108533807830e6d7449a51437f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 22:55:04 +00:00
Ling Ma
18b4802337 Merge "setProperty check for byte limit" 2022-04-01 21:43:23 +00:00
Jim Blackler
a4dd0499bd Merge "Add loading boost intervention for games." into tm-dev 2022-04-01 09:39:44 +00:00
Yi-yo Chiang
404c27d323 Merge "DSU service: Log insufficient storage space error" am: 9b420e664a am: 1e43855f6c am: 8c48dc11cf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049806

Change-Id: Iee0a17c0517449a523aba8827915af79bc7b11eb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 08:46:36 +00:00
jimblackler
ac10e4a396 Add loading boost intervention for games.
Bug: 207845905
Test: atest com.android.server.app.GameManagerServiceTests
Change-Id: I2d0b4988797fe21bd7aec6d5351273757ae1a3ce
2022-03-31 20:38:29 +00:00
Steven Moreland
46770fa49c Parcel: recycle recycles
Before, it was like getting a used pan with food stuck on it. We run
a clean ship here. You want a Parcel? You get a fresh Parcel. When
we recycle a Parcel, we do a real clean-up job. Air freshener. All
bits brushed over. These Parcel objects are clean as heck now!

(specifically cleans mClassCookies)

Bug: 208279300
Test: build
Merged-In: I250872f5c6796bb64e2dc68008154c0e90feb218
Change-Id: I250872f5c6796bb64e2dc68008154c0e90feb218
2022-03-31 15:57:30 +00:00
Steven Moreland
ec56973eb7 Merge "Parcel: recycle recycles" into tm-dev 2022-03-31 15:21:35 +00:00
Yi-Yo Chiang
c88a3d9be4 DSU service: Log insufficient storage space error
Log a specialized error message if installation task
failed due to insufficient storage space.
This helps the user to disgnose the source of error.

Bug: 200002443
Test: start DSU task and check logcat
Change-Id: Iabb3e0325ae99c343978ca6c35ab8378f20e0527
2022-03-31 18:38:00 +08:00
Robert Horvath
3f31afd1cf Merge "Don't poke user activity when dream ends" into tm-dev 2022-03-31 07:32:45 +00:00
Steven Moreland
011dda6e01 Parcel: recycle recycles
Before, it was like getting a used pan with food stuck on it. We run
a clean ship here. You want a Parcel? You get a fresh Parcel. When
we recycle a Parcel, we do a real clean-up job. Air freshener. All
bits brushed over. These Parcel objects are clean as heck now!

(specifically cleans mClassCookies)

Bug: 208279300
Test: build
Change-Id: I250872f5c6796bb64e2dc68008154c0e90feb218
2022-03-30 21:59:12 +00:00
Treehugger Robot
1e7f831d5b Merge "Added Java bindings to async trace functions with track argument" am: 004bb42f93 am: 83b26d260d am: b5c308d7b2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2048185

Change-Id: I0b6033f880d01081eea32ec205a59997a5b254af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 19:11:12 +00:00
Tim Murray
ef1b9a9562 Merge "Update OWNERS for tracing, including the Java APIs." am: 45f3622eb3 am: a8888da2a2 am: 8f7679aeea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2049990

Change-Id: I7e6d6a6026b583a0b4e0347e6e77f76382904ce9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-30 19:10:17 +00:00
Treehugger Robot
004bb42f93 Merge "Added Java bindings to async trace functions with track argument" 2022-03-30 18:16:29 +00:00
Tim Murray
45f3622eb3 Merge "Update OWNERS for tracing, including the Java APIs." 2022-03-30 18:15:38 +00:00
Tim Murray
1c968c099f Update OWNERS for tracing, including the Java APIs.
Change-Id: I7b4f972f09695c68110ed09e3a75e35e40a61387
2022-03-30 11:10:21 -07:00
Robert Horvath
3c7fa15aaa Don't poke user activity when dream ends
The dream may end for various reasons, including some that do not
represent user activity, such as app crashes or the app being updated.
In these cases, the user activity should not be poked, as this would
reset the inattentive sleep timer.

Bug: 215559033
Test: atest PowerManagerServiceTest
Test: Kill dream app, observe `dumpsys power` lastUserActivityTime
Test: Kill dream app, verify inattentive sleep timer not affected
Change-Id: If9b61cab3d5e21b89f3c0ab7fe541d46bc865f97
Merged-In: If9b61cab3d5e21b89f3c0ab7fe541d46bc865f97
2022-03-30 12:57:57 +00:00