public class BrowserDescriptor extends Object
Represents a browser that may be used for an authorization flow.
| Modifier and Type | Field and Description |
|---|---|
String |
packageName
The package name of the browser app.
|
Set<String> |
signatureHashes
The set of
signatures of the browser app,
which have been hashed with SHA-512, and Base-64 URL-safe encoded. |
Boolean |
useCustomTab
Whether it is intended that the browser will be used via a custom tab.
|
String |
version
The version string of the browser app.
|
| Constructor and Description |
|---|
BrowserDescriptor(android.content.pm.PackageInfo packageInfo,
boolean useCustomTab)
Creates a description of a browser from a
PackageInfo object returned from the
PackageManager. |
BrowserDescriptor(String packageName,
Set<String> signatureHashes,
String version,
boolean useCustomTab)
Creates a description of a browser from the core properties that are frequently used to
decide whether a browser can be used for an authorization flow.
|
| Modifier and Type | Method and Description |
|---|---|
BrowserDescriptor |
changeUseCustomTab(boolean newUseCustomTabValue)
Creates a copy of this browser descriptor, changing the intention to use it as a custom
tab to the specified value.
|
boolean |
equals(Object obj) |
static String |
generateSignatureHash(android.content.pm.Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from a
Signature. |
static Set<String> |
generateSignatureHashes(android.content.pm.Signature[] signatures)
Generates a set of SHA-512, Base64 url-safe encoded signature hashes from the provided
array of signatures.
|
int |
hashCode() |
public final String packageName
The package name of the browser app.
public final Set<String> signatureHashes
The set of signatures of the browser app,
which have been hashed with SHA-512, and Base-64 URL-safe encoded.
public final String version
The version string of the browser app.
public final Boolean useCustomTab
Whether it is intended that the browser will be used via a custom tab.
public BrowserDescriptor(@NonNull
android.content.pm.PackageInfo packageInfo,
boolean useCustomTab)
Creates a description of a browser from a PackageInfo object returned from the
PackageManager. The object is expected to include the
signatures of the app, which can be retrieved with the
GET_SIGNATURES flag when
calling PackageManager.getPackageInfo(String, int).
public BrowserDescriptor(@NonNull
String packageName,
@NonNull
Set<String> signatureHashes,
@NonNull
String version,
boolean useCustomTab)
Creates a description of a browser from the core properties that are frequently used to
decide whether a browser can be used for an authorization flow. In most cases, it is
more convenient to use the other variant of the constructor that consumes a
PackageInfo object provided by the package manager.
packageName - The Android package name of the browser.signatureHashes - The set of SHA-512, Base64 url safe encoded signatures for the app. This can be
generated for a signature by calling generateSignatureHash(Signature).version - The version name of the browser.useCustomTab - Whether it is intended to use the browser as a custom tab.@NonNull public BrowserDescriptor changeUseCustomTab(boolean newUseCustomTabValue)
Creates a copy of this browser descriptor, changing the intention to use it as a custom tab to the specified value.
@NonNull public static String generateSignatureHash(@NonNull android.content.pm.Signature signature)
Generates a SHA-512 hash, Base64 url-safe encoded, from a Signature.