Skip to content

Commit

Permalink
Allow to open Google account settings from microG settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ale5000-git committed Sep 28, 2023
1 parent 4cbb55b commit a710c82
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions play-services-core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@
android:process=":ui"
android:taskAffinity="org.microg.gms.settings" />

<activity
android:name="org.microg.gms.ui.ShowAccountSettingsActivity"
android:process=":ui"
android:taskAffinity="org.microg.gms.settings" />

<activity
android:name="org.microg.gms.ui.LegacyAccountSettingsActivity"
android:process=":ui"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* SPDX-FileCopyrightText: 2023 microG Project Team
* SPDX-License-Identifier: Apache-2.0
*/

package org.microg.gms.ui;

import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import org.microg.gms.auth.AuthConstants;

/**
* This is just an activity that forwards to Android account settings
*/
public class ShowAccountSettingsActivity extends AppCompatActivity {
private static final String TAG = "GmsShowAccountSettings";

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
intent.putExtra(Settings.EXTRA_AUTHORITIES, new String[] { "com.android.contacts" });
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] { AuthConstants.DEFAULT_ACCOUNT_TYPE });
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w(TAG, e);
}
finish();
}
}
2 changes: 2 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ This can take a couple of minutes."</string>

<string name="pref_add_account_title">Account</string>
<string name="pref_add_account_summary">Add Google account</string>
<string name="pref_show_account_settings_title">Account settings</string>
<string name="pref_show_account_settings_summary">Manage Google accounts on this device</string>
<string name="pref_gcm_enable_mcs_summary">Cloud Messaging is a push notification provider used by many third-party applications. To use it you must enable device registration.</string>
<string name="pref_gcm_heartbeat_title">Cloud Messaging heartbeat interval</string>
<string name="pref_gcm_heartbeat_summary">The interval in seconds for the system to heartbeat the Google servers. Increasing this number will reduce battery consumption, but might cause delays on push messages.\nDeprecated, will be replaced in future release.</string>
Expand Down
8 changes: 8 additions & 0 deletions play-services-core/src/main/res/xml/preferences_start.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
android:targetClass="org.microg.gms.auth.login.LoginActivity"
android:targetPackage="com.google.android.gms" />
</Preference>
<Preference
android:icon="@drawable/proprietary_auth_gls_ic_google_minitab_selected"
android:summary="@string/pref_show_account_settings_summary"
android:title="@string/pref_show_account_settings_title">
<intent
android:targetClass="org.microg.gms.ui.ShowAccountSettingsActivity"
android:targetPackage="com.google.android.gms" />
</Preference>
<Preference
android:icon="@drawable/ic_device_login"
android:key="pref_checkin"
Expand Down

0 comments on commit a710c82

Please sign in to comment.