Package org.mozilla.geckoview
Class GeckoRuntime
Object
org.mozilla.geckoview.GeckoRuntime
- All Implemented Interfaces:
Parcelable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
This is used to allow GeckoRuntime to start activities via the embedding application (andActivity
).static @interface
static interface
static interface
Nested classes/interfaces inherited from interface android.os.Parcelable
Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Intent action sent to the crash handler when a crash is encountered.static final String
Value forEXTRA_CRASH_PROCESS_TYPE
indicating a background child process crashed.static final String
Value forEXTRA_CRASH_PROCESS_TYPE
indicating a foreground child process, such as a content process, crashed.static final String
Value forEXTRA_CRASH_PROCESS_TYPE
indicating the main application process was affected by the crash, which is therefore fatal.static final Parcelable.Creator<GeckoRuntime>
static final String
This is a key for extra data sent withACTION_CRASHED
.static final String
This is a key for extra data sent withACTION_CRASHED
.static final String
This is a key for extra data sent withACTION_CRASHED
.static final String
This is a key for extra data sent withACTION_CRASHED
.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Appends notes to crash report.void
Attach the runtime to the given context.void
configurationChanged
(Configuration newConfig) Notify Gecko that the device configuration has changed.static GeckoRuntime
Create a new runtime with default settings and attach it to the given context.static GeckoRuntime
create
(Context context, GeckoRuntimeSettings settings) Create a new runtime with the given settings and attach it to the given context.int
Get theGeckoRuntime.ActivityDelegate
instance set on this runtime, if any,Get theAutocomplete.StorageDelegate
instance set on this runtime.Returns the ContentBlockingController for this GeckoRuntime.static GeckoRuntime
getDefault
(Context context) Get the default runtime for the given context.Returns the current delegate, if any.Get the orientation controller for this runtime.Returns a ProfilerController for this GeckoRuntime.Gets theGeckoRuntime.ServiceWorkerDelegate
to be used for Service Worker requests.Get the storage controller for this runtime.Returns a WebExtensionController for this GeckoRuntime.Returns the current WebNotificationDelegate, if anyGet the Web Push controller for this runtime.boolean
Whether the default `interactive-widget` is `resizes-visual`.void
Notify Gecko that the screen orientation has changed.void
orientationChanged
(int newOrientation) Notify Gecko that the screen orientation has changed.void
readFromParcel
(Parcel source) void
Set theGeckoRuntime.ActivityDelegate
instance on this runtime.void
Set theAutocomplete.StorageDelegate
instance on this runtime.void
setDelegate
(GeckoRuntime.Delegate delegate) Set a delegate for receiving callbacks relevant to to this GeckoRuntime.void
setServiceWorkerDelegate
(GeckoRuntime.ServiceWorkerDelegate serviceWorkerDelegate) Sets theGeckoRuntime.ServiceWorkerDelegate
to be used for Service Worker requests.void
Sets the delegate to be used for handling Web Notifications.void
shutdown()
Shutdown the runtime.void
writeToParcel
(Parcel out, int flags)
-
Field Details
-
ACTION_CRASHED
Intent action sent to the crash handler when a crash is encountered. -
EXTRA_MINIDUMP_PATH
This is a key for extra data sent withACTION_CRASHED
. It refers to a String with the path to a Breakpad minidump file containing information about the crash. Several crash reporters are able to ingest this in a crash report, including Sentry and Mozilla's Socorro.
Be aware, the minidump can contain personally identifiable information. Ensure you are obeying all applicable laws and policies before sending this to a remote server. -
EXTRA_EXTRAS_PATH
This is a key for extra data sent withACTION_CRASHED
. It refers to a string with the path to a file containing extra metadata about the crash. The file contains key-value pairs in the formKey=Value
Be aware, it may contain sensitive data such as the URI that was loaded at the time of the crash.- See Also:
-
EXTRA_CRASH_PROCESS_TYPE
This is a key for extra data sent withACTION_CRASHED
. The value is a String matching one of the `CRASHED_PROCESS_TYPE_*` constants, describing what type of process the crash occurred in. -
EXTRA_CRASH_REMOTE_TYPE
This is a key for extra data sent withACTION_CRASHED
. The value is a String containing the content process type, which might not be available even for child processes. -
CRASHED_PROCESS_TYPE_MAIN
Value forEXTRA_CRASH_PROCESS_TYPE
indicating the main application process was affected by the crash, which is therefore fatal.- See Also:
-
CRASHED_PROCESS_TYPE_FOREGROUND_CHILD
Value forEXTRA_CRASH_PROCESS_TYPE
indicating a foreground child process, such as a content process, crashed. The application may be able to recover from this crash, but it was likely noticable to the user.- See Also:
-
CRASHED_PROCESS_TYPE_BACKGROUND_CHILD
Value forEXTRA_CRASH_PROCESS_TYPE
indicating a background child process crashed. This should have been recovered from automatically, and will have had minimal impact to the user, if any.- See Also:
-
CREATOR
-
-
Method Details
-
getDefault
Get the default runtime for the given context. This will create and initialize the runtime with the default settings.Note: Only use this for session-less apps. For regular apps, use create() instead.
- Parameters:
context
- An application context for the default runtime.- Returns:
- The (static) default runtime for the context.
-
attachTo
Attach the runtime to the given context.- Parameters:
context
- The new context to attach to.
-
create
Create a new runtime with default settings and attach it to the given context.Create will throw if there is already an active Gecko instance running, to prevent that, bind the runtime to the process lifetime instead of the activity lifetime.
- Parameters:
context
- The context of the runtime.- Returns:
- An initialized runtime.
-
getWebExtensionController
Returns a WebExtensionController for this GeckoRuntime.- Returns:
- an instance of
WebExtensionController
.
-
getContentBlockingController
Returns the ContentBlockingController for this GeckoRuntime.- Returns:
- An instance of
ContentBlockingController
.
-
getProfilerController
Returns a ProfilerController for this GeckoRuntime.- Returns:
- an instance of
ProfilerController
.
-
create
@UiThread @NonNull public static GeckoRuntime create(@NonNull Context context, @NonNull GeckoRuntimeSettings settings) Create a new runtime with the given settings and attach it to the given context.Create will throw if there is already an active Gecko instance running, to prevent that, bind the runtime to the process lifetime instead of the activity lifetime.
- Parameters:
context
- The context of the runtime.settings
- The settings for the runtime.- Returns:
- An initialized runtime.
-
shutdown
@AnyThread public void shutdown()Shutdown the runtime. This will invalidate all attached sessions. -
setDelegate
Set a delegate for receiving callbacks relevant to to this GeckoRuntime.- Parameters:
delegate
- an implementation ofGeckoRuntime.Delegate
.
-
getDelegate
Returns the current delegate, if any.- Returns:
- an instance of
GeckoRuntime.Delegate
or null if no delegate has been set.
-
setAutocompleteStorageDelegate
@UiThread public void setAutocompleteStorageDelegate(@Nullable Autocomplete.StorageDelegate delegate) Set theAutocomplete.StorageDelegate
instance on this runtime. This delegate is required for handling autocomplete storage requests.- Parameters:
delegate
- TheAutocomplete.StorageDelegate
handling autocomplete storage requests.
-
getAutocompleteStorageDelegate
Get theAutocomplete.StorageDelegate
instance set on this runtime.- Returns:
- The
Autocomplete.StorageDelegate
set on this runtime.
-
setServiceWorkerDelegate
@UiThread public void setServiceWorkerDelegate(@Nullable GeckoRuntime.ServiceWorkerDelegate serviceWorkerDelegate) Sets theGeckoRuntime.ServiceWorkerDelegate
to be used for Service Worker requests.- Parameters:
serviceWorkerDelegate
- An instance ofGeckoRuntime.ServiceWorkerDelegate
.- See Also:
-
getServiceWorkerDelegate
Gets theGeckoRuntime.ServiceWorkerDelegate
to be used for Service Worker requests.- Returns:
- the
GeckoRuntime.ServiceWorkerDelegate
instance set bysetServiceWorkerDelegate(org.mozilla.geckoview.GeckoRuntime.ServiceWorkerDelegate)
-
setWebNotificationDelegate
Sets the delegate to be used for handling Web Notifications.- Parameters:
delegate
- An instance ofWebNotificationDelegate
.- See Also:
-
getWebNotificationDelegate
Returns the current WebNotificationDelegate, if any- Returns:
- an instance of WebNotificationDelegate or null if no delegate has been set
-
setActivityDelegate
Set theGeckoRuntime.ActivityDelegate
instance on this runtime. This delegate is used to provide GeckoView support for launching external activities and receiving results from those activities.- Parameters:
delegate
- TheGeckoRuntime.ActivityDelegate
handling intent launching requests.
-
getActivityDelegate
Get theGeckoRuntime.ActivityDelegate
instance set on this runtime, if any,- Returns:
- The
GeckoRuntime.ActivityDelegate
set on this runtime.
-
getSettings
-
orientationChanged
@UiThread public void orientationChanged()Notify Gecko that the screen orientation has changed. -
configurationChanged
Notify Gecko that the device configuration has changed.- Parameters:
newConfig
- The new Configuration object,Configuration
.
-
orientationChanged
@UiThread public void orientationChanged(int newOrientation) Notify Gecko that the screen orientation has changed.- Parameters:
newOrientation
- The new screen orientation, as retrieved e.g. from the currentConfiguration
.
-
getOrientationController
Get the orientation controller for this runtime. The orientation controller can be used to manage changes to and locking of the screen orientation.- Returns:
- The
OrientationController
for this instance.
-
getStorageController
Get the storage controller for this runtime. The storage controller can be used to manage persistent storage data accumulated byGeckoSession
.- Returns:
- The
StorageController
for this instance.
-
getWebPushController
Get the Web Push controller for this runtime. The Web Push controller can be used to allow content to use the Web Push API.- Returns:
- The
WebPushController
for this instance.
-
appendAppNotesToCrashReport
Appends notes to crash report.- Parameters:
notes
- The application notes to append to the crash report.
-
describeContents
@AnyThread public int describeContents()- Specified by:
describeContents
in interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcel
in interfaceParcelable
-
readFromParcel
-
isInteractiveWidgetDefaultResizesVisual
@AnyThread public boolean isInteractiveWidgetDefaultResizesVisual()Whether the default `interactive-widget` is `resizes-visual`.- Returns:
- True the default `interactive-widget` is `resizes-visual`, false otherwise.
-