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 17 package android.app.admin; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.SystemApi; 22 import android.annotation.TestApi; 23 import android.os.Parcel; 24 25 /** 26 * Class used to identify that authority of the {@link EnforcingAdmin} setting a policy is a non-DPC 27 * device admin. 28 * 29 * @hide 30 */ 31 @SystemApi 32 public final class DeviceAdminAuthority extends Authority { 33 34 /** 35 * Object representing a device admin authority. 36 * 37 * @hide 38 */ 39 @TestApi 40 @NonNull 41 public static final DeviceAdminAuthority DEVICE_ADMIN_AUTHORITY = new DeviceAdminAuthority(); 42 43 /** 44 * Creates an authority that represents a device admin. 45 */ DeviceAdminAuthority()46 public DeviceAdminAuthority() {} 47 48 @Override toString()49 public String toString() { 50 return "DeviceAdminAuthority {}"; 51 } 52 53 @Override equals(@ullable Object o)54 public boolean equals(@Nullable Object o) { 55 if (this == o) return true; 56 return o != null && getClass() == o.getClass(); 57 } 58 59 @Override hashCode()60 public int hashCode() { 61 return 0; 62 } 63 64 @Override describeContents()65 public int describeContents() { 66 return 0; 67 } 68 69 @Override writeToParcel(@onNull Parcel dest, int flags)70 public void writeToParcel(@NonNull Parcel dest, int flags) {} 71 72 @NonNull 73 public static final Creator<DeviceAdminAuthority> CREATOR = 74 new Creator<DeviceAdminAuthority>() { 75 @Override 76 public DeviceAdminAuthority createFromParcel(Parcel source) { 77 return DEVICE_ADMIN_AUTHORITY; 78 } 79 80 @Override 81 public DeviceAdminAuthority[] newArray(int size) { 82 return new DeviceAdminAuthority[size]; 83 } 84 }; 85 } 86