-
Notifications
You must be signed in to change notification settings - Fork 48
Add AIDL interface for device registration service., Fixes AB#3127905 #2926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fc60a63
Add AIDL interface and IPC client for device registration service
p3dr0rv 726663c
Merge branch 'dev' into pedroro/dr-service
p3dr0rv 9dd7f41
Refactor AIDL interface and update access modifiers in DeviceRegistra…
p3dr0rv 48af396
Add constant for main thread execution violation in ClientException
p3dr0rv 8260843
Add AIDL interface for device registration service to changelog
p3dr0rv de00ed2
Merge branch 'dev' into pedroro/dr-service
p3dr0rv 80489d8
Merge branch 'dev' into pedroro/dr-service
p3dr0rv 04e9b29
Merge branch 'dev' into pedroro/dr-service
p3dr0rv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
common/src/main/aidl/com/microsoft/identity/client/IDeviceRegistrationService.aidl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // All rights reserved. | ||
| // | ||
| // This code is licensed under the MIT License. | ||
| // | ||
| // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| // of this software and associated documentation files(the "Software"), to deal | ||
| // in the Software without restriction, including without limitation the rights | ||
| // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
| // copies of the Software, and to permit persons to whom the Software is | ||
| // furnished to do so, subject to the following conditions : | ||
| // | ||
| // The above copyright notice and this permission notice shall be included in | ||
| // all copies or substantial portions of the Software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| // THE SOFTWARE. | ||
| package com.microsoft.identity.client; | ||
|
|
||
| /** | ||
| * AIDL interface for the device registration bound service exposed by the broker. | ||
| * Client applications (such as Authenticator or CP) call into this service to execute device registration operations | ||
| * when the content provider strategy is not available. The implementation of this service resides in the broker app. | ||
| */ | ||
| interface IDeviceRegistrationService { | ||
| /** | ||
| * Executes a device registration protocol with the broker. | ||
| * | ||
| * @param protocolParams Bundle containing device registration protocol parameters | ||
| * @return Bundle containing the protocol response from the broker | ||
| */ | ||
| Bundle executeDeviceRegistrationProtocol(in Bundle protocolParams); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...java/com/microsoft/identity/common/internal/broker/ipc/DeviceRegistrationServiceClient.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // All rights reserved. | ||
| // | ||
| // This code is licensed under the MIT License. | ||
| // | ||
| // Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| // of this software and associated documentation files(the "Software"), to deal | ||
| // in the Software without restriction, including without limitation the rights | ||
| // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell | ||
| // copies of the Software, and to permit persons to whom the Software is | ||
| // furnished to do so, subject to the following conditions : | ||
| // | ||
| // The above copyright notice and this permission notice shall be included in | ||
| // all copies or substantial portions of the Software. | ||
| // | ||
| // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| // THE SOFTWARE. | ||
| package com.microsoft.identity.common.internal.broker.ipc | ||
|
|
||
| import android.content.Context | ||
| import android.os.Bundle | ||
| import android.os.IBinder | ||
| import com.microsoft.identity.client.IDeviceRegistrationService | ||
| import com.microsoft.identity.common.internal.broker.BoundServiceClient | ||
|
|
||
| /** | ||
| * A client for communicating with the DeviceRegistrationService via IPC. | ||
| * This client binds to the service and allows executing device registration protocol operations with the broker. | ||
| * | ||
| * @param context the application context used to bind to the service. | ||
| */ | ||
| class DeviceRegistrationServiceClient(context: Context) : | ||
| BoundServiceClient<IDeviceRegistrationService>( | ||
| context, | ||
| SERVICE_CLASS_NAME, | ||
| SERVICE_INTENT_FILTER | ||
| ) { | ||
p3dr0rv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| companion object { | ||
| /** The fully qualified class name of the DeviceRegistrationService to bind to. */ | ||
| private const val SERVICE_CLASS_NAME = "com.microsoft.identity.client.DeviceRegistrationService" | ||
|
|
||
| /** The intent filter used to identify the DeviceRegistrationService. */ | ||
| private const val SERVICE_INTENT_FILTER = "com.microsoft.identity.client.DeviceRegistration" | ||
| } | ||
|
|
||
| /** | ||
| * Extracts the [IDeviceRegistrationService] AIDL interface from the given [IBinder]. | ||
| * | ||
| * @param binder the [IBinder] returned by the service connection. | ||
| * @return the [IDeviceRegistrationService] interface for communicating with the service. | ||
| */ | ||
| protected override fun getInterfaceFromIBinder(binder: IBinder): IDeviceRegistrationService = | ||
| IDeviceRegistrationService.Stub.asInterface(binder) | ||
|
|
||
| /** | ||
| * Executes the device registration protocol operation by delegating to the AIDL interface. | ||
| * | ||
| * @param inputBundle the [BrokerOperationBundle] containing the operation parameters. | ||
| * @param aidlInterface the [IDeviceRegistrationService] AIDL interface bound to the service. | ||
| * @return a [Bundle] containing the result of the device registration protocol, or null if no result. | ||
| */ | ||
| protected override fun performOperationInternal( | ||
| inputBundle: BrokerOperationBundle, | ||
| aidlInterface: IDeviceRegistrationService | ||
| ): Bundle? = aidlInterface.executeDeviceRegistrationProtocol(inputBundle.bundle) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be in the broker repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are planning to expose the DR API to OneAuth so we need this interface here, if I move it to broker it will be back in common.