Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f13cb2fd authored by Walter Jang's avatar Walter Jang
Browse files

Prompts to "Add account" should add a google one (2/2)

* Also replace use of deprecated
  FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET with
  FLAG_ACTIVITY_NEW_DOCUMENT
* Switch ACTION_SYNC_SETTINGS for contacts
  providers so the Settings activity says
  "Accounts" instead of "Add Account"

Bug 29185471
Bug 30080351

Change-Id: Ibb5fee73021a4f2a11c3dd2241fcd92e2c93220d
parent 8bee30db
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import android.provider.ContactsContract.QuickContact;
import android.provider.Settings;
import android.text.TextUtils;

import com.android.contacts.common.model.account.GoogleAccountType;

import java.util.List;

/**
@@ -108,13 +110,24 @@ public class ImplicitIntentsUtil {
     * display contact provider account types.
     */
    public static Intent getIntentForAddingAccount() {
        final Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
        final Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
        intent.putExtra(Settings.EXTRA_AUTHORITIES,
                new String[]{ContactsContract.AUTHORITY});
        return intent;
    }

    /**
     * Returns an Intent to add a google account.
     */
    public static Intent getIntentForAddingGoogleAccount() {
        final Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES,
                new String[]{GoogleAccountType.ACCOUNT_TYPE});
        return intent;
    }

    /**
     * Returns a copy of {@param intent} with a class name set, if a class inside this app
     * has a corresponding intent filter.