Skip to content

Commit

Permalink
Merge branch 'master' into integrity_service
Browse files Browse the repository at this point in the history
  • Loading branch information
DaVinci9196 authored Dec 9, 2024
2 parents 66b248e + eb484ba commit e69a470
Show file tree
Hide file tree
Showing 194 changed files with 8,291 additions and 783 deletions.
1 change: 1 addition & 0 deletions firebase-dynamic-links/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ dependencies {
// api project(':firebase-common-ktx')
// api project(':firebase-components')
api 'org.jetbrains.kotlin:kotlin-stdlib:1.7.10'
annotationProcessor project(':safe-parcel-processor')
}

apply from: '../gradle/publish-android.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import android.os.Parcel;
import androidx.annotation.NonNull;
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
import com.google.android.gms.common.internal.safeparcel.SafeParcelableCreatorAndWriter;

import android.os.Bundle;
import android.net.Uri;
import org.microg.gms.utils.ToStringHelper;

@SafeParcelable.Class
public class DynamicLinkData extends AbstractSafeParcelable {
@Field(1)
public final String dynamicLink;
Expand All @@ -35,6 +37,7 @@ public class DynamicLinkData extends AbstractSafeParcelable {
@Field(6)
public final Uri redirectUrl;

@Constructor
public DynamicLinkData(@Param(1) String dynamicLink, @Param(2) String deepLink, @Param(3) int minVersion, @Param(4) long clickTimestamp, @Param(5) Bundle extensionBundle, @Param(6) Uri redirectUrl) {
this.dynamicLink = dynamicLink;
this.deepLink = deepLink;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="perm_ad_id_notification_label">إشعار معرّف الإعلان</string>
<string name="perm_ad_id_label">إذن معرّف الإعلان</string>
<string name="perm_ad_id_notification_description">يتيح للتطبيق تلقي إشعار عند تحديث معرّف الإعلان أو تحديد تفضيلات تتبع الإعلانات للمستخدم.</string>
<string name="perm_ad_id_description">يتيح لتطبيق الناشر بالوصول إلى معرف إعلان صالح بشكل مباشر أو غير مباشر.</string>
<string name="perm_ad_id_notification_label">إشعار مُعَرِّف الإعلان</string>
<string name="perm_ad_id_label">إذن مُعَرِّف الإعلان</string>
<string name="perm_ad_id_notification_description">يتيح للتطبيق تلقي إشعار عند تحديث مُعَرِّف الإعلان أو تحديد تفضيلات تتبع الإعلانات للمستخدم.</string>
<string name="perm_ad_id_description">يتيح لتطبيق الناشر بالوصول إلى مُعَرِّف إعلان صالح بشكل مباشر أو غير مباشر.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<string name="perm_ad_id_label">Permiso de identificación publicitaria</string>
<string name="perm_ad_id_description">Permite que una aplicación de editor acceda directa o indirectamente a un ID de publicidad válido.</string>
<string name="perm_ad_id_notification_label">Notificación del ID de publicidad</string>
<string name="perm_ad_id_notification_description">Permite que una aplicación reciba una notificación cuando se actualiza el ID de publicidad o la preferencia de limitar el seguimiento de anuncios del usuario.</string>
<string name="perm_ad_id_notification_description">Permite que una aplicación reciba una notificación cuando se actualiza la preferencia de ID de publicidad o de seguimiento de anuncios del usuario.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources>
<string name="perm_ad_id_label">Permission de l\'identifiant publicitaire</string>
<string name="perm_ad_id_description">Autorise une application affichant de la publicité à accéder directement ou indirectement à un identifiant publicitaire valide.</string>
<string name="perm_ad_id_notification_label">Notification de l\'identifiant publicitaire</string>
<string name="perm_ad_id_notification_description">Autorise une application à être notifiée de la modification de l\'identifiant publicitaire ou de la limitation du suivi publicitaire de l\'utilisateur.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="perm_ad_id_label">อนุญาติรหัสประจำตัวของโฆษณา</string>
<string name="perm_ad_id_notification_label">การแจ้งเตือน รหัสประจำตัวของโฆษณา</string>
<string name="perm_ad_id_description">อนุญาตให้แอปผู้เผยแพร่เข้าถึง รหัสประจำตัวของโฆษณาที่ถูกต้องได้โดยตรงหรือโดยอ้อม</string>
<string name="perm_ad_id_notification_description">อนุญาตให้แอปรับการแจ้งเตือนเมื่อมีการอัปเดต รหัสประจำตัวของโฆษณา หรือ การตั้งค่าการติดตามโฆษณาของผู้ใช้</string>
</resources>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="perm_ad_id_notification_description">Cho phép một ứng dụng nhận được thông báo khi ID quảng cáo hoặc giới hạn tùy chọn theo dõi quảng cáo của người dùng được cập nhật.</string>
<string name="perm_ad_id_label">Quyền của Mã Quảng cáo</string>
<string name="perm_ad_id_notification_label">Thông báo của Mã Quảng cáo</string>
<string name="perm_ad_id_description">Cho phép ứng dụng của nhà xuất bản truy cập trực tiếp hoặc gián tiếp vào một mã quảng cáo hợp lệ.</string>
<string name="perm_ad_id_notification_description">Cho phép ứng dụng nhận thông báo khi ID quảng cáo hoặc tùy chọn giới hạn theo dõi quảng cáo của người dùng được cập nhật.</string>
<string name="perm_ad_id_label">Quyền ID quảng cáo</string>
<string name="perm_ad_id_notification_label">Thông báo ID quảng cáo</string>
<string name="perm_ad_id_description">Cho phép ứng dụng của nhà xuất bản truy cập trực tiếp hoặc gián tiếp vào ID quảng cáo hợp lệ.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import androidx.core.view.setPadding
import androidx.lifecycle.lifecycleScope
import com.android.volley.*
import com.android.volley.toolbox.Volley
import com.google.android.gms.common.internal.safeparcel.SafeParcelableSerializer
import com.google.firebase.dynamiclinks.internal.DynamicLinkData
import com.squareup.wire.Message
import com.squareup.wire.ProtoAdapter
import kotlinx.coroutines.CompletableDeferred
import okio.ByteString.Companion.decodeHex
import org.microg.gms.appinvite.*
import org.microg.gms.common.Constants
import org.microg.gms.utils.singleInstanceOf
import org.microg.gms.utils.toBase64
import java.util.*

private const val TAG = "AppInviteActivity"
Expand All @@ -37,6 +38,7 @@ private const val APPINVITE_DEEP_LINK = "com.google.android.gms.appinvite.DEEP_L
private const val APPINVITE_INVITATION_ID = "com.google.android.gms.appinvite.INVITATION_ID"
private const val APPINVITE_OPENED_FROM_PLAY_STORE = "com.google.android.gms.appinvite.OPENED_FROM_PLAY_STORE"
private const val APPINVITE_REFERRAL_BUNDLE = "com.google.android.gms.appinvite.REFERRAL_BUNDLE"
private const val DYNAMIC_LINK_DATA = "com.google.firebase.dynamiclinks.DYNAMIC_LINK_DATA"

class AppInviteActivity : AppCompatActivity() {
private val queue by lazy { singleInstanceOf { Volley.newRequestQueue(applicationContext) } }
Expand Down Expand Up @@ -71,6 +73,8 @@ class AppInviteActivity : AppCompatActivity() {
}

private fun open(appInviteLink: MutateAppInviteLinkResponse) {
val dynamicLinkData = DynamicLinkData(appInviteLink.metadata?.info?.url, appInviteLink.data_?.intentData,
(appInviteLink.data_?.app?.minAppVersion ?: 0).toInt(), System.currentTimeMillis(), null, null)
val intent = Intent(Intent.ACTION_VIEW).apply {
addCategory(Intent.CATEGORY_DEFAULT)
data = appInviteLink.data_?.intentData?.let { Uri.parse(it) }
Expand All @@ -83,17 +87,31 @@ class AppInviteActivity : AppCompatActivity() {
APPINVITE_OPENED_FROM_PLAY_STORE to false
)
)
putExtra(DYNAMIC_LINK_DATA, SafeParcelableSerializer.serializeToBytes(dynamicLinkData))
}
val fallbackIntent = Intent(Intent.ACTION_VIEW).apply {
addCategory(Intent.CATEGORY_DEFAULT)
data = appInviteLink.data_?.fallbackUrl?.let { Uri.parse(it) }
}
val installedVersionCode = runCatching {
intent.resolveActivity(packageManager)?.let {
PackageInfoCompat.getLongVersionCode(packageManager.getPackageInfo(it.packageName, 0))
if (appInviteLink.data_?.packageName != null) {
PackageInfoCompat.getLongVersionCode(packageManager.getPackageInfo(appInviteLink.data_.packageName, 0))
} else {
null
}
}.getOrNull()
if (installedVersionCode != null && (appInviteLink.data_?.app?.minAppVersion == null || installedVersionCode >= appInviteLink.data_.app.minAppVersion)) {
val componentName = intent.resolveActivity(packageManager)
if (componentName == null) {
Log.w(TAG, "open resolve activity is null")
if (appInviteLink.data_?.packageName != null) {
val intentLaunch =
packageManager.getLaunchIntentForPackage(appInviteLink.data_.packageName)
if (intentLaunch != null) {
intent.setComponent(intentLaunch.component)
}
}
}
startActivity(intent)
finish()
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<resources>
<string name="sms_user_consent_title">Autoriser <b>%s</b> à lire le message ci-dessous et saisir le code ?</string>
<string name="sms_user_consent_allow">Autoriser</string>
<string name="sms_user_consent_deny">Refuser</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sms_user_consent_title">อนุญาตให้ <b>%s</b> อ่านข้อความด้านล่างและกรอกรหัส?</string>
<string name="sms_user_consent_allow">อนุญาต</string>
<string name="sms_user_consent_deny">ปฏิเสธ</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
public class DeviceConfiguration {
public List<String> availableFeatures;
public int densityDpi;
public double diagonalInch;
public int glEsVersion;
public List<String> glExtensions;
public boolean hasFiveWayNavigation;
Expand Down Expand Up @@ -92,6 +93,10 @@ public DeviceConfiguration(Context context) {
this.nativePlatforms = getNativePlatforms();
widthPixels = displayMetrics.widthPixels;
heightPixels = displayMetrics.heightPixels;
diagonalInch = Math.sqrt(
Math.pow(widthPixels / displayMetrics.xdpi, 2) +
Math.pow(heightPixels / displayMetrics.ydpi, 2)
);
locales = getLocales(context);
Set<String> glExtensions = new HashSet<String>();
addEglExtensions(glExtensions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static <T> T request(String url, Request request, Class<T> tClass) throws
} catch (IOException e) {
// Ignore
}
throw new IOException(error);
throw new NotOkayException(error);
}

String result = new String(Utils.readStreamToEnd(connection.getInputStream()));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.microg.gms.common;

import java.io.IOException;

public class NotOkayException extends IOException {
public NotOkayException() {
}

public NotOkayException(String message) {
super(message);
}

public NotOkayException(String message, Throwable cause) {
super(message, cause);
}

public NotOkayException(Throwable cause) {
super(cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ private val KNOWN_GOOGLE_PACKAGES = mapOf(
PackageAndCertHash("com.google.android.apps.tasks", SHA256, "99f6cc5308e6f3318a3bf168bf106d5b5defe2b4b9c561e5ddd7924a7a2ba1e2"),
setOf(ACCOUNT, AUTH, OWNER)
),

// Google familylink
Pair(
PackageAndCertHash("com.google.android.apps.kids.familylink", SHA256, "6b58bb84c1c6d081d950448ff5c051a34769d7fd8d415452c86efeb808716c0e"),
setOf(ACCOUNT, AUTH, OWNER)
),

// Google Kids home
Pair(
PackageAndCertHash("com.google.android.apps.kids.home", SHA256, "8f7bd4c5c0273a1a0dd6b3bfa8cc8e9f980a25108adcfd7be9962e8ae9feeb6f"),
setOf(ACCOUNT, AUTH, OWNER)
),
)

fun isGooglePackage(pkg: PackageAndCertHash): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,10 @@ object ProfileManager {
Log.v(TAG, "<data key=\"$key\" value=\"$value\" />")
}
}
applyProfileData(profileData)
activeProfile = PROFILE_REMOTE
if (profileData.isNotEmpty()) {
applyProfileData(profileData)
activeProfile = PROFILE_REMOTE
}
}

fun getProfileName(context: Context, profile: String): String? = getProfileName { getProfileXml(context, profile) }
Expand Down Expand Up @@ -377,6 +379,11 @@ object ProfileManager {
}
}

@JvmStatic
fun resetActiveProfile() {
activeProfile = null
}

@JvmStatic
fun ensureInitialized(context: Context) {
val metaData = runCatching { context.packageManager.getApplicationInfo(context.packageName, PackageManager.GET_META_DATA).metaData }.getOrNull() ?: Bundle.EMPTY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ object SettingsContract {
const val GEOCODER_NOMINATIM = "location_geocoder_nominatim"
const val ICHNAEA_ENDPOINT = "location_ichnaea_endpoint"
const val ONLINE_SOURCE = "location_online_source"
const val ICHNAEA_CONTRIBUTE = "location_ichnaea_contribute"

val PROJECTION = arrayOf(
WIFI_ICHNAEA,
Expand All @@ -185,6 +186,7 @@ object SettingsContract {
GEOCODER_NOMINATIM,
ICHNAEA_ENDPOINT,
ONLINE_SOURCE,
ICHNAEA_CONTRIBUTE,
)
}

Expand All @@ -196,11 +198,13 @@ object SettingsContract {
const val LICENSING = "vending_licensing"
const val LICENSING_PURCHASE_FREE_APPS = "vending_licensing_purchase_free_apps"
const val BILLING = "vending_billing"
const val ASSET_DELIVERY = "vending_asset_delivery"

val PROJECTION = arrayOf(
LICENSING,
LICENSING_PURCHASE_FREE_APPS,
BILLING,
ASSET_DELIVERY,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,26 @@ import android.content.ContentValues
import android.content.Context
import android.content.Context.MODE_PRIVATE
import android.content.SharedPreferences
import android.content.pm.ApplicationInfo
import android.database.Cursor
import android.database.MatrixCursor
import android.net.Uri
import android.os.Build.VERSION.SDK_INT
import android.preference.PreferenceManager
import org.microg.gms.base.core.BuildConfig
import org.microg.gms.common.PackageUtils.warnIfNotMainProcess
import org.microg.gms.settings.SettingsContract.Auth
import org.microg.gms.settings.SettingsContract.CheckIn
import org.microg.gms.settings.SettingsContract.DroidGuard
import org.microg.gms.settings.SettingsContract.Exposure
import org.microg.gms.settings.SettingsContract.Gcm
import org.microg.gms.settings.SettingsContract.Location
import org.microg.gms.settings.SettingsContract.Vending
import org.microg.gms.settings.SettingsContract.Profile
import org.microg.gms.settings.SettingsContract.SafetyNet
import org.microg.gms.settings.SettingsContract.Vending
import org.microg.gms.settings.SettingsContract.getAuthority
import java.io.File


private const val SETTINGS_PREFIX = "org.microg.gms.settings."

/**
Expand Down Expand Up @@ -321,6 +322,7 @@ class SettingsProvider : ContentProvider() {
Location.GEOCODER_NOMINATIM -> getSettingsBoolean(key, hasUnifiedNlpGeocoderBackend("org.microg.nlp.backend.nominatim") )
Location.ICHNAEA_ENDPOINT -> getSettingsString(key, null)
Location.ONLINE_SOURCE -> getSettingsString(key, null)
Location.ICHNAEA_CONTRIBUTE -> getSettingsBoolean(key, false)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand All @@ -341,6 +343,7 @@ class SettingsProvider : ContentProvider() {
Location.GEOCODER_NOMINATIM -> editor.putBoolean(key, value as Boolean)
Location.ICHNAEA_ENDPOINT -> (value as String).let { if (it.isBlank()) editor.remove(key) else editor.putString(key, it) }
Location.ONLINE_SOURCE -> (value as? String?).let { if (it.isNullOrBlank()) editor.remove(key) else editor.putString(key, it) }
Location.ICHNAEA_CONTRIBUTE -> editor.putBoolean(key, value as Boolean)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand All @@ -352,6 +355,7 @@ class SettingsProvider : ContentProvider() {
Vending.LICENSING -> getSettingsBoolean(key, false)
Vending.LICENSING_PURCHASE_FREE_APPS -> getSettingsBoolean(key, false)
Vending.BILLING -> getSettingsBoolean(key, false)
Vending.ASSET_DELIVERY -> getSettingsBoolean(key, false)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand All @@ -364,6 +368,7 @@ class SettingsProvider : ContentProvider() {
Vending.LICENSING -> editor.putBoolean(key, value as Boolean)
Vending.LICENSING_PURCHASE_FREE_APPS -> editor.putBoolean(key, value as Boolean)
Vending.BILLING -> editor.putBoolean(key, value as Boolean)
Vending.ASSET_DELIVERY -> editor.putBoolean(key, value as Boolean)
else -> throw IllegalArgumentException("Unknown key: $key")
}
}
Expand Down
8 changes: 7 additions & 1 deletion play-services-base/core/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
<!--
~ SPDX-FileCopyrightText: 2020, microG Project Team
~ SPDX-License-Identifier: Apache-2.0
--><resources>
--><resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="menu_advanced">Avancé</string>
<string name="list_no_item_none">Aucun</string>
<string name="service_status_disabled">Désactivé</string>
<string name="service_status_enabled">Activé</string>
<string name="service_status_automatic">Automatique</string>
<string name="service_status_manual">Manuel</string>
<string name="foreground_service_notification_title">Actif en arrière-plan</string>
<string name="open_app">Ouvrir</string>
<string name="foreground_service_notification_big_text">Exclure <xliff:g example="microG Services">%1$s</xliff:g> de l\'optimisation de la batterie ou modifier les paramètres des notifications pour désactiver cette notification.</string>
<string name="service_status_enabled_short">Act.</string>
<string name="service_status_disabled_short">Désact.</string>
<string name="list_item_see_all">Tout voir</string>
<string name="foreground_service_notification_text"><xliff:g example="Exposure Notification">%1$s</xliff:g> fonctionne en arrière-plan.</string>
</resources>
Loading

0 comments on commit e69a470

Please sign in to comment.