1 /*
2  * Copyright (C) 2024 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.intentresolver.emptystate;
18 
19 import android.app.admin.DevicePolicyEventLogger;
20 import android.stats.devicepolicy.nano.DevicePolicyEnums;
21 
22 import androidx.annotation.NonNull;
23 
24 public class NoAppsAvailableEmptyState implements EmptyState {
25 
26     @NonNull
27     private final String mTitle;
28 
29     @NonNull
30     private final String mMetricsCategory;
31 
32     private final boolean mIsPersonalProfile;
33 
NoAppsAvailableEmptyState(@onNull String title, @NonNull String metricsCategory, boolean isPersonalProfile)34     public NoAppsAvailableEmptyState(@NonNull String title, @NonNull String metricsCategory,
35             boolean isPersonalProfile) {
36         mTitle = title;
37         mMetricsCategory = metricsCategory;
38         mIsPersonalProfile = isPersonalProfile;
39     }
40 
41     @NonNull
42     @Override
getTitle()43     public String getTitle() {
44         return mTitle;
45     }
46 
47     @Override
onEmptyStateShown()48     public void onEmptyStateShown() {
49         DevicePolicyEventLogger.createEvent(
50                         DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_APPS_RESOLVED)
51                 .setStrings(mMetricsCategory)
52                 .setBoolean(/*isPersonalProfile*/ mIsPersonalProfile)
53                 .write();
54     }
55 }
56