Huge merge/refactor/update

This commit is contained in:
Marvin W 2020-07-08 20:04:23 +02:00
parent a5bfecee6f
commit 895c74d095
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A
119 changed files with 1001 additions and 800 deletions

15
.gitmodules vendored
View File

@ -1,15 +0,0 @@
[submodule "extern/UnifiedNlp"]
path = extern/UnifiedNlp
url = https://github.com/microg/android_packages_apps_UnifiedNlp.git
[submodule "extern/GmsApi"]
path = extern/GmsApi
url = https://github.com/microg/android_external_GmsApi.git
[submodule "extern/Wearable"]
path = extern/Wearable
url = https://github.com/microg/android_external_Wearable.git
[submodule "extern/GmsLib"]
path = extern/GmsLib
url = https://github.com/microg/android_external_GmsLib.git
[submodule "extern/RemoteDroidGuard"]
path = extern/RemoteDroidGuard
url = https://github.com/microg/android_packages_apps_RemoteDroidGuard.git

View File

@ -10,7 +10,6 @@ android:
components:
- tools
- platform-tools
- build-tools-29.0.2
- android-27
- android-28
- build-tools-29.0.3
- android-29
- extra-android-m2repository

View File

@ -1,63 +1,110 @@
/*
* Copyright 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.
* 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: 2013, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
buildscript {
ext.kotlin_version = '1.3.21'
ext.nlpVersion = '2.0-alpha1'
ext.remoteDroidGuardVersion = '0.1.1'
ext.safeParcelVersion = '1.6.0'
ext.wearableVersion = '0.1.1'
ext.kotlinVersion = '1.3.72'
ext.coroutineVersion = '1.3.7'
ext.annotationVersion = '1.1.0'
ext.appcompatVersion = '1.1.0'
ext.fragmentVersion = '1.2.5'
ext.lifecycleVersion = '2.2.0'
ext.mediarouterVersion = '1.1.0'
ext.multidexVersion = '2.0.1'
ext.navigationVersion = '2.3.0'
ext.preferenceVersion = '1.1.1'
ext.recyclerviewVersion = '1.1.0'
ext.supportLibraryVersion = "28.0.0"
ext.slf4jVersion = "1.7.25"
ext.androidBuildGradleVersion = "3.6.3"
ext.androidBuildVersionTools = "29.0.3"
ext.androidMinSdk = 14
ext.androidTargetSdk = 29
ext.androidCompileSdk = 29
repositories {
jcenter()
google()
}
dependencies {
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"
classpath "com.android.tools.build:gradle:$androidBuildGradleVersion"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
def execResult(...args) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine args
standardOutput = stdout
}
return stdout.toString().trim()
}
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"))
def gitCommitId = execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').split(' ')[0]
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" : "") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
logger.lifecycle('Starting build for version {} ({})...', ourVersionName, ourVersionCode)
@Deprecated
String getMyVersionName() {
return ourVersionName
}
@Deprecated
int getMyVersionCode() {
return ourVersionCode
}
allprojects {
apply plugin: 'idea'
ext.androidBuildVersionTools = "29.0.2"
ext.supportLibraryVersion = "28.0.0"
group = 'org.microg.gms'
version = ourVersionName
ext.appVersionCode = ourVersionCode
ext.isReleaseVersion = false
ext.slf4jVersion = "1.7.25"
}
def androidCompileSdk() { return 28 }
@Deprecated
def androidCompileSdk() { return androidCompileSdk }
def androidTargetSdk() { return 29 }
@Deprecated
def androidTargetSdk() { return androidTargetSdk }
def androidMinSdk() { return 14 }
@Deprecated
def androidMinSdk() { return androidMinSdk }
@Deprecated
def versionCode() {
def stdout = new ByteArrayOutputStream()
exec { commandLine 'git', 'rev-list', '--count', "HEAD"; standardOutput = stdout }
return Integer.parseInt(stdout.toString().trim())
return ourVersionCode
}
@Deprecated
def versionName() {
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)
return ourVersionName
}
subprojects {
group = 'org.microg'
repositories {
jcenter()
google()

1
extern/GmsApi vendored

@ -1 +0,0 @@
Subproject commit 2a43448e49dc0aec0d6c53c8a27dd58245fdaba6

1
extern/GmsLib vendored

@ -1 +0,0 @@
Subproject commit 15cd4491bcca57d627796b35b69bdf8c97564792

1
extern/UnifiedNlp vendored

@ -1 +0,0 @@
Subproject commit 82479b79c76353f532e0c6edd0d1dee8d49c48f4

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
android.useAndroidX=true

View File

@ -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.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4-all.zip

View File

@ -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"
@ -36,8 +27,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
lintOptions {

View File

@ -103,7 +103,6 @@ public abstract class AbstractAboutFragment extends Fragment {
}
List<Library> libraries = new ArrayList<Library>();
libraries.add(new Library(BuildConfig.APPLICATION_ID, getString(R.string.lib_name), getString(R.string.lib_license)));
collectLibraries(libraries);
Collections.sort(libraries);
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));

View File

@ -4,7 +4,6 @@ import android.os.Bundle;
import android.view.ViewGroup;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
@ -22,8 +21,6 @@ public abstract class AbstractDashboardActivity extends AppCompatActivity {
setContentView(R.layout.dashboard_activity);
conditionContainer = (ViewGroup) findViewById(R.id.condition_container);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_wrapper, getFragment())
.commit();

View File

@ -5,7 +5,6 @@ import android.view.MenuItem;
import android.view.ViewGroup;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
@ -20,8 +19,6 @@ public abstract class AbstractSettingsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings_activity);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
if (showHomeAsUp) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

View File

@ -19,8 +19,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
<LinearLayout
android:id="@+id/condition_container"
android:layout_width="match_parent"

View File

@ -19,8 +19,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar"/>
<org.microg.tools.ui.SwitchBar
android:id="@+id/switch_bar"
android:layout_width="match_parent"

View File

@ -38,7 +38,6 @@
android:layout_gravity="center_vertical"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:background="@null"
android:theme="@style/Widget.AppCompat.Settings.SwitchBar.Switch"/>
android:background="@null"/>
</merge>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.AppCompat.Settings.Dashboard">
<item name="preferenceTheme">@style/SettingsDashboardThemeOverlay</item>
</style>
<style name="SettingsDashboardFragment" parent="@style/PreferenceFragment">
<item name="android:divider">@drawable/empty</item>
<item name="divider">@drawable/empty</item>
<item name="android:dividerHeight">0dip</item>
</style>
<style name="SettingsDashboardThemeOverlay" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="preferenceCategoryStyle">@style/SettingsDashboardCategory</item>
<item name="preferenceFragmentStyle">@style/SettingsDashboardFragment</item>
<item name="preferenceFragmentCompatStyle">@style/SettingsDashboardFragment</item>
<item name="colorAccent">#666666</item>
</style>
<style name="SettingsDashboardCategory">
<item name="android:layout">@layout/preference_category_dashboard</item>
</style>
</resources>

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ 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.
-->
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.AppCompat.Settings" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/settings_theme_primary</item>
<item name="colorPrimaryDark">@color/settings_theme_primary_dark</item>
<item name="colorAccent">@color/settings_theme_accent</item>
<item name="android:colorPrimary" tools:targetApi="21">@color/settings_theme_primary</item>
<item name="android:colorPrimaryDark" tools:targetApi="21">@color/settings_theme_primary_dark</item>
<item name="android:colorAccent" tools:targetApi="21">@color/settings_theme_accent</item>
</style>
<style name="Widget.AppCompat.Settings.SwitchBar.Switch" parent="Widget.AppCompat.CompoundButton.Switch">
<item name="colorAccent">@color/switch_accent_color</item>
<item name="android:colorAccent" tools:targetApi="21">@color/switch_accent_color</item>
</style>
<style name="Theme.AppCompat.Settings.Dashboard"/>
</resources>

View File

@ -16,31 +16,19 @@
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -0,0 +1,28 @@
/*
* SPDX-FileCopyrightText: 2020, microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/
apply plugin: 'com.android.library'
dependencies {
api project(':play-services-basement')
implementation "androidx.annotation:annotation:$annotationVersion"
}
android {
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2020, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest package="org.microg.gms.base.core">
<application />
</manifest>

View File

@ -21,10 +21,11 @@ import android.content.ContentValues;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class ChimeraSpoofProvider extends ContentProvider {
private static final String TAG = "GmsChimeraSpoof";
private static final String[] COLUMNS = new String[]{"version", "apkPath", "loaderPath", "apkDescStr"};

View File

@ -11,10 +11,9 @@ import android.content.ContextWrapper;
import android.content.Intent;
import android.os.Build;
import android.os.PowerManager;
import android.support.annotation.RequiresApi;
import android.util.Log;
import com.google.android.gms.R;
import androidx.annotation.RequiresApi;
import java.util.List;
@ -74,7 +73,7 @@ public class ForegroundServiceContext extends ContextWrapper {
return new Notification.Builder(context, channel.getId())
.setOngoing(true)
.setContentTitle("Running in background")
.setSmallIcon(R.drawable.gcm_bell)
//.setSmallIcon(R.drawable.gcm_bell)
.build();
}
}

View File

@ -17,9 +17,10 @@
package org.microg.gms.common;
import android.os.IInterface;
import android.support.annotation.NonNull;
import android.util.Log;
import androidx.annotation.NonNull;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

View File

@ -23,9 +23,8 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.os.Binder;
import android.support.annotation.Nullable;
import com.google.android.gms.Manifest;
import androidx.annotation.Nullable;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
@ -100,7 +99,7 @@ public class PackageUtils {
return true;
}
}
return context.checkCallingPermission(Manifest.permission.EXTENDED_ACCESS) == PackageManager.PERMISSION_GRANTED;
return context.checkCallingPermission("org.microg.gms.EXTENDED_ACCESS") == PackageManager.PERMISSION_GRANTED;
}
public static void checkPackageUid(Context context, String packageName, int callingUid) {
@ -195,6 +194,7 @@ public class PackageUtils {
}
@Nullable
@Deprecated
public static String packageFromProcessId(Context context, int pid) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (manager == null) return null;
@ -202,7 +202,9 @@ public class PackageUtils {
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = manager.getRunningAppProcesses();
if (runningAppProcesses != null) {
for (ActivityManager.RunningAppProcessInfo processInfo : runningAppProcesses) {
if (processInfo.pid == pid) return processInfo.processName;
if (processInfo.pid == pid && processInfo.pkgList.length == 1) {
return processInfo.pkgList[0];
}
}
}
return null;

View File

@ -17,14 +17,9 @@
package org.microg.gms.common;
import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.R;
import org.microg.gms.checkin.LastCheckinInfo;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@ -33,9 +28,6 @@ import java.util.Locale;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
public class Utils {
public static String getAndroidIdHex(Context context) {
return Long.toHexString(LastCheckinInfo.read(context).androidId);
}
public static Locale getLocale(Context context) {
return Locale.getDefault(); // TODO
@ -55,10 +47,10 @@ public class Utils {
public static boolean hasSelfPermissionOrNotify(Context context, String permission) {
if (context.checkCallingOrSelfPermission(permission) != PERMISSION_GRANTED) {
Log.w("GmsUtils", "Lacking permission to " + permission + " for pid:" + android.os.Process.myPid() + " uid:" + android.os.Process.myUid());
try {
Toast.makeText(context, context.getString(R.string.lacking_permission_toast, permission), Toast.LENGTH_SHORT).show();
//TODO: Toast.makeText(context, context.getString(R.string.lacking_permission_toast, permission), Toast.LENGTH_SHORT).show();
} catch (RuntimeException e) {
Log.w("GmsUtils", "Lacking permission to " + permission + " for pid:" + android.os.Process.myPid() + " uid:" + android.os.Process.myUid());
}
return false;
}

View File

@ -16,28 +16,19 @@
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()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -25,22 +25,8 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
aidlPackageWhiteList "com/google/android/gms/common/api/Status.aidl"
@ -51,9 +37,9 @@ android {
aidlPackageWhiteList "com/google/android/gms/dynamic/IObjectWrapper.aidl"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
sourceSets {
@ -61,7 +47,7 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -16,34 +16,22 @@
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
aidlPackageWhiteList "com/google/android/gms/cast/ApplicationMetadata.aidl"
aidlPackageWhiteList "com/google/android/gms/cast/LaunchOptions.aidl"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -16,31 +16,19 @@
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -23,12 +23,11 @@ def useMapbox() {
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:support-v4:$supportLibraryVersion"
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:mediarouter-v7:$supportLibraryVersion"
implementation "androidx.multidex:multidex:$multidexVersion"
implementation "androidx.appcompat:appcompat:$appcompatVersion"
implementation "androidx.mediarouter:mediarouter:$mediarouterVersion"
implementation "androidx.preference:preference:$preferenceVersion"
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.1.0"
// TODO: Switch to upstream once raw requests are merged
@ -41,52 +40,40 @@ dependencies {
api "org.slf4j:slf4j-api:1.7.25"
api "uk.uuid.slf4j:slf4j-android:1.7.25-1"
implementation project(':play-services-base-core')
implementation project(':play-services-location-core')
implementation project(':microg-ui-tools')
implementation project(':play-services-api')
implementation project(':play-services-cast-api')
implementation project(':play-services-wearable')
implementation project(':unifiednlp-base')
implementation project(':wearable-lib')
implementation "org.microg:wearable:$wearableVersion"
implementation "org.microg.gms:remote-droid-guard:$remoteDroidGuardVersion"
implementation project(':remote-droid-guard-lib')
if (useMapbox()) {
implementation project(':play-services-maps-core-mapbox')
} else {
implementation project(':play-services-maps-core-vtm')
}
}
def execResult(...args) {
def stdout = new ByteArrayOutputStream()
exec {
commandLine args
standardOutput = stdout
}
return stdout.toString().trim()
// Navigation
implementation "androidx.navigation:navigation-fragment:$navigationVersion"
implementation "androidx.navigation:navigation-ui:$navigationVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
}
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"))
def gitCommitId = execResult('git', 'show-ref', '--abbrev=7', '--head', 'HEAD').split(' ')[0]
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() ? "" : "-vtm") + (gitCommitCount > 0 && !gitDirty ? " ($gitCommitId)" : "")
logger.lifecycle('Starting build for version {} ({})...', ourVersionName, ourVersionCode)
android {
compileSdkVersion androidCompileSdk()
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName ourVersionName
versionCode ourVersionCode
versionName version + (useMapbox() ? "" : "-vtm")
versionCode appVersionCode
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
buildConfigField "boolean", "USE_MAPBOX", "${useMapbox()}"
multiDexEnabled true
@ -95,6 +82,10 @@ android {
}
}
dataBinding {
enabled = true
}
sourceSets {
main {
java.srcDirs += 'src/main/protos-java'
@ -107,7 +98,7 @@ android {
buildTypes {
release {
minifyEnabled true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

View File

@ -14,159 +14,141 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest package="com.google.android.gms"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.google.android.gms">
<permission
android:name="com.google.android.c2dm.permission.RECEIVE"
android:label="@string/perm_c2dm_receive_label"
android:permissionGroup="android.permission-group.NETWORK"
android:protectionLevel="normal"/>
android:protectionLevel="normal" />
<permission
android:name="com.google.android.c2dm.permission.SEND"
android:label="@string/perm_c2dm_send_label"
android:protectionLevel="signature"/>
android:protectionLevel="signature" />
<permission
android:name="com.google.android.gtalkservice.permission.GTALK_SERVICE"
android:label="@string/perm_gtalk_svc_label"
android:protectionLevel="signature"/>
android:protectionLevel="signature" />
<permission-tree
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"
android:icon="@drawable/proprietary_auth_ic_scope_icon_default"/>
android:icon="@drawable/proprietary_auth_ic_scope_icon_default" />
<permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.cp"
android:description="@string/permission_service_cp_description"
android:label="@string/permission_service_cp_label"
android:protectionLevel="dangerous"/>
android:protectionLevel="dangerous" />
<permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.local"
android:description="@string/permission_service_local_description"
android:label="@string/permission_service_local_label"
android:protectionLevel="dangerous"/>
android:protectionLevel="dangerous" />
<permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.mail"
android:description="@string/permission_service_mail_description"
android:label="@string/permission_service_mail_label"
android:protectionLevel="dangerous"/>
android:protectionLevel="dangerous" />
<permission
android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.writely"
android:description="@string/permission_service_writely_description"
android:label="@string/permission_service_writely_label"
android:protectionLevel="dangerous"/>
android:protectionLevel="dangerous" />
<permission
android:name="org.microg.gms.STATUS_BROADCAST"
android:label="@string/perm_status_broadcast_label"
android:protectionLevel="normal"/>
android:protectionLevel="normal" />
<permission
android:name="org.microg.gms.EXTENDED_ACCESS"
android:label="@string/perm_extended_access_label"
android:protectionLevel="dangerous"/>
android:protectionLevel="dangerous" />
<uses-permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE"/>
<uses-permission android:name="android.permission.FAKE_PACKAGE_SIGNATURE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<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.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<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"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="com.google.android.c2dm.permission.SEND"/>
<uses-permission android:name="com.google.android.gtalkservice.permission.GTALK_SERVICE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.SEND" />
<uses-permission android:name="com.google.android.gtalkservice.permission.GTALK_SERVICE" />
<uses-permission android:name="org.microg.gms.STATUS_BROADCAST"/>
<uses-permission android:name="org.microg.gms.STATUS_BROADCAST" />
<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.FOREGROUND_SERVICE"/>
<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.FOREGROUND_SERVICE" />
<uses-permission
android:name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"
tools:ignore="ProtectedPermissions"/>
<uses-sdk tools:overrideLibrary="
com.takisoft.fix.support.v7.preference,
android.support.graphics.drawable.animated,
android.arch.lifecycle,
android.arch.lifecycle.livedata.core,
android.arch.lifecycle.viewmodel,
android.arch.core,
android.support.v7.mediarouter,
android.support.v7.palette"/>
tools:ignore="ProtectedPermissions" />
<uses-permission
android:name="android.permission.UPDATE_APP_OPS_STATS"
tools:ignore="ProtectedPermissions" />
<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">
<meta-data
android:name="fake-signature"
android:value="@string/fake_signature"/>
android:value="@string/fake_signature" />
<!-- Location -->
<service android:name="org.microg.gms.location.GoogleLocationManagerService">
<intent-filter>
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.location.ReportingAndroidService">
<intent-filter>
<action android:name="com.google.android.location.reporting.service.START"/>
<action android:name="com.google.android.gms.location.reporting.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
<activity android:name="org.microg.nlp.ui.BackendSettingsActivity"
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.PlacePickerActivity"
android:exported="true"
android:label="@string/pick_place_title"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
<intent-filter>
<action android:name="com.google.android.gms.location.places.ui.PICK_PLACE"/>
<action android:name="com.google.android.gms.location.places.ui.PICK_PLACE" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service android:name="org.microg.gms.places.GeoDataService">
<intent-filter>
<action android:name="com.google.android.gms.location.places.GeoDataApi"/>
<action android:name="com.google.android.gms.location.places.PlacesApi"/>
<action android:name="com.google.android.gms.location.places.GeoDataApi" />
<action android:name="com.google.android.gms.location.places.PlacesApi" />
</intent-filter>
</service>
<service android:name="org.microg.gms.places.PlaceDetectionService">
<intent-filter>
<action android:name="com.google.android.gms.location.places.PlaceDetectionApi"/>
<action android:name="com.google.android.gms.location.places.PlaceDetectionApi" />
</intent-filter>
</service>
<service
android:name="org.microg.gms.wearable.location.WearableLocationService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED"/>
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<data
android:host="*"
android:pathPrefix="/com/google/android/location/fused/wearable"
android:scheme="wear"/>
android:scheme="wear" />
</intent-filter>
</service>
@ -175,43 +157,43 @@
<provider
android:name="org.microg.gms.gservices.GServicesProvider"
android:authorities="com.google.android.gsf.gservices"
android:exported="true"/>
android:exported="true" />
<provider
android:name="org.microg.gms.settings.GoogleSettingsProvider"
android:authorities="com.google.settings"
android:exported="true"/>
android:exported="true" />
<provider
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
android:authorities="subscribedfeeds"
android:exported="true"
android:multiprocess="false"
android:readPermission="android.permission.SUBSCRIBED_FEEDS_READ"
android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE"/>
android:writePermission="android.permission.SUBSCRIBED_FEEDS_WRITE" />
<!-- Device Checkin -->
<service android:name="org.microg.gms.checkin.CheckinService">
<intent-filter>
<action android:name="com.google.android.gms.checkin.BIND_TO_SERVICE"/>
<action android:name="com.google.android.gms.checkin.BIND_TO_SERVICE" />
</intent-filter>
</service>
<receiver android:name="org.microg.gms.checkin.TriggerReceiver">
<intent-filter>
<action android:name="android.server.checkin.CHECKIN"/>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
<action android:name="android.server.checkin.CHECKIN" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="android.server.checkin.CHECKIN"/>
<category android:name="android.server.checkin.CHECKIN" />
</intent-filter>
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE"/>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data
android:host="2432546"
android:scheme="android_secret_code"/>
android:scheme="android_secret_code" />
</intent-filter>
</receiver>
@ -220,57 +202,57 @@
android:name="org.microg.gms.gcm.PushRegisterService"
android:permission="com.google.android.c2dm.permission.RECEIVE">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTER"/>
<action android:name="com.google.android.c2dm.intent.UNREGISTER"/>
<action android:name="com.google.android.c2dm.intent.REGISTER" />
<action android:name="com.google.android.c2dm.intent.UNREGISTER" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<receiver android:name="org.microg.gms.gcm.PushRegisterReceiver">
<intent-filter>
<action android:name="com.google.iid.TOKEN_REQUEST"/>
<action android:name="com.google.iid.TOKEN_REQUEST" />
</intent-filter>
</receiver>
<service android:name="org.microg.gms.gcm.McsService"/>
<service android:name="org.microg.gms.gcm.McsService" />
<receiver
android:name="org.microg.gms.gcm.SendReceiver"
android:permission="com.google.android.c2dm.permission.RECEIVE">
<intent-filter>
<action android:name="com.google.android.gcm.intent.SEND"/>
<action android:name="com.google.android.gcm.intent.SEND" />
</intent-filter>
</receiver>
<receiver android:name="org.microg.gms.gcm.TriggerReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.AIRPLANE_MODE"/>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
<action android:name="android.net.conn.BACKGROUND_DATA_SETTING_CHANGED"/>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.AIRPLANE_MODE" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.net.conn.BACKGROUND_DATA_SETTING_CHANGED" />
<action android:name="org.microg.gms.gcm.RECONNECT"/>
<action android:name="org.microg.gms.gcm.RECONNECT" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.PACKAGE_RESTARTED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
<action android:name="android.intent.action.PACKAGE_RESTARTED" />
</intent-filter>
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE"/>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<data
android:host="42678278"
android:scheme="android_secret_code"/>
android:scheme="android_secret_code" />
</intent-filter>
</receiver>
<receiver android:name="org.microg.gms.gcm.UnregisterReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED"/>
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_REMOVED"/>
<action android:name="android.intent.action.PACKAGE_DATA_CLEARED" />
<action android:name="android.intent.action.PACKAGE_FULLY_REMOVED" />
<action android:name="android.intent.action.PACKAGE_REMOVED" />
<data android:scheme="package"/>
<data android:scheme="package" />
</intent-filter>
</receiver>
@ -278,9 +260,9 @@
<service android:name="org.microg.gms.droidguard.DroidGuardService">
<intent-filter>
<action android:name="com.google.android.gms.droidguard.service.START"/>
<action android:name="com.google.android.gms.droidguard.service.START" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
@ -288,9 +270,9 @@
<service android:name="org.microg.gms.car.CarService">
<intent-filter>
<action android:name="com.google.android.gms.car.service.START"/>
<action android:name="com.google.android.gms.car.service.START" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
@ -298,9 +280,9 @@
<service android:name="org.microg.gms.people.PeopleService">
<intent-filter>
<action android:name="com.google.android.gms.people.service.START"/>
<action android:name="com.google.android.gms.people.service.START" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
@ -308,18 +290,18 @@
android:name="org.microg.gms.people.ContactSyncService"
android:exported="false">
<intent-filter>
<action android:name="android.content.SyncAdapter"/>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/contact_syncadapter"/>
android:resource="@xml/contact_syncadapter" />
</service>
<!-- Wearable -->
<service android:name="org.microg.gms.wearable.WearableService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND"/>
<action android:name="com.google.android.gms.wearable.BIND" />
</intent-filter>
</service>
@ -327,23 +309,23 @@
<service android:name="org.microg.gms.auth.loginservice.GoogleLoginService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"/>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.gsf.action.GET_GLS"/>
<action android:name="com.google.android.gsf.action.GET_GLS" />
</intent-filter>
<meta-data
android:name="android.accounts.AccountAuthenticator"
android:resource="@xml/authenticator"/>
android:resource="@xml/authenticator" />
<meta-data
android:name="android.accounts.AccountAuthenticator.customTokens"
android:value="1"/>
android:value="1" />
</service>
<service android:name=".auth.FirebaseAuthService">
<intent-filter>
<action android:name="com.google.firebase.auth.api.gms.service.START"/>
<action android:name="com.google.firebase.auth.api.gms.service.START" />
</intent-filter>
</service>
@ -352,9 +334,9 @@
android:excludeFromRecents="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.common.account.CHOOSE_ACCOUNT"/>
<action android:name="com.google.android.gms.common.account.CHOOSE_ACCOUNT" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -364,9 +346,9 @@
android:exported="true"
android:theme="@style/LoginBlueTheme">
<intent-filter>
<action android:name="com.google.android.gms.auth.login.LOGIN"/>
<action android:name="com.google.android.gms.auth.login.LOGIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -374,36 +356,36 @@
android:name="org.microg.gms.auth.AskPermissionActivity"
android:excludeFromRecents="true"
android:exported="true"
android:theme="@style/Theme.AppCompat.Light.Dialog"/>
android:theme="@style/Theme.AppCompat.DayNight.Dialog" />
<service
android:name=".auth.GetToken"
android:exported="true"/>
android:exported="true" />
<activity
android:name=".auth.TokenActivity"
android:exported="true"/>
android:exported="true" />
<provider
android:name="org.microg.gms.auth.AccountContentProvider"
android:authorities="com.google.android.gms.auth.accounts"
android:exported="true"/>
android:exported="true" />
<!-- Games -->
<service android:name="org.microg.gms.games.GamesStubService">
<intent-filter>
<action android:name="com.google.android.gms.games.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.games.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<activity
android:name="org.microg.gms.games.UpgradeActivity"
android:theme="@style/Theme.AppCompat.Light.Dialog">
android:theme="@style/Theme.AppCompat.DayNight.Dialog">
<intent-filter>
<action android:name="com.google.android.gms.games.PLAY_GAMES_UPGRADE"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.games.PLAY_GAMES_UPGRADE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -411,7 +393,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>
@ -419,7 +401,7 @@
<provider
android:name="org.microg.gms.ChimeraSpoofProvider"
android:authorities="com.google.android.gms.chimera"
android:exported="true"/>
android:exported="true" />
<!-- microG custom UI -->
@ -429,15 +411,15 @@
android:icon="@mipmap/ic_microg_settings"
android:label="@string/gms_settings_name"
android:roundIcon="@mipmap/ic_microg_settings"
android:theme="@style/Theme.AppCompat.Settings.Dashboard">
android:theme="@style/Theme.AppCompat.DayNight">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -447,93 +429,93 @@
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">
android:theme="@style/Theme.AppCompat.DayNight">
<intent-filter>
<action android:name="com.android.settings.action.EXTRA_SETTINGS"/>
<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"/>
android:value="com.android.settings.category.device" />
<meta-data
android:name="com.android.settings.icon"
android:resource="@drawable/microg_light_color_24"/>
android:resource="@drawable/microg_light_color_24" />
<meta-data
android:name="com.android.settings.summary"
android:resource="@string/gms_settings_summary"/>
android:resource="@string/gms_settings_summary" />
</activity-alias>
<activity
android:name="org.microg.gms.ui.AskPushPermission"
android:excludeFromRecents="true"
android:theme="@style/Theme.AppCompat.Light.Dialog.Alert"/>
android:theme="@style/Theme.AppCompat.DayNight.Dialog.Alert" />
<activity
android:name="org.microg.gms.ui.AboutFragment$AsActivity"
android:label="@string/pref_about_title"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.CheckinFragment$AsActivity"
android:label="@string/service_name_checkin"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.GcmFragment$AsActivity"
android:label="@string/service_name_mcs"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.GcmAdvancedFragment$AsActivity"
android:label="@string/service_name_mcs"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.GcmAppFragment$AsActivity"
android:label="@string/service_name_mcs"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.GoogleMoreFragment$AsActivity"
android:label="@string/gms_settings_name"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.SafetyNetFragment$AsActivity"
android:label="@string/service_name_snet"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.SafetyNetAdvancedFragment$AsActivity"
android:label="@string/service_name_snet"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.SelfCheckFragment$AsActivity"
android:label="@string/self_check_title"
android:theme="@style/Theme.AppCompat.Settings"/>
android:theme="@style/Theme.AppCompat.DayNight" />
<activity
android:name="org.microg.gms.ui.AccountSettingsActivity"
android:theme="@style/Theme.AppCompat.Settings">
android:theme="@style/Theme.AppCompat.DayNight">
<intent-filter>
<action android:name="com.google.android.gms.accountsettings.ACCOUNT_PREFERENCES_SETTINGS"/>
<action android:name="com.google.android.gms.accountsettings.PRIVACY_SETTINGS"/>
<action android:name="com.google.android.gms.accountsettings.SECURITY_SETTINGS"/>
<action android:name="com.google.android.gms.accountsettings.ACCOUNT_PREFERENCES_SETTINGS" />
<action android:name="com.google.android.gms.accountsettings.PRIVACY_SETTINGS" />
<action android:name="com.google.android.gms.accountsettings.SECURITY_SETTINGS" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="org.microg.gms.ui.LocationSettingsActivity"
android:theme="@style/Theme.AppCompat.Settings">
android:theme="@style/Theme.AppCompat.DayNight">
<intent-filter>
<action android:name="com.google.android.gms.location.settings.LOCATION_HISTORY"/>
<action android:name="com.google.android.location.settings.LOCATION_REPORTING_SETTINGS"/>
<action android:name="com.google.android.gms.location.settings.LOCATION_REPORTING_SETTINGS"/>
<action android:name="com.google.android.gms.location.settings.LOCATION_HISTORY" />
<action android:name="com.google.android.location.settings.LOCATION_REPORTING_SETTINGS" />
<action android:name="com.google.android.gms.location.settings.LOCATION_REPORTING_SETTINGS" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
@ -542,147 +524,147 @@
<provider
android:name="org.microg.gms.phenotype.ConfigurationProvider"
android:authorities="com.google.android.gms.phenotype"
android:exported="true"/>
android:exported="true" />
<service
android:name="org.microg.gms.measurement.MeasurementBrokerService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.measurement.START"/>
<action android:name="com.google.android.gms.measurement.START" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.mdm.NetworkQualityService">
<intent-filter>
<action android:name="com.google.android.gms.mdm.services.START"/>
<action android:name="com.google.android.gms.mdm.services.START" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.icing.LightweightIndexService">
<intent-filter>
<action android:name="com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE"/>
<action android:name="com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE" />
</intent-filter>
</service>
<service android:name="org.microg.gms.icing.IndexService">
<intent-filter>
<action android:name="com.google.android.gms.icing.INDEX_SERVICE"/>
<action android:name="com.google.android.gms.icing.INDEX_SERVICE" />
</intent-filter>
</service>
<service
android:name=".analytics.service.AnalyticsService"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.service.START"/>
<action android:name="com.google.android.gms.analytics.service.START" />
</intent-filter>
</service>
<service android:name="org.microg.gms.playlog.PlayLogService">
<intent-filter>
<action android:name="com.google.android.gms.playlog.service.START"/>
<action android:name="com.google.android.gms.playlog.service.START" />
</intent-filter>
</service>
<service
android:name=".gcm.http.GoogleHttpService"
android:exported="true"/>
android:exported="true" />
<service android:name="org.microg.gms.ads.GService">
<intent-filter>
<action android:name="com.google.android.gms.ads.gservice.START"/>
<action android:name="com.google.android.gms.ads.gservice.START" />
</intent-filter>
</service>
<service android:name="org.microg.gms.feedback.FeedbackService">
<intent-filter>
<action android:name="com.google.android.gms.feedback.internal.IFeedbackService"/>
<action android:name="com.google.android.gms.feedback.internal.IFeedbackService" />
</intent-filter>
</service>
<service android:name="org.microg.gms.ads.AdvertisingIdService">
<intent-filter>
<action android:name="com.google.android.gms.ads.identifier.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.ads.identifier.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.clearcut.ClearcutLoggerService">
<intent-filter>
<action android:name="com.google.android.gms.clearcut.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.clearcut.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.drive.api.DriveApiService">
<intent-filter>
<action android:name="com.google.android.gms.drive.ApiService.START"/>
<action android:name="com.google.android.gms.drive.ApiService.STOP"/>
<action android:name="com.google.android.gms.drive.ApiService.RESET_AFTER_BOOT"/>
<action android:name="com.google.android.gms.drive.ApiService.START" />
<action android:name="com.google.android.gms.drive.ApiService.STOP" />
<action android:name="com.google.android.gms.drive.ApiService.RESET_AFTER_BOOT" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.auth.SignInService">
<intent-filter>
<action android:name="com.google.android.gms.signin.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.signin.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.reminders.RemindersService">
<intent-filter>
<action android:name="com.google.android.gms.reminders.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="com.google.android.gms.reminders.service.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<service android:name="org.microg.gms.snet.SafetyNetClientService">
<intent-filter>
<action android:name="com.google.android.gms.safetynet.service.START"/>
<action android:name="com.google.android.gms.safetynet.service.START" />
</intent-filter>
</service>
<service android:name="org.microg.gms.wallet.PaymentService">
<intent-filter>
<action android:name="com.google.android.gms.wallet.service.BIND"/>
<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"/>
<action android:name="com.google.android.gms.tapandpay.service.BIND" />
</intent-filter>
</service>
<service android:name="org.microg.gms.cast.CastDeviceControllerService">
<intent-filter>
<action android:name="com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE"/>
<action android:name="com.google.android.gms.cast.service.BIND_CAST_DEVICE_CONTROLLER_SERVICE" />
</intent-filter>
</service>
<service android:name="org.microg.gms.DummyService">
<intent-filter>
<action android:name="com.google.android.gms.plus.service.START"/>
<action android:name="com.google.android.gms.plus.service.internal.START"/>
<action android:name="com.google.android.gms.panorama.service.START"/>
<action android:name="com.google.android.gms.appstate.service.START"/>
<action android:name="com.google.android.gms.ads.service.START"/>
<action android:name="com.google.android.gms.accounts.ACCOUNT_SERVICE"/>
<action android:name="com.google.android.gms.identity.service.BIND"/>
<action android:name="com.google.android.gms.wearable.BIND"/>
<action android:name="com.google.android.gms.auth.service.START"/>
<action android:name="com.google.android.gms.fitness.GoogleFitnessService.START"/>
<action android:name="com.google.android.gms.deviceconnection.service.START"/>
<action android:name="com.google.android.gms.droidguard.service.START"/>
<action android:name="com.google.android.gms.lockbox.service.START"/>
<action android:name="com.google.android.gms.cast_mirroring.service.START"/>
<action android:name="com.google.android.gms.photos.autobackup.service.START"/>
<action android:name="com.google.android.gms.udc.service.START"/>
<action android:name="com.google.android.gms.mdm.services.DeviceManagerApiService.START"/>
<action android:name="com.google.android.gms.pseudonymous.service.START"/>
<action android:name="com.google.android.gms.common.service.START"/>
<action android:name="com.google.android.gms.usagereporting.service.START"/>
<action android:name="com.google.android.gms.kids.service.START"/>
<action android:name="com.google.android.gms.common.download.START"/>
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START"/>
<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.phenotype.service.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.plus.service.START" />
<action android:name="com.google.android.gms.plus.service.internal.START" />
<action android:name="com.google.android.gms.panorama.service.START" />
<action android:name="com.google.android.gms.appstate.service.START" />
<action android:name="com.google.android.gms.ads.service.START" />
<action android:name="com.google.android.gms.accounts.ACCOUNT_SERVICE" />
<action android:name="com.google.android.gms.identity.service.BIND" />
<action android:name="com.google.android.gms.wearable.BIND" />
<action android:name="com.google.android.gms.auth.service.START" />
<action android:name="com.google.android.gms.fitness.GoogleFitnessService.START" />
<action android:name="com.google.android.gms.deviceconnection.service.START" />
<action android:name="com.google.android.gms.droidguard.service.START" />
<action android:name="com.google.android.gms.lockbox.service.START" />
<action android:name="com.google.android.gms.cast_mirroring.service.START" />
<action android:name="com.google.android.gms.photos.autobackup.service.START" />
<action android:name="com.google.android.gms.udc.service.START" />
<action android:name="com.google.android.gms.mdm.services.DeviceManagerApiService.START" />
<action android:name="com.google.android.gms.pseudonymous.service.START" />
<action android:name="com.google.android.gms.common.service.START" />
<action android:name="com.google.android.gms.usagereporting.service.START" />
<action android:name="com.google.android.gms.kids.service.START" />
<action android:name="com.google.android.gms.common.download.START" />
<action android:name="com.google.android.contextmanager.service.ContextManagerService.START" />
<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.phenotype.service.START" />
<action android:name="com.google.android.gms.auth.api.credentials.service.START" />
<action android:name="com.google.android.gms.gass.START" />
</intent-filter>
</service>
</application>

View File

@ -20,11 +20,11 @@ import android.content.Context;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaRouteSelector;
import android.support.v7.media.MediaRouter;
import android.util.Log;
import androidx.mediarouter.media.MediaControlIntent;
import androidx.mediarouter.media.MediaRouteSelector;
import com.google.android.gms.cast.CastMediaControlIntent;
import com.google.android.gms.cast.framework.CastOptions;
import com.google.android.gms.cast.framework.IAppVisibilityListener;

View File

@ -18,7 +18,6 @@ package com.google.android.gms.cast.framework.internal;
import android.content.Context;
import android.os.RemoteException;
import android.support.v7.media.MediaRouter;
import android.util.Log;
import com.google.android.gms.cast.framework.CastOptions;

View File

@ -26,8 +26,6 @@ import com.google.android.gms.cast.framework.ISession;
import com.google.android.gms.dynamic.IObjectWrapper;
import com.google.android.gms.dynamic.ObjectWrapper;
import android.support.v7.media.MediaControlIntent;
public class MediaRouterCallbackImpl extends IMediaRouterCallback.Stub {
private static final String TAG = MediaRouterCallbackImpl.class.getSimpleName();

View File

@ -18,10 +18,11 @@ package com.google.android.gms.cast.media;
import org.microg.gms.cast.CastMediaRouteProvider;
import android.support.v7.media.MediaRouteProviderService;
import android.support.v7.media.MediaRouteProvider;
import android.util.Log;
import androidx.mediarouter.media.MediaRouteProvider;
import androidx.mediarouter.media.MediaRouteProviderService;
public class CastMediaRouteProviderService extends MediaRouteProviderService {
private static final String TAG = CastMediaRouteProviderService.class.getSimpleName();

View File

@ -18,7 +18,7 @@ package com.google.android.gms.common;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.support.annotation.Keep;
import androidx.annotation.Keep;
import android.util.Log;
import com.google.android.gms.common.internal.GoogleCertificatesQuery;

View File

@ -27,9 +27,10 @@ import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import androidx.annotation.Nullable;
import org.microg.gms.common.PackageUtils;
import java.util.Arrays;

View File

@ -26,10 +26,11 @@ import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Parcel;
import android.os.RemoteException;
import android.support.v4.app.NotificationCompat;
import android.util.Base64;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import com.google.android.auth.IAuthManagerService;
import com.google.android.gms.R;
import com.google.android.gms.auth.AccountChangeEventsRequest;

View File

@ -18,6 +18,7 @@ package org.microg.gms.auth;
import android.content.Context;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.Build;
import org.microg.gms.common.Constants;
import org.microg.gms.common.HttpFormClient;
@ -112,7 +113,7 @@ public class AuthRequest extends HttpFormClient.Request {
public AuthRequest fromContext(Context context) {
build(Utils.getBuild(context));
locale(Utils.getLocale(context));
androidIdHex = Utils.getAndroidIdHex(context);
androidIdHex = Long.toHexString(LastCheckinInfo.read(context).androidId);
return this;
}

View File

@ -20,13 +20,14 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.StringRes;
import com.google.android.gms.R;
public abstract class AssistantActivity extends Activity {

View File

@ -28,7 +28,6 @@ import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.StringRes;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
@ -44,6 +43,8 @@ import android.webkit.WebViewClient;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.StringRes;
import com.google.android.gms.R;
import org.json.JSONArray;

View File

@ -23,14 +23,11 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.AsyncTask;
import android.os.Handler;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaRouteDescriptor;
import android.support.v7.media.MediaRouteDiscoveryRequest;
import android.support.v7.media.MediaRouteProvider;
import android.support.v7.media.MediaRouteProviderDescriptor;
import android.support.v7.media.MediaRouter;
import android.util.Log;
import androidx.mediarouter.media.MediaRouteProvider;
import androidx.mediarouter.media.MediaRouter;
import com.google.android.gms.common.images.WebImage;
import com.google.android.gms.cast.CastDevice;

View File

@ -26,14 +26,15 @@ import android.os.Build;
import android.os.Bundle;
import android.os.AsyncTask;
import android.os.Handler;
import android.support.v7.media.MediaControlIntent;
import android.support.v7.media.MediaRouteDescriptor;
import android.support.v7.media.MediaRouteDiscoveryRequest;
import android.support.v7.media.MediaRouteProvider;
import android.support.v7.media.MediaRouteProviderDescriptor;
import android.support.v7.media.MediaRouter;
import android.util.Log;
import androidx.mediarouter.media.MediaControlIntent;
import androidx.mediarouter.media.MediaRouteDescriptor;
import androidx.mediarouter.media.MediaRouteDiscoveryRequest;
import androidx.mediarouter.media.MediaRouteProvider;
import androidx.mediarouter.media.MediaRouteProviderDescriptor;
import androidx.mediarouter.media.MediaRouter;
import com.google.android.gms.common.images.WebImage;
import com.google.android.gms.cast.CastDevice;
import com.google.android.gms.cast.CastMediaControlIntent;

View File

@ -23,9 +23,10 @@ import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.legacy.content.WakefulBroadcastReceiver;
import com.google.android.gms.checkin.internal.ICheckinService;
import org.microg.gms.auth.AuthConstants;

View File

@ -21,9 +21,10 @@ import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.preference.PreferenceManager;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.legacy.content.WakefulBroadcastReceiver;
import org.microg.gms.common.ForegroundServiceContext;
import static org.microg.gms.checkin.CheckinService.EXTRA_FORCE_CHECKIN;

View File

@ -38,10 +38,11 @@ import android.os.Parcelable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.support.annotation.RequiresApi;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.annotation.RequiresApi;
import androidx.legacy.content.WakefulBroadcastReceiver;
import com.squareup.wire.Message;
import org.microg.gms.checkin.LastCheckinInfo;
@ -553,7 +554,13 @@ public class McsService extends Service implements Handler.Callback {
}
}
targetIntent.setComponent(new ComponentName(resolveInfo.activityInfo.packageName, resolveInfo.activityInfo.name));
sendOrderedBroadcast(targetIntent, receiverPermission);
if (resolveInfo.activityInfo.packageName.equals(packageName)) {
sendOrderedBroadcast(targetIntent, receiverPermission);
} else if (receiverPermission != null) {
sendOrderedBroadcast(targetIntent, receiverPermission);
} else {
Log.w(TAG, resolveInfo.activityInfo.packageName + "/" + resolveInfo.activityInfo.name + " matches for C2D message to " + packageName + " but corresponding permission was not declared");
}
}
}
}

View File

@ -18,7 +18,8 @@ package org.microg.gms.gcm;
import android.content.Context;
import android.content.Intent;
import android.support.v4.content.WakefulBroadcastReceiver;
import androidx.legacy.content.WakefulBroadcastReceiver;
import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_REGISTER;
import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_UNREGISTER;

View File

@ -25,10 +25,11 @@ import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.support.annotation.Nullable;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.legacy.content.WakefulBroadcastReceiver;
import org.microg.gms.checkin.CheckinService;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.PackageUtils;

View File

@ -19,9 +19,10 @@ package org.microg.gms.gcm;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.legacy.content.WakefulBroadcastReceiver;
import static org.microg.gms.gcm.McsConstants.ACTION_SEND;
public class SendReceiver extends WakefulBroadcastReceiver {

View File

@ -21,9 +21,10 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.v4.content.WakefulBroadcastReceiver;
import android.util.Log;
import androidx.legacy.content.WakefulBroadcastReceiver;
import org.microg.gms.checkin.LastCheckinInfo;
import org.microg.gms.common.ForegroundServiceContext;

View File

@ -24,9 +24,10 @@ import android.content.Intent;
import android.content.SyncResult;
import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.Nullable;
import android.util.Log;
import androidx.annotation.Nullable;
public class ContactSyncService extends Service {
private static final String TAG = "GmsContactSync";

View File

@ -21,10 +21,11 @@ import android.content.ContentValues;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public class ConfigurationProvider extends ContentProvider {
private static final String TAG = "GmsPhenotypeCfgProvider";
@Override

View File

@ -16,7 +16,9 @@
package org.microg.gms.ui;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import com.google.android.gms.BuildConfig;
import org.microg.tools.ui.AbstractAboutFragment;
import org.microg.tools.ui.AbstractSettingsActivity;
@ -27,17 +29,17 @@ public class AboutFragment extends AbstractAboutFragment {
@Override
protected void collectLibraries(List<AbstractAboutFragment.Library> libraries) {
if (BuildConfig.USE_MAPBOX) {
libraries.add(new AbstractAboutFragment.Library("com.mapbox.mapboxsdk", "Mapbox Maps SDK for Android", "Three-Clause BSD, Mapbox"));
} else {
libraries.add(new AbstractAboutFragment.Library("org.oscim.android", "V™", "GNU LGPLv3, Hannes Janetzek and devemux86"));
}
libraries.add(new AbstractAboutFragment.Library("de.hdodenhof.circleimageview", "CircleImageView", "Apache License 2.0, Henning Dodenhof"));
libraries.add(new AbstractAboutFragment.Library("su.litvak.chromecast.api.v2", "ChromeCast Java API v2", "Apache License 2.0, Vitaly Litvak"));
libraries.add(new AbstractAboutFragment.Library("org.conscrypt", "Conscrypt", "Apache License 2.0, The Android Open Source Project"));
libraries.add(new AbstractAboutFragment.Library("org.microg.gms.api", "GmsApi", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("org.microg.gms", "GmsLib", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("com.mapbox.mapboxsdk", "Mapbox Maps SDK for Android", "Three-Clause BSD, Mapbox"));
libraries.add(new AbstractAboutFragment.Library("org.microg.safeparcel", "SafeParcel", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("org.slf4j", "SLF4J", "MIT License, QOS.ch"));
libraries.add(new AbstractAboutFragment.Library("org.microg.nlp", "UnifiedNlp", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("org.microg.nlp.api", "UnifiedNlp Api", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("org.oscim.android", "V™", "GNU LGPLv3, Hannes Janetzek and devemux86"));
libraries.add(new AbstractAboutFragment.Library("org.microg.nlp.service", "UnifiedNlp", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("org.microg.wearable", "Wearable", "Apache License 2.0, microG Team"));
libraries.add(new AbstractAboutFragment.Library("com.squareup.wire", "Wire Protocol Buffers", "Apache License 2.0, Square Inc."));
}

View File

@ -20,9 +20,10 @@ import android.accounts.Account;
import android.accounts.AccountManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.preference.Preference;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import com.google.android.gms.R;
@ -49,8 +50,8 @@ public class AccountSettingsActivity extends AbstractSettingsActivity {
}
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferencesFix(savedInstanceState, rootKey);
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
Preference pref = findPreference(PREF_AUTH_VISIBLE);
if (pref != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {

View File

@ -4,11 +4,12 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.Html;
import android.view.View;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import com.google.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;
@ -88,8 +89,8 @@ public class AskPushPermission extends FragmentActivity {
}
@Override
protected void onStop() {
super.onStop();
protected void onDestroy() {
super.onDestroy();
if (!answered) {
PushRegisterService.replyNotAvailable(AskPushPermission.this, intent, packageName, requestId);
answered = true;

View File

@ -18,7 +18,8 @@ package org.microg.gms.ui;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import com.google.android.gms.R;

View File

@ -23,10 +23,11 @@ import android.net.Uri;
import android.os.Build;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.View;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.google.android.gms.R;
import org.microg.gms.gcm.GcmPrefs;

View File

@ -18,9 +18,10 @@ package org.microg.gms.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.preference.Preference;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import com.google.android.gms.R;
@ -41,8 +42,8 @@ public class GcmAdvancedFragment extends ResourceSettingsFragment {
}
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferencesFix(savedInstanceState, rootKey);
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
for (String pref : HEARTBEAT_PREFS) {
findPreference(pref).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override

View File

@ -7,16 +7,17 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.format.DateUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import com.google.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;

View File

@ -21,18 +21,19 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.preference.PreferenceViewHolder;
import android.text.format.DateUtils;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceViewHolder;
import com.google.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;
@ -75,8 +76,8 @@ public class GcmFragment extends SwitchBarResourceSettingsFragment {
}
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferencesFix(savedInstanceState, rootKey);
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
database = new GcmDatabase(getContext());

View File

@ -23,12 +23,6 @@ import android.location.Location;
import android.location.LocationManager;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
@ -38,6 +32,13 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.view.MenuItemCompat;
import com.google.android.gms.R;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.common.api.Status;

View File

@ -17,9 +17,10 @@
package org.microg.gms.ui;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.preference.Preference;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.preference.Preference;
import com.google.android.gms.R;
@ -42,8 +43,8 @@ public class SafetyNetAdvancedFragment extends ResourceSettingsFragment {
private RadioButtonPreference radioThirdParty;
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferencesFix(savedInstanceState, rootKey);
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
radioOfficial = (RadioButtonPreference) findPreference(PREF_SNET_OFFICIAL);
radioSelfSigned = (RadioButtonPreference) findPreference(PREF_SNET_SELF_SIGNED);

View File

@ -18,12 +18,13 @@ package org.microg.gms.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.google.android.gms.R;
import org.microg.gms.snet.SafetyNetPrefs;

View File

@ -18,13 +18,14 @@ package org.microg.gms.ui;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import org.microg.tools.selfcheck.InstalledPackagesChecks;
import org.microg.tools.selfcheck.NlpOsCompatChecks;
import org.microg.tools.selfcheck.NlpStatusChecks;
//import org.microg.tools.selfcheck.NlpOsCompatChecks;
//import org.microg.tools.selfcheck.NlpStatusChecks;
import org.microg.tools.selfcheck.PermissionCheckGroup;
import org.microg.tools.selfcheck.RomSpoofSignatureChecks;
import org.microg.tools.selfcheck.SelfCheckGroup;
@ -48,13 +49,13 @@ public class SelfCheckFragment extends AbstractSelfCheckFragment {
checks.add(new RomSpoofSignatureChecks());
checks.add(new InstalledPackagesChecks());
if (SDK_INT > LOLLIPOP_MR1) {
checks.add(new PermissionCheckGroup(ACCESS_COARSE_LOCATION, WRITE_EXTERNAL_STORAGE, GET_ACCOUNTS, READ_PHONE_STATE));
checks.add(new PermissionCheckGroup(ACCESS_COARSE_LOCATION, "android.permission.ACCESS_BACKGROUND_LOCATION", WRITE_EXTERNAL_STORAGE, GET_ACCOUNTS, READ_PHONE_STATE));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checks.add(new SystemChecks());
}
checks.add(new NlpOsCompatChecks());
checks.add(new NlpStatusChecks());
// checks.add(new NlpOsCompatChecks());
// checks.add(new NlpStatusChecks());
}
@Override

View File

@ -18,16 +18,17 @@ package org.microg.gms.ui;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.google.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;
import org.microg.gms.gcm.GcmPrefs;
import org.microg.gms.snet.SafetyNetPrefs;
import org.microg.nlp.Preferences;
//import org.microg.nlp.Preferences;
import org.microg.tools.ui.AbstractDashboardActivity;
import org.microg.tools.ui.ResourceSettingsFragment;
@ -51,7 +52,7 @@ public class SettingsActivity extends AbstractDashboardActivity {
public static final String PREF_ABOUT = "pref_about";
public static final String PREF_GCM = "pref_gcm";
public static final String PREF_SNET = "pref_snet";
public static final String PREF_UNIFIEDNLP = "pref_unifiednlp";
// public static final String PREF_UNIFIEDNLP = "pref_unifiednlp";
public static final String PREF_CHECKIN = "pref_checkin";
public FragmentImpl() {
@ -59,8 +60,8 @@ public class SettingsActivity extends AbstractDashboardActivity {
}
@Override
public void onCreatePreferencesFix(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferencesFix(savedInstanceState, rootKey);
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
super.onCreatePreferences(savedInstanceState, rootKey);
updateDetails();
}
@ -97,12 +98,12 @@ public class SettingsActivity extends AbstractDashboardActivity {
findPreference(PREF_SNET).setSummary(R.string.service_status_disabled);
}
Preferences unifiedNlPrefs = new Preferences(getContext());
int backendCount = TextUtils.isEmpty(unifiedNlPrefs.getLocationBackends()) ? 0 :
Preferences.splitBackendString(unifiedNlPrefs.getLocationBackends()).length;
backendCount += TextUtils.isEmpty(unifiedNlPrefs.getGeocoderBackends()) ? 0 :
Preferences.splitBackendString(unifiedNlPrefs.getGeocoderBackends()).length;
findPreference(PREF_UNIFIEDNLP).setSummary(getResources().getQuantityString(R.plurals.pref_unifiednlp_summary, backendCount, backendCount));
// Preferences unifiedNlPrefs = new Preferences(getContext());
// int backendCount = TextUtils.isEmpty(unifiedNlPrefs.getLocationBackends()) ? 0 :
// Preferences.splitBackendString(unifiedNlPrefs.getLocationBackends()).length;
// backendCount += TextUtils.isEmpty(unifiedNlPrefs.getGeocoderBackends()) ? 0 :
// Preferences.splitBackendString(unifiedNlPrefs.getGeocoderBackends()).length;
// findPreference(PREF_UNIFIEDNLP).setSummary(getResources().getQuantityString(R.plurals.pref_unifiednlp_summary, backendCount, backendCount));
boolean checkinEnabled = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(PREF_ENABLE_CHECKIN, false);
findPreference(PREF_CHECKIN).setSummary(checkinEnabled ? R.string.service_status_enabled : R.string.service_status_disabled);

View File

@ -0,0 +1,18 @@
package org.microg.gms.ui;
import androidx.fragment.app.Fragment;
import org.microg.nlp.ui.BackendDetailsFragment;
import org.microg.nlp.ui.BackendListFragment;
import org.microg.tools.ui.AbstractSettingsActivity;
public class UnifiedBackendDetailsActivity extends AbstractSettingsActivity {
public UnifiedBackendDetailsActivity() {
showHomeAsUp = true;
}
@Override
protected Fragment getFragment() {
return new BackendDetailsFragment();
}
}

View File

@ -0,0 +1,32 @@
package org.microg.gms.ui;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import org.microg.nlp.ui.BackendListFragment;
import org.microg.tools.ui.AbstractSettingsActivity;
public class UnifiedBackendListActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} catch (Exception e) {
Log.w("GmsCoreSettingUi", e);
}
getSupportFragmentManager().beginTransaction().add(new BackendListFragment(), null).commit();
}
@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}
}

View File

@ -24,11 +24,12 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import androidx.annotation.Nullable;
import com.google.android.gms.common.data.DataHolder;
import com.google.android.gms.wearable.Asset;
import com.google.android.gms.wearable.ConnectionConfiguration;

View File

@ -18,8 +18,9 @@ package org.microg.tools.selfcheck;
import android.content.Context;
import android.content.pm.PackageManager;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import com.google.android.gms.R;

View File

@ -22,7 +22,8 @@ import android.content.Intent;
import android.net.Uri;
import android.os.PowerManager;
import android.provider.Settings;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import com.google.android.gms.R;

View File

@ -69,17 +69,15 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefcat_configuration">
<org.microg.tools.ui.TintIconPreference
android:icon="@drawable/location_marker"
android:key="pref_unifiednlp"
android:title="@string/nlp_settings_label">
android:title="UnifiedNlp">
<intent
android:targetClass="org.microg.nlp.ui.SettingsActivity"
android:targetClass="org.microg.nlp.ui.BackendSettingsActivity"
android:targetPackage="com.google.android.gms"/>
</org.microg.tools.ui.TintIconPreference>
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefcat_about">
<org.microg.tools.ui.TintIconPreference
android:icon="@drawable/info"
android:key="pref_about"
android:title="@string/pref_about_title">
<intent

View File

@ -16,31 +16,19 @@
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -16,35 +16,22 @@
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)
}
group = 'org.microg'
version = getMyVersionName()
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName getMyVersionName()
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation project(':play-services-basement')
implementation "org.microg:safe-parcel:$safeParcelVersion"
api project(':play-services-basement')
}

View File

@ -0,0 +1,39 @@
/*
* 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'
dependencies {
api project(':play-services-location-api')
implementation project(':play-services-base-core')
implementation "org.microg.nlp:geocode-v1:$nlpVersion"
implementation "org.microg.nlp:location-v2:$nlpVersion"
implementation "org.microg.nlp:location-v3:$nlpVersion"
implementation "org.microg.nlp:service:$nlpVersion"
implementation "org.microg.nlp:client:$nlpVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutineVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
api "org.microg.nlp:ui:$nlpVersion"
}
android {
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ SPDX-FileCopyrightText: 2020, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
-->
<manifest package="org.microg.gms.location.core" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application>
<service android:name="org.microg.gms.location.GoogleLocationManagerService">
<intent-filter>
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START"/>
</intent-filter>
</service>
<service android:name="org.microg.gms.location.ReportingAndroidService">
<intent-filter>
<action android:name="com.google.android.location.reporting.service.START"/>
<action android:name="com.google.android.gms.location.reporting.service.START"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</service>
</application>
</manifest>

View File

@ -21,6 +21,7 @@ import android.app.PendingIntent;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.Binder;
import android.os.RemoteException;
import com.google.android.gms.location.ILocationListener;
@ -50,7 +51,7 @@ public class GoogleLocationManager implements LocationChangeListener {
private final Context context;
private final RealLocationProvider gpsProvider;
private final RealLocationProvider networkProvider;
private final UnifiedLocationProvider networkProvider;
private final MockLocationProvider mockProvider;
private final List<LocationRequestHelper> currentRequests = new ArrayList<LocationRequestHelper>();
@ -64,7 +65,7 @@ public class GoogleLocationManager implements LocationChangeListener {
}
if (Utils.hasSelfPermissionOrNotify(context, Manifest.permission.ACCESS_COARSE_LOCATION)) {
if (locationManager.getAllProviders().contains(NETWORK_PROVIDER)) {
this.networkProvider = new RealLocationProvider(locationManager, NETWORK_PROVIDER, this);
this.networkProvider = new UnifiedLocationProvider(context, this);
} else {
// TODO: Add ability to directly contact UnifiedNlp without the system location provider
this.networkProvider = null;
@ -116,20 +117,19 @@ public class GoogleLocationManager implements LocationChangeListener {
private void requestLocationUpdates(LocationRequestHelper request) {
currentRequests.add(request);
if (gpsProvider != null && request.hasFinePermission && request.locationRequest.getPriority() == PRIORITY_HIGH_ACCURACY)
if (gpsProvider != null && request.hasFinePermission() && request.locationRequest.getPriority() == PRIORITY_HIGH_ACCURACY) {
gpsProvider.addRequest(request);
if (networkProvider != null && request.hasCoarsePermission && request.locationRequest.getPriority() != PRIORITY_NO_POWER)
}
if (networkProvider != null && request.hasCoarsePermission() && request.locationRequest.getPriority() != PRIORITY_NO_POWER)
networkProvider.addRequest(request);
}
public void requestLocationUpdates(LocationRequest request, ILocationListener listener, String packageName) {
requestLocationUpdates(new LocationRequestHelper(context, request, hasFineLocationPermission(),
hasCoarseLocationPermission(), packageName, listener));
requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), listener));
}
public void requestLocationUpdates(LocationRequest request, PendingIntent intent, String packageName) {
requestLocationUpdates(new LocationRequestHelper(context, request, hasFineLocationPermission(),
hasCoarseLocationPermission(), packageName, intent));
requestLocationUpdates(new LocationRequestHelper(context, request, packageName, Binder.getCallingUid(), intent));
}
private void removeLocationUpdates(LocationRequestHelper request) {
@ -157,11 +157,11 @@ public class GoogleLocationManager implements LocationChangeListener {
}
public void updateLocationRequest(LocationRequestUpdateData data) {
String packageName = null;
String packageName = PackageUtils.getCallingPackage(context);
if (data.pendingIntent != null)
packageName = PackageUtils.packageFromPendingIntent(data.pendingIntent);
if (data.opCode == LocationRequestUpdateData.REQUEST_UPDATES) {
requestLocationUpdates(new LocationRequestHelper(context, hasFineLocationPermission(), hasCoarseLocationPermission(), packageName, data));
requestLocationUpdates(new LocationRequestHelper(context, packageName, Binder.getCallingUid(), data));
if (data.fusedLocationProviderCallback != null) {
try {
data.fusedLocationProviderCallback.onFusedLocationProviderResult(FusedLocationProviderResult.SUCCESS);
@ -196,7 +196,7 @@ public class GoogleLocationManager implements LocationChangeListener {
public void onLocationChanged() {
for (int i = 0; i < currentRequests.size(); i++) {
LocationRequestHelper request = currentRequests.get(i);
if (!request.report(getLocation(request.hasFinePermission, request.hasCoarsePermission))) {
if (!request.report(getLocation(request.initialHasFinePermission, request.initialHasCoarsePermission))) {
removeLocationUpdates(request);
i--;
}

View File

@ -146,14 +146,14 @@ public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerServ
@Override
public Location getLastLocation() throws RemoteException {
Log.d(TAG, "getLastLocation");
return getLocationManager().getLastLocation(PackageUtils.packageFromProcessId(context, Binder.getCallingPid()));
return getLocationManager().getLastLocation(PackageUtils.getCallingPackage(context));
}
@Override
public void requestLocationUpdatesWithListener(LocationRequest request,
final ILocationListener listener) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesWithListener: " + request);
getLocationManager().requestLocationUpdates(request, listener, PackageUtils.packageFromProcessId(context, Binder.getCallingPid()));
getLocationManager().requestLocationUpdates(request, listener, PackageUtils.getCallingPackage(context));
}
@Override
@ -167,7 +167,7 @@ public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerServ
public void removeLocationUpdatesWithListener(ILocationListener listener)
throws RemoteException {
Log.d(TAG, "removeLocationUpdatesWithListener: " + listener);
getLocationManager().removeLocationUpdates(listener, PackageUtils.packageFromProcessId(context, Binder.getCallingPid()));
getLocationManager().removeLocationUpdates(listener, PackageUtils.getCallingPackage(context));
}
@Override
@ -314,7 +314,7 @@ public class GoogleLocationManagerServiceImpl extends IGoogleLocationManagerServ
public void requestLocationUpdatesInternalWithListener(LocationRequestInternal request,
ILocationListener listener) throws RemoteException {
Log.d(TAG, "requestLocationUpdatesInternalWithListener: " + request);
getLocationManager().requestLocationUpdates(request.request, listener, PackageUtils.packageFromProcessId(context, Binder.getCallingPid()));
getLocationManager().requestLocationUpdates(request.request, listener, PackageUtils.getCallingPackage(context));
}
@Override

View File

@ -16,10 +16,16 @@
package org.microg.gms.location;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.os.Binder;
import android.os.Build;
import android.os.RemoteException;
import android.util.Log;
@ -27,22 +33,26 @@ import com.google.android.gms.location.ILocationCallback;
import com.google.android.gms.location.ILocationListener;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.internal.IFusedLocationProviderCallback;
import com.google.android.gms.location.internal.LocationRequestUpdateData;
import com.google.android.gms.location.internal.FusedLocationProviderResult;
import com.google.android.gms.common.api.Status;
import org.microg.gms.common.PackageUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.ACCESS_FINE_LOCATION;
public class LocationRequestHelper {
public static final String TAG = "GmsLocRequestHelper";
private final Context context;
public final LocationRequest locationRequest;
public final boolean hasFinePermission;
public final boolean hasCoarsePermission;
public final boolean initialHasFinePermission;
public final boolean initialHasCoarsePermission;
public final String packageName;
public final int uid;
private final boolean selfHasAppOpsRights;
private ILocationListener listener;
private PendingIntent pendingIntent;
private ILocationCallback callback;
@ -50,30 +60,30 @@ public class LocationRequestHelper {
private Location lastReport;
private int numReports = 0;
private LocationRequestHelper(Context context, LocationRequest locationRequest, boolean hasFinePermission,
boolean hasCoarsePermission, String packageName) {
private LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid) {
this.context = context;
this.locationRequest = locationRequest;
this.hasFinePermission = hasFinePermission;
this.hasCoarsePermission = hasCoarsePermission;
this.packageName = packageName;
this.uid = uid;
this.initialHasFinePermission = context.getPackageManager().checkPermission(ACCESS_FINE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
this.initialHasCoarsePermission = context.getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, packageName) == PackageManager.PERMISSION_GRANTED;
this.selfHasAppOpsRights = context.getPackageManager().checkPermission("android.permission.UPDATE_APP_OPS_STATS", context.getPackageName()) == PackageManager.PERMISSION_GRANTED;
}
public LocationRequestHelper(Context context, LocationRequest locationRequest, boolean hasFinePermission,
boolean hasCoarsePermission, String packageName, ILocationListener listener) {
this(context, locationRequest, hasFinePermission, hasCoarsePermission, packageName);
public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, ILocationListener listener) {
this(context, locationRequest, packageName, uid);
this.listener = listener;
}
public LocationRequestHelper(Context context, LocationRequest locationRequest, boolean hasFinePermission,
boolean hasCoarsePermission, String packageName, PendingIntent pendingIntent) {
this(context, locationRequest, hasFinePermission, hasCoarsePermission, packageName);
public LocationRequestHelper(Context context, LocationRequest locationRequest, String packageName, int uid, PendingIntent pendingIntent) {
this(context, locationRequest, packageName, uid);
this.pendingIntent = pendingIntent;
}
public LocationRequestHelper(Context context, boolean hasFinePermission, boolean hasCoarsePermission,
String packageName, LocationRequestUpdateData data) {
this(context, data.request.request, hasFinePermission, hasCoarsePermission, packageName);
public LocationRequestHelper(Context context, String packageName, int uid, LocationRequestUpdateData data) {
this(context, data.request.request, packageName, uid);
this.listener = data.listener;
this.pendingIntent = data.pendingIntent;
this.callback = data.callback;
@ -84,6 +94,7 @@ public class LocationRequestHelper {
*/
public boolean report(Location location) {
if (location == null) return true;
if (!hasCoarsePermission()) return false;
if (lastReport != null) {
if (location.getTime() - lastReport.getTime() < locationRequest.getFastestInterval()) {
return true;
@ -124,8 +135,8 @@ public class LocationRequestHelper {
public String toString() {
return "LocationRequestHelper{" +
"locationRequest=" + locationRequest +
", hasFinePermission=" + hasFinePermission +
", hasCoarsePermission=" + hasCoarsePermission +
", hasFinePermission=" + hasFinePermission() +
", hasCoarsePermission=" + hasCoarsePermission() +
", packageName='" + packageName + '\'' +
", lastReport=" + lastReport +
'}';
@ -152,22 +163,55 @@ public class LocationRequestHelper {
LocationRequestHelper that = (LocationRequestHelper) o;
if (hasFinePermission != that.hasFinePermission) return false;
if (hasCoarsePermission != that.hasCoarsePermission) return false;
if (!locationRequest.equals(that.locationRequest)) return false;
if (packageName != null ? !packageName.equals(that.packageName) : that.packageName != null) return false;
if (listener != null ? !listener.equals(that.listener) : that.listener != null) return false;
if (pendingIntent != null ? !pendingIntent.equals(that.pendingIntent) : that.pendingIntent != null)
return false;
return !(callback != null ? !callback.equals(that.callback) : that.callback != null);
}
public boolean hasFinePermission() {
if (Build.VERSION.SDK_INT >= 19) {
return isAppOpsAllowed(AppOpsManager.OPSTR_FINE_LOCATION, initialHasFinePermission);
} else {
return initialHasFinePermission;
}
}
public boolean hasCoarsePermission() {
if (Build.VERSION.SDK_INT >= 19) {
return isAppOpsAllowed(AppOpsManager.OPSTR_COARSE_LOCATION, initialHasCoarsePermission);
} else {
return initialHasCoarsePermission;
}
}
@TargetApi(19)
private boolean isAppOpsAllowed(String op, boolean def) {
AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
if (appOpsManager == null) return def;
try {
if (Binder.getCallingUid() == uid && Build.VERSION.SDK_INT >= 23) {
return appOpsManager.noteProxyOpNoThrow(op, packageName) == AppOpsManager.MODE_ALLOWED;
} else if (Build.VERSION.SDK_INT >= 29) {
return appOpsManager.noteProxyOpNoThrow(op, packageName, uid) == AppOpsManager.MODE_ALLOWED;
} else if (selfHasAppOpsRights) {
return appOpsManager.noteOpNoThrow(op, uid, packageName) == AppOpsManager.MODE_ALLOWED;
} else {
// TODO: More variant that works pre-29 and without perms?
Log.w(TAG, "Can't check appops (yet)");
return def;
}
} catch (Exception e) {
Log.w(TAG, e);
return def;
}
}
@Override
public int hashCode() {
int result = locationRequest.hashCode();
result = 31 * result + (hasFinePermission ? 1 : 0);
result = 31 * result + (hasCoarsePermission ? 1 : 0);
result = 31 * result + (packageName != null ? packageName.hashCode() : 0);
result = 31 * result + (listener != null ? listener.hashCode() : 0);
result = 31 * result + (pendingIntent != null ? pendingIntent.hashCode() : 0);

View File

@ -105,11 +105,14 @@ public class RealLocationProvider {
} else if (!requests.isEmpty()) {
long minTime = Long.MAX_VALUE;
float minDistance = Float.MAX_VALUE;
StringBuilder sb = new StringBuilder();
for (LocationRequestHelper request : requests) {
minTime = Math.min(request.locationRequest.getInterval(), minTime);
minDistance = Math.min(request.locationRequest.getSmallestDesplacement(), minDistance);
if (sb.length() == 0) sb.append(", ");
sb.append(request.packageName).append(":").append(request.locationRequest.getInterval()).append("ms");
}
Log.d(TAG, name + ": requesting location updates. minTime=" + minTime + " minDistance=" + minDistance);
Log.d(TAG, name + ": requesting location updates with interval " + minTime + "ms (" + sb + "), minDistance=" + minDistance);
if (connected.get()) {
if (connectedMinTime != minTime || connectedMinDistance != minDistance) {
locationManager.removeUpdates(listener);

View File

@ -0,0 +1,88 @@
package org.microg.gms.location
import android.content.Context
import android.location.Location
import android.util.Log
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.microg.nlp.client.UnifiedLocationClient
import java.util.*
import java.util.concurrent.atomic.AtomicBoolean
class UnifiedLocationProvider(context: Context?, changeListener: LocationChangeListener) {
private val client: UnifiedLocationClient
private var connectedMinTime: Long = 0
private var lastLocation: Location? = null
private val connected = AtomicBoolean(false)
private val changeListener: LocationChangeListener
private val requests: MutableList<LocationRequestHelper> = ArrayList()
private val listener: UnifiedLocationClient.LocationListener = object : UnifiedLocationClient.LocationListener {
override fun onLocation(location: Location) {
lastLocation = location
changeListener.onLocationChanged()
}
}
private fun updateLastLocation() {
GlobalScope.launch {
client.getLastLocation()?.let { lastLocation = it }
}
}
fun addRequest(request: LocationRequestHelper) {
Log.d(TAG, "unified network: addRequest $request")
requests.add(request)
updateConnection()
}
fun removeRequest(request: LocationRequestHelper) {
Log.d(TAG, "unified network: removeRequest $request")
requests.remove(request)
updateConnection()
}
fun getLastLocation(): Location? {
if (lastLocation == null) {
Log.d(TAG, "uh-ok: last location for unified network is null!")
}
return lastLocation
}
@Synchronized
private fun updateConnection() {
if (connected.get() && requests.isEmpty()) {
Log.d(TAG, "unified network: no longer requesting location update")
client.removeLocationUpdates(listener)
connected.set(false)
} else if (!requests.isEmpty()) {
var minTime = Long.MAX_VALUE
val sb = StringBuilder()
var opPackageName: String? = null
for (request in requests) {
if (request.locationRequest.interval < minTime) {
opPackageName = request.packageName
minTime = request.locationRequest.interval
}
if (sb.isNotEmpty()) sb.append(", ")
sb.append("${request.packageName}:${request.locationRequest.interval}ms")
}
client.opPackageName = opPackageName
Log.d(TAG, "unified network: requesting location updates with interval ${minTime}ms ($sb)")
if (!connected.get() || connectedMinTime != minTime) {
client.requestLocationUpdates(listener, minTime)
}
connected.set(true)
connectedMinTime = minTime
}
}
companion object {
const val TAG = "GmsLocProviderU"
}
init {
client = UnifiedLocationClient[context!!]
this.changeListener = changeListener
updateLastLocation()
}
}

View File

@ -15,14 +15,18 @@
*/
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
dependencies {
implementation project(':play-services-api')
implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:7.3.0"
implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v7:0.6.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation("com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.1") {
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
}
implementation("com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0") {
exclude group: 'com.mapbox.mapboxsdk', module: 'mapbox-android-accounts'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
}
def execResult(...args) {
@ -41,15 +45,13 @@ def mapboxKey() {
}
android {
compileSdkVersion androidCompileSdk()
compileSdkVersion androidCompileSdk
buildToolsVersion "$androidBuildVersionTools"
defaultConfig {
versionName "temp"
versionCode 1
minSdkVersion androidMinSdk()
targetSdkVersion androidTargetSdk()
versionName version
minSdkVersion androidMinSdk
targetSdkVersion androidTargetSdk
buildConfigField "String", "MAPBOX_KEY", "\"${mapboxKey()}\""
ndk {

View File

@ -21,7 +21,7 @@ import android.content.Context;
import android.content.res.Resources;
import android.os.Parcel;
import android.os.RemoteException;
import android.support.annotation.Keep;
import androidx.annotation.Keep;
import android.util.Log;
import com.google.android.gms.dynamic.IObjectWrapper;

View File

@ -0,0 +1,28 @@
package com.mapbox.android.accounts.v1;
import java.util.UUID;
/**
* This class is used from within the Mapbox library
*/
@SuppressWarnings("unused")
public class MapboxAccounts {
public final static String SKU_ID_MAPS_MAUS = "00";
private final static String MAPS_SKU_PREFIX = "100";
/**
* Generates random UUID without hyphens
*/
public static String obtainEndUserId() {
String uuid = UUID.randomUUID().toString();
return uuid.substring(0, 8) + uuid.substring(9, 13) + uuid.substring(14, 18) + uuid.substring(19, 23) + uuid.substring(24, 36);
}
/**
* Generates a SKU which is the user id prefixed with 100 and base-36 encoded timestamp
*/
public static String obtainMapsSkuUserToken(String userId) {
String stamp = Long.toString(System.currentTimeMillis(), 36);
return MAPS_SKU_PREFIX + stamp + userId;
}
}

View File

@ -64,7 +64,7 @@ class CameraUpdateFactoryImpl : ICameraUpdateFactoryDelegate.Stub() {
override fun newLatLngBoundsWithSize(bounds: LatLngBounds, width: Int, height: Int, padding: Int): IObjectWrapper =
ObjectWrapper.wrap(CameraBoundsWithSizeUpdate(bounds.toMapbox(), width, height, padding))
override fun onTransact(code: Int, data: Parcel?, reply: Parcel?, flags: Int): Boolean =
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
if (super.onTransact(code, data, reply, flags)) {
true
} else {

View File

@ -17,20 +17,19 @@
package org.microg.gms.maps.mapbox
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.location.Location
import android.os.Bundle
import android.os.IBinder
import android.os.Parcel
import android.support.annotation.IdRes
import android.support.annotation.Keep
import android.support.v4.util.LongSparseArray
import android.os.*
import androidx.annotation.IdRes
import androidx.annotation.Keep
import android.util.DisplayMetrics
import android.util.Log
import android.view.Gravity
import android.view.View
import android.widget.FrameLayout
import android.widget.RelativeLayout
import androidx.collection.LongSparseArray
import com.google.android.gms.dynamic.IObjectWrapper
import com.google.android.gms.maps.GoogleMapOptions
import com.google.android.gms.maps.internal.*
@ -49,6 +48,7 @@ import com.mapbox.mapboxsdk.plugins.annotation.*
import com.mapbox.mapboxsdk.plugins.annotation.Annotation
import com.mapbox.mapboxsdk.style.layers.Property.LINE_CAP_ROUND
import com.mapbox.mapboxsdk.utils.ColorUtils
import com.mapbox.mapboxsdk.utils.ThreadUtils
import org.microg.gms.kotlin.unwrap
import org.microg.gms.maps.MapsConstants.*
import org.microg.gms.maps.mapbox.model.*
@ -59,6 +59,16 @@ import org.microg.gms.maps.mapbox.utils.toMapbox
private fun <T : Any> LongSparseArray<T>.values() = (0..size()).map { valueAt(it) }.mapNotNull { it }
fun runOnMainLooper(method: () -> Unit) {
if (Looper.myLooper() == Looper.getMainLooper()) {
method()
} else {
Handler(Looper.getMainLooper()).post {
method()
}
}
}
class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions) : IGoogleMapDelegate.Stub() {
val view: FrameLayout
@ -74,7 +84,7 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
private val mapLock = Object()
private val initializedCallbackList = mutableListOf<IOnMapReadyCallback>()
private var loadedCallback : IOnMapLoadedCallback? = null
private var loadedCallback: IOnMapLoadedCallback? = null
private var cameraChangeListener: IOnCameraChangeListener? = null
private var cameraMoveListener: IOnCameraMoveListener? = null
private var cameraMoveCanceledListener: IOnCameraMoveCanceledListener? = null
@ -109,7 +119,10 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
val mapContext = MapContext(context)
BitmapDescriptorFactoryImpl.initialize(mapContext.resources, context.resources)
LibraryLoader.setLibraryLoader(MultiArchLoader(mapContext, context))
Mapbox.getInstance(mapContext, BuildConfig.MAPBOX_KEY)
runOnMainLooper {
Mapbox.getInstance(mapContext, BuildConfig.MAPBOX_KEY)
}
val fakeWatermark = View(mapContext)
fakeWatermark.layoutParams = object : RelativeLayout.LayoutParams(0, 0) {
@ -389,7 +402,14 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
override fun getUiSettings(): IUiSettingsDelegate? = map?.uiSettings?.let { UiSettingsImpl(it) }
override fun getProjection(): IProjectionDelegate? = map?.projection?.let { ProjectionImpl(it) }
override fun getProjection(): IProjectionDelegate? = map?.projection?.let {
val experiment = try {
map?.cameraPosition?.tilt == 0.0 && map?.cameraPosition?.bearing == 0.0
} catch (e: Exception) {
Log.w(TAG, e); false
}
ProjectionImpl(it, experiment)
}
override fun setOnCameraChangeListener(listener: IOnCameraChangeListener?) {
cameraChangeListener = listener
@ -443,13 +463,16 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
override fun setPadding(left: Int, top: Int, right: Int, bottom: Int) {
Log.d(TAG, "setPadding: $left $top $right $bottom")
map?.setPadding(left, top, right, bottom)
val fourDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_four_dp)?.toInt() ?: 0
val ninetyTwoDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_ninety_two_dp)?.toInt()
?: 0
map?.uiSettings?.setLogoMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
map?.uiSettings?.setCompassMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
map?.uiSettings?.setAttributionMargins(left + ninetyTwoDp, top + fourDp, right + fourDp, bottom + fourDp)
map?.let { map ->
map.setPadding(left, top, right, bottom)
val fourDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_four_dp)?.toInt()
?: 0
val ninetyTwoDp = mapView?.context?.resources?.getDimension(R.dimen.mapbox_ninety_two_dp)?.toInt()
?: 0
map.uiSettings.setLogoMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
map.uiSettings.setCompassMargins(left + fourDp, top + fourDp, right + fourDp, bottom + fourDp)
map.uiSettings.setAttributionMargins(left + ninetyTwoDp, top + fourDp, right + fourDp, bottom + fourDp)
}
}
override fun isBuildingsEnabled(): Boolean {
@ -512,7 +535,7 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
private fun hasSymbolAt(latlng: com.mapbox.mapboxsdk.geometry.LatLng): Boolean {
val point = map?.projection?.toScreenLocation(latlng) ?: return false
val features = map?.queryRenderedFeatures(point, SymbolManager.ID_GEOJSON_LAYER)
val features = map?.queryRenderedFeatures(point, symbolManager?.layerId)
?: return false
return features.isNotEmpty()
}
@ -739,7 +762,7 @@ class GoogleMapImpl(private val context: Context, var options: GoogleMapOptions)
}
}
override fun onTransact(code: Int, data: Parcel?, reply: Parcel?, flags: Int): Boolean =
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean =
if (super.onTransact(code, data, reply, flags)) {
true
} else {

Some files were not shown because too many files have changed in this diff Show More