diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt index 033d65aa12..cfbfb6e2d3 100644 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt +++ b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsContract.kt @@ -85,11 +85,13 @@ object SettingsContract { const val TRUST_GOOGLE = "auth_manager_trust_google" const val VISIBLE = "auth_manager_visible" const val INCLUDE_ANDROID_ID = "auth_include_android_id" + const val STRIP_DEVICE_NAME = "auth_strip_device_name" val PROJECTION = arrayOf( TRUST_GOOGLE, VISIBLE, INCLUDE_ANDROID_ID, + STRIP_DEVICE_NAME, ) } diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt index 7899cba149..38796ea048 100644 --- a/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt +++ b/play-services-base/core/src/main/kotlin/org/microg/gms/settings/SettingsProvider.kt @@ -199,6 +199,7 @@ class SettingsProvider : ContentProvider() { Auth.TRUST_GOOGLE -> getSettingsBoolean(key, true) Auth.VISIBLE -> getSettingsBoolean(key, false) Auth.INCLUDE_ANDROID_ID -> getSettingsBoolean(key, true) + Auth.STRIP_DEVICE_NAME -> getSettingsBoolean(key, false) else -> throw IllegalArgumentException("Unknown key: $key") } } @@ -211,6 +212,7 @@ class SettingsProvider : ContentProvider() { Auth.TRUST_GOOGLE -> editor.putBoolean(key, value as Boolean) Auth.VISIBLE -> editor.putBoolean(key, value as Boolean) Auth.INCLUDE_ANDROID_ID -> editor.putBoolean(key, value as Boolean) + Auth.STRIP_DEVICE_NAME -> editor.putBoolean(key, value as Boolean) else -> throw IllegalArgumentException("Unknown key: $key") } } diff --git a/play-services-core/build.gradle b/play-services-core/build.gradle index 880f5051d5..7a8aec72e5 100644 --- a/play-services-core/build.gradle +++ b/play-services-core/build.gradle @@ -33,9 +33,6 @@ dependencies { implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - - // Material Components - implementation "com.google.android.material:material:$materialVersion" } android { diff --git a/play-services-core/src/huawei/AndroidManifest.xml b/play-services-core/src/huawei/AndroidManifest.xml index e1c7ac69c2..4ba4e94e66 100644 --- a/play-services-core/src/huawei/AndroidManifest.xml +++ b/play-services-core/src/huawei/AndroidManifest.xml @@ -19,5 +19,8 @@ + \ No newline at end of file diff --git a/play-services-core/src/huaweilh/AndroidManifest.xml b/play-services-core/src/huaweilh/AndroidManifest.xml index 8164e542e8..b2359ec540 100644 --- a/play-services-core/src/huaweilh/AndroidManifest.xml +++ b/play-services-core/src/huaweilh/AndroidManifest.xml @@ -19,6 +19,9 @@ + diff --git a/play-services-core/src/main/java/org/microg/gms/auth/AuthRequest.java b/play-services-core/src/main/java/org/microg/gms/auth/AuthRequest.java index e39984a496..f96d74c763 100644 --- a/play-services-core/src/main/java/org/microg/gms/auth/AuthRequest.java +++ b/play-services-core/src/main/java/org/microg/gms/auth/AuthRequest.java @@ -128,6 +128,10 @@ public AuthRequest fromContext(Context context) { if (AuthPrefs.shouldIncludeAndroidId(context)) { androidIdHex = Long.toHexString(LastCheckinInfo.read(context).getAndroidId()); } + if (AuthPrefs.shouldStripDeviceName(context)) { + deviceName = ""; + buildVersion = ""; + } return this; } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/AuthPrefs.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/AuthPrefs.kt index ba5d2b2e8a..f284b24392 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/AuthPrefs.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/AuthPrefs.kt @@ -27,4 +27,11 @@ object AuthPrefs { } } + @JvmStatic + fun shouldStripDeviceName(context: Context): Boolean { + return SettingsContract.getSettings(context, Auth.getContentUri(context), arrayOf(Auth.STRIP_DEVICE_NAME)) { c -> + c.getInt(0) != 0 + } + } + } diff --git a/play-services-core/src/main/res/menu/gcm_menu_item.xml b/play-services-core/src/main/res/menu/gcm_menu_item.xml index db6231e20d..0a894ba585 100644 --- a/play-services-core/src/main/res/menu/gcm_menu_item.xml +++ b/play-services-core/src/main/res/menu/gcm_menu_item.xml @@ -3,8 +3,7 @@ - + android:title="@string/menu_advanced" + app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/play-services-core/src/main/res/values/strings.xml b/play-services-core/src/main/res/values/strings.xml index 1116c751f0..7fcff15175 100644 --- a/play-services-core/src/main/res/values/strings.xml +++ b/play-services-core/src/main/res/values/strings.xml @@ -103,6 +103,8 @@ This can take a couple of minutes" Huawei Authenticate with device registration When disabled, authentication requests won\'t be linked to the device registration, which allows unauthorized devices to sign in, but may have unforeseen consequences + Strip device name for authentication + When enabled, authentication requests won\'t include the device\'s name, which may allow unauthorized devices to sign in, but may have unforeseen consequences. Registers your device to Google services and creates a unique device identifier. MicroG strips identifying bits other than your Google account name from registration data Android ID diff --git a/play-services-core/src/main/res/xml/preferences_account.xml b/play-services-core/src/main/res/xml/preferences_account.xml index 3664f2539b..eab5b47f8e 100644 --- a/play-services-core/src/main/res/xml/preferences_account.xml +++ b/play-services-core/src/main/res/xml/preferences_account.xml @@ -36,5 +36,11 @@ android:key="auth_include_android_id" android:summary="@string/pref_auth_include_android_id_summary" android:title="@string/pref_auth_include_android_id_title" /> + + \ No newline at end of file