Commit 8c5f47cb authored by Romain Hunault's avatar Romain Hunault
Browse files

Update to v0.2.20.212158

parent 10ed9d47
......@@ -4,6 +4,7 @@
*/
buildscript {
ext.cronetVersion = '91.0.4472.120'
ext.nlpVersion = '2.0-alpha6'
ext.remoteDroidGuardVersion = '0.1.2'
ext.safeParcelVersion = '1.7.0'
......@@ -58,7 +59,7 @@ def execResult(...args) {
return stdout.toString().trim()
}
def gmsVersion = "21.15.15"
def gmsVersion = "21.21.58"
def gmsVersionCode = Integer.parseInt(gmsVersion.replaceAll('\\.', ''))
def gitVersionBase = execResult('git', 'describe', '--tags', '--abbrev=0', '--match=v[0-9]*').substring(1)
def gitCommitCount = Integer.parseInt(execResult('git', 'rev-list', '--count', "v$gitVersionBase..HEAD"))
......
......@@ -9,6 +9,9 @@ import com.google.android.gms.auth.AccountChangeEventsRequest;
interface IAuthManagerService {
Bundle getToken(String accountName, String scope, in Bundle extras) = 0;
Bundle clearToken(String token, in Bundle extras) = 1;
AccountChangeEventsResponse getChangeEvents(in AccountChangeEventsRequest request) = 2;
AccountChangeEventsResponse getChangeEvents(in AccountChangeEventsRequest request) = 2;
Bundle getTokenWithAccount(in Account account, String scope, in Bundle extras) = 4;
Bundle getAccounts(in Bundle extras) = 5;
Bundle removeAccount(in Account account) = 6;
Bundle requestGoogleAccountsAccess(String packageName) = 7;
}
......@@ -3,8 +3,12 @@ package com.google.android.gms.dynamite;
import com.google.android.gms.dynamic.IObjectWrapper;
interface IDynamiteLoader {
int getModuleVersion(IObjectWrapper context, String moduleId) = 0;
int getModuleVersion2(IObjectWrapper context, String moduleId, boolean updateConfigIfRequired) = 2;
int getModuleVersion(IObjectWrapper wrappedContext, String moduleId) = 0;
int getModuleVersion2(IObjectWrapper wrappedContext, String moduleId, boolean updateConfigIfRequired) = 2;
int getModuleVersion2NoCrashUtils(IObjectWrapper wrappedContext, String moduleId, boolean updateConfigIfRequired) = 4;
IObjectWrapper createModuleContext(IObjectWrapper context, String moduleId, int minVersion) = 1;
}
\ No newline at end of file
IObjectWrapper createModuleContext(IObjectWrapper wrappedContext, String moduleId, int minVersion) = 1;
IObjectWrapper createModuleContextNoCrashUtils(IObjectWrapper wrappedContext, String moduleId, int minVersion) = 3;
int getIDynamiteLoaderVersion() = 5;
}
package com.google.android.gms.tapandpay.internal;
interface ITapAndPayService {
}
......@@ -29,6 +29,8 @@ public class CredentialRequest extends AutoSafeParcelable {
@Field(4)
private CredentialPickerConfig credentialHintPickerConfig;
private CredentialRequest() { }
public CredentialRequest(boolean passwordLoginSupported, String[] accountTypes, CredentialPickerConfig credentialPickerConfig, CredentialPickerConfig credentialHintPickerConfig) {
this.passwordLoginSupported = passwordLoginSupported;
this.accountTypes = accountTypes;
......
......@@ -19,13 +19,13 @@ import java.util.Collection;
*/
@PublicApi
public class IsReadyToPayRequest extends AutoSafeParcelable {
@Field(2)
@Field(value = 2, useDirectList = true)
private ArrayList<Integer> allowedCardNetworks;
@Field(4)
private String unknown4;
@Field(5)
private String unknown5;
@Field(6)
@Field(value = 6, useDirectList = true)
private ArrayList<Integer> allowedPaymentMethods;
@Field(7)
private boolean existingPaymentMethodRequired;
......
......@@ -9,9 +9,9 @@ apply plugin: 'signing'
dependencies {
api project(':play-services-basement')
api "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
implementation "androidx.annotation:annotation:$annotationVersion"
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
}
android {
......
......@@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
import org.microg.gms.common.PublicApi;
@SuppressWarnings({"deprecation", "DeprecatedIsStillUsed"})
@PublicApi
public class CommonStatusCodes {
public static final int SUCCESS_CACHE = -1;
......
package org.microg.gms.settings
import android.content.ContentValues
import android.content.Context
import android.database.Cursor
import android.net.Uri
object SettingsContract {
const val AUTHORITY = "org.microg.gms.settings"
val AUTHORITY_URI: Uri = Uri.parse("content://$AUTHORITY")
object CheckIn {
private const val id = "check-in"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
const val ENABLED = "checkin_enable_service"
const val ANDROID_ID = "androidId"
const val DIGEST = "digest"
const val LAST_CHECK_IN = "lastCheckin"
const val SECURITY_TOKEN = "securityToken"
const val VERSION_INFO = "versionInfo"
const val DEVICE_DATA_VERSION_INFO = "deviceDataVersionInfo"
val PROJECTION = arrayOf(
ENABLED,
ANDROID_ID,
DIGEST,
LAST_CHECK_IN,
SECURITY_TOKEN,
VERSION_INFO,
DEVICE_DATA_VERSION_INFO,
)
const val PREFERENCES_NAME = "checkin"
const val INITIAL_DIGEST = "1-929a0dca0eee55513280171a8585da7dcd3700f8"
}
object Gcm {
private const val id = "gcm"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
const val FULL_LOG = "gcm_full_log"
const val LAST_PERSISTENT_ID = "gcm_last_persistent_id"
const val CONFIRM_NEW_APPS = "gcm_confirm_new_apps"
const val ENABLE_GCM = "gcm_enable_mcs_service"
const val NETWORK_MOBILE = "gcm_network_mobile"
const val NETWORK_WIFI = "gcm_network_wifi"
const val NETWORK_ROAMING = "gcm_network_roaming"
const val NETWORK_OTHER = "gcm_network_other"
const val LEARNT_MOBILE = "gcm_learnt_mobile"
const val LEARNT_WIFI = "gcm_learnt_wifi"
const val LEARNT_OTHER = "gcm_learnt_other"
val PROJECTION = arrayOf(
FULL_LOG,
LAST_PERSISTENT_ID,
CONFIRM_NEW_APPS,
ENABLE_GCM,
NETWORK_MOBILE,
NETWORK_WIFI,
NETWORK_ROAMING,
NETWORK_OTHER,
LEARNT_MOBILE,
LEARNT_WIFI,
LEARNT_OTHER,
)
}
object Auth {
private const val id = "auth"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
const val TRUST_GOOGLE = "auth_manager_trust_google"
const val VISIBLE = "auth_manager_visible"
val PROJECTION = arrayOf(
TRUST_GOOGLE,
VISIBLE,
)
}
object Exposure {
private const val id = "exposureNotification"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
const val SCANNER_ENABLED = "exposure_scanner_enabled"
const val LAST_CLEANUP = "exposure_last_cleanup"
val PROJECTION = arrayOf(
SCANNER_ENABLED,
LAST_CLEANUP,
)
}
object SafetyNet {
private const val id = "safety-net"
val CONTENT_URI: Uri = Uri.withAppendedPath(AUTHORITY_URI, id)
const val CONTENT_TYPE = "vnd.android.cursor.item/vnd.$AUTHORITY.$id"
}
fun <T> getSettings(context: Context, uri: Uri, projection: Array<out String>?, f: (Cursor) -> T): T {
context.contentResolver.query(uri, projection, null, null, null).use { c ->
require(c != null) { "Cursor for query $uri ${projection?.toList()} was null" }
if (!c.moveToFirst()) error("Cursor for query $uri ${projection?.toList()} was empty")
return f.invoke(c)
}
}
fun setSettings(context: Context, uri: Uri, v: ContentValues.() -> Unit) {
val values = ContentValues().apply { v.invoke(this) }
val affected = context.contentResolver.update(uri, values, null, null)
require(affected == 1) { "Update for $uri with $values affected 0 rows"}
}
}
......@@ -43,10 +43,13 @@ dependencies {
implementation project(':play-services-base-core')
implementation project(':play-services-base-core-ui')
implementation project(':play-services-conscrypt-provider-core')
implementation project(':play-services-cronet-core')
implementation project(':play-services-location-core')
implementation project(':play-services-vision-core')
withNearbyImplementation project(':play-services-nearby-core')
withNearbyImplementation project(':play-services-nearby-core-ui')
implementation project(':play-services-tapandpay-core')
implementation project(':play-services-vision-core')
implementation project(':play-services-core-proto')
implementation project(':play-services-core:microg-ui-tools') // deprecated
implementation project(':play-services-api')
......
......@@ -114,6 +114,7 @@
android:fullBackupOnly="true"
android:extractNativeLibs="false"
android:forceQueryable="true"
android:persistent="true"
android:icon="@mipmap/ic_core_service_app"
android:label="@string/gms_app_name"
android:theme="@style/Theme.AppCompat.DayNight">
......@@ -128,6 +129,13 @@
android:exported="true"
android:permission="org.microg.gms.PROVISION" />
<!-- Internal Settings -->
<provider
android:name="org.microg.gms.settings.SettingsProvider"
android:authorities="org.microg.gms.settings"
android:exported="false" />
<!-- Location -->
<activity
......@@ -197,8 +205,6 @@
</intent-filter>
</service>
<receiver android:name="org.microg.gms.checkin.ServiceInfoReceiver" />
<receiver android:name="org.microg.gms.checkin.TriggerReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
......@@ -422,7 +428,7 @@
android:exported="true" />
<activity
android:name="org.microg.gms.ui.CredentialPickerActivity"
android:name="org.microg.gms.auth.CredentialPickerActivity"
android:process=":ui">
<intent-filter>
<action android:name="com.google.android.gms.auth.api.credentials.PICKER" />
......@@ -430,6 +436,12 @@
</intent-filter>
</activity>
<service android:name="org.microg.gms.auth.CredentialsService">
<intent-filter>
<action android:name="com.google.android.gms.auth.api.credentials.service.START" />
</intent-filter>
</service>
<!-- Games -->
<service android:name="org.microg.gms.games.GamesStubService">
......@@ -463,6 +475,12 @@
android:authorities="com.google.android.gms.chimera"
android:exported="true" />
<!-- Fonts -->
<provider
android:name="org.microg.gms.fonts.FontsProvider"
android:authorities="com.google.android.gms.fonts"
android:exported="true"/>
<!-- microG Settings shown in Launcher -->
<activity
android:name="org.microg.gms.ui.SettingsActivity"
......@@ -675,11 +693,6 @@
<action android:name="com.google.android.gms.wallet.service.BIND" />
</intent-filter>
</service>
<service android:name="org.microg.gms.tapandpay.TapAndPayService">
<intent-filter>
<action android:name="com.google.android.gms.tapandpay.service.BIND" />
</intent-filter>
</service>
<service android:name="org.microg.gms.cast.CastDeviceControllerService">
<intent-filter>
......@@ -733,7 +746,6 @@
<action android:name="com.google.android.gms.audiomodem.service.AudioModemService.START" />
<action android:name="com.google.android.gms.nearby.sharing.service.NearbySharingService.START" />
<action android:name="com.google.android.gms.herrevad.services.LightweightNetworkQualityAndroidService.START" />
<action android:name="com.google.android.gms.auth.api.credentials.service.START" />
<action android:name="com.google.android.gms.gass.START" />
<action android:name="com.google.android.gms.audit.service.START" />
</intent-filter>
......
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.chimera.container;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Process;
import android.util.Log;
import androidx.annotation.RequiresApi;
import org.microg.gms.common.Constants;
import java.io.File;
import dalvik.system.PathClassLoader;
public class DynamiteContext extends ContextWrapper {
private static final String TAG = "DynamiteContext";
private DynamiteModuleInfo moduleInfo;
private Context originalContext;
private Context gmsContext;
private DynamiteContext appContext;
private ClassLoader classLoader;
public DynamiteContext(DynamiteModuleInfo moduleInfo, Context base, Context gmsContext, DynamiteContext appContext) {
super(base);
this.moduleInfo = moduleInfo;
this.originalContext = base;
this.gmsContext = gmsContext;
this.appContext = appContext;
}
@Override
public ClassLoader getClassLoader() {
if (classLoader == null) {
StringBuilder nativeLoaderDirs = new StringBuilder(gmsContext.getApplicationInfo().nativeLibraryDir);
if (Build.VERSION.SDK_INT >= 23 && Process.is64Bit()) {
for (String abi : Build.SUPPORTED_64_BIT_ABIS) {
nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
}
} else if (Build.VERSION.SDK_INT >= 21) {
for (String abi : Build.SUPPORTED_32_BIT_ABIS) {
nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(abi);
}
} else {
nativeLoaderDirs.append(File.pathSeparator).append(gmsContext.getApplicationInfo().sourceDir).append("!/lib/").append(Build.CPU_ABI);
}
classLoader = new PathClassLoader(gmsContext.getApplicationInfo().sourceDir, nativeLoaderDirs.toString(), new FilteredClassLoader(originalContext.getClassLoader(), moduleInfo.getMergedClasses(), moduleInfo.getMergedPackages()));
}
return classLoader;
}
@Override
public String getPackageName() {
return gmsContext.getPackageName();
}
@Override
public ApplicationInfo getApplicationInfo() {
return gmsContext.getApplicationInfo();
}
@Override
public Context getApplicationContext() {
return appContext;
}
@RequiresApi(24)
@Override
public Context createDeviceProtectedStorageContext() {
return new DynamiteContext(moduleInfo, originalContext.createDeviceProtectedStorageContext(), gmsContext.createDeviceProtectedStorageContext(), appContext);
}
public static DynamiteContext create(String moduleId, Context originalContext) {
try {
DynamiteModuleInfo moduleInfo = new DynamiteModuleInfo(moduleId);
Context gmsContext = originalContext.createPackageContext(Constants.GMS_PACKAGE_NAME, 0);
Context originalAppContext = originalContext.getApplicationContext();
if (originalAppContext == null || originalAppContext == originalContext) {
return new DynamiteContext(moduleInfo, originalContext, gmsContext, null);
} else {
return new DynamiteContext(moduleInfo, originalContext, gmsContext, new DynamiteContext(moduleInfo, originalAppContext, gmsContext, null));
}
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, e);
return null;
}
}
}
......@@ -35,28 +35,41 @@ public class DynamiteLoaderImpl extends IDynamiteLoader.Stub {
@Override
public IObjectWrapper createModuleContext(IObjectWrapper wrappedContext, String moduleId, int minVersion) throws RemoteException {
// We don't have crash utils, so just forward
return createModuleContextNoCrashUtils(wrappedContext, moduleId, minVersion);
}
@Override
public IObjectWrapper createModuleContextNoCrashUtils(IObjectWrapper wrappedContext, String moduleId, int minVersion) throws RemoteException {
Log.d(TAG, "createModuleContext for " + moduleId + " at version " + minVersion);
final Context context = (Context) ObjectWrapper.unwrap(wrappedContext);
try {
return ObjectWrapper.wrap(new ContextWrapper(context.createPackageContext(Constants.GMS_PACKAGE_NAME, Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY)) {
@Override
public Context getApplicationContext() {
return context;
}
});
} catch (PackageManager.NameNotFoundException e) {
Log.w(TAG, "returning null instead", e);
return null;
}
final Context originalContext = (Context) ObjectWrapper.unwrap(wrappedContext);
return ObjectWrapper.wrap(DynamiteContext.create(moduleId, originalContext));
}
@Override
public int getModuleVersion(IObjectWrapper context, String moduleId) throws RemoteException {
return getModuleVersion2(context, moduleId, true);
public int getIDynamiteLoaderVersion() throws RemoteException {
return 2;
}
@Override
public int getModuleVersion2(IObjectWrapper context, String moduleId, boolean updateConfigIfRequired) throws RemoteException {
public int getModuleVersion(IObjectWrapper wrappedContext, String moduleId) throws RemoteException {
return getModuleVersion2(wrappedContext, moduleId, true);
}
@Override
public int getModuleVersion2(IObjectWrapper wrappedContext, String moduleId, boolean updateConfigIfRequired) throws RemoteException {
// We don't have crash utils, so just forward
return getModuleVersion2NoCrashUtils(wrappedContext, moduleId, updateConfigIfRequired);
}
@Override
public int getModuleVersion2NoCrashUtils(IObjectWrapper wrappedContext, String moduleId, boolean updateConfigIfRequired) throws RemoteException {
final Context context = (Context) ObjectWrapper.unwrap(wrappedContext);
if (context == null) {
Log.w(TAG, "Invalid client context");
return 0;
}
try {
return Class.forName("com.google.android.gms.dynamite.descriptors." + moduleId + ".ModuleDescriptor").getDeclaredField("MODULE_VERSION").getInt(null);
} catch (Exception e) {
......
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.chimera.container;
import java.util.Collection;
import java.util.Collections;
import static android.content.Context.CONTEXT_IGNORE_SECURITY;
import static android.content.Context.CONTEXT_INCLUDE_CODE;
public class DynamiteModuleInfo {
private Class<?> descriptor;
private String moduleId;
public DynamiteModuleInfo(String moduleId) {
this.moduleId = moduleId;
try {
this.descriptor = Class.forName("com.google.android.gms.dynamite.descriptors." + moduleId + ".ModuleDescriptor");
} catch (Exception e) {
// Ignore
}
}
public String getModuleId() {
return moduleId;
}
public int getVersion() {
try {
return descriptor.getDeclaredField("MODULE_VERSION").getInt(null);
} catch (Exception e) {
return 0;
}
}
public Collection<String> getMergedPackages() {
try {
return (Collection<String>) descriptor.getDeclaredField("MERGED_PACKAGES").get(null);
} catch (Exception e) {
return Collections.emptySet();
}
}
public Collection<String> getMergedClasses() {
try {
return (Collection<String>) descriptor.getDeclaredField("MERGED_CLASSES").get(null);
} catch (Exception e) {
return Collections.emptySet();
}
}
}
/*
* SPDX-FileCopyrightText: 2021, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package com.google.android.gms.chimera.container;
import android.util.Log;
import java.util.Collection;
import java.util.HashSet;
public class FilteredClassLoader extends ClassLoader {
private static ClassLoader rootClassLoader;
private final Collection<String> allowedClasses;
private final Collection<String> allowedPackages;
static {
rootClassLoader = ClassLoader.getSystemClassLoader();
if (rootClassLoader == null) {
rootClassLoader = FilteredClassLoader.class.getClassLoader();
while (rootClassLoader.getParent() != null) {
rootClassLoader = rootClassLoader.getParent();
}
}
}
public FilteredClassLoader(ClassLoader parent, Collection<String> allowedClasses, Collection<String> allowedPackages) {
super(parent);
this.allowedClasses = new HashSet<>(allowedClasses);
this.allowedPackages = new HashSet<>(allowedPackages);
}
private String getPackageName(String name) {
int lastIndex = name.lastIndexOf(".");