# CallingAppInfo

Artifact: [androidx.credentials:credentials](https://developer.android.com/jetpack/androidx/releases/credentials) [View Source](https://cs.android.com/search?q=file:androidx/credentials/provider/CallingAppInfo.kt+class:androidx.credentials.provider.CallingAppInfo) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

*** ** * ** ***

<br />

```
class CallingAppInfo
```

<br />

*** ** * ** ***

Information pertaining to the calling application.

## Summary

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting @https://developer.android.com/reference/kotlin/androidx/annotation/DeprecatedSinceApi(api = 28, message = "Use the SigningInfo based constructor instead") https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#CallingAppInfo(kotlin.String,kotlin.collections.List,kotlin.String)( packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, signatures: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/content/pm/Signature.html>, origin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo` |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 28) @https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#CallingAppInfo(kotlin.String,android.content.pm.SigningInfo,kotlin.String)( packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, signingInfo: https://developer.android.com/reference/android/content/pm/SigningInfo.html, origin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)(privilegedAllowlist: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns the origin of the calling app. |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#isOriginPopulated()()` Returns true if the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#origin()` is populated, and false otherwise. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#packageName()` the calling package name of the calling app |
| `lateinit https://developer.android.com/reference/android/content/pm/SigningInfo.html` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#signingInfo()` the signingInfo associated with the calling app, added at API level 28 |
| `https://developer.android.com/reference/kotlin/androidx/credentials/provider/SigningInfoCompat` | `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#signingInfoCompat()` the signing information associated with the calling app, which can be used across all Android API levels |

## Public constructors

### CallingAppInfo

```
@VisibleForTesting
@DeprecatedSinceApi(api = 28, message = "Use the SigningInfo based constructor instead")
CallingAppInfo(
    packageName: String,
    signatures: List<Signature>,
    origin: String? = null
)
```

Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo`

| Parameters |
|---|---|
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the calling package name of the calling app |
| `signatures: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/content/pm/Signature.html>` | the app signatures, which should be retrieved from the app's `https://developer.android.com/reference/android/content/pm/PackageInfo.html#signatures` |
| `origin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? = null` | the origin of the calling app. This is only set when a privileged app like a browser, calls on behalf of another application. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#(kotlin.String,kotlin.collections.List,kotlin.String)` is null |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If the class is initialized with a null `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#signingInfo()` on Android API 28 and above |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#(kotlin.String,kotlin.collections.List,kotlin.String)` is empty |

### CallingAppInfo

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
@RequiresApi(value = 28)
@VisibleForTesting
CallingAppInfo(
    packageName: String,
    signingInfo: SigningInfo,
    origin: String? = null
)
```

Constructs an instance of `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo`

| Parameters |
|---|---|
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the calling package name of the calling app |
| `signingInfo: https://developer.android.com/reference/android/content/pm/SigningInfo.html` | the signingInfo associated with the calling app |
| `origin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? = null` | the origin of the calling app. This is only set when a privileged app like a browser, calls on behalf of another application. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#(kotlin.String,android.content.pm.SigningInfo,kotlin.String)` is null |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-null-pointer-exception/index.html` | If the class is initialized with a null `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#(kotlin.String,android.content.pm.SigningInfo,kotlin.String)` on Android P and above |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#(kotlin.String,android.content.pm.SigningInfo,kotlin.String)` is empty |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### getOrigin

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
fun getOrigin(privilegedAllowlist: String): String?
```

Returns the origin of the calling app. This is only non-null if a privileged app like a browser calls Credential Manager APIs on behalf of another application.

Additionally, in order to get the origin, the credential provider must provide an allowlist of privileged browsers/apps that it trusts. This allowlist must be in the form of a valid, non-empty JSON. The origin will only be returned if the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#packageName()` and the SHA256 hash of the newest signature obtained from the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#signingInfo()`, is present in the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)`.

Packages that are signed with multiple signers will only receive the origin if all of the signatures are present in the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)`.

The format of this `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)` JSON must adhere to the following sample.

```kotlin
{"apps": [
   {
      "type": "android",
      "info": {
         "package_name": "com.example.myapp",
         "signatures" : [
         {"build": "release",
             "cert_fingerprint_sha256": "59:0D:2D:7B:33:6A:BD:FB:54:CD:3D:8B:36:8C:5C:3A:
             7D:22:67:5A:9A:85:9A:6A:65:47:FD:4C:8A:7C:30:32"
         },
         {"build": "userdebug",
         "cert_fingerprint_sha256": "59:0D:2D:7B:33:6A:BD:FB:54:CD:3D:8B:36:8C:5C:3A:7D:
         22:67:5A:9A:85:9A:6A:65:47:FD:4C:8A:7C:30:32"
         }]
      }
    }
]}
```

All keys in the JSON must be exactly as stated in the sample above. Note that if the build for a given fingerprint is specified as 'userdebug', that fingerprint will only be considered if the device is on a 'userdebug' build, as determined by `https://developer.android.com/reference/android/os/Build.html#TYPE`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | If `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)` is empty, or an invalid JSON, or does not follow the format detailed above |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | If the origin is non-null, but the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#packageName()` and `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#signingInfo()` do not have a match in the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#getOrigin(kotlin.String)` |

### hashCode

```
open fun hashCode(): Int
```

### isOriginPopulated

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
fun isOriginPopulated(): Boolean
```

Returns true if the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#origin()` is populated, and false otherwise.

Note that the `https://developer.android.com/reference/kotlin/androidx/credentials/provider/CallingAppInfo#origin()` is only populated if a privileged app like a browser calls Credential Manager APIs on behalf of another application.

## Public properties

### packageName

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
val packageName: String
```

the calling package name of the calling app

### signingInfo

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.2.0)

```
lateinit val signingInfo: SigningInfo
```

the signingInfo associated with the calling app, added at API level 28

### signingInfoCompat

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/credentials#1.5.0)

```
val signingInfoCompat: SigningInfoCompat
```

the signing information associated with the calling app, which can be used across all Android API levels