Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ android.useAndroidX=true
org.gradle.configuration-cache=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx4096m -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
kotlin.daemon.jvmargs=-Xmx2048m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.constellation.internal;

import com.google.android.gms.common.api.Status;

interface IConstellationCallbacks {
void onPhoneNumber(in Status status, String phoneNumber) = 0;
void onVerificationResult(in Status status, boolean success) = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.constellation.internal;

import com.google.android.gms.constellation.internal.IConstellationCallbacks;

interface IConstellationService {
void getPhoneNumber(IConstellationCallbacks callbacks) = 0;
void verifyPhoneNumber(IConstellationCallbacks callbacks, String phoneNumber) = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.rcs.internal;

import com.google.android.gms.common.api.Status;
import android.os.Bundle;

interface IRcsCallbacks {
void onCapabilities(in Status status, in Bundle capabilities) = 0;
void onAvailability(in Status status, boolean available) = 1;
void onConfiguration(in Status status, in Bundle config) = 2;
void onProvisioningStatus(in Status status, int provisioningStatus) = 3;
void onResult(in Status status) = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package com.google.android.gms.rcs.internal;

import com.google.android.gms.rcs.internal.IRcsCallbacks;

interface IRcsService {
void getCapabilities(IRcsCallbacks callbacks) = 0;
void isAvailable(IRcsCallbacks callbacks) = 1;
void getConfiguration(IRcsCallbacks callbacks) = 2;
void registerCapabilityCallback(IRcsCallbacks callbacks) = 3;
void unregisterCapabilityCallback(IRcsCallbacks callbacks) = 4;
void startProvisioning(IRcsCallbacks callbacks) = 5;
void stopProvisioning(IRcsCallbacks callbacks) = 6;
void getProvisioningStatus(IRcsCallbacks callbacks) = 7;
void triggerReconfiguration(IRcsCallbacks callbacks) = 8;
}
22 changes: 20 additions & 2 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />

<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Expand Down Expand Up @@ -1187,6 +1190,22 @@
android:name="com.google.android.gms.maps.auth.ApiTokenService"
android:exported="true"/>

<service
android:name="org.microg.gms.rcs.RcsService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.rcs.START" />
</intent-filter>
</service>

<service
android:name="org.microg.gms.constellation.ConstellationService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.constellation.service.START" />
</intent-filter>
</service>

<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
Expand Down Expand Up @@ -1223,7 +1242,6 @@
<action android:name="com.google.android.gms.chromesync.service.START" />
<action android:name="com.google.android.gms.common.download.START" />
<action android:name="com.google.android.gms.config.START" />
<action android:name="com.google.android.gms.constellation.service.START" />
<action android:name="com.google.android.gms.deviceconnection.service.START" />
<action android:name="com.google.android.gms.enterprise.loader.service.START" />
<action android:name="com.google.android.gms.facs.internal.service.START" />
Expand Down Expand Up @@ -1276,7 +1294,7 @@
<action android:name="com.google.android.gms.plus.service.image.INTENT" />
<action android:name="com.google.android.gms.plus.service.internal.START" />
<action android:name="com.google.android.gms.plus.service.START" />
<action android:name="com.google.android.gms.rcs.START" />

<action android:name="com.google.android.gms.romanesco.MODULE_BACKUP_AGENT" />
<action android:name="com.google.android.gms.romanesco.service.START" />
<action android:name="com.google.android.gms.search.service.SEARCH_AUTH_START" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* SPDX-FileCopyrightText: 2025 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package org.microg.gms.constellation

import android.content.Context
import android.os.Bundle
import android.telephony.TelephonyManager
import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.lifecycleScope
import com.google.android.gms.common.api.CommonStatusCodes
import com.google.android.gms.common.api.Status
import com.google.android.gms.common.internal.GetServiceRequest
import com.google.android.gms.common.internal.IGmsCallbacks
import com.google.android.gms.constellation.internal.IConstellationCallbacks
import com.google.android.gms.constellation.internal.IConstellationService
import kotlinx.coroutines.launch
import org.microg.gms.BaseService
import org.microg.gms.common.GmsService
import org.microg.gms.common.PackageUtils

private const val TAG = "ConstellationService"

class ConstellationService : BaseService(TAG, GmsService.CONSTELLATION) {
override fun handleServiceRequest(callback: IGmsCallbacks, request: GetServiceRequest, service: GmsService) {
val packageName = PackageUtils.getAndCheckCallingPackage(this, request.packageName)
Log.d(TAG, "handleServiceRequest for package: $packageName")

callback.onPostInitComplete(
CommonStatusCodes.SUCCESS,
ConstellationServiceImpl(this, packageName ?: "unknown", lifecycle),
null
)
}
}

class ConstellationServiceImpl(
private val context: Context,
private val packageName: String,
override val lifecycle: Lifecycle
) : IConstellationService.Stub(), LifecycleOwner {

private val telephonyManager = context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager

override fun getPhoneNumber(callbacks: IConstellationCallbacks?) {
Log.d(TAG, "getPhoneNumber() called by $packageName")
lifecycleScope.launch {
try {
val phoneNumber = telephonyManager?.line1Number ?: ""
callbacks?.onPhoneNumber(Status.SUCCESS, phoneNumber)
} catch (e: Exception) {
Log.w(TAG, "Error in getPhoneNumber", e)
callbacks?.onPhoneNumber(Status(CommonStatusCodes.INTERNAL_ERROR), "")
}
}
}

override fun verifyPhoneNumber(callbacks: IConstellationCallbacks?, phoneNumber: String?) {
Log.d(TAG, "verifyPhoneNumber($phoneNumber) called by $packageName")
lifecycleScope.launch {
try {
// Just mock verification success for now
callbacks?.onVerificationResult(Status.SUCCESS, true)
} catch (e: Exception) {
Log.w(TAG, "Error in verifyPhoneNumber", e)
callbacks?.onVerificationResult(Status(CommonStatusCodes.INTERNAL_ERROR), false)
}
}
}
}
Loading