Added in U Extensions 15

EmbeddedPhotoPickerProvider


public interface EmbeddedPhotoPickerProvider

android.widget.photopicker.EmbeddedPhotoPickerProvider


This interface provides an api that callers can use to get a session of embedded PhotoPicker (EmbeddedPhotoPickerSession).

Callers can get instance of this class using EmbeddedPhotoPickerProviderFactory.create(Context).

Under the hood, a service connection with photopicker is established by the implementation of this api. To help establish this connection, a caller must include in their Manifest:

<queries>
   <intent>
       <action android:name="com.android.photopicker.core.embedded.EmbeddedService.BIND"/>
   </intent>
 </queries>
 

When a session opens successfully, they would receive an instance of EmbeddedPhotoPickerSession and SurfaceControlViewHost.SurfacePackage via the api

Callers pass an instance of EmbeddedPhotoPickerClient which is used by service to notify about different events (like sessionError, uri granted/revoked etc) to them. One-to-one relationship of client to session must be maintained by a caller i.e. they shouldn't reuse same callback for more than one openSession requests.

The EmbeddedPhotoPickerSession instance can be used to notify photopicker about different events (like resize, configChange etc).

This api is supported on api versions Android U+.

Summary

Public methods

abstract void openSession(IBinder hostToken, int displayId, int width, int height, EmbeddedPhotoPickerFeatureInfo featureInfo, Executor clientExecutor, EmbeddedPhotoPickerClient callback)

Open a new session for displaying content with an initial size of width x height pixels.

Public methods

openSession

Added in U Extensions 15
public abstract void openSession (IBinder hostToken, 
                int displayId, 
                int width, 
                int height, 
                EmbeddedPhotoPickerFeatureInfo featureInfo, 
                Executor clientExecutor, 
                EmbeddedPhotoPickerClient callback)

Open a new session for displaying content with an initial size of width x height pixels. EmbeddedPhotoPickerClient will receive all incoming communication from the PhotoPicker. All incoming calls to EmbeddedPhotoPickerClient will be made through the provided clientExecutor

Parameters
hostToken IBinder: Token used for constructing SurfaceControlViewHost. Use AttachedSurfaceControl.getInputTransferToken() to get token of attached SurfaceControlViewHost.SurfacePackage. This value cannot be null.

displayId int: Application display id. Use DisplayManager.getDisplays() to get the id.

width int: width of the view, in pixels.

height int: height of the view, in pixels.

featureInfo EmbeddedPhotoPickerFeatureInfo: EmbeddedPhotoPickerFeatureInfo object containing all the required features for the given session. This value cannot be null.

clientExecutor Executor: Executor to invoke callbacks. This value cannot be null.

callback EmbeddedPhotoPickerClient: EmbeddedPhotoPickerClient object to receive callbacks from photopicker. This value cannot be null.