• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 package com.android.launcher3.model;
17 
18 import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;
19 
20 import android.content.ComponentName;
21 import android.os.UserHandle;
22 
23 import androidx.annotation.Nullable;
24 
25 import com.android.launcher3.R;
26 import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
27 import com.android.launcher3.util.MainThreadInitializedObject;
28 import com.android.launcher3.util.ResourceBasedOverride;
29 
30 /**
31  * Callback for receiving various app launch events
32  */
33 public class AppLaunchTracker implements ResourceBasedOverride {
34 
35     /**
36      * Derived from LauncherEvent proto.
37      * TODO: Use proper descriptive constants
38      */
39     public static final String CONTAINER_DEFAULT = Integer.toString(ContainerType.WORKSPACE);
40     public static final String CONTAINER_ALL_APPS = Integer.toString(ContainerType.ALLAPPS);
41     public static final String CONTAINER_PREDICTIONS = Integer.toString(ContainerType.PREDICTION);
42     public static final String CONTAINER_SEARCH = Integer.toString(ContainerType.SEARCHRESULT);
43     public static final String CONTAINER_OVERVIEW = Integer.toString(ContainerType.OVERVIEW);
44     public static final String CONTAINER_HOTSEAT = Integer.toString(ContainerType.HOTSEAT);
45 
46 
47     public static final MainThreadInitializedObject<AppLaunchTracker> INSTANCE =
48             forOverride(AppLaunchTracker.class, R.string.app_launch_tracker_class);
49 
onStartShortcut(String packageName, String shortcutId, UserHandle user, @Nullable String container)50     public void onStartShortcut(String packageName, String shortcutId, UserHandle user,
51             @Nullable String container) { }
52 
onStartApp(ComponentName componentName, UserHandle user, @Nullable String container)53     public void onStartApp(ComponentName componentName, UserHandle user,
54             @Nullable String container) { }
55 
onDismissApp(ComponentName componentName, UserHandle user, @Nullable String container)56     public void onDismissApp(ComponentName componentName, UserHandle user,
57              @Nullable String container){}
58 
onReturnedToHome()59     public void onReturnedToHome() { }
60 }
61