fune/mobile/android/android-components/components/browser/engine-system
Mihai Adrian Carare e087b524a6 Bug 1796353 - Build with compileSdkVersion for Android 13 / API 33. (https://github.com/mozilla-mobile/firefox-android/pull/62)
* Bug 1796353 - Build with compileSdkVersion for Android 13 / API 33.

* Bug 1796353 - Update method signature for View.AccessibilityDelegate.

* Bug 1796353 - Handle AccessibilityNodeInfo.CollectionInfo.obtain deprecation.

* Bug 1796353 - Update method signature for View.OnAttachStateChangeListener.

* Bug 1796353 - Handle getParcelableExtra(String) deprecation.

* Bug 1796353 - Handle getParcelable(String) deprecation.

* Bug 1796353 - Handle getParcelableArrayListExtra(String) deprecation.

* Bug 1796353 - Move URLStringUtils to ktx package.

This is needed to avoid circular dependencies for some needed changes.

* Bug 1796353 - Suppress deprecation for get(String).

* Bug 1796353 - Replace removed method setAppCacheEnabled.

* Bug 1796353 - Handle PackageManager methods deprecations.

* Bug 1796353 - Handle getSerializable(String) deprecation.

* Bug 1796353 - Handle stopForeground deprecation.

* Bug 1796353 - Update method signature for GestureDetector.SimpleOnGestureListener.

* Bug 1796353 - Handle AccessibilityEvent.obtain deprecation.

* Bug 1796353 - Handle getParcelableArrayList(String) deprecation.

* Bug 1796353 - Handle getParcelableArray(String) deprecation.

* Bug 1796353 - Handle getSerializableExtra(String) deprecation.

* Bug 1796353 - Handle readParcelable(classLoader) deprecation.

* Bug 1796353 - Handle FillResponse.Builder setAuthentication deprecation.

* Bug 1796353 - Handle Dataset.Builder setValue deprecation.

* Bug 1796353 - Suppress get(String) deprecation.

We still need to use this method because we do not know the type beforehand.

* Bug 1796353 - Handle onBackPressed() deprecation.

* Bug 1796353 - Suppress queryBroadcastReceivers deprecation.

* Bug 1796353 - Suppress package manager methods deprecation.

* Bug 1796353 - Catch and report exceptions when handling touch event detection.

* Bug 1796353 - Suppress deprecation for getPackageInfo used in tests with SDK 28.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-11-16 00:35:40 -05:00
..
src Bug 1796353 - Build with compileSdkVersion for Android 13 / API 33. (https://github.com/mozilla-mobile/firefox-android/pull/62) 2022-11-16 00:35:40 -05:00
build.gradle [components] For https://github.com/mozilla-mobile/android-components/pull/11175 - Migrate runBlocking and runBlockingTest to runTest in unit tests 2022-05-10 13:45:03 +00:00
proguard-rules.pro
README.md [components] SystemEngine's constructor changed 2021-09-27 10:27:47 +00:00

Android Components > Browser > Engine-System

Engine implementation based on the system's WebView.

Usage

See concept-engine for a documentation of the abstract engine API this component implements.

Setting up the dependency

Use Gradle to download the library from maven.mozilla.org (Setup repository):

implementation "org.mozilla.components:browser-engine-system:{latest-version}"

Initializing

It is recommended t create only one SystemEngine instance per app.

// Create default settings (optional) and enable tracking protection for all future sessions.
val defaultSettings = DefaultSettings().apply {
    trackingProtectionPolicy = EngineSession.TrackingProtectionPolicy.all()
}

// Create an engine instance to be used by other components.
val engine = SystemEngine(context, defaultSettings)

Integration

Usually it is not needed to interact with the Engine component directly. The browser-session component will take care of making the state accessible and link a Session to an EngineSession internally. The feature-session component will provide "use cases" to perform actions like loading URLs and takes care of rendering the selected Session on an EngineView.

View

SystemEngineView is the Gecko-based implementation of EngineView in order to render web content.

<mozilla.components.browser.engine.system.SystemEngineView
    android:id="@+id/engineView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

SystemEngineView can render any SystemEngineSession using the render() method.

val engineSession = engine.createSession()
val engineView = view.findViewById<SystemEngineView>(R.id.engineView)
engineView.render(engineSession)

License

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/