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.settings.enterprise;
18 
19 import android.content.Context;
20 
21 import java.util.Date;
22 
23 public interface EnterprisePrivacyFeatureProvider {
24 
25     /**
26      * Returns whether the device is managed by a Device Owner app.
27      */
hasDeviceOwner()28     boolean hasDeviceOwner();
29 
30     /**
31      * Returns whether the device is in COMP mode (primary user managed by a Device Owner app and
32      * work profile managed by a Profile Owner app).
33      */
isInCompMode()34     boolean isInCompMode();
35 
36     /**
37      * Returns the name of the organization managing the device via a Device Owner app. If the
38      * device is not managed by a Device Owner app or the name of the managing organization was not
39      * set, returns {@code null}.
40      */
getDeviceOwnerOrganizationName()41     String getDeviceOwnerOrganizationName();
42 
43     /**
44      * Returns a message informing the user that the device is managed by a Device Owner app. The
45      * message includes a Learn More link that takes the user to the enterprise privacy section of
46      * Settings. If the device is not managed by a Device Owner app, returns {@code null}.
47      */
getDeviceOwnerDisclosure()48     CharSequence getDeviceOwnerDisclosure();
49 
50     /**
51      * Returns the time at which the Device Owner last retrieved security logs, or {@code null} if
52      * logs were never retrieved by the Device Owner on this device.
53      */
getLastSecurityLogRetrievalTime()54     Date getLastSecurityLogRetrievalTime();
55 
56     /**
57      * Returns the time at which the Device Owner last requested a bug report, or {@code null} if no
58      * bug report was ever requested by the Device Owner on this device.
59      */
getLastBugReportRequestTime()60     Date getLastBugReportRequestTime();
61 
62     /**
63      * Returns the time at which the Device Owner last retrieved network logs, or {@code null} if
64      * logs were never retrieved by the Device Owner on this device.
65      */
getLastNetworkLogRetrievalTime()66     Date getLastNetworkLogRetrievalTime();
67 
68     /**
69      * Returns whether security logging is currently enabled.
70      */
isSecurityLoggingEnabled()71     boolean isSecurityLoggingEnabled();
72 
73     /**
74      * Returns whether network logging is currently enabled.
75      */
isNetworkLoggingEnabled()76     boolean isNetworkLoggingEnabled();
77 
78     /**
79      * Returns whether the Device Owner or Profile Owner in the current user set an always-on VPN.
80      */
isAlwaysOnVpnSetInCurrentUser()81     boolean isAlwaysOnVpnSetInCurrentUser();
82 
83     /**
84      * Returns whether the Profile Owner in the current user's managed profile (if any) set an
85      * always-on VPN.
86      */
isAlwaysOnVpnSetInManagedProfile()87     boolean isAlwaysOnVpnSetInManagedProfile();
88 
89     /**
90      * Returns the number of failed login attempts that the Device Owner or Profile Owner allows
91      * before the current user is wiped, or zero if no such limit is set.
92      */
getMaximumFailedPasswordsBeforeWipeInCurrentUser()93     int getMaximumFailedPasswordsBeforeWipeInCurrentUser();
94 
95     /**
96      * Returns the number of failed login attempts that the Profile Owner allows before the current
97      * user's managed profile (if any) is wiped, or zero if no such limit is set.
98      */
getMaximumFailedPasswordsBeforeWipeInManagedProfile()99     int getMaximumFailedPasswordsBeforeWipeInManagedProfile();
100 
101     /**
102      * Returns the label of the current user's input method if that input method was set by a Device
103      * Owner or Profile Owner in that user. Otherwise, returns {@code null}.
104      */
getImeLabelIfOwnerSet()105     String getImeLabelIfOwnerSet();
106 
107     /**
108      * Returns the number of CA certificates that the Device Owner or Profile Owner installed in
109      * current user.
110      */
getNumberOfOwnerInstalledCaCertsForCurrentUser()111     int getNumberOfOwnerInstalledCaCertsForCurrentUser();
112 
113     /**
114      * Returns the number of CA certificates that the Device Owner or Profile Owner installed in
115      * the current user's managed profile  (if any).
116      */
getNumberOfOwnerInstalledCaCertsForManagedProfile()117     int getNumberOfOwnerInstalledCaCertsForManagedProfile();
118 
119     /**
120      * Returns the number of Device Admin apps active in the current user and the user's managed
121      * profile (if any).
122      */
getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile()123     int getNumberOfActiveDeviceAdminsForCurrentUserAndManagedProfile();
124 
125     /**
126      * Returns {@code true} if it is possilbe to resolve an Intent to launch the "Your work policy
127      * info" page provided by the active Device Owner or Profile Owner app if it exists, {@code
128      * false} otherwise.
129      */
hasWorkPolicyInfo()130     boolean hasWorkPolicyInfo();
131 
132     /**
133      * Launches the Device Owner or Profile Owner's activity that displays the "Your work policy
134      * info" page. Returns {@code true} if the activity has indeed been launched.
135      */
showWorkPolicyInfo(Context activityContext)136     boolean showWorkPolicyInfo(Context activityContext);
137 
138     /**
139      * Launches the parental controls settings page. Returns {@code true} if the activity has
140      * been launched.
141      */
showParentalControls()142     boolean showParentalControls();
143 }
144