Loading play-services-auth-workaccount/build.gradle 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * SPDX-FileCopyrightText: 2023 e foundation * SPDX-License-Identifier: Apache-2.0 */ apply plugin: 'com.android.library' apply plugin: 'maven-publish' apply plugin: 'signing' android { namespace "com.google.android.gms.auth.workaccount" compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" buildFeatures { aidl = true } defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk } compileOptions { sourceCompatibility = 1.8 targetCompatibility = 1.8 } } apply from: '../gradle/publish-android.gradle' description = 'microG implementation of play-services-auth-api-phone' dependencies { // Dependencies from play-services-auth-api-phone:18.0.1 api project(':play-services-base') api project(':play-services-basement') api project(':play-services-tasks') } play-services-auth-workaccount/core/build.gradle 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * SPDX-FileCopyrightText: 2023 e foundation * SPDX-License-Identifier: Apache-2.0 */ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' dependencies { api project(':play-services-auth-workaccount') api project(':play-services-auth') implementation project(':play-services-base-core') implementation "androidx.appcompat:appcompat:$appcompatVersion" } android { namespace "com.google.android.gms.auth.workaccount" compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk } sourceSets { main.java.srcDirs += 'src/main/kotlin' } compileOptions { sourceCompatibility = 1.8 targetCompatibility = 1.8 } kotlinOptions { jvmTarget = 1.8 } lintOptions { disable 'MissingTranslation' } } play-services-auth-workaccount/core/src/main/AndroidManifest.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ SPDX-FileCopyrightText: 2023 e foundation ~ SPDX-License-Identifier: Apache-2.0 --> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <application> <service android:name="org.microg.gms.auth.workaccount.WorkAccountService" android:exported="true"> <intent-filter> <action android:name="com.google.android.gms.auth.api.phone.service.SmsRetrieverApiService.START" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </service> </application> </manifest> play-services-auth-workaccount/core/src/main/kotlin/org/microg/gms/auth/workaccount/WorkAccountService.kt 0 → 100644 +64 −0 Original line number Diff line number Diff line package org.microg.gms.auth.workaccount import android.accounts.Account import android.accounts.AccountManager import android.content.Context import android.os.Parcel import android.util.Log import com.google.android.gms.auth.account.IWorkAccountService import com.google.android.gms.auth.account.IWorkAccountService.AddAccountResult import com.google.android.gms.common.Feature import com.google.android.gms.common.api.CommonStatusCodes import com.google.android.gms.common.api.Status import com.google.android.gms.common.internal.ConnectionInfo import com.google.android.gms.common.internal.GetServiceRequest import com.google.android.gms.common.internal.IGmsCallbacks import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import org.microg.gms.BaseService import org.microg.gms.common.GmsService private const val TAG = "GmsWorkAccountService" class WorkAccountService : BaseService(TAG, GmsService.WORK_ACCOUNT) { override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { callback.onPostInitCompleteWithConnectionInfo(CommonStatusCodes.SUCCESS, WorkAccountServiceImpl(this), ConnectionInfo().apply { features = arrayOf(Feature("work_account_client_is_whitelisted", 1)) } ) } } class WorkAccountServiceImpl(val context: Context) : IWorkAccountService.Stub() { override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { Log.d(TAG, "$code, $data, $reply, $flags") return super.onTransact(code, data, reply, flags) } override fun addWorkAccount(googleApiClient: IObjectWrapper?, s: String?): IWorkAccountService.AddAccountResult { Log.d(TAG, "addWorkAccount with $googleApiClient, $s") return object : AddAccountResult.Stub() { override fun getAccount(): Account? { // TODO return AccountManager.get(context).accounts.firstOrNull()?.also { Log.d(TAG, "returning account $it") } } override fun getStatus(): IObjectWrapper { return ObjectWrapper.wrap(Status(CommonStatusCodes.SUCCESS)).also { Log.d(TAG, "returning status $it (${it.unwrap<Status>()})") } } } } override fun removeWorkAccount(googleApiClient: IObjectWrapper?, account: IObjectWrapper?): IObjectWrapper { return ObjectWrapper.wrap(null) } override fun setWorkAuthenticatorEnabled(googleApiClient: IObjectWrapper?, b: Boolean) { // TODO Log.d(TAG, "setWorkAuthenticatorEnabled with $googleApiClient, $b") } override fun setWorkAuthenticatorEnabledWithResult(googleApiClient: IObjectWrapper?, b: Boolean): IObjectWrapper { return ObjectWrapper.wrap(null) } } play-services-auth-workaccount/src/main/AndroidManifest.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ SPDX-FileCopyrightText: 2023 microG Project Team ~ SPDX-License-Identifier: Apache-2.0 --> <manifest /> No newline at end of file Loading
play-services-auth-workaccount/build.gradle 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * SPDX-FileCopyrightText: 2023 e foundation * SPDX-License-Identifier: Apache-2.0 */ apply plugin: 'com.android.library' apply plugin: 'maven-publish' apply plugin: 'signing' android { namespace "com.google.android.gms.auth.workaccount" compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" buildFeatures { aidl = true } defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk } compileOptions { sourceCompatibility = 1.8 targetCompatibility = 1.8 } } apply from: '../gradle/publish-android.gradle' description = 'microG implementation of play-services-auth-api-phone' dependencies { // Dependencies from play-services-auth-api-phone:18.0.1 api project(':play-services-base') api project(':play-services-basement') api project(':play-services-tasks') }
play-services-auth-workaccount/core/build.gradle 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * SPDX-FileCopyrightText: 2023 e foundation * SPDX-License-Identifier: Apache-2.0 */ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' dependencies { api project(':play-services-auth-workaccount') api project(':play-services-auth') implementation project(':play-services-base-core') implementation "androidx.appcompat:appcompat:$appcompatVersion" } android { namespace "com.google.android.gms.auth.workaccount" compileSdkVersion androidCompileSdk buildToolsVersion "$androidBuildVersionTools" defaultConfig { versionName version minSdkVersion androidMinSdk targetSdkVersion androidTargetSdk } sourceSets { main.java.srcDirs += 'src/main/kotlin' } compileOptions { sourceCompatibility = 1.8 targetCompatibility = 1.8 } kotlinOptions { jvmTarget = 1.8 } lintOptions { disable 'MissingTranslation' } }
play-services-auth-workaccount/core/src/main/AndroidManifest.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ SPDX-FileCopyrightText: 2023 e foundation ~ SPDX-License-Identifier: Apache-2.0 --> <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-permission android:name="android.permission.GET_ACCOUNTS" android:maxSdkVersion="22" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <application> <service android:name="org.microg.gms.auth.workaccount.WorkAccountService" android:exported="true"> <intent-filter> <action android:name="com.google.android.gms.auth.api.phone.service.SmsRetrieverApiService.START" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </service> </application> </manifest>
play-services-auth-workaccount/core/src/main/kotlin/org/microg/gms/auth/workaccount/WorkAccountService.kt 0 → 100644 +64 −0 Original line number Diff line number Diff line package org.microg.gms.auth.workaccount import android.accounts.Account import android.accounts.AccountManager import android.content.Context import android.os.Parcel import android.util.Log import com.google.android.gms.auth.account.IWorkAccountService import com.google.android.gms.auth.account.IWorkAccountService.AddAccountResult import com.google.android.gms.common.Feature import com.google.android.gms.common.api.CommonStatusCodes import com.google.android.gms.common.api.Status import com.google.android.gms.common.internal.ConnectionInfo import com.google.android.gms.common.internal.GetServiceRequest import com.google.android.gms.common.internal.IGmsCallbacks import com.google.android.gms.dynamic.IObjectWrapper import com.google.android.gms.dynamic.ObjectWrapper import com.google.android.gms.dynamic.unwrap import org.microg.gms.BaseService import org.microg.gms.common.GmsService private const val TAG = "GmsWorkAccountService" class WorkAccountService : BaseService(TAG, GmsService.WORK_ACCOUNT) { override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) { callback.onPostInitCompleteWithConnectionInfo(CommonStatusCodes.SUCCESS, WorkAccountServiceImpl(this), ConnectionInfo().apply { features = arrayOf(Feature("work_account_client_is_whitelisted", 1)) } ) } } class WorkAccountServiceImpl(val context: Context) : IWorkAccountService.Stub() { override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean { Log.d(TAG, "$code, $data, $reply, $flags") return super.onTransact(code, data, reply, flags) } override fun addWorkAccount(googleApiClient: IObjectWrapper?, s: String?): IWorkAccountService.AddAccountResult { Log.d(TAG, "addWorkAccount with $googleApiClient, $s") return object : AddAccountResult.Stub() { override fun getAccount(): Account? { // TODO return AccountManager.get(context).accounts.firstOrNull()?.also { Log.d(TAG, "returning account $it") } } override fun getStatus(): IObjectWrapper { return ObjectWrapper.wrap(Status(CommonStatusCodes.SUCCESS)).also { Log.d(TAG, "returning status $it (${it.unwrap<Status>()})") } } } } override fun removeWorkAccount(googleApiClient: IObjectWrapper?, account: IObjectWrapper?): IObjectWrapper { return ObjectWrapper.wrap(null) } override fun setWorkAuthenticatorEnabled(googleApiClient: IObjectWrapper?, b: Boolean) { // TODO Log.d(TAG, "setWorkAuthenticatorEnabled with $googleApiClient, $b") } override fun setWorkAuthenticatorEnabledWithResult(googleApiClient: IObjectWrapper?, b: Boolean): IObjectWrapper { return ObjectWrapper.wrap(null) } }
play-services-auth-workaccount/src/main/AndroidManifest.xml 0 → 100644 +6 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ SPDX-FileCopyrightText: 2023 microG Project Team ~ SPDX-License-Identifier: Apache-2.0 --> <manifest /> No newline at end of file