1b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha/*
2b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * Copyright (C) 2014 The Android Open Source Project
3b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha *
4b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * Licensed under the Apache License, Version 2.0 (the "License");
5b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * you may not use this file except in compliance with the License.
6b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * You may obtain a copy of the License at
7b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha *
8b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha *      http://www.apache.org/licenses/LICENSE-2.0
9b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha *
10b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * Unless required by applicable law or agreed to in writing, software
11b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * distributed under the License is distributed on an "AS IS" BASIS,
12b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * See the License for the specific language governing permissions and
14b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * limitations under the License.
15b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha */
16b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
17b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddharthapackage com.android.inputmethod.latin.accounts;
18b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
19b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddharthaimport android.support.annotation.NonNull;
20b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
21b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddharthaimport javax.annotation.Nullable;
22b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
23b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha/**
24b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * Handles changes to account used to sign in to the keyboard.
25b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * e.g. account switching/sign-in/sign-out from the keyboard
26b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha * user toggling the sync preference.
27b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha */
28b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddharthapublic class AccountStateChangedListener {
29b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
30b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    /**
31b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * Called when the current account being used in keyboard is signed out.
32b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     *
33b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param oldAccount the account that was signed out of.
34b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     */
35b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    public static void onAccountSignedOut(@NonNull String oldAccount) {
36b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    }
37b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
38b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    /**
39b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * Called when the user signs-in to the keyboard.
40b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * This may be called when the user switches accounts to sign in with a different account.
41b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     *
42b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param oldAccount the previous account that was being used for sign-in.
43b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     *        May be null for a fresh sign-in.
44b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param newAccount the account being used for sign-in.
45b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     */
46b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    public static void onAccountSignedIn(@Nullable String oldAccount, @NonNull String newAccount) {
47b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    }
48b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
49b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    /**
50b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * Called when the user toggles the sync preference.
51b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     *
52b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param account the account being used for sync.
53b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param syncEnabled indicates whether sync has been enabled or not.
54b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     */
55b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    public static void onSyncPreferenceChanged(@Nullable String account, boolean syncEnabled) {
56b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    }
57b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha
58b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    /**
59b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * Forces an immediate sync to happen.
60b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * This should only be used for debugging purposes.
61b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     *
62b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     * @param account the account to use for sync.
63b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha     */
64b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    public static void forceSync(@Nullable String account) {
65b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha    }
666814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani
676814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani    /**
686814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani     * Forces an immediate deletion of user's data.
696814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani     * This should only be used for debugging purposes.
706814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani     *
716814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani     * @param account the account to use for sync.
726814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani     */
736814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani    public static void forceDelete(@Nullable String account) {
746814e7aa870efcd0dea2b67df8d2cbfbdc0c438cJatin Matani    }
75b17a3bc4e8a77905ca567f3876c4e37191d7aae5Sandeep Siddhartha}
76