Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 463c4019 authored by Jonathan Klee's avatar Jonathan Klee
Browse files

feat: introduce CredentialProviderService minimal implementation

parent 9b131695
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
  -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <uses-permission android:name="android.permission.PROVIDE_DEFAULT_ENABLED_CREDENTIAL_SERVICE"
        tools:ignore="ProtectedPermissions" />

    <permission
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
@@ -581,6 +583,23 @@
            </intent-filter>
        </service>

        <service
            android:name="org.microg.gms.credential.CredentialProviderService"
            android:exported="true"
            android:permission="android.permission.BIND_CREDENTIAL_PROVIDER_SERVICE"
            android:label="@string/gms_app_name">
            <intent-filter>
                <action android:name="android.service.credentials.CredentialProviderService" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <meta-data
                android:name="android.credentials.provider"
                android:resource="@xml/credential_provider_platform" />
            <meta-data
                android:name="android.service.credentials.CredentialProviderService"
                android:resource="@xml/credential_provider_platform" />
        </service>

        <activity
            android:name="org.microg.gms.auth.signin.AuthSignInActivity"
            android:theme="@style/Theme.App.DayNight.Dialog.Alert.NoActionBar"
+62 −0
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2025 microG Project Team
 * SPDX-License-Identifier: Apache-2.0
 */

package org.microg.gms.credential

import android.credentials.ClearCredentialStateException
import android.credentials.CreateCredentialException
import android.credentials.GetCredentialException
import android.os.Build
import android.os.CancellationSignal
import android.os.OutcomeReceiver
import android.service.credentials.BeginCreateCredentialRequest
import android.service.credentials.BeginCreateCredentialResponse
import android.service.credentials.BeginGetCredentialRequest
import android.service.credentials.BeginGetCredentialResponse
import android.service.credentials.ClearCredentialStateRequest
import android.service.credentials.CredentialProviderService
import android.util.Log
import androidx.annotation.RequiresApi

@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
class CredentialProviderService : CredentialProviderService() {
    override fun onCreate() {
        super.onCreate()
        Log.d(TAG, "onCreate")
    }

    @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
    override fun onBeginGetCredential(
        request: BeginGetCredentialRequest,
        cancellationSignal: CancellationSignal,
        callback: OutcomeReceiver<BeginGetCredentialResponse, GetCredentialException>
    ) {
        Log.d(TAG, "onBeginGetCredential")
        callback.onError(GetCredentialException(GetCredentialException.TYPE_NO_CREDENTIAL))
    }

    @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
    override fun onBeginCreateCredential(
        request: BeginCreateCredentialRequest,
        cancellationSignal: CancellationSignal,
        callback: OutcomeReceiver<BeginCreateCredentialResponse, CreateCredentialException>
    ) {
        Log.d(TAG, "onBeginCreateCredential")
        callback.onError(CreateCredentialException(CreateCredentialException.TYPE_NO_CREATE_OPTIONS))
    }

    override fun onClearCredentialState(
        request: ClearCredentialStateRequest,
        cancellationSignal: CancellationSignal,
        callback: OutcomeReceiver<Void, ClearCredentialStateException>
    ) {
        Log.d(TAG, "onClearCredentialState")
        callback.onResult(null)
    }

    companion object {
        private const val TAG = "CredentialProvider"
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -408,4 +408,5 @@ Dies kann etwas dauern."</string>
    <string name="prefcat_device_attestation_apps_title">Apps, die Geräteattestierung verwenden</string>
    <string name="pref_device_attestation_app_allow_requests_title">Anfragen zulassen</string>
    <string name="pref_device_attestation_app_allow_requests_summary">Zulassen, dass die App eine Geräteattestierung anfordert</string>
    <string name="credential_provider_subtitle">Anmeldedatenanbieter</string>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -405,4 +405,5 @@ Inténtalo otra vez mas tarde."</string>
    <string name="prefcat_device_attestation_apps_title">Apps con certificación del dispositivo</string>
    <string name="pref_device_attestation_app_allow_requests_title">Permitir solicitudes</string>
    <string name="pref_device_attestation_app_allow_requests_summary">Permitir que la app solicite la certificación del dispositivo</string>
    <string name="credential_provider_subtitle">Proveedor de credenciales</string>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -417,4 +417,5 @@ Ceci peut prendre plusieurs minutes."</string>
    <string name="prefcat_device_attestation_apps_title">Applis utilisant la certification de l\'appareil</string>
    <string name="pref_device_attestation_app_allow_requests_title">Autoriser requêtes</string>
    <string name="pref_device_attestation_app_allow_requests_summary">Autorise l\'appli à demander la certification de l\'appareil</string>
    <string name="credential_provider_subtitle">Fournisseur d\'identifiants</string>
</resources>
Loading