Merge "Add Broadcast Receiver for listening to provider updates" into udc-dev
This commit is contained in:
@@ -78,7 +78,7 @@ public class IntentFactory {
|
|||||||
Resources.getSystem()
|
Resources.getSystem()
|
||||||
.getString(
|
.getString(
|
||||||
com.android.internal.R.string
|
com.android.internal.R.string
|
||||||
.config_credentialManagerDialogComponent));
|
.config_credentialManagerReceiverComponent));
|
||||||
intent.setComponent(componentName);
|
intent.setComponent(componentName);
|
||||||
intent.setAction(Constants.CREDMAN_ENABLED_PROVIDERS_UPDATED);
|
intent.setAction(Constants.CREDMAN_ENABLED_PROVIDERS_UPDATED);
|
||||||
return intent;
|
return intent;
|
||||||
|
|||||||
@@ -3065,6 +3065,10 @@
|
|||||||
<string name="config_credentialManagerDialogComponent" translatable="false"
|
<string name="config_credentialManagerDialogComponent" translatable="false"
|
||||||
>com.android.credentialmanager/com.android.credentialmanager.CredentialSelectorActivity</string>
|
>com.android.credentialmanager/com.android.credentialmanager.CredentialSelectorActivity</string>
|
||||||
|
|
||||||
|
<!-- Name of the broadcast receiver that is used to receive provider change events -->
|
||||||
|
<string name="config_credentialManagerReceiverComponent" translatable="false"
|
||||||
|
>com.android.credentialmanager/com.android.credentialmanager.CredentialProviderReceiver</string>
|
||||||
|
|
||||||
<!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
|
<!-- Apps that are authorized to access shared accounts, overridden by product overlays -->
|
||||||
<string name="config_appsAuthorizedForSharedAccounts" translatable="false">;com.android.settings;</string>
|
<string name="config_appsAuthorizedForSharedAccounts" translatable="false">;com.android.settings;</string>
|
||||||
|
|
||||||
|
|||||||
@@ -2210,6 +2210,7 @@
|
|||||||
<java-symbol type="string" name="config_platformVpnConfirmDialogComponent" />
|
<java-symbol type="string" name="config_platformVpnConfirmDialogComponent" />
|
||||||
<java-symbol type="string" name="config_carrierAppInstallDialogComponent" />
|
<java-symbol type="string" name="config_carrierAppInstallDialogComponent" />
|
||||||
<java-symbol type="string" name="config_credentialManagerDialogComponent" />
|
<java-symbol type="string" name="config_credentialManagerDialogComponent" />
|
||||||
|
<java-symbol type="string" name="config_credentialManagerReceiverComponent" />
|
||||||
<java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
|
<java-symbol type="string" name="config_defaultNetworkScorerPackageName" />
|
||||||
<java-symbol type="string" name="config_persistentDataPackageName" />
|
<java-symbol type="string" name="config_persistentDataPackageName" />
|
||||||
<java-symbol type="string" name="config_deviceConfiguratorPackageName" />
|
<java-symbol type="string" name="config_deviceConfiguratorPackageName" />
|
||||||
|
|||||||
@@ -41,6 +41,15 @@
|
|||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:theme="@style/Theme.CredentialSelector">
|
android:theme="@style/Theme.CredentialSelector">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<receiver
|
||||||
|
android:name=".CredentialProviderReceiver"
|
||||||
|
android:exported="true"
|
||||||
|
android:permission="android.permission.LAUNCH_CREDENTIAL_SELECTOR">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.credentials.ui.action.CREDMAN_ENABLED_PROVIDERS_UPDATED"/>
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class CredentialManagerRepo(
|
|||||||
requestInfo = intent.extras?.getParcelable(
|
requestInfo = intent.extras?.getParcelable(
|
||||||
RequestInfo.EXTRA_REQUEST_INFO,
|
RequestInfo.EXTRA_REQUEST_INFO,
|
||||||
RequestInfo::class.java
|
RequestInfo::class.java
|
||||||
) ?: testCreatePasskeyRequestInfo()
|
) ?: testCreatePasswordRequestInfo()
|
||||||
|
|
||||||
providerEnabledList = when (requestInfo.type) {
|
providerEnabledList = when (requestInfo.type) {
|
||||||
RequestInfo.TYPE_CREATE ->
|
RequestInfo.TYPE_CREATE ->
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.credentialmanager
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.util.Log
|
||||||
|
import com.android.credentialmanager.common.Constants
|
||||||
|
|
||||||
|
|
||||||
|
class CredentialProviderReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
|
Log.d(Constants.LOG_TAG, "Received intent in CredentialProviderReceiver")
|
||||||
|
|
||||||
|
val sharedPreferences = context?.getSharedPreferences(context?.packageName,
|
||||||
|
Context.MODE_PRIVATE)
|
||||||
|
sharedPreferences?.edit()?.remove(UserConfigRepo.DEFAULT_PROVIDER)?.commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.server.credentials;
|
package com.android.server.credentials;
|
||||||
|
|
||||||
import static android.Manifest.permission.CREDENTIAL_MANAGER_SET_ORIGIN;
|
import static android.Manifest.permission.CREDENTIAL_MANAGER_SET_ORIGIN;
|
||||||
|
import static android.Manifest.permission.LAUNCH_CREDENTIAL_SELECTOR;
|
||||||
import static android.content.Context.CREDENTIAL_SERVICE;
|
import static android.content.Context.CREDENTIAL_SERVICE;
|
||||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||||
|
|
||||||
@@ -631,7 +632,8 @@ public final class CredentialManagerService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send an intent to the UI that we have new enabled providers.
|
// Send an intent to the UI that we have new enabled providers.
|
||||||
getContext().sendBroadcast(IntentFactory.createProviderUpdateIntent());
|
getContext().sendBroadcast(IntentFactory.createProviderUpdateIntent(),
|
||||||
|
LAUNCH_CREDENTIAL_SELECTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user