Commit 0047182d authored by Romain Hunault's avatar Romain Hunault
Browse files

Merge branch 'sprint_cordoba' into 'master'

[RELEASE] Sprint cordoba

See merge request e/apps/GmsCore!5
parents c0817e8e 912af072
Pipeline #34300 passed with stage
in 5 minutes
......@@ -25,11 +25,11 @@ build:
script:
- git submodule update --recursive --init
- echo sdk.dir $ANDROID_HOME > local.properties
- echo mapbox.key $MAPBOX_KEY >> local.properties
- echo mapbox.enabled true >> local.properties
- export TERM=dumb
- export JAVA_OPTS="-XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx2048m"
- ./gradlew build
only:
- tags
- ./gradlew assemble
artifacts:
paths:
- play-services-core/build/outputs/apk/
......@@ -10,7 +10,7 @@ android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- build-tools-29.0.2
- android-27
- android-28
- extra-android-m2repository
......@@ -21,7 +21,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
......@@ -29,7 +29,7 @@ buildscript {
allprojects {
apply plugin: 'idea'
ext.androidBuildVersionTools = "28.0.3"
ext.androidBuildVersionTools = "29.0.2"
ext.supportLibraryVersion = "28.0.0"
ext.isReleaseVersion = false
ext.slf4jVersion = "1.7.25"
......@@ -37,7 +37,7 @@ allprojects {
def androidCompileSdk() { return 28 }
def androidTargetSdk() { return 28 }
def androidTargetSdk() { return 29 }
def androidMinSdk() { return 14 }
......
Subproject commit 51509859ae51097ad5789ba4ca2e9ffb9658f80e
Subproject commit 2a43448e49dc0aec0d6c53c8a27dd58245fdaba6
Subproject commit 39d20ec1f28bcc4b134d76f43296bad587362c69
Subproject commit 15cd4491bcca57d627796b35b69bdf8c97564792
android.useDeprecatedNdk=true
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
......@@ -30,7 +30,7 @@ dependencies {
implementation "com.squareup.wire:wire-runtime:1.6.1"
implementation "com.takisoft.fix:preference-v7:$supportLibraryVersion.0"
implementation "de.hdodenhof:circleimageview:1.3.0"
implementation "org.conscrypt:conscrypt-android:2.0.0"
implementation "org.conscrypt:conscrypt-android:2.1.0"
// TODO: Switch to upstream once raw requests are merged
// https://github.com/vitalidze/chromecast-java-api-v2/pull/99
// implementation "su.litvak.chromecast:api-v2:0.10.4"
......@@ -65,7 +65,7 @@ def execResult(...args) {
return stdout.toString().trim()
}
def gmsVersion = "17.7.85"
def gmsVersion = "19.4.20"
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"))
......@@ -74,7 +74,7 @@ def gitDirty = execResult('git', 'status', '--porcelain').size() > 0
def ourVersionBase = gitVersionBase.substring(0, gitVersionBase.lastIndexOf('.'))
def ourVersionMinor = Integer.parseInt(ourVersionBase.substring(ourVersionBase.lastIndexOf('.') + 1))
def ourVersionCode = gmsVersionCode * 1000 + ourVersionMinor * 2 + (gitCommitCount > 0 || gitDirty ? 1 : 0)
def ourVersionName = "$ourVersionBase.$gmsVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (useMapbox() ? "-mapbox" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
def ourVersionName = "$ourVersionBase.$gmsVersionCode" + (gitCommitCount > 0 && !gitDirty ? "-$gitCommitCount" : "") + (gitDirty ? "-dirty" : "") + (useMapbox() ? "" : "-vtm") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
logger.lifecycle('Starting build for version {} ({})...', ourVersionName, ourVersionCode)
android {
......
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2013-2017 microG Project Team
~ Copyright (C) 2013-2019 microG Project Team
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
......@@ -78,6 +78,9 @@
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.READ_SYNC_STATS"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
......@@ -90,7 +93,9 @@
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST" tools:ignore="ProtectedPermissions"/>
<uses-permission
android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"
tools:ignore="ProtectedPermissions"/>
<uses-sdk tools:overrideLibrary="
com.takisoft.fix.support.v7.preference,
......@@ -100,14 +105,14 @@
android.arch.lifecycle.viewmodel,
android.arch.core,
android.support.v7.mediarouter,
android.support.v7.palette" />
android.support.v7.palette"/>
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="false"
android:extractNativeLibs="false"
android:icon="@mipmap/ic_core_service_app"
android:label="@string/gms_app_name"
android:name="android.support.multidex.MultiDexApplication">
android:label="@string/gms_app_name">
<meta-data
android:name="fake-signature"
android:value="@string/fake_signature"/>
......@@ -405,7 +410,7 @@
<service android:name="com.google.android.gms.cast.media.CastMediaRouteProviderService">
<intent-filter>
<action android:name="android.media.MediaRouteProviderService" />
<action android:name="android.media.MediaRouteProviderService"/>
</intent-filter>
</service>
......@@ -421,8 +426,8 @@
<activity
android:name="org.microg.gms.ui.SettingsActivity"
android:icon="@mipmap/ic_microg_settings"
android:roundIcon="@mipmap/ic_microg_settings"
android:label="@string/gms_settings_name"
android:roundIcon="@mipmap/ic_microg_settings"
android:theme="@style/Theme.AppCompat.Settings.Dashboard">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......@@ -438,16 +443,23 @@
<!-- microG Settings embedded in System Settings on SDK 23 and newer -->
<activity-alias
android:name="org.microg.gms.ui.SettingsActivityLink"
android:targetActivity="org.microg.gms.ui.SettingsActivity"
android:icon="@drawable/microg_light_color_24"
android:label="@string/gms_settings_name"
android:targetActivity="org.microg.gms.ui.SettingsActivity"
android:theme="@style/Theme.AppCompat.Settings.Dashboard">
<intent-filter>
<action android:name="com.android.settings.action.EXTRA_SETTINGS"/>
</intent-filter>
<meta-data android:name="com.android.settings.category" android:value="com.android.settings.category.device"/>
<meta-data android:name="com.android.settings.icon" android:resource="@drawable/microg_light_color_24"/>
<meta-data android:name="com.android.settings.summary" android:resource="@string/gms_settings_summary"/>
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.device"/>
<meta-data
android:name="com.android.settings.icon"
android:resource="@drawable/microg_light_color_24"/>
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/gms_settings_summary"/>
</activity-alias>
<activity
......@@ -627,6 +639,11 @@
<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>
......
......@@ -66,6 +66,10 @@ public class DynamiteLoaderImpl extends IDynamiteLoader.Stub {
Log.d(TAG, "returning temp fix module version for " + moduleId + ". Cast API wil not be functional!");
return 1;
}
if (moduleId.equals("com.google.android.gms.maps_dynamite")) {
Log.d(TAG, "returning v1 for maps");
return 1;
}
Log.d(TAG, "unimplemented Method: getModuleVersion for " + moduleId);
return 0;
}
......
......@@ -16,6 +16,7 @@
package com.google.android.gms.common;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.support.annotation.Keep;
import android.util.Log;
......@@ -55,6 +56,14 @@ public class GoogleCertificatesImpl extends IGoogleCertificatesApi.Stub {
@Override
public boolean isGoogleOrPlatformSigned(GoogleCertificatesQuery query, IObjectWrapper packageManager) throws RemoteException {
return PackageUtils.isGooglePackage(query.getPackageName(), query.getCertData().getBytes());
PackageManager pm = ObjectWrapper.unwrapTyped(packageManager, PackageManager.class);
if (query == null || query.getPackageName() == null) {
return false;
} else if (query.getCertData() == null) {
if (pm == null) return false;
return PackageUtils.isGooglePackage(pm, query.getPackageName());
} else {
return PackageUtils.isGooglePackage(query.getPackageName(), query.getCertData().getBytes());
}
}
}
......@@ -34,9 +34,10 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.Security;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
......@@ -45,7 +46,7 @@ import javax.net.ssl.SSLContext;
public class ProviderInstallerImpl {
private static final String TAG = "GmsProviderInstaller";
private static final List<String> DISABLED = Collections.singletonList("com.discord");
private static final List<String> DISABLED = Collections.unmodifiableList(Arrays.asList("com.discord", "com.bankid.bus"));
public static void insertProvider(Context context) {
String packageName = PackageUtils.packageFromProcessId(context, Process.myPid());
......@@ -86,13 +87,57 @@ public class ProviderInstallerImpl {
System.load(cacheFile.getAbsolutePath());
Class<NativeCrypto> clazz = NativeCrypto.class;
Field loadError = clazz.getDeclaredField("loadError");
loadError.setAccessible(true);
loadError.set(null, null);
Method clinit =clazz.getDeclaredMethod("clinit");
Method clinit = clazz.getDeclaredMethod("clinit");
clinit.setAccessible(true);
Method get_cipher_names = clazz.getDeclaredMethod("get_cipher_names", String.class);
get_cipher_names.setAccessible(true);
Method cipherSuiteToJava = clazz.getDeclaredMethod("cipherSuiteToJava", String.class);
cipherSuiteToJava.setAccessible(true);
Method EVP_has_aes_hardware = clazz.getDeclaredMethod("EVP_has_aes_hardware");
EVP_has_aes_hardware.setAccessible(true);
Field f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_TLS_1_2_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_LEGACY_CIPHER_SUITES_SET");
f.setAccessible(true);
Set<String> SUPPORTED_LEGACY_CIPHER_SUITES_SET = (Set<String>) f.get(null);
f = clazz.getDeclaredField("SUPPORTED_TLS_1_2_CIPHER_SUITES");
f.setAccessible(true);
try {
clinit.invoke(null);
String[] allCipherSuites = (String[]) get_cipher_names.invoke(null, "ALL:!DHE");
int size = allCipherSuites.length;
String[] SUPPORTED_TLS_1_2_CIPHER_SUITES = new String[size / 2 + 2];
for (int i = 0; i < size; i += 2) {
String cipherSuite = (String) cipherSuiteToJava.invoke(null, allCipherSuites[i]);
SUPPORTED_TLS_1_2_CIPHER_SUITES[i / 2] = cipherSuite;
SUPPORTED_TLS_1_2_CIPHER_SUITES_SET.add(cipherSuite);
SUPPORTED_LEGACY_CIPHER_SUITES_SET.add(allCipherSuites[i + 1]);
}
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2] = "TLS_EMPTY_RENEGOTIATION_INFO_SCSV";
SUPPORTED_TLS_1_2_CIPHER_SUITES[size / 2 + 1] = "TLS_FALLBACK_SCSV";
f.set(null, SUPPORTED_TLS_1_2_CIPHER_SUITES);
f = clazz.getDeclaredField("HAS_AES_HARDWARE");
f.setAccessible(true);
f.set(null, (int) EVP_has_aes_hardware.invoke(null) == 1);
provider = new OpenSSLProvider("GmsCore_OpenSSL");
} catch (InvocationTargetException inner) {
if (inner.getTargetException() instanceof UnsatisfiedLinkError) {
......
......@@ -17,6 +17,7 @@
package org.microg.gms.auth;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
......@@ -167,6 +168,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
packageName = PackageUtils.getAndCheckCallingPackage(context, packageName, extras.getInt(KEY_CALLER_UID, 0), extras.getInt(KEY_CALLER_PID, 0));
Log.d(TAG, "clearToken: token:" + token + " extras:" + extras);
AccountManager.get(context).invalidateAuthToken(AuthConstants.DEFAULT_ACCOUNT_TYPE, token);
return null;
}
......
......@@ -55,6 +55,7 @@ import org.microg.gms.checkin.CheckinManager;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.HttpFormClient;
import org.microg.gms.common.Utils;
import org.microg.gms.gcm.McsService;
import org.microg.gms.people.PeopleManager;
import java.io.IOException;
......@@ -308,7 +309,12 @@ public class LoginActivity extends AssistantActivity {
@Override
public void onException(Exception exception) {
Log.w(TAG, "onException: " + exception);
Log.w(TAG, "onException", exception);
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setNextButtonText(android.R.string.ok);
});
state = -2;
}
});
}
......@@ -339,7 +345,12 @@ public class LoginActivity extends AssistantActivity {
@Override
public void onException(Exception exception) {
Log.w(TAG, "onException: " + exception);
Log.w(TAG, "onException", exception);
runOnUiThread(() -> {
showError(R.string.auth_general_error_desc);
setNextButtonText(android.R.string.ok);
});
state = -2;
}
});
}
......@@ -347,6 +358,7 @@ public class LoginActivity extends AssistantActivity {
private boolean checkin(boolean force) {
try {
CheckinManager.checkin(LoginActivity.this, force);
McsService.scheduleReconnect(this);
return true;
} catch (IOException e) {
Log.w(TAG, "Checkin failed", e);
......
......@@ -62,6 +62,7 @@ public class PackageUtils {
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.wellbeing", "4ebdd02380f1fa0b6741491f0af35625dba76e9f");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.village.boond", "48e7985b8f901df335b5d5223579c81618431c7b");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.subscriptions.red", "de8304ace744ae4c4e05887a27a790815e610ff0");
KNOWN_GOOGLE_PACKAGES.put("com.google.android.apps.meetings", "47a6936b733dbdb45d71997fbe1d610eca36b8bf");
}
public static boolean isGooglePackage(Context context, String packageName) {
......@@ -69,6 +70,11 @@ public class PackageUtils {
return isGooglePackage(packageName, signatureDigest);
}
public static boolean isGooglePackage(PackageManager packageManager, String packageName) {
String signatureDigest = firstSignatureDigest(packageManager, packageName);
return isGooglePackage(packageName, signatureDigest);
}
public static boolean isGooglePackage(String packageName, byte[] bytes) {
return isGooglePackage(packageName, sha1sum(bytes));
}
......@@ -102,7 +108,11 @@ public class PackageUtils {
@Nullable
public static String firstSignatureDigest(Context context, String packageName) {
PackageManager packageManager = context.getPackageManager();
return firstSignatureDigest(context.getPackageManager(), packageName);
}
@Nullable
public static String firstSignatureDigest(PackageManager packageManager, String packageName) {
final PackageInfo info;
try {
info = packageManager.getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
......
/*
* Copyright (C) 2013-2017 microG Project Team
* Copyright (C) 2013-2019 microG Project Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -66,7 +66,6 @@ public class RemoteListenerProxy<T extends IInterface> implements ServiceConnect
if (!connecting) Log.d(TAG, "Could not connect to: " + intent);
return connecting;
}
Log.d(TAG, "Unable to resolve: " + searchIntent);
return false;
} catch (Exception e) {
Log.w(TAG, e);
......@@ -91,11 +90,17 @@ public class RemoteListenerProxy<T extends IInterface> implements ServiceConnect
synchronized (this) {
remote = service;
if (!waiting.isEmpty()) {
for (Runnable runnable : waiting) {
runnable.run();
try {
for (Runnable runnable : waiting) {
runnable.run();
}
} catch (Exception e) {
}
waiting.clear();
context.unbindService(RemoteListenerProxy.this);
try {
context.unbindService(RemoteListenerProxy.this);
} catch (Exception e) {
}
connecting = false;
remote = null;
}
......
......@@ -307,7 +307,7 @@ public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerServ
public void requestLocationSettingsDialog(LocationSettingsRequest settingsRequest, ISettingsCallbacks callback, String packageName) throws RemoteException {
Log.d(TAG, "requestLocationSettingsDialog: " + settingsRequest);
PackageUtils.getAndCheckCallingPackage(context, packageName);
callback.onLocationSettingsResult(new LocationSettingsResult(new LocationSettingsStates(true, true, false, true, true, false), Status.CANCELED));
callback.onLocationSettingsResult(new LocationSettingsResult(new LocationSettingsStates(true, true, false, true, true, false), Status.SUCCESS));
}
@Override
......
......@@ -16,9 +16,11 @@
package org.microg.gms.people;
import android.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Parcel;
......@@ -26,7 +28,6 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Log;
import com.google.android.gms.R;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.common.internal.ICancelToken;
import com.google.android.gms.people.internal.IPeopleCallbacks;
......@@ -51,7 +52,9 @@ public class PeopleServiceImpl extends IPeopleService.Stub {
@Override
public void loadOwners(final IPeopleCallbacks callbacks, boolean var2, boolean var3, final String accountName, String var5, int sortOrder) {
Log.d(TAG, "loadOwners: " + var2 + ", " + var3 + ", " + accountName + ", " + var5 + ", " + sortOrder);
PackageUtils.assertExtendedAccess(context);
if (context.checkCallingPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
PackageUtils.assertExtendedAccess(context);
}
AccountManager accountManager = AccountManager.get(context);
Bundle accountMetadata = new Bundle();
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
......
/*
* Copyright (C) 2019 microG Project Team
*
* 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 org.microg.gms.tapandpay;
import com.google.android.gms.tapandpay.internal.ITapAndPayService;
import android.os.Parcel;
import android.os.RemoteException;
import android.util.Log;
public class TapAndPayImpl extends ITapAndPayService.Stub {
private static final String TAG = "GmsTapAndPayImpl";
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) return true;
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}
/*
* Copyright (C) 2019 microG Project Team
*
* 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 org.microg.gms.tapandpay;
import android.os.RemoteException;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.internal.GetServiceRequest;
import com.google.android.gms.common.internal.IGmsCallbacks;
import org.microg.gms.BaseService;
import org.microg.gms.common.GmsService;
public class TapAndPayService extends BaseService {
public TapAndPayService() {
super("GmsTapAndPaySvc", GmsService.TAP_AND_PAY);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
callback.onPostInitComplete(CommonStatusCodes.SUCCESS, new TapAndPayImpl(), null);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment