MicroG 0.2.14.204218

This commit is contained in:
Oizaro 2020-12-09 14:36:34 +01:00
parent 1c099bfef8
commit 56806c41f2
9 changed files with 34 additions and 37 deletions

View File

@ -4,7 +4,6 @@
*/
buildscript {
ext.nlpVersion = '2.0-alpha4'
ext.safeParcelVersion = '1.6.0'
ext.kotlinVersion = '1.3.72'
@ -46,8 +45,8 @@ allprojects {
apply plugin: 'idea'
group = 'org.microg.gms'
version = "0.2.14.204216"
ext.appVersionCode = 204215002
version = "0.2.14.204218"
ext.appVersionCode = 204215004
ext.isReleaseVersion = false
}

View File

@ -1,6 +1,6 @@
#Fri Oct 16 00:14:59 CEST 2020
#Wed Dec 09 14:28:25 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

View File

@ -22,7 +22,7 @@ dependencies {
api "org.microg:safe-parcel:$safeParcelVersion"
implementation "androidx.annotation:annotation:$annotationVersion"
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
}
android {

View File

@ -41,11 +41,11 @@ dependencies {
implementation "androidx.mediarouter:mediarouter:1.2.0"
implementation "androidx.preference:preference-ktx:$preferenceVersion"
implementation "androidx.navigation:navigation-fragment-ktx:2.3.1"
implementation "androidx.navigation:navigation-ui-ktx:2.3.1"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
implementation project(path: ':play-services-basement')
api project(':play-services-location-api')

View File

@ -131,7 +131,7 @@ public class ProviderInstallerImpl {
// TODO: Move manual loading into helper function (as it is also used in both maps implementations)
String primaryCpuAbi = (String) ApplicationInfo.class.getField("primaryCpuAbi").get(otherAppInfo);
if (primaryCpuAbi != null) {
String path = "lib/" + primaryCpuAbi + "/libconscrypt_jni.so";
String path = "lib/" + primaryCpuAbi + "/libconscrypt_gmscore_jni.so";
File cacheFile = new File(context.createPackageContext(packageName, 0).getCacheDir().getAbsolutePath() + "/.gmscore/" + path);
cacheFile.getParentFile().mkdirs();
File apkFile = new File(context.getPackageCodePath());
@ -144,7 +144,7 @@ public class ProviderInstallerImpl {
Log.d(TAG, "Can't load native library: " + path + " does not exist in " + apkFile);
}
}
Log.d(TAG, "Loading conscrypt_jni from " + cacheFile.getPath());
Log.d(TAG, "Loading conscrypt_gmscore_jni from " + cacheFile.getPath());
System.load(cacheFile.getAbsolutePath());
Class<NativeCrypto> clazz = NativeCrypto.class;

View File

@ -35,6 +35,7 @@ import org.microg.gms.common.PackageUtils;
import java.util.Arrays;
import static org.microg.gms.auth.AuthConstants.DEFAULT_ACCOUNT_TYPE;
import static org.microg.gms.auth.AuthConstants.PROVIDER_EXTRA_ACCOUNTS;
import static org.microg.gms.auth.AuthConstants.PROVIDER_EXTRA_CLEAR_PASSWORD;
import static org.microg.gms.auth.AuthConstants.PROVIDER_METHOD_CLEAR_PASSWORD;
@ -65,15 +66,20 @@ public class AccountContentProvider extends ContentProvider {
if (getContext().checkCallingPermission(Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED)
throw new SecurityException("Access denied, missing GET_ACCOUNTS or EXTENDED_ACCESS permission");
}
if (PROVIDER_METHOD_GET_ACCOUNTS.equals(method) && AuthConstants.DEFAULT_ACCOUNT_TYPE.equals(arg)) {
if (PROVIDER_METHOD_GET_ACCOUNTS.equals(method)) {
Bundle result = new Bundle();
AccountManager am = AccountManager.get(getContext());
Account[] accounts = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
accounts = am.getAccountsByTypeForPackage(arg, packageName);
if (arg != null && (arg.equals(DEFAULT_ACCOUNT_TYPE) || arg.startsWith(DEFAULT_ACCOUNT_TYPE + "."))) {
AccountManager am = AccountManager.get(getContext());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
accounts = am.getAccountsByTypeForPackage(arg, packageName);
}
if (accounts == null || accounts.length == 0) {
accounts = am.getAccountsByType(arg);
}
}
if (accounts == null || accounts.length == 0) {
accounts = am.getAccountsByType(arg);
if (accounts == null) {
accounts = new Account[0];
}
result.putParcelableArray(PROVIDER_EXTRA_ACCOUNTS, accounts);
return result;

View File

@ -133,6 +133,13 @@ public class AuthManager {
getAccountManager().setUserData(getAccount(), key, value);
}
public boolean accountExists() {
for (Account refAccount : getAccountManager().getAccountsByType(accountType)) {
if (refAccount.name.equalsIgnoreCase(accountName)) return true;
}
return false;
}
public String peekAuthToken() {
Log.d(TAG, "peekAuthToken: " + buildTokenKey());
return getAccountManager().peekAuthToken(getAccount(), buildTokenKey());

View File

@ -93,6 +93,10 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
Bundle result = new Bundle();
result.putString(KEY_ACCOUNT_NAME, accountName);
result.putString(KEY_ACCOUNT_TYPE, authManager.getAccountType());
if (!authManager.accountExists()) {
result.putString(KEY_ERROR, "NetworkError");
return result;
}
try {
AuthResponse res = authManager.requestAuth(false);
if (res.auth != null) {

View File

@ -1,6 +1,5 @@
package org.microg.gms.common;
import android.app.ActivityManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
@ -20,8 +19,6 @@ import androidx.core.app.NotificationCompat;
import com.mgoogle.android.gms.R;
import java.util.List;
public class ForegroundServiceContext extends ContextWrapper {
private static final String TAG = "ForegroundService";
public static final String EXTRA_FOREGROUND = "foreground";
@ -33,8 +30,7 @@ public class ForegroundServiceContext extends ContextWrapper {
@Override
public ComponentName startService(Intent service) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& !isIgnoringBatteryOptimizations()
&& !isAppOnForeground()) {
&& !isIgnoringBatteryOptimizations()) {
Log.d(TAG, "Starting in foreground mode.");
service.putExtra(EXTRA_FOREGROUND, true);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
@ -52,21 +48,6 @@ public class ForegroundServiceContext extends ContextWrapper {
return powerManager.isIgnoringBatteryOptimizations(getPackageName());
}
private boolean isAppOnForeground() {
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
if (appProcesses == null) {
return false;
}
final String packageName = getPackageName();
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
if (appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND && appProcess.processName.equals(packageName)) {
return true;
}
}
return false;
}
public static void completeForegroundService(Service service, Intent intent, String tag) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& intent != null