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.annotation.NonNull; 20 import android.app.admin.DevicePolicyManager; 21 import android.content.ComponentName; 22 import android.os.UserHandle; 23 import android.support.annotation.Nullable; 24 25 import java.util.List; 26 27 public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrapper { 28 private final DevicePolicyManager mDpm; 29 DevicePolicyManagerWrapperImpl(DevicePolicyManager dpm)30 public DevicePolicyManagerWrapperImpl(DevicePolicyManager dpm) { 31 mDpm = dpm; 32 } 33 34 @Override getActiveAdminsAsUser(int userId)35 public @Nullable List<ComponentName> getActiveAdminsAsUser(int userId) { 36 return mDpm.getActiveAdminsAsUser(userId); 37 } 38 39 @Override getMaximumFailedPasswordsForWipe(@ullable ComponentName admin, int userHandle)40 public int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle) { 41 return mDpm.getMaximumFailedPasswordsForWipe(admin, userHandle); 42 } 43 44 @Override getDeviceOwnerComponentOnAnyUser()45 public ComponentName getDeviceOwnerComponentOnAnyUser() { 46 return mDpm.getDeviceOwnerComponentOnAnyUser(); 47 } 48 49 @Override getProfileOwnerAsUser(final int userId)50 public @Nullable ComponentName getProfileOwnerAsUser(final int userId) { 51 return mDpm.getProfileOwnerAsUser(userId); 52 } 53 54 @Override getDeviceOwnerOrganizationName()55 public CharSequence getDeviceOwnerOrganizationName() { 56 return mDpm.getDeviceOwnerOrganizationName(); 57 } 58 59 @Override getPermissionGrantState(@ullable ComponentName admin, String packageName, String permission)60 public int getPermissionGrantState(@Nullable ComponentName admin, String packageName, 61 String permission) { 62 return mDpm.getPermissionGrantState(admin, packageName, permission); 63 } 64 65 @Override isSecurityLoggingEnabled(@ullable ComponentName admin)66 public boolean isSecurityLoggingEnabled(@Nullable ComponentName admin) { 67 return mDpm.isSecurityLoggingEnabled(admin); 68 } 69 70 @Override isNetworkLoggingEnabled(@ullable ComponentName admin)71 public boolean isNetworkLoggingEnabled(@Nullable ComponentName admin) { 72 return mDpm.isNetworkLoggingEnabled(admin); 73 } 74 75 @Override getLastSecurityLogRetrievalTime()76 public long getLastSecurityLogRetrievalTime() { 77 return mDpm.getLastSecurityLogRetrievalTime(); 78 } 79 80 @Override getLastBugReportRequestTime()81 public long getLastBugReportRequestTime() { 82 return mDpm.getLastBugReportRequestTime(); 83 } 84 85 @Override getLastNetworkLogRetrievalTime()86 public long getLastNetworkLogRetrievalTime() { 87 return mDpm.getLastNetworkLogRetrievalTime(); 88 } 89 90 @Override isCurrentInputMethodSetByOwner()91 public boolean isCurrentInputMethodSetByOwner() { 92 return mDpm.isCurrentInputMethodSetByOwner(); 93 } 94 95 @Override getOwnerInstalledCaCerts(@onNull UserHandle user)96 public List<String> getOwnerInstalledCaCerts(@NonNull UserHandle user) { 97 return mDpm.getOwnerInstalledCaCerts(user); 98 } 99 100 @Override isDeviceOwnerAppOnAnyUser(String packageName)101 public boolean isDeviceOwnerAppOnAnyUser(String packageName) { 102 return mDpm.isDeviceOwnerAppOnAnyUser(packageName); 103 } 104 105 @Override packageHasActiveAdmins(String packageName)106 public boolean packageHasActiveAdmins(String packageName) { 107 return mDpm.packageHasActiveAdmins(packageName); 108 } 109 110 @Override isUninstallInQueue(String packageName)111 public boolean isUninstallInQueue(String packageName) { 112 return mDpm.isUninstallInQueue(packageName); 113 } 114 } 115