From 6555997664b83ccc7aa20edaa9ea780a5da2ed8a Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 6 Jun 2021 16:00:43 -0600 Subject: [PATCH 1/3] Location: fix LocationSettingsRequest parcelable --- .../LocationSettingsConfiguration.java | 19 ++++++++++++ .../gms/location/LocationSettingsRequest.java | 31 ++++++++----------- 2 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsConfiguration.java diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsConfiguration.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsConfiguration.java new file mode 100644 index 00000000..29dabea9 --- /dev/null +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsConfiguration.java @@ -0,0 +1,19 @@ +/* + * SPDX-FileCopyrightText: 2021, microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.google.android.gms.location; + +import org.microg.safeparcel.AutoSafeParcelable; + +public class LocationSettingsConfiguration extends AutoSafeParcelable { + @Field(1) + public String justificationText; + @Field(2) + public String experimentId; + @Field(5) + public String titleText; + + public static final Creator CREATOR = new AutoCreator<>(LocationSettingsConfiguration.class); +} diff --git a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java index 517ab1c8..f77a392e 100644 --- a/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java +++ b/play-services-location-api/src/main/java/com/google/android/gms/location/LocationSettingsRequest.java @@ -1,17 +1,6 @@ /* - * Copyright (C) 2013-2017 microG Project Team - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-FileCopyrightText: 2015, microG Project Team + * SPDX-License-Identifier: Apache-2.0 */ package com.google.android.gms.location; @@ -26,27 +15,33 @@ import java.util.List; @PublicApi public class LocationSettingsRequest extends AutoSafeParcelable { - @SafeParceled(1000) + @Field(1000) private int versionCode = 2; - @SafeParceled(value = 1, subClass = LocationRequest.class) + @Field(value = 1, subClass = LocationRequest.class) @PublicApi(exclude = true) public List requests; - @SafeParceled(2) + @Field(2) @PublicApi(exclude = true) public boolean alwaysShow; + @Field(3) @PublicApi(exclude = true) public boolean needBle; + @Field(5) + @PublicApi(exclude = true) + public LocationSettingsConfiguration configuration; + private LocationSettingsRequest() { } - private LocationSettingsRequest(List requests, boolean alwaysShow, boolean needBle) { + private LocationSettingsRequest(List requests, boolean alwaysShow, boolean needBle, LocationSettingsConfiguration configuration) { this.requests = requests; this.alwaysShow = alwaysShow; this.needBle = needBle; + this.configuration = configuration; } /** @@ -79,7 +74,7 @@ public class LocationSettingsRequest extends AutoSafeParcelable { * Creates a LocationSettingsRequest that can be used with SettingsApi. */ public LocationSettingsRequest build() { - return new LocationSettingsRequest(requests, alwaysShow, needBle); + return new LocationSettingsRequest(requests, alwaysShow, needBle, null); } /** From 3eb3380c2dc6fed1d416ee9771ef63de6cffa9f4 Mon Sep 17 00:00:00 2001 From: Chirayu Desai Date: Wed, 2 Jun 2021 22:24:16 +0530 Subject: [PATCH 2/3] Make the application persistent * Should help with not having services killed * System app only, but shouldn't cause any errors if it's a user-app Change-Id: Iee2a662da074753008f6896cfa155acbeddcc974 --- play-services-core/src/main/AndroidManifest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 1cbecd77..12c7f6c3 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -114,6 +114,7 @@ android:fullBackupOnly="true" android:extractNativeLibs="false" android:forceQueryable="true" + android:persistent="true" android:icon="@mipmap/ic_core_service_app" android:label="@string/gms_app_name" android:theme="@style/Theme.AppCompat.DayNight"> From 9ccb2073e001760643ab7cedf13cecae2b65a5c4 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Fri, 21 May 2021 20:01:29 -0300 Subject: [PATCH 3/3] Add a FontsProvider that always returns the default font --- .../src/main/AndroidManifest.xml | 6 ++ .../org/microg/gms/fonts/FontsProvider.kt | 97 +++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 play-services-core/src/main/kotlin/org/microg/gms/fonts/FontsProvider.kt diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 12c7f6c3..f20594bd 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -464,6 +464,12 @@ android:authorities="com.google.android.gms.chimera" android:exported="true" /> + + + ?, + selection: String?, + selectionArgs: Array?, + sortOrder: String? + ): Cursor { + Log.e(TAG, "query: $uri ${projection?.toList()} $selection") + val cursor = MatrixCursor(COLUMNS) + // We could also return an empty cursor here, but some apps have been reported to crash + // when their expected font is not returned by Google's font provider. + cursor.addRow( + arrayOf( + 1337L, // file_id + 0, // font_ttc_index + null, // font_variation_settings + 400, // font_weight + 0, // font_italic + 0, // result_code: RESULT_CODE_OK + ) + ) + return cursor + } + + override fun insert(uri: Uri, values: ContentValues?): Uri { + Log.d(TAG, "insert: $uri, $values") + return uri + } + + override fun update( + uri: Uri, + values: ContentValues?, + selection: String?, + selectionArgs: Array? + ): Int { + Log.d(TAG, "update: $uri, $values, $selection, $selectionArgs") + return 0 + } + + override fun delete(uri: Uri, selection: String?, selectionArgs: Array?): Int { + Log.d(TAG, "delete: $uri, $selection, $selectionArgs") + return 0 + } + + override fun getType(uri: Uri): String { + Log.d(TAG, "getType: $uri") + return "font/ttf" + } + + override fun openFile(uri: Uri, mode: String): ParcelFileDescriptor? { + Log.d(TAG, "openFile: $uri mode: $mode") + val file = File("/system/fonts/Roboto-Regular.ttf") + return ParcelFileDescriptor.open(file, MODE_READ_ONLY) + } + + companion object { + private const val TAG = "FontsProvider" + private val COLUMNS = arrayOf( + "file_id", + "font_ttc_index", + "font_variation_settings", + "font_weight", + "font_italic", + "result_code" + ) + } +}