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