blob: ed7bf3de0b3bea7b065fdfe48e9609a70890c9b7 [file] [log] [blame]
Adam Cohen79d90c52016-04-22 13:29:20 -07001/*
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
Adam Cohen9211d422014-10-07 18:14:53 -070017package com.android.launcher3;
18
Adam Cohen9211d422014-10-07 18:14:53 -070019import android.content.Intent;
Adam Cohen9211d422014-10-07 18:14:53 -070020import android.os.Bundle;
21import android.view.Menu;
Adam Cohen9211d422014-10-07 18:14:53 -070022
23import java.io.FileDescriptor;
24import java.io.PrintWriter;
25import java.util.ArrayList;
26
27/**
28 * LauncherCallbacks is an interface used to extend the Launcher activity. It includes many hooks
29 * in order to add additional functionality. Some of these are very general, and give extending
30 * classes the ability to react to Activity life-cycle or specific user interactions. Others
31 * are more specific and relate to replacing parts of the application, for example, the search
32 * interface or the wallpaper picker.
33 */
34public interface LauncherCallbacks {
35
36 /*
37 * Activity life-cycle methods. These methods are triggered after
38 * the code in the corresponding Launcher method is executed.
39 */
Mario Bertschlerc06af332017-03-28 12:23:22 -070040 void preOnCreate();
41 void onCreate(Bundle savedInstanceState);
Mario Bertschlerc06af332017-03-28 12:23:22 -070042 void onResume();
43 void onStart();
44 void onStop();
45 void onPause();
46 void onDestroy();
47 void onSaveInstanceState(Bundle outState);
Mario Bertschlerc06af332017-03-28 12:23:22 -070048 void onActivityResult(int requestCode, int resultCode, Intent data);
49 void onRequestPermissionsResult(int requestCode, String[] permissions,
Dave Hawkey3a43ed62015-06-26 10:27:47 -060050 int[] grantResults);
Mario Bertschlerc06af332017-03-28 12:23:22 -070051 void onAttachedToWindow();
52 void onDetachedFromWindow();
Mario Bertschlerc06af332017-03-28 12:23:22 -070053 void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
54 void onHomeIntent();
55 boolean handleBackPressed();
56 void onTrimMemory(int level);
Adam Cohen9211d422014-10-07 18:14:53 -070057
58 /*
59 * Extension points for providing custom behavior on certain user interactions.
60 */
Mario Bertschlerc06af332017-03-28 12:23:22 -070061 void onLauncherProviderChange();
Mario Bertschlerc06af332017-03-28 12:23:22 -070062 void bindAllApplications(ArrayList<AppInfo> apps);
Adam Cohen9211d422014-10-07 18:14:53 -070063
Sunny Goyal6f28e712016-09-13 14:19:29 -070064 /**
65 * Starts a search with {@param initialQuery}. Return false if search was not started.
66 */
Mario Bertschlerc06af332017-03-28 12:23:22 -070067 boolean startSearch(
Sunny Goyal6f28e712016-09-13 14:19:29 -070068 String initialQuery, boolean selectInitialQuery, Bundle appSearchData);
Adam Cohen9211d422014-10-07 18:14:53 -070069
70 /*
71 * Extensions points for adding / replacing some other aspects of the Launcher experience.
72 */
Mario Bertschlerc06af332017-03-28 12:23:22 -070073 boolean hasSettings();
Sunny Goyal3bac2c22018-02-07 14:44:05 -080074
75 /**
76 * Called when launcher integrated quickstep and some quickstep gesture started. It can be
77 * called multiple times for a single gesture an UI or background thread.
78 *
79 * @param isVisible if Launcher was visible when the gesture started.
80 */
81 void onQuickstepGestureStarted(boolean isVisible);
Adam Cohen9211d422014-10-07 18:14:53 -070082}