mirror of https://github.com/YTVanced/VancedMicroG
Pre-preparation for new update
- Bump version. - Automatically fetch versioncode from buildconfig. - Code cleanup.
This commit is contained in:
parent
8bb1d8720c
commit
99635b0f4d
15
.travis.yml
15
.travis.yml
|
@ -1,15 +0,0 @@
|
|||
language: java
|
||||
jdk: openjdk8
|
||||
install:
|
||||
- mkdir $HOME/android-cmdline-tools
|
||||
- curl https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip > $HOME/android-cmdline-tools/cmdline-tools.zip
|
||||
- unzip -qq -n $HOME/android-cmdline-tools/cmdline-tools.zip -d $HOME/android-cmdline-tools
|
||||
- echo y | $HOME/android-cmdline-tools/tools/bin/sdkmanager --sdk_root=$HOME/android-sdk 'platform-tools'
|
||||
- echo y | $HOME/android-cmdline-tools/tools/bin/sdkmanager --sdk_root=$HOME/android-sdk 'build-tools;29.0.3'
|
||||
- echo y | $HOME/android-cmdline-tools/tools/bin/sdkmanager --sdk_root=$HOME/android-sdk 'platforms;android-30'
|
||||
env:
|
||||
- ANDROID_HOME=$HOME/android-sdk TERM=dumb JAVA_OPTS="-Xmx2048m"
|
||||
before_script:
|
||||
- echo sdk.dir $ANDROID_HOME > local.properties
|
||||
script:
|
||||
- ./gradlew --no-daemon build
|
21
build.gradle
21
build.gradle
|
@ -4,24 +4,24 @@
|
|||
*/
|
||||
|
||||
buildscript {
|
||||
ext.safeParcelVersion = '1.6.0'
|
||||
ext.safeParcelVersion = '1.7.0'
|
||||
|
||||
ext.kotlinVersion = '1.3.72'
|
||||
ext.kotlinVersion = '1.4.10'
|
||||
ext.coroutineVersion = '1.3.7'
|
||||
|
||||
ext.annotationVersion = '1.1.0'
|
||||
ext.appcompatVersion = '1.1.0'
|
||||
ext.appcompatVersion = '1.2.0'
|
||||
ext.fragmentVersion = '1.2.5'
|
||||
ext.lifecycleVersion = '2.2.0'
|
||||
ext.mediarouterVersion = '1.1.0'
|
||||
ext.navigationVersion = '2.3.0'
|
||||
ext.mediarouterVersion = '1.2.0'
|
||||
ext.navigationVersion = '2.3.1'
|
||||
ext.preferenceVersion = '1.1.1'
|
||||
ext.recyclerviewVersion = '1.1.0'
|
||||
|
||||
ext.supportLibraryVersion = "28.0.0"
|
||||
ext.wireVersion = '3.2.2'
|
||||
|
||||
ext.androidBuildGradleVersion = "4.0.1"
|
||||
ext.androidBuildGradleVersion = "4.1.0"
|
||||
|
||||
ext.androidBuildVersionTools = "29.0.3"
|
||||
|
||||
|
@ -35,7 +35,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.2'
|
||||
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.16.204713"
|
||||
ext.appVersionCode = 204713001
|
||||
version = "0.2.17.210390"
|
||||
ext.appVersionCode = 210390001
|
||||
ext.isReleaseVersion = false
|
||||
}
|
||||
|
||||
|
@ -55,5 +55,4 @@ subprojects {
|
|||
jcenter()
|
||||
google()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#Sun Dec 27 23:11:46 GMT 2020
|
||||
#Mon Feb 01 05:37:05 CET 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
|
||||
|
|
|
@ -38,4 +38,4 @@ dependencies {
|
|||
api project(':play-services-cast-framework-api')
|
||||
api project(':play-services-iid-api')
|
||||
api project(':play-services-location-api')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -37,4 +37,4 @@ android {
|
|||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,10 +33,11 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.google.android.gms:play-services-base:17.5.0'
|
||||
|
||||
api project(':play-services-basement')
|
||||
api project(':play-services-tasks')
|
||||
api project(':play-services-base-api')
|
||||
|
||||
implementation "androidx.fragment:fragment:$fragmentVersion"
|
||||
implementation 'com.google.android.gms:play-services-base:17.5.0'
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -55,7 +55,7 @@ public class GoogleApiAvailability {
|
|||
/**
|
||||
* Google Play services client library version (declared in library's AndroidManifest.xml android:versionCode).
|
||||
*/
|
||||
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = Constants.MAX_REFERENCE_VERSION;
|
||||
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = Constants.GMS_VERSION_CODE;
|
||||
|
||||
private static GoogleApiAvailability instance;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class GooglePlayServicesUtil {
|
|||
* Google Play services client library version (declared in library's AndroidManifest.xml android:versionCode).
|
||||
*/
|
||||
@Deprecated
|
||||
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = Constants.MAX_REFERENCE_VERSION;
|
||||
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = Constants.GMS_VERSION_CODE;
|
||||
|
||||
/**
|
||||
* Package name for Google Play Store.
|
||||
|
|
|
@ -38,6 +38,7 @@ android {
|
|||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
buildConfigField "int", "VERSION_CODE", "$appVersionCode"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
@ -48,4 +49,4 @@ android {
|
|||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -31,6 +31,7 @@ import java.util.Arrays;
|
|||
|
||||
import kotlin.Suppress;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class GetServiceRequest extends AutoSafeParcelable {
|
||||
@SafeParceled(1)
|
||||
private int versionCode = 3;
|
||||
|
@ -61,12 +62,12 @@ public class GetServiceRequest extends AutoSafeParcelable {
|
|||
|
||||
private GetServiceRequest() {
|
||||
serviceId = -1;
|
||||
gmsVersion = Constants.MAX_REFERENCE_VERSION;
|
||||
gmsVersion = Constants.GMS_VERSION_CODE;
|
||||
}
|
||||
|
||||
public GetServiceRequest(int serviceId) {
|
||||
this.serviceId = serviceId;
|
||||
this.gmsVersion = Constants.MAX_REFERENCE_VERSION;
|
||||
this.gmsVersion = Constants.GMS_VERSION_CODE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,9 +16,13 @@
|
|||
|
||||
package org.microg.gms.common;
|
||||
|
||||
import org.microg.gms.basement.BuildConfig;
|
||||
|
||||
public class Constants {
|
||||
public static final int MAX_REFERENCE_VERSION = 202414 * 1000;
|
||||
public static final int GMS_VERSION_CODE = (BuildConfig.VERSION_CODE / 1000) * 1000;
|
||||
public static final String GMS_PACKAGE_NAME = "com.google.android.gms";
|
||||
public static final String GSF_PACKAGE_NAME = "com.mgoogle.android.gsf";
|
||||
public static final String GMS_PACKAGE_SIGNATURE_SHA1 = "38918a453d07199354f8b19af05ec6562ced5788";
|
||||
@Deprecated
|
||||
public static final int MAX_REFERENCE_VERSION = GMS_VERSION_CODE;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public enum GmsService {
|
|||
LOCATION_REPORTING(22, "com.google.android.gms.location.reporting.service.START", "com.google.android.location.reporting.service.START"),
|
||||
LOCATION_MANAGER(23, "com.google.android.location.internal.GoogleLocationManagerService.START"),
|
||||
PLAY_LOG(24, "com.google.android.gms.playlog.service.START"),
|
||||
DROIDGUARD(25, "com.google.android.gms.droidguard.service.START"),
|
||||
CAST_MIRRORING(27, "com.google.android.gms.cast_mirroring.service.START"),
|
||||
SEARCH_ADMINISTRATION(30),
|
||||
SEARCH_QUERIES(32),
|
||||
|
|
|
@ -37,5 +37,6 @@ android {
|
|||
|
||||
dependencies {
|
||||
api project(':play-services-basement')
|
||||
|
||||
api project(':play-services-base-api')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -16,15 +16,6 @@
|
|||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
String getMyVersionName() {
|
||||
def stdout = new ByteArrayOutputStream()
|
||||
if (rootProject.file("gradlew").exists())
|
||||
exec { commandLine 'git', 'describe', '--tags', '--always', '--dirty'; standardOutput = stdout }
|
||||
else // automatic build system, don't tag dirty
|
||||
exec { commandLine 'git', 'describe', '--tags', '--always'; standardOutput = stdout }
|
||||
return stdout.toString().trim().substring(1)
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
@ -44,4 +35,4 @@ android {
|
|||
dependencies {
|
||||
api project(':play-services-base')
|
||||
api project(':play-services-cast-api')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -16,10 +16,14 @@ wire {
|
|||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += "$buildDir/generated/source/wire"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.jvmTarget = 1.8
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = 1.8
|
||||
}
|
||||
}
|
|
@ -16,21 +16,17 @@
|
|||
|
||||
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.5.0'
|
||||
implementation 'de.hdodenhof:circleimageview:3.1.0'
|
||||
implementation "org.microg.gms:conscrypt-gmscore:2.5.1"
|
||||
implementation "androidx.annotation:annotation:$annotationVersion"
|
||||
// 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"
|
||||
implementation "info.armills.chromecast-java-api-v2:api-v2-raw-request:0.10.4-raw-request-1"
|
||||
|
||||
// Specified manually due to
|
||||
// https://github.com/vitalidze/chromecast-java-api-v2/issues/91
|
||||
|
||||
implementation project(':play-services-core-proto')
|
||||
implementation project(':play-services-core:microg-ui-tools') // deprecated
|
||||
implementation project(':play-services-api')
|
||||
|
@ -38,17 +34,21 @@ dependencies {
|
|||
|
||||
// AndroidX UI
|
||||
implementation "androidx.appcompat:appcompat:1.2.0"
|
||||
implementation "androidx.mediarouter:mediarouter:1.2.0"
|
||||
implementation 'androidx.mediarouter:mediarouter:1.2.1'
|
||||
implementation "androidx.preference:preference-ktx:$preferenceVersion"
|
||||
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
|
||||
|
||||
implementation "org.microg.gms:conscrypt-gmscore:2.5.1"
|
||||
implementation "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
|
||||
|
||||
// Navigation
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
|
||||
implementation project(path: ':play-services-basement')
|
||||
|
||||
api project(':play-services-location-api')
|
||||
api project(':play-services-basement')
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -101,4 +101,4 @@ android {
|
|||
|
||||
if (file('user.gradle').exists()) {
|
||||
apply from: 'user.gradle'
|
||||
}
|
||||
}
|
|
@ -58,7 +58,7 @@ public class AuthRequest extends HttpFormClient.Request {
|
|||
@RequestContent("lang")
|
||||
public String locale;
|
||||
@RequestContent("google_play_services_version")
|
||||
public int gmsVersion = Constants.MAX_REFERENCE_VERSION;
|
||||
public int gmsVersion = Constants.GMS_VERSION_CODE;
|
||||
@RequestContent("accountType")
|
||||
public String accountType;
|
||||
@RequestContent("Email")
|
||||
|
|
|
@ -74,7 +74,7 @@ import static android.view.View.INVISIBLE;
|
|||
import static android.view.View.VISIBLE;
|
||||
import static android.view.inputmethod.InputMethodManager.SHOW_IMPLICIT;
|
||||
import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME;
|
||||
import static org.microg.gms.common.Constants.MAX_REFERENCE_VERSION;
|
||||
import static org.microg.gms.common.Constants.GMS_VERSION_CODE;
|
||||
|
||||
public class LoginActivity extends AssistantActivity {
|
||||
public static final String TMPL_NEW_ACCOUNT = "new_account";
|
||||
|
@ -484,7 +484,7 @@ public class LoginActivity extends AssistantActivity {
|
|||
|
||||
@JavascriptInterface
|
||||
public final int getPlayServicesVersionCode() {
|
||||
return MAX_REFERENCE_VERSION;
|
||||
return GMS_VERSION_CODE;
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
|
|
@ -57,9 +57,9 @@ public class GServicesProvider extends ContentProvider {
|
|||
public boolean onCreate() {
|
||||
if (CheckinPrefs.get(getContext()).isEnabled()) {
|
||||
getContext().sendOrderedBroadcast(new Intent(getContext(), org.microg.gms.checkin.TriggerReceiver.class), null);
|
||||
}
|
||||
if (GcmPrefs.get(getContext()).isEnabled()) {
|
||||
getContext().sendBroadcast(new Intent(org.microg.gms.gcm.TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), org.microg.gms.gcm.TriggerReceiver.class));
|
||||
if (GcmPrefs.get(getContext()).isEnabled()) {
|
||||
getContext().sendBroadcast(new Intent(org.microg.gms.gcm.TriggerReceiver.FORCE_TRY_RECONNECT, null, getContext(), org.microg.gms.gcm.TriggerReceiver.class));
|
||||
}
|
||||
}
|
||||
|
||||
databaseHelper = new DatabaseHelper(getContext());
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
defaultConfig {
|
||||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':play-services-basement')
|
||||
api project(':play-services-base-api')
|
||||
|
||||
implementation "androidx.annotation:annotation:$annotationVersion"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<manifest package="org.microg.gms.droidguard.api"/>
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
parcelable DroidGuardInitReply;
|
|
@ -0,0 +1,3 @@
|
|||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
parcelable DroidGuardResultsRequest;
|
|
@ -0,0 +1,5 @@
|
|||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
interface IDroidGuardCallbacks {
|
||||
void onResult(in byte[] res);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
import com.google.android.gms.droidguard.internal.DroidGuardInitReply;
|
||||
import com.google.android.gms.droidguard.internal.DroidGuardResultsRequest;
|
||||
|
||||
interface IDroidGuardHandle {
|
||||
void init(String flow) = 0;
|
||||
DroidGuardInitReply initWithRequest(String flow, in DroidGuardResultsRequest request) = 4;
|
||||
|
||||
byte[] guard(in Map map) = 1;
|
||||
|
||||
void close() = 2;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardCallbacks;
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardHandle;
|
||||
import com.google.android.gms.droidguard.internal.DroidGuardResultsRequest;
|
||||
|
||||
interface IDroidGuardService {
|
||||
void guard(IDroidGuardCallbacks callbacks, String flow, in Map map) = 0;
|
||||
void guardWithRequest(IDroidGuardCallbacks callbacks, String flow, in Map map, in DroidGuardResultsRequest request) = 3;
|
||||
|
||||
IDroidGuardHandle getHandle() = 1;
|
||||
|
||||
int getClientTimeoutMillis() = 2;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class DroidGuardInitReply implements Parcelable {
|
||||
public ParcelFileDescriptor pfd;
|
||||
public Parcelable object;
|
||||
|
||||
public DroidGuardInitReply(ParcelFileDescriptor pfd, Parcelable object) {
|
||||
this.pfd = pfd;
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return (pfd != null ? Parcelable.CONTENTS_FILE_DESCRIPTOR : 0) | (object != null ? object.describeContents() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(pfd, flags);
|
||||
dest.writeParcelable(object, flags);
|
||||
}
|
||||
|
||||
public final static Creator<DroidGuardInitReply> CREATOR = new Creator<DroidGuardInitReply>() {
|
||||
@Override
|
||||
public DroidGuardInitReply createFromParcel(Parcel source) {
|
||||
ParcelFileDescriptor pfd = source.readParcelable(ParcelFileDescriptor.class.getClassLoader());
|
||||
Parcelable object = source.readParcelable(getClass().getClassLoader());
|
||||
if (pfd != null && object != null) {
|
||||
return new DroidGuardInitReply(pfd, object);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DroidGuardInitReply[] newArray(int size) {
|
||||
return new DroidGuardInitReply[size];
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package com.google.android.gms.droidguard.internal;
|
||||
|
||||
import android.net.Network;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import org.microg.gms.common.Constants;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class DroidGuardResultsRequest extends AutoSafeParcelable {
|
||||
private static final String KEY_APP_ARCHITECTURE = "appArchitecture";
|
||||
private static final String KEY_CLIENT_VERSION = "clientVersion";
|
||||
private static final String KEY_FD = "fd";
|
||||
private static final String KEY_NETWORK_TO_USE = "networkToUse";
|
||||
private static final String KEY_TIMEOUT_MS = "timeoutMs";
|
||||
public static final String KEY_OPEN_HANDLES = "openHandles";
|
||||
|
||||
@Field(2)
|
||||
public Bundle bundle;
|
||||
|
||||
public DroidGuardResultsRequest() {
|
||||
bundle = new Bundle();
|
||||
String arch;
|
||||
try {
|
||||
arch = System.getProperty("os.arch");
|
||||
} catch (Exception ignored) {
|
||||
arch = "?";
|
||||
}
|
||||
bundle.putString(KEY_APP_ARCHITECTURE, arch);
|
||||
setClientVersion(Constants.GMS_VERSION_CODE);
|
||||
}
|
||||
|
||||
public String getAppArchitecture() {
|
||||
return bundle.getString(KEY_APP_ARCHITECTURE);
|
||||
}
|
||||
|
||||
public int getTimeoutMillis() {
|
||||
return bundle.getInt(KEY_TIMEOUT_MS, 60000);
|
||||
}
|
||||
|
||||
public DroidGuardResultsRequest setTimeoutMillis(int millis) {
|
||||
bundle.putInt(KEY_TIMEOUT_MS, millis);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getClientVersion() {
|
||||
return bundle.getInt(KEY_CLIENT_VERSION);
|
||||
}
|
||||
|
||||
public DroidGuardResultsRequest setClientVersion(int clientVersion) {
|
||||
bundle.putInt(KEY_CLIENT_VERSION, clientVersion);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ParcelFileDescriptor getFd() {
|
||||
return bundle.getParcelable(KEY_FD);
|
||||
}
|
||||
|
||||
public DroidGuardResultsRequest setFd(ParcelFileDescriptor fd) {
|
||||
bundle.putParcelable(KEY_FD, fd);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getOpenHandles() {
|
||||
return bundle.getInt(KEY_OPEN_HANDLES);
|
||||
}
|
||||
|
||||
public DroidGuardResultsRequest setOpenHandles(int openHandles) {
|
||||
bundle.putInt(KEY_OPEN_HANDLES, openHandles);
|
||||
return this;
|
||||
}
|
||||
|
||||
@RequiresApi(api = 21)
|
||||
public Network getNetworkToUse() {
|
||||
return bundle.getParcelable(KEY_NETWORK_TO_USE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = 21)
|
||||
public DroidGuardResultsRequest setNetworkToUse(Network networkToUse) {
|
||||
bundle.putParcelable(KEY_NETWORK_TO_USE, networkToUse);
|
||||
return this;
|
||||
}
|
||||
|
||||
public static final Creator<DroidGuardResultsRequest> CREATOR = new AutoCreator<>(DroidGuardResultsRequest.class);
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdk
|
||||
buildToolsVersion "$androidBuildVersionTools"
|
||||
|
||||
defaultConfig {
|
||||
versionName version
|
||||
minSdkVersion androidMinSdk
|
||||
targetSdkVersion androidTargetSdk
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api project(':play-services-base')
|
||||
api project(':play-services-droidguard-api')
|
||||
|
||||
implementation "androidx.annotation:annotation:$annotationVersion"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.21"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<manifest package="org.microg.gms.droidguard"/>
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.droidguard
|
||||
|
||||
import android.content.Context
|
||||
import android.os.IBinder
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardHandle
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardService
|
||||
import org.microg.gms.common.GmsClient
|
||||
import org.microg.gms.common.GmsService
|
||||
import org.microg.gms.common.api.ConnectionCallbacks
|
||||
import org.microg.gms.common.api.OnConnectionFailedListener
|
||||
|
||||
class DroidGuardApiClient(context: Context, connectionCallbacks: ConnectionCallbacks, onConnectionFailedListener: OnConnectionFailedListener) : GmsClient<IDroidGuardService>(context, connectionCallbacks, onConnectionFailedListener, GmsService.DROIDGUARD.ACTION) {
|
||||
init {
|
||||
serviceId = GmsService.DROIDGUARD.SERVICE_ID
|
||||
}
|
||||
|
||||
override fun interfaceFromBinder(binder: IBinder): IDroidGuardService = IDroidGuardService.Stub.asInterface(binder)
|
||||
|
||||
fun getHandle() = serviceInterface.handle
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.droidguard
|
||||
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardHandle
|
||||
import com.google.android.gms.tasks.Task
|
||||
|
||||
interface DroidGuardClient {
|
||||
fun getHandle(): Task<DroidGuardHandle>
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.droidguard
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Looper
|
||||
import com.google.android.gms.common.api.Api
|
||||
import com.google.android.gms.common.api.Api.ApiOptions.NoOptions
|
||||
import com.google.android.gms.common.api.GoogleApi
|
||||
import com.google.android.gms.tasks.Task
|
||||
import org.microg.gms.common.api.ApiClientBuilder
|
||||
import org.microg.gms.common.api.ApiClientSettings
|
||||
import org.microg.gms.common.api.ConnectionCallbacks
|
||||
import org.microg.gms.common.api.OnConnectionFailedListener
|
||||
|
||||
class DroidGuardClientImpl(context: Context) : GoogleApi<NoOptions>(context, API), DroidGuardClient {
|
||||
companion object {
|
||||
private val API = Api(ApiClientBuilder { _: NoOptions?, context: Context, _: Looper?, _: ApiClientSettings?, callbacks: ConnectionCallbacks, connectionFailedListener: OnConnectionFailedListener -> DroidGuardApiClient(context, callbacks, connectionFailedListener) })
|
||||
}
|
||||
|
||||
override fun getHandle(): Task<DroidGuardHandle> {
|
||||
return scheduleTask { client: DroidGuardApiClient, completionSource ->
|
||||
try {
|
||||
completionSource.setResult(DroidGuardHandle(client.getHandle()))
|
||||
} catch (e: Exception) {
|
||||
completionSource.setException(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2020, microG Project Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package org.microg.gms.droidguard
|
||||
|
||||
import com.google.android.gms.droidguard.internal.DroidGuardResultsRequest
|
||||
import com.google.android.gms.droidguard.internal.IDroidGuardHandle
|
||||
|
||||
class DroidGuardHandle(private val handle: IDroidGuardHandle) {
|
||||
private var state = 0
|
||||
|
||||
fun init(flow: String) {
|
||||
if (state != 0) throw IllegalStateException("init() already called")
|
||||
try {
|
||||
handle.initWithRequest(flow, DroidGuardResultsRequest().setOpenHandles(openHandles++))
|
||||
state = 1
|
||||
} catch (e: Exception) {
|
||||
state = -1
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
fun guard(map: Map<String, String>): ByteArray {
|
||||
if (state != 1) throw IllegalStateException("init() must be called before guard()")
|
||||
try {
|
||||
return handle.guard(map)
|
||||
} catch (e: Exception) {
|
||||
state = -1
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
fun close() {
|
||||
if (state != 1) throw IllegalStateException("init() must be called before close()")
|
||||
try {
|
||||
handle.close()
|
||||
openHandles--
|
||||
state = 2
|
||||
} catch (e: Exception) {
|
||||
state = -1
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
fun finalize() {
|
||||
if (state == 1) close()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var openHandles = 0
|
||||
}
|
||||
}
|
|
@ -34,4 +34,4 @@ android {
|
|||
|
||||
dependencies {
|
||||
api project(':play-services-basement')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -36,4 +36,4 @@ dependencies {
|
|||
api project(':play-services-basement')
|
||||
|
||||
api project(':play-services-base-api')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -37,4 +37,4 @@ dependencies {
|
|||
api project(':play-services-location-api')
|
||||
|
||||
implementation 'androidx.annotation:annotation:1.1.0'
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -46,7 +46,7 @@ public abstract class GoogleLocationManagerClient extends GmsClient<IGoogleLocat
|
|||
throws RemoteException {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("client_name", "locationServices");
|
||||
broker.getGoogleLocationManagerService(callbacks, Constants.MAX_REFERENCE_VERSION,
|
||||
broker.getGoogleLocationManagerService(callbacks, Constants.GMS_VERSION_CODE,
|
||||
getContext().getPackageName(), bundle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,4 @@ android {
|
|||
|
||||
dependencies {
|
||||
api project(':play-services-basement')
|
||||
}
|
||||
}
|
|
@ -30,5 +30,4 @@ POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
|
|||
POM_LICENCE_DIST=repo
|
||||
|
||||
POM_DEVELOPER_ID=mar-v-in
|
||||
POM_DEVELOPER_NAME=Marvin W
|
||||
|
||||
POM_DEVELOPER_NAME=Marvin W
|
|
@ -1,21 +1,22 @@
|
|||
include ':play-services-basement'
|
||||
|
||||
include ':play-services-api'
|
||||
include ':play-services-cast'
|
||||
include ':play-services-tasks'
|
||||
|
||||
include ':play-services-base-api'
|
||||
include ':play-services-cast-api'
|
||||
include ':play-services-cast-framework-api'
|
||||
include ':play-services-droidguard-api'
|
||||
include ':play-services-iid-api'
|
||||
|
||||
include ':play-services-location-api'
|
||||
include ':play-services-location'
|
||||
|
||||
include ':play-services-api'
|
||||
|
||||
include ':play-services-core-proto'
|
||||
|
||||
include ':play-services-core:microg-ui-tools' // Legacy
|
||||
include ':play-services-core'
|
||||
|
||||
include ':play-services-base'
|
||||
include ':play-services-base-api'
|
||||
include ':play-services-tasks'
|
||||
include ':play-services-core-proto'
|
||||
include ':play-services-conscrypt-provider-core'
|
||||
|
||||
include ':play-services-core'
|
||||
include ':play-services-core:microg-ui-tools'
|
||||
|
||||
|
||||
include ':play-services-cast'
|
||||
include ':play-services-droidguard'
|
||||
include ':play-services-location'
|
Loading…
Reference in New Issue