1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.launcher3;
18
19import android.content.Intent;
20import android.os.Bundle;
21
22import java.io.FileDescriptor;
23import java.io.PrintWriter;
24import java.util.ArrayList;
25
26/**
27 * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
28 * in order to add additional functionality. Some of these are very general, and give extending
29 * classes the ability to react to Activity life-cycle or specific user interactions. Others
30 * are more specific and relate to replacing parts of the application, for example, the search
31 * interface or the wallpaper picker.
32 */
33public interface LauncherCallbacks {
34
35    /*
36     * Activity life-cycle methods. These methods are triggered after
37     * the code in the corresponding Launcher method is executed.
38     */
39    void onCreate(Bundle savedInstanceState);
40    void onResume();
41    void onStart();
42    void onStop();
43    void onPause();
44    void onDestroy();
45    void onSaveInstanceState(Bundle outState);
46    void onActivityResult(int requestCode, int resultCode, Intent data);
47    void onRequestPermissionsResult(int requestCode, String[] permissions,
48            int[] grantResults);
49    void onAttachedToWindow();
50    void onDetachedFromWindow();
51    void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
52    void onHomeIntent(boolean internalStateHandled);
53    boolean handleBackPressed();
54    void onTrimMemory(int level);
55
56    /*
57     * Extension points for providing custom behavior on certain user interactions.
58     */
59    void onLauncherProviderChange();
60    void bindAllApplications(ArrayList<AppInfo> apps);
61
62    /**
63     * Starts a search with {@param initialQuery}. Return false if search was not started.
64     */
65    boolean startSearch(
66            String initialQuery, boolean selectInitialQuery, Bundle appSearchData);
67
68    /*
69     * Extensions points for adding / replacing some other aspects of the Launcher experience.
70     */
71    boolean hasSettings();
72}
73