Auth: Add option to authenticate without android id 8663e52563
This commit is contained in:
parent
3b12bb0e11
commit
ebb9f2d54e
6 changed files with 36 additions and 1 deletions
|
|
@ -78,10 +78,12 @@ 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"
|
||||
|
||||
val PROJECTION = arrayOf(
|
||||
TRUST_GOOGLE,
|
||||
VISIBLE,
|
||||
INCLUDE_ANDROID_ID,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ class SettingsProvider : ContentProvider() {
|
|||
when (key) {
|
||||
Auth.TRUST_GOOGLE -> getSettingsBoolean(key, true)
|
||||
Auth.VISIBLE -> getSettingsBoolean(key, false)
|
||||
Auth.INCLUDE_ANDROID_ID -> getSettingsBoolean(key, true)
|
||||
else -> throw IllegalArgumentException("Unknown key: $key")
|
||||
}
|
||||
}
|
||||
|
|
@ -224,6 +225,7 @@ class SettingsProvider : ContentProvider() {
|
|||
when (key) {
|
||||
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)
|
||||
else -> throw IllegalArgumentException("Unknown key: $key")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,9 @@ public class AuthRequest extends HttpFormClient.Request {
|
|||
public AuthRequest fromContext(Context context) {
|
||||
build(context);
|
||||
locale(Utils.getLocale(context));
|
||||
androidIdHex = Long.toHexString(LastCheckinInfo.read(context).getAndroidId());
|
||||
if (AuthPrefs.shouldIncludeAndroidId(context)) {
|
||||
androidIdHex = Long.toHexString(LastCheckinInfo.read(context).getAndroidId());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,4 +24,11 @@ object AuthPrefs {
|
|||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun shouldIncludeAndroidId(context: Context): Boolean {
|
||||
return SettingsContract.getSettings(context, Auth.getContentUri(context), arrayOf(Auth.INCLUDE_ANDROID_ID)) { c ->
|
||||
c.getInt(0) != 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ This can take a couple of minutes."</string>
|
|||
<string name="prefs_account_privacy">Personal info & privacy</string>
|
||||
<string name="prefs_account_security">Sign-in & security</string>
|
||||
|
||||
<string name="pref_auth_include_android_id_title">Authenticate with device registration</string>
|
||||
<string name="pref_auth_include_android_id_summary">When disabled, authentication requests won\'t be linked to the device registration, which allows unauthorized devices to sign in, but may have unforeseen consequences.</string>
|
||||
<string name="pref_auth_trust_google_title">Trust Google for app permissions</string>
|
||||
<string name="pref_auth_trust_google_summary">When disabled, the user is asked before an apps authorization request is sent to Google. Some applications will fail to use the Google account if this is disabled.</string>
|
||||
<string name="pref_auth_visible_title">Allow apps to find accounts</string>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
android:targetPackage="com.android.settings" />
|
||||
</Preference>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<Preference
|
||||
android:icon="@drawable/ic_add_account"
|
||||
android:summary="@string/pref_add_account_summary"
|
||||
|
|
@ -45,4 +46,23 @@
|
|||
<Preference
|
||||
android:selectable="false"
|
||||
android:summary="@string/google_account_manager" />
|
||||
=======
|
||||
<PreferenceCategory android:title="@string/account_manager_title">
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="auth_manager_trust_google"
|
||||
android:summary="@string/pref_auth_trust_google_summary"
|
||||
android:title="@string/pref_auth_trust_google_title"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="auth_manager_visible"
|
||||
android:summary="@string/pref_auth_visible_summary"
|
||||
android:title="@string/pref_auth_visible_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="auth_include_android_id"
|
||||
android:summary="@string/pref_auth_include_android_id_summary"
|
||||
android:title="@string/pref_auth_include_android_id_title"/>
|
||||
</PreferenceCategory>
|
||||
>>>>>>> c8d53d6b (Auth: Add option to authenticate without android id https://github.com/microg/GmsCore/commit/8663e52563040bfcc57432173f891108fa693f07)
|
||||
</PreferenceScreen>
|
||||
Loading…
Reference in a new issue