Loading core/java/android/credentials/CredentialManager.java +37 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.app.PendingIntent; import android.content.Context; import android.content.IntentSender; import android.os.CancellationSignal; import android.os.ICancellationSignal; import android.os.OutcomeReceiver; Loading Loading @@ -84,8 +86,11 @@ public final class CredentialManager { ICancellationSignal cancelRemote = null; try { cancelRemote = mService.executeGetCredential(request, new GetCredentialTransport(executor, callback), mContext.getOpPackageName()); cancelRemote = mService.executeGetCredential( request, // TODO: use a real activity instead of context. new GetCredentialTransport(mContext, executor, callback), mContext.getOpPackageName()); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading Loading @@ -124,7 +129,8 @@ public final class CredentialManager { ICancellationSignal cancelRemote = null; try { cancelRemote = mService.executeCreateCredential(request, new CreateCredentialTransport(executor, callback), // TODO: use a real activity instead of context. new CreateCredentialTransport(mContext, executor, callback), mContext.getOpPackageName()); } catch (RemoteException e) { e.rethrowFromSystemServer(); Loading Loading @@ -176,16 +182,29 @@ public final class CredentialManager { private static class GetCredentialTransport extends IGetCredentialCallback.Stub { // TODO: listen for cancellation to release callback. private final Context mActivityContext; private final Executor mExecutor; private final OutcomeReceiver< GetCredentialResponse, CredentialManagerException> mCallback; private GetCredentialTransport(Executor executor, private GetCredentialTransport(Context activityContext, Executor executor, OutcomeReceiver<GetCredentialResponse, CredentialManagerException> callback) { mActivityContext = activityContext; mExecutor = executor; mCallback = callback; } @Override public void onPendingIntent(PendingIntent pendingIntent) { try { mActivityContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "startIntentSender() failed for intent:" + pendingIntent.getIntentSender(), e); // TODO: propagate the error. } } @Override public void onResponse(GetCredentialResponse response) { mExecutor.execute(() -> mCallback.onResult(response)); Loading @@ -201,16 +220,29 @@ public final class CredentialManager { private static class CreateCredentialTransport extends ICreateCredentialCallback.Stub { // TODO: listen for cancellation to release callback. private final Context mActivityContext; private final Executor mExecutor; private final OutcomeReceiver< CreateCredentialResponse, CredentialManagerException> mCallback; private CreateCredentialTransport(Executor executor, private CreateCredentialTransport(Context activityContext, Executor executor, OutcomeReceiver<CreateCredentialResponse, CredentialManagerException> callback) { mActivityContext = activityContext; mExecutor = executor; mCallback = callback; } @Override public void onPendingIntent(PendingIntent pendingIntent) { try { mActivityContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "startIntentSender() failed for intent:" + pendingIntent.getIntentSender(), e); // TODO: propagate the error. } } @Override public void onResponse(CreateCredentialResponse response) { mExecutor.execute(() -> mCallback.onResult(response)); Loading core/java/android/credentials/ICreateCredentialCallback.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.credentials; import android.app.PendingIntent; import android.credentials.CreateCredentialResponse; /** Loading @@ -24,6 +25,7 @@ import android.credentials.CreateCredentialResponse; * @hide */ interface ICreateCredentialCallback { oneway void onPendingIntent(in PendingIntent pendingIntent); oneway void onResponse(in CreateCredentialResponse response); oneway void onError(int errorCode, String message); } No newline at end of file core/java/android/credentials/IGetCredentialCallback.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.credentials; import android.app.PendingIntent; import android.credentials.GetCredentialResponse; /** Loading @@ -24,6 +25,7 @@ import android.credentials.GetCredentialResponse; * @hide */ interface IGetCredentialCallback { oneway void onPendingIntent(in PendingIntent pendingIntent); oneway void onResponse(in GetCredentialResponse response); oneway void onError(int errorCode, String message); } No newline at end of file packages/CredentialManager/AndroidManifest.xml +0 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ android:name=".CredentialSelectorActivity" android:exported="true" android:label="@string/app_name" android:launchMode="singleInstance" android:noHistory="true" android:excludeFromRecents="true" android:theme="@style/Theme.CredentialSelector"> </activity> Loading Loading
core/java/android/credentials/CredentialManager.java +37 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import android.annotation.CallbackExecutor; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.app.PendingIntent; import android.content.Context; import android.content.IntentSender; import android.os.CancellationSignal; import android.os.ICancellationSignal; import android.os.OutcomeReceiver; Loading Loading @@ -84,8 +86,11 @@ public final class CredentialManager { ICancellationSignal cancelRemote = null; try { cancelRemote = mService.executeGetCredential(request, new GetCredentialTransport(executor, callback), mContext.getOpPackageName()); cancelRemote = mService.executeGetCredential( request, // TODO: use a real activity instead of context. new GetCredentialTransport(mContext, executor, callback), mContext.getOpPackageName()); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading Loading @@ -124,7 +129,8 @@ public final class CredentialManager { ICancellationSignal cancelRemote = null; try { cancelRemote = mService.executeCreateCredential(request, new CreateCredentialTransport(executor, callback), // TODO: use a real activity instead of context. new CreateCredentialTransport(mContext, executor, callback), mContext.getOpPackageName()); } catch (RemoteException e) { e.rethrowFromSystemServer(); Loading Loading @@ -176,16 +182,29 @@ public final class CredentialManager { private static class GetCredentialTransport extends IGetCredentialCallback.Stub { // TODO: listen for cancellation to release callback. private final Context mActivityContext; private final Executor mExecutor; private final OutcomeReceiver< GetCredentialResponse, CredentialManagerException> mCallback; private GetCredentialTransport(Executor executor, private GetCredentialTransport(Context activityContext, Executor executor, OutcomeReceiver<GetCredentialResponse, CredentialManagerException> callback) { mActivityContext = activityContext; mExecutor = executor; mCallback = callback; } @Override public void onPendingIntent(PendingIntent pendingIntent) { try { mActivityContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "startIntentSender() failed for intent:" + pendingIntent.getIntentSender(), e); // TODO: propagate the error. } } @Override public void onResponse(GetCredentialResponse response) { mExecutor.execute(() -> mCallback.onResult(response)); Loading @@ -201,16 +220,29 @@ public final class CredentialManager { private static class CreateCredentialTransport extends ICreateCredentialCallback.Stub { // TODO: listen for cancellation to release callback. private final Context mActivityContext; private final Executor mExecutor; private final OutcomeReceiver< CreateCredentialResponse, CredentialManagerException> mCallback; private CreateCredentialTransport(Executor executor, private CreateCredentialTransport(Context activityContext, Executor executor, OutcomeReceiver<CreateCredentialResponse, CredentialManagerException> callback) { mActivityContext = activityContext; mExecutor = executor; mCallback = callback; } @Override public void onPendingIntent(PendingIntent pendingIntent) { try { mActivityContext.startIntentSender(pendingIntent.getIntentSender(), null, 0, 0, 0); } catch (IntentSender.SendIntentException e) { Log.e(TAG, "startIntentSender() failed for intent:" + pendingIntent.getIntentSender(), e); // TODO: propagate the error. } } @Override public void onResponse(CreateCredentialResponse response) { mExecutor.execute(() -> mCallback.onResult(response)); Loading
core/java/android/credentials/ICreateCredentialCallback.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.credentials; import android.app.PendingIntent; import android.credentials.CreateCredentialResponse; /** Loading @@ -24,6 +25,7 @@ import android.credentials.CreateCredentialResponse; * @hide */ interface ICreateCredentialCallback { oneway void onPendingIntent(in PendingIntent pendingIntent); oneway void onResponse(in CreateCredentialResponse response); oneway void onError(int errorCode, String message); } No newline at end of file
core/java/android/credentials/IGetCredentialCallback.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.credentials; import android.app.PendingIntent; import android.credentials.GetCredentialResponse; /** Loading @@ -24,6 +25,7 @@ import android.credentials.GetCredentialResponse; * @hide */ interface IGetCredentialCallback { oneway void onPendingIntent(in PendingIntent pendingIntent); oneway void onResponse(in GetCredentialResponse response); oneway void onError(int errorCode, String message); } No newline at end of file
packages/CredentialManager/AndroidManifest.xml +0 −2 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ android:name=".CredentialSelectorActivity" android:exported="true" android:label="@string/app_name" android:launchMode="singleInstance" android:noHistory="true" android:excludeFromRecents="true" android:theme="@style/Theme.CredentialSelector"> </activity> Loading