1 /*
2  * Copyright (C) 2023 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;
17 
18 public class LauncherConstants {
19 
20     /**
21      * Trace events to visualize using Systrace tool.
22      */
23     public static class TraceEvents {
24 
25         public static final String DISPLAY_ALL_APPS_TRACE_METHOD_NAME = "DisplayAllApps";
26         public static final int DISPLAY_WORKSPACE_TRACE_COOKIE = 0;
27         public static final int DISPLAY_ALL_APPS_TRACE_COOKIE = 1;
28         public static final int COLD_STARTUP_TRACE_COOKIE = 2;
29         public static final String ON_CREATE_EVT = "Launcher.onCreate";
30         public static final String ON_START_EVT = "Launcher.onStart";
31         public static final String ON_RESUME_EVT = "Launcher.onResume";
32         public static final String ON_NEW_INTENT_EVT = "Launcher.onNewIntent";
33         static final String DISPLAY_WORKSPACE_TRACE_METHOD_NAME = "DisplayWorkspaceFirstFrame";
34         static final String COLD_STARTUP_TRACE_METHOD_NAME = "LauncherColdStartup";
35     }
36 
37     /**
38      * This are the different codes the Launcher can receive when a new Launcher Intent is created.
39      */
40     public static class ActivityCodes {
41 
42         public static final int REQUEST_BIND_PENDING_APPWIDGET = 12;
43         public static final int REQUEST_RECONFIGURE_APPWIDGET = 13;
44         public static final int REQUEST_HOME_ROLE = 14;
45         static final int REQUEST_CREATE_SHORTCUT = 1;
46         static final int REQUEST_CREATE_APPWIDGET = 5;
47         static final int REQUEST_PICK_APPWIDGET = 9;
48         static final int REQUEST_BIND_APPWIDGET = 11;
49     }
50 
51     /**
52      * Keys used to get the saved values of the previous Activity instance.
53      */
54     public static class SavedInstanceKeys {
55 
56         // Type: int
57         public static final String RUNTIME_STATE = "launcher.state";
58         // Type PendingSplitSelectInfo<Parcelable>
59         public static final String PENDING_SPLIT_SELECT_INFO = "launcher.pending_split_select_info";
60         // Type: PendingRequestArgs
61         static final String RUNTIME_STATE_PENDING_REQUEST_ARGS = "launcher.request_args";
62         // Type: int
63         static final String RUNTIME_STATE_PENDING_REQUEST_CODE = "launcher.request_code";
64         // Type: ActivityResultInfo
65         static final String RUNTIME_STATE_PENDING_ACTIVITY_RESULT = "launcher.activity_result";
66         // Type: SparseArray<Parcelable>
67         static final String RUNTIME_STATE_WIDGET_PANEL = "launcher.widget_panel";
68         // Type int[]
69         static final String RUNTIME_STATE_CURRENT_SCREEN_IDS = "launcher.current_screen_ids";
70     }
71 }
72