Otherwise, neither the Activity#onConfigurationChanged is called,
nor the Activity is relaunched.
This CL is restoring the behavior to before commit 42b7273 landed.
The commit was meant to skip reporting the config changes to the
app because the app is not interested in handling the changes.
However, there are libraries like Compose that are still relying
on the callback.
Bug: 247013643
Test: AppConfigurationTests ActivityThreadClientTest
Change-Id: I552a5bccdb7862b0e903548e057d2cf94ac28c83
We use to set Activity#mIsInPictureInPictureMode to be true when app
requests Activity#enterPictureInPictureMode and therefore when they
receive the onPause callback, Activity#isInPictureInPictureMode can be
true. With the new auto-enter-pip API, this code path is no more
relevant and here we add extra info to PauseActivityItem to set the same
flag when WM puts the Activity into PiP mode due to auto-enter.
Video: http://recall/-/aaaaaabFQoRHlzixHdtY/yXi24xi6TgYGhoqB31Oov
Bug: 239618513
Test: follow the reproduce steps in bug, see video
Test: atest PinnedStackTests
Change-Id: I81ece7d3aad8eb868d95f106f6825612e0741a19
Follow up to ag/18795008.
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 GCrun to be
recycled, causing a short term memory-leak. We previously force recycled
the parcel when bundle.clear() was called.
This commit takes it a step further and adds reference counting for the number of
lazy values in mMap. When this reaches 0, we can safely eager recycle the
underlying parcel.
This still does not work when parcel references have been shared outside
the owning bundle (i.e, when mOwnsLazyValues is false.) We have two
options here:
1. Allow the GC to eventually claim the parcel (current behaviour).
2. Track lazy values refs globally across bundles. High complexity cost,
and likely high performance impact.
We can not unmwrap the lazy values before copying, in case the
originating classloader can not instantiate the given class type. See
go/lazy-bundle
In initializeFromParcelLocked(), renamed boolean parameter recycleParcel to ownsParcel since the method no longer recycles in all cases. Also, only create lazy values if ownsParcel = true so that we don't have lazy values referencing the passed in parcel in case the caller doesn't own the parcel (which means the parcel could be recycled out of our control).
Bug: 233216232
Test: Reproduced linked bug on-device
Test: atest android.os.cts.ParcelTest android.os.cts.BundleTest
android.os.BundleTest android.os.ParcelTest android.os.BundleRecylingTest
Change-Id: I8a878a6d0055b04b2611909b4b17977ba5677a4f
Originally, compatibilityInfoForPackage is called for delivering
broadcast to receivers or starting services, which may easily
encounter lock contention between activity manager and window
manager.
Because CompatibilityInfo is package based, it is known when binding
application. If the info is changed, the update will be done by
IApplicationThread#updatePackageCompatibilityInfo. Hence this change
only keeps the 2 places to send CompatibilityInfo. Which would
improve performance and simplify the code path.
Bug: 204870457
Test: atest TransactionParcelTests
Change-Id: Ie030c9aa8ed363469e22061f959fa8f40e03965d
The current configuration in the client activity could be
updated via the other flow (from ViewRootImpl). So, it is
possible that the client activity configuration is different
from the last reported configuration that cached in the system.
If the configuration changed again in that case, the
ActivityConfigurationChangeItem could end up without reporting
Activity#onConfigurationChanged if the differences between
the new configuration and the current client activity
configuration contains the configuration changes that the
activity cannot handle.
Update the activity current config only when reported, so
the configuration differences can be correctly evaluated from
the new configuration and the configuration last reported.
Bug: 231312158
Bug: 236415038
Test: repro steps on the bug
Test: atest ActivityThreadClientTest
Test: atest OverlayHostTest
Change-Id: I56a871fb30809f5f75f0007601a7629f9435e03a
The changes in SizeConfigurationBuckets in commit 8ec32dd
was not verified by wm presubmit and therefore broke a few
wm unit tests.
Bug: 235774601
Bug: 237348419
Test: ActivityRecordTests
Test: SizeConfigurationBucketsTest
Change-Id: I23299e329c2bf2ca94fc156859993ea31ad3dc75
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
The current configuration in the client activity could be
updated via the other flow (from ViewRootImpl). So, it is
possible that the client activity configuration is different
from the last reported configuration that cached in the system.
If the configuration changed again in that case, the
ActivityConfigurationChangeItem could end up without reporting
Activity#onConfigurationChanged if the differences between
the new configuration and the current client activity
configuration contains the configuration changes that the
activity cannot handle.
Update the activity current config only when reported, so
the configuration differences can be correctly evaluated from
the new configuration and the configuration last reported.
Bug: 231312158
Test: repro steps on the bug
Test: atest ActivityThreadClientTest
Change-Id: Ifa27d222bb0905053cf12e08c423bf7bfad904cd
This reverts commit 6dc124025d
in tm-dev. The revert is necessary because SplitController
needs to access the initial task fragment token from the
activity client to ensure that split info callbacks are sent
before an activity is created.
Test: existing tests pass
Bug: b/218791665
Change-Id: I7d6506312b46af026ec19e4aad9d0f31482e175a
The test failed because we used public config diff to determine if
Activity#onConfigurationChanged should be dispatched.
However, the public config diff contained the change which wouldn't
make Activity relaunch and also receive the callback.
This CL uses the public diff, which filters the change without
relaunching Activity, to determine if the callback should be
dispatched. This CL also covers the case that the callback is
still dispatched if small changes are handled.
Test: atest ActivityThreadClientTest ConfigChangeTests
Bug: 222067515
Bug: 222223467
Change-Id: I8aa80e9fd70fddc9f88a36e7dc2ffb2163b9ffa6
Also adds unit tests for TimingsTraceAndSlog.
Test: atest FrameworksMockingCoreTests:TimingsTraceLogTest FrameworksMockingServicesTests:TimingsTraceAndSlogTest
Bug: 223642864
Change-Id: I3a2b259fca7c4fbab08bc4212d850fee3ac2f037
Augment the "apparent" display information in configuration
from just the display bounds (maxBounds) to also include the
display rotation and cutout. Like maxBounds, these will be
expected to always be set as basically "the display that this
configuration was built against".
This heavily simplifies fixed-rotation since now we don't
need to deal with the "are we overriding?" question and also
don't need extra activity servertransactions. The configuration
is also in sync (since it is the source of truth used by
resources). Additionally, this means that even the current
legacy fixed-rotation model should work with in any
mixed-rotation situtaion, not just fullscreen.
Bug: 202201326
Test: atest DisplayTest
Change-Id: I6232f74c74324b70b1b0c9f46448c509c2694310
The token was needed because the TaskFragment info may not
sent to the organizer before activity created.
The token is no longer necessary because the TaskFragment
info is now ensured to be updated before activity created.
Bug: 200303250
Test: wm presubmit
Change-Id: I69a42fa35efde4fc7f37ab50334de5de146da90d
Currently, an activity is relaunched from a resize only if
the activity does not handle SCREEN_SIZE config changes and
the new activity size crosses a width, height, or smallest
width resource qualifier. A change in activity size may also
change an activity’s screen layout. However, an activity
is relaunched from a screen layout change if it does not
handle SCREEN_LAYOUT config changes even if the screen layout
did not cross a screen layout resource qualifier.
This CL does three things:
(1) Propogates screen layout qualifiers through the same
path as width, height, and smallest width qualifiers
in the AssetManager to make it available to the
WindowManager.
(2) Prevents an activity relaunch if the screen layout
has been changed but does not cross a screen layout
qualifier.
(3) Adds tests for SizeConfigurationBuckets for the new
screen layout logic as well as for existing logic.
Test: atest FrameworksMockingCoreTests:SizeConfigurationBucketsTest
Bug: b/192369163 b/187529743
Change-Id: I41d28e6492b76c4284c4dca2c1f3f5904fc5e91a
Activity#onCreate is called before receiving the TaskFragment
appeared event in the client process. So, the client split
controller created another split and resulted in unexpected
behaviors.
Bug: 194860679
Test: start activity to side
Test: wm presubmit
Change-Id: Iac34bd39376940c5c0224c8687ad9858a4190e20
Per API council, moving this off of an intent and into
ActivityOptions. This information is exposed via a new
method: Activity#isLaunchedFromBubble
In this CL:
* Remove extra_is_bubbled bits & update javadoc
* Adds launchedFromBubble bit on ActivityOptions
* Check if the client is allowed to set this bit, only
system / sysui can set it
* Need to add this to the record / LaunchActivityItem as
ActivityOptions get null'd out once they're used so
save the bubble bit separately
* Adds Activity#isLaunchedAsBubble
* Sets bit on BubbleExpandedView
Bug: 180945896
Test: atest NotificationManagerTest
Change-Id: Ia2711f05fc4ebb521cc48e95c16336c13f2d47f8
the app bounds.
Fixes Display#getRealMetrics sandboxing bug, where a non-null
configuration results in DisplayInfo ignoring max bounds width
and height for app bounds. Consistent with non-sandboxing
implementation of Display#getRealMetrics
Bug: 182377479
Test: atest FrameworksMockingCoreTests:android.view.DisplayTests
Change-Id: I067aeb020e1ca214aa269182c475b4553de0eb09
Sandbox Display#getRealSize and WindowManager
bounds when letterbox or size compat mode are
applied to the configuration. Display uses
this field to provide the sandboxed display
size.
This reverts commit 0ba6185639.
Test: atest WindowConfigurationTests
Test: atest FrameworksMockingCoreTests:android.view.DisplayTests
Test: atest WmTests:SizeCompatTests
Bug: 181219241
Change-Id: I86e8edb8368269da8e02cf34f429d245550666c6
In order to support auto translation, we need to give information to
content capture service to let the app can use this information to
find the Activity which needed to be translated.
It's not safe to provide an activity token to the client app directly
even if it is a privilege app. They can use this activity token to
access many activity/windows related functions. We create a new token
for use for content capture and translation. This token will be used
get the target Activity for translation new APIs.
This change focuses on the Content capture API change, the API change
about translation will be done in the next change,
Bug: 177789967
Test: manual. Make sure cc service can get the information.
Test: atest android.view.contentcapture.ContentCaptureContextTest
Test: atest CtsContentCaptureServiceTestCases
Change-Id: Ife8096a8bd1e71ce4e686d95043e347222ad7ee6
Sandbox Display#getRealSize and WindowManager
bounds when letterbox or size compat mode are
applied to the configuration. Display uses
this field to provide the sandboxed display
size.
Test: atest WindowConfigurationTests
Test: atest FrameworksMockingCoreTests:android.view.DisplayTests
Test: atest WmTests:SizeCompatTests
Bug: 171386167
Change-Id: I6f78edcd9214b52ab0708e3892bc86ee05bb5b9a
This removes getActivityOptions from server side. So 2 binder
transactions from Activity#performCreate and performStart can
be eliminated.
The remote animation in ActivityOptions is also separated to
another field of ActivityRecord, so when consuming the options,
the remote animation won't be affected.
Bug: 65202329
Bug: 132432864
Bug: 175409544
Test: WmTests:ActivityRecordTests#testTakeOptions
ObjectPoolTests#testRecycleStartActivityItem
CtsTransitionTestCases:ActivityTransitionTest
CtsUsageStatsTestCases:ActivityTransitionTest
Change-Id: I600a9a478a3e596e58b0a8120cfa8b9f32598b47
This CL focuses on the methods used by Activity and ActivityThread.
Also remove getUriPermissionOwnerForActivity, notifyActivityDrawn
notifyLaunchTaskBehindComplete notifyEnterAnimationComplete
because they are only used between ATMS and WMS.
Bug: 174041144
Bug: 174040691
Test: CtsWindowManagerDeviceTestCases
Change-Id: I5a30ec30cf6acd9ae4c908e524141fd17a4e54ff
To prevent a black screen if the activity calls recreate in
the foreground.
Bug: 133216672
Test: ActivityThreadTest#testRecreateActivity
ActivityThreadTest#testHandleActivity_assetsChanged
Change-Id: I47d22895287f94cc77130767b67d4b0bdf82c3a3
This reverts commit fd2be2c178.
Reason for revert: Reland the CL
This class is used for activity-targeting item to inherit,
which encapsulate null checks of activity client record.
This patch also change signature of ClientTransactionHandler#handle*
and reduces null checks.
In addition, add some null pointer checks after getActivityClient().
Also fix a typo in performStopActivityInner() and
performDestroyActivity().
Bug: 127877792
Bug: 164982975
Test: atest frameworks/base/core/tests/coretests/src/android/app/servertransaction
Test: atest ActivityThreadTest ActivityThreadClientTest
Test: atest TransactionExecutorTests#testActivityItemNullRecordThrowsException
Test: atest TransactionExecutorTests#testActivityItemExecute
Test: atest CtsAppTestCases:LocalActivityManagerTest
Change-Id: Ida612f1c8af7ecd7a04e69ade461403b8711508a
This reverts commit 167538021b.
Reason for revert: Reland the CL
- Extend the timeout period for low-end devices.
We should also allow the activity to be recreated in ON_START state,
since ON_START is also a resting state and we don't see a reason to
prevent applications from doing so.
Bug: 162906202
Test: atest FrameworksMockingCoreTests
atest FrameworksCoreTests
atest WmTests
Change-Id: Idb17514619c6501474f7fc6844dda9da98a4dd72
This reverts commit d3ed35f3e9.
Reason for revert: Droidcop: Potential culprit for Bug 166391370 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Change-Id: Ib6007f01fdaf0ef74e8b630e5e13862f30689ef0
We should also allow the activity to be recreated in ON_START state,
since ON_START is also a resting state and we don't see a reason to
prevent applications from doing so.
Bug: 162906202
Test: atest FrameworksMockingCoreTests
atest FrameworksCoreTests
atest WmTests
Change-Id: I20a9c1c25c0b5e1a392b18dc5bac26a1551990e2
This class is used for activity-targeting item to inherit,
which encapsulate null checks of activity client record.
This patch also change signature of ClientTransactionHandler#handle*
and reduces null checks.
Bug: 127877792
Test: atest frameworks/base/core/tests/coretests/src/android/app/servertransaction
Test: atest ActivityThreadTest ActivityThreadClientTest
Test: atest TransactionExecutorTests#testActivityItemNullRecordThrowsException
Test: atest TransactionExecutorTests#testActivityItemExecute
Change-Id: Idc0e9f583fc04e3a9043c28e83475acc65710731
So the real information of display can be adjusted according
to the adjustments for the application started with fixed
rotation transform.
The enabling adjustments may be sent in different ways:
- Launch activity
The information is bundled with LaunchActivityItem.
- Resume activity or update non-activity window
Send a standalone FixedRotationAdjustmentsItem.
The disabling adjustments (null) are always sent by
FixedRotationAdjustmentsItem.
Bug: 147213487
Test: AppConfigurationTests#testRotatedInfoWithFixedRotationTransform
TransactionParcelTests#testFixedRotationAdjustments
Change-Id: I5238888a5c8352db83fc12749f4de2bfabf46026
This just has to be non-null for the purposes of path
generation. The result is thrown away as the mocked LoadedApk
doesn't actually support updating its info, so this should have
no effect on the test logic.
Bug: 154807103
Test: atest android.app.activity.ActivityThreadClientTest
Change-Id: Id097a0f3be3c8822e679093347c9a0320fdba13e
Activity visibility messages simply move the activity to STOPPED or
STARTED state. We can use the lifecycle messages to do the same and
simplify the logic/remove duplicated code.
This CL also removes the option to send STOP message without making
the client invisible and actually calling onStop(). This option
caused a mismatch of the state between server (STOPPED) and client
(PAUSED). Also, in cases when the device was going to sleep, STOP
message was always followed by SLEEP message, which called onStop()
anyway.
Bug: 137329632
Bug: 129750406
Test: AM/WM CTS and unit tests
Change-Id: I487575520ce301bb2f65519f0c0a30b6b9edac0c
Remove flaky annotation on ActivityThreadClientTest since they are
stable from test metrics.
fixes:144675058
Test: atest ActivityThreadClientTest
Change-Id: I67e95f955f2b73721a35ceb7748271977e607f8b
ActivityThreadclient test case failed in emulator environment, but they
always work successfully on devices. This CL try to fix the test
case failed by mocking the LoadApk#updateApplicationInfo function
because the purpose of the test focuses on activity client state changes
behavior.
Bug: 144675058
Test: atest FrameworksMockingCoreTests:android.app.activity.ActivityThreadClientTest
Change-Id: I8bec296b65a4e688166fde0f2803bdb06d981a30