Commit Graph

3916 Commits

Author SHA1 Message Date
Ryan Mitchell
350c2669d6 Revert^3 "Deprecate Context#createApplicationContext"
This reverts commit cb5a80ea57.

Reason for revert: Was not the cause of the test failure

Fixes: 186622527
Test: atest FrameworksCoreTests:ContextTest
Change-Id: I705854f080200f0465d94a7754e710f05a3ec92c
2021-06-30 15:53:45 +00:00
Paul Hobbs
cb5a80ea57 Revert^2 "Deprecate Context#createApplicationContext"
Bug: 192242649

5a41b45a85

Change-Id: Idcebd68e0079e7e87de04ae25069b3a9ff72093c
2021-06-29 20:06:45 +00:00
Ryan Mitchell
5a41b45a85 Revert "Deprecate Context#createApplicationContext"
This reverts commit c54ebba25b.

Bug: 188059515
Test: atest FrameworksCoreTests:ContextTest
Change-Id: I986563142dac135281889e811e6e5219d728d5d1
2021-06-22 22:30:38 -07:00
TreeHugger Robot
ee438f960a Merge "Deprecate Context#createApplicationContext" into sc-dev 2021-05-19 15:35:09 +00:00
Ryan Mitchell
c54ebba25b Deprecate Context#createApplicationContext
If an application caches an ApplicationInfo and uses it to call
Context#createApplicationContext, the app will not get the most recent
version of the overlays for that application. To make things worse, the
LoadedApk stored in ActivityThread#mResourcePackages is updated using
the old ApplicationInfo causing further uses of the cached LoadedApk to
return outdated information.

Deprecate Context#createApplicationContext, convert all internal uses
to Context#createPackageContext(String packageName, ...) and log
whenever any one calls Context#createApplicationContext with an
outdated ApplicationInfo to detect debug issues in using old infos.

Bug: 188059515
Test: change wallpaper and observe widgets get reloaded with most
      recent overlays
Change-Id: I2aeefa8c0e66264859109975a54c4f73f76ad710
2021-05-18 09:07:58 -07:00
Torne (Richard Coles)
ef1e913955 Rework WebView startup timestamp system API.
Rework the new WebView startup timestamp system API to use a class with
named getters instead of an array with an @IntDef index.

Fixes: 184026615
CTS-Coverage-Bug: 183239482
Test: n/a
Change-Id: I22c95b1c2dc98f8ecd23ce22dc21e3d0158d9e1b
2021-05-18 11:12:40 -04:00
Joanne Chung
b8e3112908 Add dispatchRequestTranslation() in WebViewProvider.
This change doesn't introduce a new API, the change is just pushing
down an existing API from View that we are missing to add for the
webview. We should also provide this method to allow webview provider
to provide their implementation if needed.

Bug: 186617107
Test: manual
CTS-Coverage-Bug: 177960696

Change-Id: If75285b3aafdb1f2a3d7c307a90bb783edf029b5
2021-05-12 15:50:46 +08:00
Torne (Richard Coles)
d35469d86b webview: switch timestamps to uptimeMillis().
We should use uptimeMillis for the startup timestamps since it doesn't
count time in device sleep.

Fixes: 184786485
Test: n/a
Change-Id: I4073e73de9b76d50398b820879c4fcf7b8f614e8
2021-04-29 15:22:59 -04:00
Torne (Richard Coles)
83d73c2eb4 Document WebViewDelegate.getTimestamps() better.
Specify that the values are @ElapsedRealtimeLong and document the
entries in the array via the index constants.

Fixes: 184786485
Bug: 184026615
Test: n/a
Change-Id: I26e3df80e79b14d2301e28da93f7814bc67bdb6a
2021-04-27 13:58:49 -04:00
Joanne Chung
f6a52811a1 API feedback: Translation View API refinement.
Bug: 178046780
Test: manual
Test: atest android.translation.cts.UiTranslationManagerTest
CTS-Coverage-Bug: 177960696

Change-Id: I557ca4b3b4e7324af12e81dd8b5ac8a04a17b6b8
2021-04-20 11:14:22 +08:00
Joanne Chung
8c8a14d4df Bug fix: allow to create ViewTranslationRequest for virtual AutofillId.
1. We provide virtual child list to View#onCreateTranslationRequests
but we don't provide a method to allow developers to create
ViewTranslationRequest for virtual AutofillId. Add a builder
constructor to allow developer to use it for virtual AutofillId.
2. Fix some comments in ag/13982294(e1b23cd)

Bug: 177789967
Test: manual on sample app
Test: atest CtsTranslationTestCases

Change-Id: I63e914b888b23cdb7a5169fc6931be93625ca8e4
2021-03-31 01:02:01 +08:00
Joanne Chung
e1b23cd423 Add translation APIs for virtual views.
Bug: 178046780
Test: manual
Test: atest CtsTranslationTestCases
CTS-Coverage-Bug: 177960696

Change-Id: I99caed0d42b3a164a25c2707eba7057c42c19140
2021-03-29 20:36:40 +08:00
Anna Malova
f649ddfcea Use SystemClock.elapsedRealtime() to record WebView startup timestamps.
ag/13435848 introduces timestamp collections based on
System.currentTimeMillis but elapsedRealtime is a better
choice for a interval timing.

Bug: 180489435
Test: n/a
Change-Id: If7b29cbe90e8bba76bccb42a5bc570c08b75c9e7
2021-02-17 14:38:08 +00:00
Anna Malova
3972728a44 Merge "Record WebView startup timestamps and add API to access them." into sc-dev 2021-02-03 11:36:52 +00:00
Automerger Merge Worker
f20f52a304 Merge "Merge "WebView: clarify CookieManager docs" am: 5844882671 am: d2243be46a" into rvc-qpr-dev-plus-aosp am: 8e92545adf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1569302

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9d66b86d7ad4990e3e8910816cfb6d78587b4d83
2021-02-03 00:38:32 +00:00
Nate Fischer
3a9cdb4485 WebView: clarify CookieManager docs
No change to logic, only documentation change. This adds some
clarifications to getCookie()/setCookie():

* getCookie() returns multiple cookies, setCookie() accepts only one
* This briefly describes getCookie()'s output format because it's fairly
  simple
* This summarizes setCookie()'s input format and provides an example,
  but directs the reader to the RFC spec for a full description
* Minor formatting changes, including editing a javadoc link which
  doesn't currently render correctly in kotlin docs (for
  ValueCallback#onReceiveValue)

Fixes: 175471135
Test: m offline-sdk-docs -j4
Change-Id: Id9052fa03584caae5ffc92ed1f6c4d2641d900ce
2021-02-02 03:15:47 +00:00
Anna Malova
416a99d69b Record WebView startup timestamps and add API to access them.
This change records timestamps that happen before the WebView APK's code
is loaded and can record timestamps itself.

Bug: 177895749
Test: n/a
Change-Id: Ibb832fa13e868846625cc02c584a535a11561c66
2021-01-29 14:44:04 +00:00
Anna Malova
4d7d9603e9 Add TEST_MAPPING to run WebView CTS/GTS tests in presubmit.
Bug: 173406791
Test: cd frameworks/base/core/java/android/webkit && atest --test-mapping
Change-Id: Ic75336a7067faf2c9ec10c8b7089eee48b2ec89d
2021-01-08 12:33:56 +00:00
Torne (Richard Coles)
7d70982263 Clean up WebViewFactory.getProvider error handling.
We were catching and ignoring exceptions when looking up the provider
factory method, because in the past the code fell back to calling the
provider constructor instead. However, this case was removed a while
ago, so now if the reflection fails the exception will be lost.

This isn't a big issue as it will still crash with a
NullPointerException when trying to call the method that wasn't found,
but it makes the cause of the problem less clear. Remove the extra
try-catch and just handle all exceptions thrown during the process of
creating the provider the same way.

Test: atest CtsWebkitTestCases
Change-Id: Ib2079e743a830a04a4117d782afa6eaaa26766df
2020-12-01 16:02:45 -05:00
Anna Malova
aedc4ae81c Merge "Give ACCESS_NETWORK_STATE permission to PacProcessor. Fix UnsupportedOperationException for PacProcessor#createInstance." 2020-11-23 11:56:51 +00:00
Anna Malova
f47c1ebc10 Give ACCESS_NETWORK_STATE permission to PacProcessor.
Fix UnsupportedOperationException for PacProcessor#createInstance.

Bug: 169844605
Bug: 171733851
Test: n/a

Change-Id: Ied19cc296c945c8923ffa65452113a87a13e7a25
2020-11-23 11:56:20 +00:00
Aurimas Liutikas
d23189b998 Suppress all hidden abstract methods in constructable classes.
Having a hidden abstract method for a class that can be extended
means that public implementors cannot implement these hidden methods
posing a risk that custom implementations will not have required
abstract methods resulting in an exception.

Bug: 151134792
Test: make update-api
Change-Id: I758d12465fabc671be19bedeeceb16885de23c87
Merged-In: I758d12465fabc671be19bedeeceb16885de23c87
Exempt-From-Owner-Approval: large scale suppression of existing issues,
    no-op in terms of behavior
2020-11-13 02:56:20 +00:00
Aurimas Liutikas
796760c56e Suppress all hidden abstract methods in constructable classes.
Having a hidden abstract method for a class that can be extended
means that public implementors cannot implement these hidden methods
posing a risk that custom implementations will not have required
abstract methods resulting in an exception.

Bug: 151134792
Test: make update-api
Change-Id: I758d12465fabc671be19bedeeceb16885de23c87
Exempt-From-Owner-Approval: large scale suppression of existing issues,
    no-op in terms of behavior
2020-11-11 23:16:32 +00:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Mathew Inwood
8e742f928e Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

This is a resubmit of ag/12929664 with some APIs excluded that caused
test failures; see bugs 171886397, 171888296, 171864568.

APIs excluded:
Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord;
Landroid/os/Process;->myPpid()I
Landroid/os/SharedMemory;->getFd()I
Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I

Bug: 170729553
Test: Treehugger
Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
2020-10-29 11:51:12 +00:00
Hongwei Wang
050275cd83 Revert "Add maxTargetSdk restriction to unused APIs."
This reverts commit 72f07d6a8a.

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397

Bug: 171886397
Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
2020-10-28 20:16:22 +00:00
Mathew Inwood
72f07d6a8a Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
2020-10-27 15:46:07 +00:00
Anna Malova
913e00c8c2 Rename PacProcessor#releasePacProcessor to PacProcessor#release.
Bug: 170226229
CTS-Coverage-Bug: 169844605
Test: n/a
Change-Id: Iba954d0a2784e69156dd1be14714a1c53b7bec07
2020-10-14 18:56:27 +00:00
TreeHugger Robot
0936ab496c Merge "Reland "Enable new S APIs for WebView.""" 2020-10-13 21:22:15 +00:00
Richard Coles
2fce8b0e83 Reland "Enable new S APIs for WebView.""
This reverts commit 039e10f76a.

New WebView binary has now been dropped, fixing the strict mode issue that necessitated a revert.

Change-Id: I86644e8a216c7087d7a00294d2b7f9ddb1705968
2020-10-13 19:24:00 +00:00
TreeHugger Robot
838cb845f1 Merge "Revert "Enable new S APIs for WebView."" 2020-10-02 21:02:10 +00:00
Nate Fischer
039e10f76a Revert "Enable new S APIs for WebView."
This reverts commit cfa9b7033c.

Reason for revert: WebView M85+ has a strictmode violation

Bug: 169877920
Change-Id: I46a26c16d83debc548217538200c6736ab8abeae
2020-10-02 18:35:41 +00:00
TreeHugger Robot
87ce51b8ed Merge "Enable new S APIs for WebView." 2020-10-01 23:26:46 +00:00
TreeHugger Robot
b9d481bdaf Merge "WebView: update loadUrl documentation" 2020-10-01 15:28:00 +00:00
Laís Minchillo
883b165d48 WebView: update loadUrl documentation
No change to logic, only docs. Updates loadUrl documentation to make it
clear that some WebView versions require the Map parameter to be
mutable.

Bug: 145881245
Test: m offline-sdk-docs -j4
Change-Id: I15f3c48f02090b8855880ff5d39c02aa28d4dfa8
2020-10-01 09:39:29 +00:00
Anna Malova
351256d16a Update methods of PacProcessor.
See discussion in b/149000014 for more information.

Bug: 168455630
Test: n/a

Change-Id: I3b63a0120b151a41ed219dcec818c6a400d03daa
2020-09-30 12:50:04 +01:00
Xin Li
628590d7ec Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Anna Malova
242def4269 Use Network object instead of network handle and expand documentation.
Bug: 165192953
Bug: 165307632
Test: N/A
Change-Id: I5e2d22d3c332debe33d0cc617f86071b5926c50a
2020-08-19 13:46:02 +01:00
Felipe Leme
b07b092f9e Refactored some UserManager.getUsers(excludeDying) calls.
Replaced by getUsers() when exlcudeDying was hardcoded to false, or
getUsers(true,  excludeDying, true) when it was a variable.

This refactoring will help replacing getUsers(true) to getAliveUsers().

Bug: 157921703

Test: m
Test: atest atest LockscreenFrpTest LockSettingsServiceTests SyntheticPasswordTests

Change-Id: I139462ab329fe46d8136eae0a39ac071a7e019db
2020-08-12 15:03:37 -07:00
Anna Malova
1d0dede72d Add new methods to PacProcessor to
- allow multiple PacProcessors
- allow network-aware DNS lookups in PAC scripts

Bug: 162785263
Test: n/a

Change-Id: I39432d8f6358e386527b00b58d92e74ef32763d1
2020-08-06 14:44:32 +01:00
Torne (Richard Coles)
cfa9b7033c Enable new S APIs for WebView.
Make WebViewFactory create the *ForS version of the WebView factory
provider, and require that WebView implementations target at least S to
be valid.

Test: atest CtsWebkitTestCases
Change-Id: I21a1dc9a9084c1086bba52921bd19ba968544a9c
2020-08-05 16:44:34 -04:00
Nate Fischer
17c077cac6 WebView: remove non-inclusive terminology from docs
No change to logic, only docs. This removes non-inclusive terminology
("whitelist") from our API javadoc, with the exception of references to
setSafeBrowsingWhitelist() (which we plan to deprecate soon, in favor of
an inclusively named API).

This rephrases one paragraph to be a bit clearer as well.

Bug: 160928306
Test: m offline-sdk-docs -j4
Change-Id: If249be8a70b01c01390ebfeb418fd7c5e119f1f2
2020-07-27 20:27:42 -07:00
Nate Fischer
36f0f45750 WebView: remove non-inclusive terminology from docs
No change to logic, only docs. This removes non-inclusive terminology
("whitelist") from our API javadoc, with the exception of references to
setSafeBrowsingWhitelist() (which we plan to deprecate soon, in favor of
an inclusively named API).

This rephrases one paragraph to be a bit clearer as well.

Bug: 160928306
Test: m offline-sdk-docs -j4
Change-Id: If249be8a70b01c01390ebfeb418fd7c5e119f1f2
2020-07-23 10:53:27 -07:00
John Reck
ee26d1ef65 Merge "Remove legacy callDrawGlFunction2 from HWUI" 2020-06-30 19:09:37 +00:00
John Reck
aa4c982294 Remove legacy callDrawGlFunction2 from HWUI
Bug: 151439970
Test: CtsUiRenderingTestCases passes

Change-Id: I1c29df17bb6e8b078467edf73cb3547db6948cdd
2020-06-26 13:49:05 -07:00
Changwan Ryu
47c0a48089 [WebView] Listen to window insets change
Overriding these methods in preparation for notch and safe area implementation
for WebView.

A corresponding implementation for Chrome app does this:
https://source.chromium.org/chromium/chromium/src/+/master:components/browser_ui/widget/android/java/src/org/chromium/components/browser_ui/widget/InsetObserverView.java;l=179;drc=b17e62321db0f69a9131d3bb87ab9cef502a0eaf?originalUrl=https:%2F%2Fcs.chromium.org%2F

An alternative would be to call View#setOnApplyWindowInsetsListener(),
but that might not be as straightforward and might conflict with app's own
usage around windowinsets.

Returning null from a default implementation and use super method until
we can actually implement it in the chromium repo.

(Note: I would like to merge this to R if possible.)

Bug: 159610496
Test: CL does not break build/test.
Change-Id: Ic0421d7347e8091e02af6c9d5a24fdb334f37c47
2020-06-25 17:15:26 -07:00
TreeHugger Robot
b1837c419f Merge "webkit: add a note regarding FLAG_SECURE for default dialogs" into rvc-dev am: f7484457cd am: bedf7e5161 am: ed9855498f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11617993

Change-Id: Id04faa91cf3c8f614ad5197506ef3e658569ffd1
2020-06-03 18:09:22 +00:00
TreeHugger Robot
efe6c29f16 Merge "webkit: add a note regarding FLAG_SECURE for default dialogs" into rvc-dev am: f7484457cd
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11617993

Change-Id: Ic7ffe9ca7bb83f27c204162a5c1d8fcecd29108b
2020-06-03 17:32:02 +00:00
Changwan Ryu
a9e2ed7bbd webkit: add a note regarding FLAG_SECURE for default dialogs
Child windows do not inherit FLAG_SECURE from parent windows, and
therefore, the default dialogs for JS callbacks do not have this flag
even when the app window has it.

This CL adds a note warning about this behavior to mitigate the
potential vulnerability.

Bug: 120086187
Test: m -j offline-sdk-docs seems not broken
Change-Id: I12f12befd1f303d26ebc866f4817f5184279caeb
2020-06-01 13:56:47 -07:00
TreeHugger Robot
55deb7e9f8 Merge "webkit: Update documentation for onJsBeforeUnload callback" into rvc-dev am: a203c27aa9 am: 346676a352 am: 52451f3b71
Change-Id: I131ad095a2ad012a56d6b7acc6bbd759054e3655
2020-05-27 21:18:14 +00:00