diff --git a/Images/Dark.png b/Images/Dark.png index 024ff22cc3..973dfaa788 100644 Binary files a/Images/Dark.png and b/Images/Dark.png differ diff --git a/Images/Light.png b/Images/Light.png index 4aa8f76c01..e50052abaf 100644 Binary files a/Images/Light.png and b/Images/Light.png differ diff --git a/build.gradle b/build.gradle index afc034e7d8..e2687b949e 100644 --- a/build.gradle +++ b/build.gradle @@ -11,8 +11,8 @@ buildscript { ext.appcompatVersion = '1.7.0' ext.biometricVersion = '1.1.0' ext.coreVersion = '1.13.1' - ext.fragmentVersion = '1.7.1' - ext.lifecycleVersion = '2.8.1' + ext.fragmentVersion = '1.8.1' + ext.lifecycleVersion = '2.8.3' ext.loaderVersion = '1.1.0' ext.materialVersion = '1.12.0' ext.mediarouterVersion = '1.7.0' @@ -22,17 +22,17 @@ buildscript { ext.recyclerviewVersion = '1.3.2' ext.webkitVersion = '1.11.0' - ext.coroutineVersion = '1.7.3' + ext.coroutineVersion = '1.8.1' ext.kotlinVersion = '2.0.0' - ext.cronetVersion = '102.5005.125' + ext.cronetVersion = '119.6045.31' ext.okhttpVersion = '4.12.0' - ext.slf4jVersion = '1.7.36' + ext.slf4jVersion = '2.0.13' ext.volleyVersion = '1.2.1' ext.wearableVersion = '0.1.1' - ext.wireVersion = '4.9.9' + ext.wireVersion = '5.0.0' - ext.androidBuildGradleVersion = '8.3.2' + ext.androidBuildGradleVersion = '8.5.1' ext.androidBuildVersionTools = '34.0.0' @@ -82,8 +82,8 @@ allprojects { apply plugin: 'idea' group = 'org.microg.gms' - ext.appVersionName = 5.4 - ext.appVersionCode = 242155000 + ext.appVersionName = 5.5 + ext.appVersionCode = 242632000 ext.baseVersion = ext.appVersionCode.toString()[0..1] + '.' + ext.appVersionCode.toString()[2..3] + '.' + ext.appVersionCode.toString()[4..5] version = ext.appVersionName+" GMS-"+ext.baseVersion.replaceAll("\\.", "") ext.isReleaseVersion = false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b084d326c7..e1ce1bf057 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,7 +3,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/play-services-base/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInOptions.java b/play-services-base/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInOptions.java index 6033bdbbaa..c742be477b 100644 --- a/play-services-base/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInOptions.java +++ b/play-services-base/src/main/java/com/google/android/gms/auth/api/signin/GoogleSignInOptions.java @@ -72,6 +72,7 @@ public class GoogleSignInOptions extends AutoSafeParcelable { private String logSessionId; private GoogleSignInOptions() { + this.scopes = new ArrayList<>(); } /** diff --git a/play-services-core/microg-ui-tools/src/main/res/values/strings.xml b/play-services-core/microg-ui-tools/src/main/res/values/strings.xml index 107abf1b42..297056bc28 100644 --- a/play-services-core/microg-ui-tools/src/main/res/values/strings.xml +++ b/play-services-core/microg-ui-tools/src/main/res/values/strings.xml @@ -44,7 +44,7 @@ - 5.4 + 5.5 diff --git a/play-services-core/src/main/AndroidManifest.xml b/play-services-core/src/main/AndroidManifest.xml index 20a1768250..371e8326d4 100644 --- a/play-services-core/src/main/AndroidManifest.xml +++ b/play-services-core/src/main/AndroidManifest.xml @@ -449,9 +449,15 @@ android:process=":ui" android:taskAffinity="org.microg.gms.settings" /> + + @@ -476,7 +482,7 @@ android:process=":ui" android:exported="true" android:excludeFromRecents="true" - android:targetActivity="org.microg.gms.ui.MainSettingsActivity" + android:targetActivity="org.microg.gms.ui.AccountsFragment$AsActivity" android:taskAffinity="org.microg.gms.settings"> diff --git a/play-services-core/src/main/java/org/microg/gms/ui/AccountsFragment.kt b/play-services-core/src/main/java/org/microg/gms/ui/AccountsFragment.kt index 49b5234bb3..736a2b7e6b 100644 --- a/play-services-core/src/main/java/org/microg/gms/ui/AccountsFragment.kt +++ b/play-services-core/src/main/java/org/microg/gms/ui/AccountsFragment.kt @@ -5,18 +5,15 @@ import android.accounts.AccountManager import android.content.ActivityNotFoundException import android.content.Intent import android.graphics.Bitmap +import android.net.Uri import android.os.Bundle import android.provider.Settings import android.util.Log -import android.view.Menu -import android.view.MenuInflater -import android.view.MenuItem import android.view.View import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory import androidx.lifecycle.lifecycleScope -import androidx.navigation.fragment.findNavController import androidx.preference.Preference import androidx.preference.PreferenceCategory import androidx.preference.PreferenceFragmentCompat @@ -30,6 +27,7 @@ import org.microg.gms.auth.AuthConstants import org.microg.gms.auth.login.LoginActivity import org.microg.gms.people.DatabaseHelper import org.microg.gms.people.PeopleManager +import org.microg.tools.ui.AbstractSettingsActivity class AccountsFragment : PreferenceFragmentCompat() { @@ -82,13 +80,14 @@ class AccountsFragment : PreferenceFragmentCompat() { } } - if (photo == null) { - withContext(Dispatchers.IO) { - PeopleManager.getOwnerAvatarBitmap(context, account.name, true) - }?.let { newPreference.icon = getCircleBitmapDrawable(it) } + if (preferenceCategory?.findPreference(newPreference.key) == null) { + if (photo == null) { + withContext(Dispatchers.IO) { + PeopleManager.getOwnerAvatarBitmap(context, account.name, true) + }?.let { newPreference.icon = getCircleBitmapDrawable(it) } + } + preferenceCategory?.addPreference(newPreference) } - - preferenceCategory?.addPreference(newPreference) } } } @@ -137,7 +136,7 @@ class AccountsFragment : PreferenceFragmentCompat() { try { startActivity(Intent(Settings.ACTION_SYNC_SETTINGS)) } catch (activityNotFoundException: ActivityNotFoundException) { - Log.e(TAG, "Failed to launch sync settings", activityNotFoundException) + Log.e(tag, "Failed to launch sync settings", activityNotFoundException) } true } @@ -146,29 +145,28 @@ class AccountsFragment : PreferenceFragmentCompat() { try { startActivity(Intent(requireContext(), LoginActivity::class.java)) } catch (activityNotFoundException: ActivityNotFoundException) { - Log.e(TAG, "Failed to launch login activity", activityNotFoundException) + Log.e(tag, "Failed to launch login activity", activityNotFoundException) } true } - } - - init { - setHasOptionsMenu(true) - } - override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { - inflater.inflate(R.menu.accounts_menu_item, menu) - super.onCreateOptionsMenu(menu, inflater) - } - - override fun onOptionsItemSelected(item: MenuItem): Boolean { - return when (item.itemId) { - R.id.privacy_settings -> { - findNavController().navigate(R.id.privacyFragment) - true + findPreference("pref_privacy")?.setOnPreferenceClickListener { + try { + startActivity(Intent(requireContext(), LegacyAccountSettingsActivity::class.java)) + } catch (activityNotFoundException: ActivityNotFoundException) { + Log.e(tag, "Failed to launch privacy activity", activityNotFoundException) } + true + } - else -> super.onOptionsItemSelected(item) + findPreference("pref_manage_history")?.setOnPreferenceClickListener { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://myactivity.google.com/product/youtube"))) + true + } + + findPreference("pref_your_data")?.setOnPreferenceClickListener { + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://myaccount.google.com/yourdata/youtube"))) + true } } @@ -193,4 +191,15 @@ class AccountsFragment : PreferenceFragmentCompat() { private fun showToast(message: String) { Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show() } + + class AsActivity : AbstractSettingsActivity() { + override fun getFragment(): PreferenceFragmentCompat { + return AccountsFragment() + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + supportActionBar?.setDisplayHomeAsUpEnabled(true) + } + } } diff --git a/play-services-core/src/main/java/org/microg/gms/ui/LegacyAccountSettingsActivity.java b/play-services-core/src/main/java/org/microg/gms/ui/LegacyAccountSettingsActivity.java index 02f211fc5b..813530fcbf 100644 --- a/play-services-core/src/main/java/org/microg/gms/ui/LegacyAccountSettingsActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/ui/LegacyAccountSettingsActivity.java @@ -21,6 +21,7 @@ import android.os.Bundle; import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; import androidx.fragment.app.Fragment; import androidx.preference.Preference; @@ -38,6 +39,16 @@ public class LegacyAccountSettingsActivity extends AbstractSettingsActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + } + @Override protected Fragment getFragment() { return new AccountSettingsFragment(); @@ -45,7 +56,7 @@ protected Fragment getFragment() { public static class AccountSettingsFragment extends ResourceSettingsFragment { public AccountSettingsFragment() { - preferencesResource = R.xml.preferences_account; + preferencesResource = R.xml.preferences_account; } @Override diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AuthSignInService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AuthSignInService.kt index 4d8424e381..0f70babf2b 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AuthSignInService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/AuthSignInService.kt @@ -103,8 +103,12 @@ class AuthSignInServiceImpl( lifecycleScope.launchWhenStarted { try { val account = account ?: options?.account ?: SignInConfigurationService.getDefaultAccount(context, packageName) - if (account != null) performSignOut(context, packageName, options, account) - SignInConfigurationService.setDefaultAccount(context, packageName, null) + if (account != null) { + val defaultOptions = SignInConfigurationService.getDefaultOptions(context, packageName) + Log.d(TAG, "$packageName:signOut defaultOptions:($defaultOptions)") + performSignOut(context, packageName, defaultOptions ?: options, account) + } + SignInConfigurationService.setDefaultSignInInfo(context, packageName, null, null) runCatching { callbacks.onSignOut(Status.SUCCESS) } } catch (e: Exception) { Log.w(TAG, e) @@ -137,7 +141,7 @@ class AuthSignInServiceImpl( authManager.invalidateAuthToken(token) authManager.isPermitted = false } - SignInConfigurationService.setDefaultAccount(context, packageName, account) + SignInConfigurationService.setDefaultSignInInfo(context, packageName, account, options?.toJson()) runCatching { callbacks.onRevokeAccess(Status.SUCCESS) } } catch (e: Exception) { Log.w(TAG, e) diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/SignInConfigurationService.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/SignInConfigurationService.kt index dec280687b..5cc24f7994 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/SignInConfigurationService.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/SignInConfigurationService.kt @@ -12,6 +12,7 @@ import android.content.* import android.os.* import androidx.core.content.getSystemService import androidx.core.os.bundleOf +import com.google.android.gms.auth.api.signin.GoogleSignInOptions import org.microg.gms.auth.AuthConstants import org.microg.gms.common.PackageUtils import kotlin.coroutines.resume @@ -20,12 +21,15 @@ import kotlin.coroutines.suspendCoroutine private const val PREFERENCES_NAME = "google_account_cache" private const val DEFAULT_ACCOUNT_PREFIX = "default_google_account_" +private const val DEFAULT_SIGN_IN_OPTIONS_PREFIX = "default_sign_in_options_" private const val MSG_GET_DEFAULT_ACCOUNT = 1 -private const val MSG_SET_DEFAULT_ACCOUNT = 2 +private const val MSG_SET_DEFAULT_SIGN_IN_INFO = 2 +private const val MSG_GET_DEFAULT_OPTIONS = 3 private const val MSG_DATA_PACKAGE_NAME = "package_name" private const val MSG_DATA_ACCOUNT = "account" +private const val MSG_DATA_SIGN_IN_OPTIONS = "google_sign_in_options" class SignInConfigurationService : Service() { private val preferences: SharedPreferences @@ -46,13 +50,24 @@ class SignInConfigurationService : Service() { ) } - MSG_SET_DEFAULT_ACCOUNT -> { + MSG_SET_DEFAULT_SIGN_IN_INFO -> { val packageName = msg.data?.getString(MSG_DATA_PACKAGE_NAME) val account = msg.data?.getParcelable(MSG_DATA_ACCOUNT) - packageName?.let { setDefaultAccount(it, account) } + val googleSignInOptions = msg.data?.getString(MSG_DATA_SIGN_IN_OPTIONS) + packageName?.let { setDefaultSignInInfo(it, account, googleSignInOptions) } bundleOf( MSG_DATA_PACKAGE_NAME to packageName, - MSG_DATA_ACCOUNT to account + MSG_DATA_ACCOUNT to account, + MSG_DATA_SIGN_IN_OPTIONS to googleSignInOptions, + ) + } + + MSG_GET_DEFAULT_OPTIONS -> { + val packageName = msg.data?.getString(MSG_DATA_PACKAGE_NAME) + val googleSignInOptions = packageName?.let { getDefaultOptions(it) } + bundleOf( + MSG_DATA_PACKAGE_NAME to packageName, + MSG_DATA_SIGN_IN_OPTIONS to googleSignInOptions ) } @@ -80,13 +95,24 @@ class SignInConfigurationService : Service() { return null } - private fun setDefaultAccount(packageName: String, account: Account?) { + private fun getDefaultOptions(packageName: String): String? { + val data = preferences.getString(DEFAULT_SIGN_IN_OPTIONS_PREFIX + getPackageNameSuffix(packageName), null) + if (data.isNullOrBlank()) return null + return data + } + + private fun setDefaultSignInInfo(packageName: String, account: Account?, optionsJson: String?) { val editor: SharedPreferences.Editor = preferences.edit() if (account == null || account.name == AuthConstants.DEFAULT_ACCOUNT) { editor.remove(DEFAULT_ACCOUNT_PREFIX + getPackageNameSuffix(packageName)) } else { editor.putString(DEFAULT_ACCOUNT_PREFIX + getPackageNameSuffix(packageName), account.name) } + if (optionsJson == null) { + editor.remove(DEFAULT_SIGN_IN_OPTIONS_PREFIX + getPackageNameSuffix(packageName)) + } else { + editor.putString(DEFAULT_SIGN_IN_OPTIONS_PREFIX + getPackageNameSuffix(packageName), optionsJson) + } editor.apply() } @@ -130,12 +156,22 @@ class SignInConfigurationService : Service() { }).data?.getParcelable(MSG_DATA_ACCOUNT) } - suspend fun setDefaultAccount(context: Context, packageName: String, account: Account?) { + suspend fun getDefaultOptions(context: Context, packageName: String): GoogleSignInOptions? { + return singleRequest(context, Message.obtain().apply { + what = MSG_GET_DEFAULT_OPTIONS + data = bundleOf( + MSG_DATA_PACKAGE_NAME to packageName + ) + }).data?.getString(MSG_DATA_SIGN_IN_OPTIONS)?.let { GoogleSignInOptions.fromJson(it) } + } + + suspend fun setDefaultSignInInfo(context: Context, packageName: String, account: Account?, optionsJson: String?) { singleRequest(context, Message.obtain().apply { - what = MSG_SET_DEFAULT_ACCOUNT + what = MSG_SET_DEFAULT_SIGN_IN_INFO data = bundleOf( MSG_DATA_PACKAGE_NAME to packageName, - MSG_DATA_ACCOUNT to account + MSG_DATA_ACCOUNT to account, + MSG_DATA_SIGN_IN_OPTIONS to optionsJson ) }) } diff --git a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/extensions.kt b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/extensions.kt index 7c1623f1d3..90ba353c7f 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/extensions.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/auth/signin/extensions.kt @@ -105,7 +105,7 @@ suspend fun performSignIn(context: Context, packageName: String, options: Google databaseHelper.close() } } else listOf(null, null, null, null) - SignInConfigurationService.setDefaultAccount(context, packageName, account) + SignInConfigurationService.setDefaultSignInInfo(context, packageName, account, options?.toJson()) return GoogleSignInAccount( id, tokenId, diff --git a/play-services-core/src/main/res/drawable/ic_youtube_data.xml b/play-services-core/src/main/res/drawable/ic_youtube_data.xml new file mode 100644 index 0000000000..86b27ba0c7 --- /dev/null +++ b/play-services-core/src/main/res/drawable/ic_youtube_data.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/drawable/ic_youtube_history.xml b/play-services-core/src/main/res/drawable/ic_youtube_history.xml new file mode 100644 index 0000000000..d884a9d075 --- /dev/null +++ b/play-services-core/src/main/res/drawable/ic_youtube_history.xml @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/layout/ask_permission.xml b/play-services-core/src/main/res/layout/ask_permission.xml index 82f8b931b5..92e1e48239 100644 --- a/play-services-core/src/main/res/layout/ask_permission.xml +++ b/play-services-core/src/main/res/layout/ask_permission.xml @@ -26,7 +26,7 @@ android:layout_height="wrap_content" android:gravity="center_horizontal" android:paddingTop="10dp" - android:text="@string/privacy_title" + android:text="@string/pref_privacy_title" android:textColor="?attr/colorPrimary" /> - - - \ No newline at end of file diff --git a/play-services-core/src/main/res/navigation/nav_settings.xml b/play-services-core/src/main/res/navigation/nav_settings.xml index 10d40ceeb0..a2918ca23e 100644 --- a/play-services-core/src/main/res/navigation/nav_settings.xml +++ b/play-services-core/src/main/res/navigation/nav_settings.xml @@ -42,7 +42,7 @@ + android:label="@string/pref_account_title" /> @@ -86,11 +86,6 @@ android:name="org.microg.gms.ui.PushNotificationAdvancedFragment" android:label="@string/menu_settings" /> - - %1$s gostaria de: %1$s gostaria de usar: - Privacidade + Privacidade + Configurações de privacidade para autenticação e apps Aplicativos Autenticação @@ -108,8 +109,8 @@ Isso pode levar alguns minutos." Status - Contas - Fazer login em uma conta Google + Contas + Fazer login em uma conta Google Cloud Messaging é um provedor de notificação push usado por aplicativos modificados. Para utilizar você deve habilitar o registro de dispositivos Confirmar novos apps Perguntar antes de registrar um novo app para receber notificações push @@ -169,6 +170,10 @@ Isso pode levar alguns minutos." Adicionar conta Gerenciador de contas Abrir o gerenciador de contas do dispositivo + + Atividades no YouTube + Gerencie todo o histórico + Seus dados no YouTube diff --git a/play-services-core/src/main/res/values/strings.xml b/play-services-core/src/main/res/values/strings.xml index 446df8a341..e81936ec69 100644 --- a/play-services-core/src/main/res/values/strings.xml +++ b/play-services-core/src/main/res/values/strings.xml @@ -13,7 +13,8 @@ %1$s would like to: %1$s would like to use: - Privacy + Privacy + Privacy settings for authentication and apps Applications Authentication @@ -119,8 +120,8 @@ This can take a couple of minutes" Status - Accounts - Login in new Google account + Accounts + Login in new Google account Cloud Messaging is a push notification provider used for modified apps. To use it you must enable device registration Confirm new apps Ask before registering a new app to receive push notifications @@ -180,6 +181,10 @@ This can take a couple of minutes" Add account Manage accounts Open device accounts manager + + YouTube Activity + Manage all history + Your data in YouTube diff --git a/play-services-core/src/main/res/xml/preferences_accounts.xml b/play-services-core/src/main/res/xml/preferences_accounts.xml index 40c61fa403..4384164fc7 100644 --- a/play-services-core/src/main/res/xml/preferences_accounts.xml +++ b/play-services-core/src/main/res/xml/preferences_accounts.xml @@ -1,20 +1,27 @@ - + + + + android:icon="@drawable/ic_privacy" + android:key="pref_privacy" + android:summary="@string/pref_privacy_summary" + android:title="@string/pref_privacy_title" /> + + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/xml/preferences_start.xml b/play-services-core/src/main/res/xml/preferences_start.xml index db35ca2ae7..5d19e37cd7 100644 --- a/play-services-core/src/main/res/xml/preferences_start.xml +++ b/play-services-core/src/main/res/xml/preferences_start.xml @@ -28,7 +28,7 @@ android:icon="@drawable/ic_accounts" android:key="pref_accounts" android:summary="@string/pref_accounts_summary" - android:title="@string/pref_add_account_title" /> + android:title="@string/pref_account_title" />