0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-11-14 15:05:06 +00:00

Merge pull request #118 from Oizaro/master

Update to latest upstream
This commit is contained in:
KevinX8 2021-03-22 10:58:22 +00:00 committed by GitHub
commit 7088a0da2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 48 additions and 111 deletions

View file

@ -35,7 +35,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
}
@ -45,8 +45,8 @@ allprojects {
apply plugin: 'idea'
group = 'org.microg.gms'
version = "0.2.18.210390"
ext.appVersionCode = 210390001
version = "0.2.18.210500"
ext.appVersionCode = 210500001
ext.isReleaseVersion = false
}

View file

@ -163,6 +163,19 @@ public class GoogleApiAvailability {
return SUCCESS;
}
/**
* Verifies that Google Play services is installed and enabled on this device, and that the version installed on
* this device is no older than the one required by this client or the version is not older than the one specified
* in <code>minApkVersion</code>.
*
* @return status code indicating whether there was an error. Can be one of following in
* {@link ConnectionResult}: SUCCESS, SERVICE_MISSING, SERVICE_UPDATING,
* SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED, SERVICE_INVALID
*/
public int isGooglePlayServicesAvailable(Context context, int minApkVersion) {
return isGooglePlayServicesAvailable(context);
}
/**
* Determines whether an error can be resolved via user action. If true, proceed by calling
* {@link #getErrorDialog(Activity, int, int)} and showing the dialog.

View file

@ -16,7 +16,6 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
api "org.microg:safe-parcel:1.7.0"
@ -41,6 +40,10 @@ android {
buildConfigField "int", "VERSION_CODE", "$appVersionCode"
}
buildFeatures {
viewBinding = true
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

View file

@ -17,7 +17,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
dependencies {
implementation 'com.squareup.wire:wire-runtime:3.6.1'
@ -70,6 +69,7 @@ android {
buildFeatures {
dataBinding = true
viewBinding = true
}
sourceSets {

View file

@ -331,12 +331,6 @@
android:resource="@string/gms_settings_summary" />
</activity-alias>
<activity
android:name="org.microg.gms.ui.AskPushPermission"
android:excludeFromRecents="true"
android:process=":ui"
android:theme="@style/Theme.AppCompat.DayNight.Dialog.Alert.NoActionBar" />
<activity
android:name="org.microg.gms.ui.AboutFragment$AsActivity"
android:label="@string/pref_about_title"

View file

@ -95,7 +95,9 @@ public class CheckinService extends IntentService {
} catch (Exception e) {
Log.w(TAG, e);
} finally {
WakefulBroadcastReceiver.completeWakefulIntent(intent);
if (intent != null) {
WakefulBroadcastReceiver.completeWakefulIntent(intent);
}
schedule(this);
stopSelf();
}

View file

@ -1,17 +1,6 @@
/*
* Copyright (C) 2013-2017 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.
* SPDX-FileCopyrightText: 2016, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
package org.microg.gms.gcm;
@ -81,13 +70,13 @@ public class GcmDatabase extends SQLiteOpenHelper {
public final boolean wakeForDelivery;
private App(Cursor cursor) {
packageName = cursor.getString(cursor.getColumnIndex(FIELD_PACKAGE_NAME));
lastError = cursor.getString(cursor.getColumnIndex(FIELD_LAST_ERROR));
lastMessageTimestamp = cursor.getLong(cursor.getColumnIndex(FIELD_LAST_MESSAGE_TIMESTAMP));
totalMessageCount = cursor.getLong(cursor.getColumnIndex(FIELD_TOTAL_MESSAGE_COUNT));
totalMessageBytes = cursor.getLong(cursor.getColumnIndex(FIELD_TOTAL_MESSAGE_BYTES));
allowRegister = cursor.getLong(cursor.getColumnIndex(FIELD_ALLOW_REGISTER)) == 1;
wakeForDelivery = cursor.getLong(cursor.getColumnIndex(FIELD_WAKE_FOR_DELIVERY)) == 1;
packageName = cursor.getString(cursor.getColumnIndexOrThrow(FIELD_PACKAGE_NAME));
lastError = cursor.getString(cursor.getColumnIndexOrThrow(FIELD_LAST_ERROR));
lastMessageTimestamp = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_LAST_MESSAGE_TIMESTAMP));
totalMessageCount = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_TOTAL_MESSAGE_COUNT));
totalMessageBytes = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_TOTAL_MESSAGE_BYTES));
allowRegister = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_ALLOW_REGISTER)) == 1;
wakeForDelivery = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_WAKE_FOR_DELIVERY)) == 1;
}
public boolean hasError() {
@ -102,10 +91,10 @@ public class GcmDatabase extends SQLiteOpenHelper {
public final String registerId;
public Registration(Cursor cursor) {
packageName = cursor.getString(cursor.getColumnIndex(FIELD_PACKAGE_NAME));
signature = cursor.getString(cursor.getColumnIndex(FIELD_SIGNATURE));
timestamp = cursor.getLong(cursor.getColumnIndex(FIELD_TIMESTAMP));
registerId = cursor.getString(cursor.getColumnIndex(FIELD_REGISTER_ID));
packageName = cursor.getString(cursor.getColumnIndexOrThrow(FIELD_PACKAGE_NAME));
signature = cursor.getString(cursor.getColumnIndexOrThrow(FIELD_SIGNATURE));
timestamp = cursor.getLong(cursor.getColumnIndexOrThrow(FIELD_TIMESTAMP));
registerId = cursor.getString(cursor.getColumnIndexOrThrow(FIELD_REGISTER_ID));
}
}

View file

@ -320,7 +320,7 @@ public class McsService extends Service implements Handler.Callback {
WakefulBroadcastReceiver.completeWakefulIntent(intent);
} else if (connectIntent == null) {
connectIntent = intent;
} else {
} else if (intent != null) {
WakefulBroadcastReceiver.completeWakefulIntent(intent);
}
}

View file

@ -42,13 +42,13 @@ public class PeopleManager {
public static final String USERINFO_URL = "https://www.googleapis.com/oauth2/v1/userinfo";
public static final String REGEX_SEARCH_USER_PHOTO = "https?\\:\\/\\/lh([0-9]*)\\.googleusercontent\\.com/";
public static File getOwnerAvaterFile(Context context, String accountName, boolean network) {
public static File getOwnerAvatarFile(Context context, String accountName, boolean network) {
DatabaseHelper databaseHelper = new DatabaseHelper(context);
Cursor cursor = databaseHelper.getOwner(accountName);
String url = null;
if (cursor.moveToNext()) {
int idx = cursor.getColumnIndex("avatar");
if (!cursor.isNull(idx)) url = cursor.getString(idx);
if (idx >= 0 && !cursor.isNull(idx)) url = cursor.getString(idx);
}
cursor.close();
databaseHelper.close();
@ -75,7 +75,7 @@ public class PeopleManager {
}
public static Bitmap getOwnerAvatarBitmap(Context context, String accountName, boolean network) {
File avaterFile = getOwnerAvaterFile(context, accountName, network);
File avaterFile = getOwnerAvatarFile(context, accountName, network);
if (avaterFile == null) return null;
return BitmapFactory.decodeFile(avaterFile.getPath());
}

View file

@ -121,7 +121,7 @@ public class PeopleServiceImpl extends IPeopleService.Stub {
extras.putBoolean("rewindable", false);
extras.putInt("width", 0);
extras.putInt("height", 0);
File avaterFile = PeopleManager.getOwnerAvaterFile(context, account, true);
File avaterFile = PeopleManager.getOwnerAvatarFile(context, account, true);
try {
ParcelFileDescriptor fileDescriptor = null;
if (avaterFile != null) {

View file

@ -1,64 +0,0 @@
package org.microg.gms.ui;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.ResultReceiver;
import android.text.Html;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import com.mgoogle.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;
import org.microg.gms.gcm.PushRegisterService;
import static org.microg.gms.gcm.GcmConstants.EXTRA_APP;
import static org.microg.gms.gcm.GcmConstants.EXTRA_KID;
import static org.microg.gms.gcm.GcmConstants.EXTRA_PENDING_INTENT;
public class AskPushPermission extends FragmentActivity {
public static final String EXTRA_REQUESTED_PACKAGE = "package";
public static final String EXTRA_RESULT_RECEIVER = "receiver";
public static final String EXTRA_EXPLICIT = "explicit";
private GcmDatabase database;
private String packageName;
private ResultReceiver resultReceiver;
private boolean answered;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
database = new GcmDatabase(this);
packageName = getIntent().getStringExtra(EXTRA_REQUESTED_PACKAGE);
resultReceiver = getIntent().getParcelableExtra(EXTRA_RESULT_RECEIVER);
if (packageName == null || resultReceiver == null) {
answered = true;
finish();
return;
}
if (database.getApp(packageName) != null) {
resultReceiver.send(Activity.RESULT_OK, Bundle.EMPTY);
answered = true;
finish();
return;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (!answered) {
resultReceiver.send(Activity.RESULT_CANCELED, Bundle.EMPTY);
}
database.close();
}
}

View file

@ -24,7 +24,6 @@ import org.microg.gms.common.ForegroundServiceContext
import org.microg.gms.common.PackageUtils
import org.microg.gms.common.Utils
import org.microg.gms.gcm.GcmConstants.*
import org.microg.gms.ui.AskPushPermission
import java.util.concurrent.atomic.AtomicBoolean
import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
@ -97,11 +96,12 @@ class PushRegisterService : LifecycleService() {
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
WakefulBroadcastReceiver.completeWakefulIntent(intent)
Log.d(TAG, "onStartCommand: $intent")
lifecycleScope.launchWhenStarted {
if (intent == null) return@launchWhenStarted
handleIntent(intent)
if (intent != null) {
WakefulBroadcastReceiver.completeWakefulIntent(intent)
Log.d(TAG, "onStartCommand: $intent")
lifecycleScope.launchWhenStarted {
handleIntent(intent)
}
}
return super.onStartCommand(intent, flags, startId)
}