Non-activity context can be passed to DecorContext, so an exception
can be thrown when Context#getDisplay() call does verification.
An example is that a free dialog uses Application context as its context.
Bug: 149928768
Test: manual: test crashed apps reported in bugs before/after this patch.
Change-Id: Ib302c23cb8e2e388e7468f37f1b63b83ef52ef0e
Revert submission 10338939
Reason for revert: The feature was punted out of R.
Reverted Changes:
I32c12702c:[NS D04] Implement a simple speed comparison betwe...
I688593cc0:[NS D03] Migrate the bad wifi avoidance policy
Change-Id: I640635a1ed94bed3b53466abe2a988caf0eca2b0
The AssetManager constructor is marked UnsupportedAppUsage and the
recent changes to OverlayConfig caused an exception to be thrown when
the function is not called from the root process.
Previously a warning message would be logged indicating that no static
overlays would be loaded. Removing the uid check will restore the
previous behavior.
Also remove the system uid checks for initializeSystemInstance so PMS
service can also be constructed during testing.
Bug: 149806146
Test: invoke new AssetManager() from non-root thread
Change-Id: I55af2cddeba4df7a99c281c93e0181b9e2139139
For procstats aggregated stats collection, we need to expose the
aggregated ProcessStats object back to the caller.
Change-Id: Ifb52f813d679e3e0a1e061f983d8b4f539d6d72a
Test: nothing yet
Make obtaining a visual service from non-visual Context instance
report a strict mode violation and print the stacktrace.
Make calling getDisplay() throw an exception if called on an instance
that is not associated with a display. For existing usages introduce
a new internal method that does not perform the verification until
the usages are properly fixed.
Bug: 128338354
Test: StrictModeTest#testIncorrectContextUse_GetSystemService
Test: StrictModeTest#testIncorrectContextUse_GetDisplay
Change-Id: Id25d590eca6e10066e55d7ed6436d3bc9e433beb
As tracked in Bug 28750507, InputMethodManagerService#onSwitchUser()
is known to be slow, and the direct reason of the UI jank in the
launcher discussed Bug 139806621 is that #onSwitchUser() is running as
part of IMMS#startInputOrWindowGainedFocus() that is called as a sync
IPC from the UI thread of the launcher. Note that this is a
relatively new behavior that was introduced in Android 10 to support
per-profile IME mode (Bug 111083076). So users shouldn't see this code
path unless the device is running on Android 10 with work profile
enabled.
What this CL does is removing that direct code path from
IMMS#startInputOrWindowGainedFocus() to #onSwitchUser() by introducing
a new pending result
InputBindResult.ResultCode.SUCCESS_WAITING_USER_SWITCHING,
which means
IMMS is now performing user switching and cannot start input session
right now, but it will call the client back when the IME becomes
available for the target user.
Note that InputMethodManager is already able to handle this kind of
pending state, where IME is not yet available, since we already have a
similar pending results as follows.
* InputBindResult.ResultCode.SUCCESS_WAITING_USER_SWITCHING
* InputBindResult.ResultCode.SUCCESS_WAITING_IME_BINDING
One remaining concern is that when IMMS#switchUserOnHandlerLocked() is
running with holding the giant lock (IMMS#mMethodMap), thus it's still
possible that IMMS#startInputOrWindowGainedFocus() can be blocked
because of lock contention, which eventually blocks client's UI
thread. Although its chance wouldn't be that high, in order to tackle
that scenario we need to pursue different approaches such as:
* Further optimize IMMS#startInputOrWindowGainedFocus() to reduce the
likelihood of lock contention. This isn't a perfect solution for
this particular case but it's still worth doing. Possible
candidate of optimizations are:
* Bug 28750507: optimize IMMS#switchUserOnHandlerLocked()
* Bug 149864769: off-load Context#unbindService()
* Reconsider the use of giant lock.
* Redesign the current "startInput" protocol as part of our on-going
effort to redesign IME focus handling protocol (Bug 141738570)
e.g. can we completely make IMMS#startInputOrWindowGainedFocus()
async IPC?
Bug: 139806621
Fix: 144291210
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: Manually made sure that IMMS#startInputOrWindowGainedFocus()
isn't blocking Launcher's UI thread when swiping home.
1. lunch aosp_coral-userdebug && make -j
2. Flash the image
3. Open the system settings
4. System -> Gestures -> System nagivation
5. Select "Gesture nagivation"
6. Install Test DPC.
7. Enable managed profile with Test DPC.
8. adb install -r \
$ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
# deal with dex2oat
9. adb shell cmd package compile -m speed \
-f com.google.android.inputmethod.latin
10. adb shell cmd package compile -m speed \
-f com.android.inputmethod.tools.edittextvariations
11. adb shell cmd package compile -m speed \
-f com.google.android.apps.nexuslauncher
12. adb root
13. adb shell setprop pm.dexopt.disable_bg_dexopt true
14. adb reboot
15. adb shell am start -u 10 \
-n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
16. Tap the first edit text on the EditTextVariations
17. Make sure that AOSP Keyboard is shown
18. adb shell am trace-ipc start
19. external/chromium-trace/systrace.py \
gfx freq am wm sched binder_driver view \
-a com.android.launcher3 -o binder.html
20. Swipe up the home button
21. Hit the enter key to terminate the systrace.
22. Check the IPC log to see how much the UI thread is blocked by
IMMS#startInputOrWindowGainedFocus()
Change-Id: I5a73a66d2b8acadad9b3577ebc4c17b5a25fd011
* changes:
Remove AndroidPackageWrite
Migrate to new ParsedComponents and ParseResult
Split ParsedComponents
Add ParseResult infrastructure
ParsingPackage/ParsedPackage test code migration
ParsingPackage/ParsedPackage split source migration
Important migration for new ParsingPackage/ParsedPackage split
Separate ParsingPackage into core and ParsedPackage into server
* The bundle will be generated/consumed by the support library.
* More API documentation and example usage will be added later once we have the support library impl ready.
* The old style resource name approach doesn't work due to the potential mismatch in the support library version across the host IME and the platform renderer service, and the non-static nature of the public attribute int id in the support lib.
* The Bundle added to the onCreateInlineSuggestionsRequest() is intended for the platform/ExtServices to communicate the UI versions it supports.
* The Bundle added to the InlinePresentationSpec is intended for the IME to communicate the custom styles for the chosen UI versions.
Test: manual verification, and also atest CtsInputMethodTestCases:InlineSuggestionInfoTest CtsInputMethodTestCases:InlineSuggestionTest CtsInputMethodTestCases:InlineSuggestionsRequestTest CtsInputMethodTestCases:InlineSuggestionsResponseTest
Bug: 146454892
Change-Id: Id7fea32a7550fb924fec811b376790474a7b92eb
Removes the massive old ComponentParseUtils in favor of
the new split classes.
Cleans up the parsing code to be uniform, removing the
String[] outError pattern in favor of ParseInput.
Bug: 135203078
Test: atest com.android.server.pm
Change-Id: I584ed37d4715300453dbe760d45d1eb4759b3dd3
Currently the method swallows the exception but that pollutes the logs.
This change preserves the behavior while getting rid of distracting
errors in the logs.
Test: atest IntentTest; atest ChooserActivityTest
Change-Id: I2b02dc4ae0343fa1fd58a112455e426d8a6d3f34
When tabs are disabled, the lines are still shown to be consistent
with Q.
Fixes: 149574743
Test: manual
Change-Id: I2307230e86da72a3f7c7d90d1454859490def679
Part of the Parsing/ParsedPackage split into core/server.
This migrates any core/services source with trivially reviewable
changes. Import changes, moving files around, or generally
small single line changes scattered throughout all code that
depended on the old state of the package code.
Bug: 135203078
Test: enumerated in first commit of change ID
Ib4fe51d729a56bfb0ea1316e577358ba0dfceccf
Change-Id: If091641a81be2d943d1d3e4a3d654e200d0ce59d
Part of the Parsing/ParsedPackage split into core/server.
This splits all the "important" changes, or those which change
significant code/logic and that requires a closer look during
review.
Bug: 135203078
Test: enumerated in first commit of change ID
Ib4fe51d729a56bfb0ea1316e577358ba0dfceccf
Change-Id: Ie0e4394de2b3063121d850060fcd58622511c59d
This commit allows the startLegacyVpn() call to start Platform VPN
profiles, allowing Settings to use the IKEv2/IPsec VPN options
When using an aliased private key, the
Ikev2VpnProfile.KEYSTORE_ALIAS_PREFIX must be prepended to the front of
the alias. This will in turn result in the fromVpnProfile() function to
pull the key from the KeyStore, as opposed to the inline-key that the
VpnManager API uses.
Bug: 148991741
Test: FrameworksNetTests passing, new tests added in subsequent CL
Test: Manually tested
Change-Id: Icbca695c353b2e12e99305676404dbf1a4495949
Use the early TaskOrganizer concepts to implement Split-screen
in system-ui.
This includes changes to both FW and SystemUI. The changes to
FW involve removing the use of split-screen specific behavior (like
minimize dock and direct ordering) and also reducing things that
care about primary vs secondary. It also changed ActivityStack
to inherit bounds from parent** when in split-mode so that sysui
only needs to manipulate the tile and/or reparent stacks to
effect their geometry.
This means a lot of layout logic moves to SystemUI. The bulk of
the work done in ActivityStack which is split-screen related is
moved into SplitDisplayLayout. This basically takes a snapshot of
display configuration and manages the sizes of splits and their
snap targets.
Intermediate dragging of divider bar now only moves root task leashes
around rather than talking to WM. This includes position as well
as crop (which used to be stack crop). Once the user releases
the divider bar, it will calculate (based on snaps) the new
root task sizes and update their configurations via
WindowContainerTransaction. Because the interim updates are only
on the leashes, no configuration updates occur until the end.
Entering/Exiting split-mode is now handled by SplitScreentaskOrganizer#
onTaskInfoChanged. This is effectively a state-machine that
looks at the current split task membership vs. previous and then decides
when to move things into/out-of split tasks and how to coordinate with the
DividerView.
Minimized dock is relegated to a purely system-ui concept. To
accomplish this, **the home *stack* is set to the minimizedhomebounds
by systemui. This means that it's relative position to its parent is
negative! This allows us to leave the split sizes constant, have
their children inherit the "actual" split sizes, but keep the
home stack unchanging in its minimized size. We just adjust the crop
negative to reveal it.
IME handling is done through the same mechanism as app-driven IME
animation... only Divider receives the control instead of the app.
This allows synchronized animation of split tasks with IME. To
account for insets, though, when IME is opened, the bottom stack
will be repositioned in WM.
Bug: 133381284
Test: Manual, use split-screen, rotate device, launch unresizable
apps in split, use divider snap to close/maximize apps, etc.
Change-Id: I7133e151a1037c42b275b97857936437a7a6725f
This change renames staticness to mutability and changes the OMS to
query OverlayConfig. Changing the enabled state of immutable overlays
and changing the mutability of overlays causes the overlays to be
reinitialized and the default-enabled states to be reapplied. The
default-enabled state is applied whenever the settings for the overlay
is initialized.
Bug: 135048762
Test: use package manager to dump overlay paths of package with
static/immutable overlays
Test: verify "cmd overlay dump"
Test: atest OverlayManagerServiceImplTests
Test: atest OverlayManagerServiceImplRebootTests
Change-Id: I791befee7f4c7c6ab5ad69cd5d1f3d85e7424f96
This change adds the ability to configure the priority, default enable
state, and mutability (previously know as staticness) of an overlay.
Rather than overlays configuring themselves, the system can configure
overlays relative to each other.
An example configuration file looks like:
<config>
<merge path="auto-generated.xml" />
<overlay package="com.example.one" mutable="false"
enabled="true"/>
<overlay package="com.example.two" mutable="false"
enabled="true"/>
<overlay package="com.example.three" enabled="true"/>
</config>
The <overlay> tag configures the overlay while the <merge> tag allows
additional configuration files to be included at a position within
the configuration file.
If the configuration file is not present for a partition, the legacy
android:isStatic and android:priority will continue to configure the
overlays in the partition. Once at least one configuration file has
been defined in any partition, strict partition precedence will be
enforced and overlays on separate partitions will no longer be able
to use android:priority to reorder themselves conversely from the
overlay partition precedence.
The order of the system partitions from least to greatest precedence
is system, vendor, odm, oem, product, system_ext.
Bug: 135048762
Test: atest OverlayConfigTest
Change-Id: If57e8caa9b881f9d424ef48bba80b18cc8b7b943
UsbResolverActivity extends ResolverActivity, but it should never
show a tabbed view if there is a work profile on the device.
Test: none
Fixes: 149749166
Change-Id: I4ea713a32d4b85820e42b4e3ab60c9da54814fdc