• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.launcher3;
18 
19 import android.content.Intent;
20 import android.os.Bundle;
21 
22 import java.io.FileDescriptor;
23 import java.io.PrintWriter;
24 import 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  */
33 public 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      */
onCreate(Bundle savedInstanceState)39     void onCreate(Bundle savedInstanceState);
onResume()40     void onResume();
onStart()41     void onStart();
onStop()42     void onStop();
onPause()43     void onPause();
onDestroy()44     void onDestroy();
onSaveInstanceState(Bundle outState)45     void onSaveInstanceState(Bundle outState);
onActivityResult(int requestCode, int resultCode, Intent data)46     void onActivityResult(int requestCode, int resultCode, Intent data);
onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)47     void onRequestPermissionsResult(int requestCode, String[] permissions,
48             int[] grantResults);
onAttachedToWindow()49     void onAttachedToWindow();
onDetachedFromWindow()50     void onDetachedFromWindow();
dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args)51     void dump(String prefix, FileDescriptor fd, PrintWriter w, String[] args);
onHomeIntent(boolean internalStateHandled)52     void onHomeIntent(boolean internalStateHandled);
handleBackPressed()53     boolean handleBackPressed();
onTrimMemory(int level)54     void onTrimMemory(int level);
55 
56     /*
57      * Extension points for providing custom behavior on certain user interactions.
58      */
onLauncherProviderChange()59     void onLauncherProviderChange();
bindAllApplications(ArrayList<AppInfo> apps)60     void bindAllApplications(ArrayList<AppInfo> apps);
61 
62     /**
63      * Starts a search with {@param initialQuery}. Return false if search was not started.
64      */
startSearch( String initialQuery, boolean selectInitialQuery, Bundle appSearchData)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      */
hasSettings()71     boolean hasSettings();
72 }
73