Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -8190,6 +8190,7 @@ package android.app.admin { method public int getResultCode(); field public static final int RESULT_FAILURE_CONFLICTING_ADMIN_POLICY = 1; // 0x1 field public static final int RESULT_FAILURE_UNKNOWN = -1; // 0xffffffff field public static final int RESULT_POLICY_CLEARED = 2; // 0x2 field public static final int RESULT_SUCCESS = 0; // 0x0 } core/api/test-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -544,6 +544,7 @@ package android.app.admin { method public void setDeviceOwnerType(@NonNull android.content.ComponentName, int); method @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_ADMINS) public void setNextOperationSafety(int, int); method @RequiresPermission(anyOf={android.Manifest.permission.MARK_DEVICE_ORGANIZATION_OWNED, android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS}, conditional=true) public void setProfileOwnerOnOrganizationOwnedDevice(@NonNull android.content.ComponentName, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public boolean triggerDevicePolicyEngineMigration(boolean); field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED"; field public static final String ACTION_DEVICE_POLICY_CONSTANTS_CHANGED = "android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED"; field public static final int DEVICE_OWNER_TYPE_DEFAULT = 0; // 0x0 Loading Loading @@ -598,6 +599,13 @@ package android.app.admin { field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FlagUnion> CREATOR; } public final class MostRecent<V> extends android.app.admin.ResolutionMechanism<V> { ctor public MostRecent(); method public int describeContents(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.MostRecent> CREATOR; } public final class MostRestrictive<V> extends android.app.admin.ResolutionMechanism<V> { method public int describeContents(); method public void writeToParcel(@NonNull android.os.Parcel, int); Loading core/java/android/app/admin/BundlePolicyValue.java 0 → 100644 +80 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.os.Parcel; import java.util.Objects; /** * @hide */ public final class BundlePolicyValue extends PolicyValue<Bundle> { public BundlePolicyValue(Bundle value) { super(value); } private BundlePolicyValue(Parcel source) { this(source.readBundle()); } @Override public boolean equals(@Nullable Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BundlePolicyValue other = (BundlePolicyValue) o; return Objects.equals(getValue(), other.getValue()); } @Override public int hashCode() { return Objects.hash(getValue()); } @Override public String toString() { return "BundlePolicyValue { mValue= " + getValue() + " }"; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeBundle(getValue()); } @NonNull public static final Creator<BundlePolicyValue> CREATOR = new Creator<BundlePolicyValue>() { @Override public BundlePolicyValue createFromParcel(Parcel source) { return new BundlePolicyValue(source); } @Override public BundlePolicyValue[] newArray(int size) { return new BundlePolicyValue[size]; } }; } core/java/android/app/admin/DevicePolicyManager.java +29 −11 Original line number Diff line number Diff line Loading @@ -4021,18 +4021,8 @@ public class DevicePolicyManager { /** * @hide */ public static final String PERMISSION_GRANT_POLICY_KEY = "permissionGrant"; public static final String PERMISSION_GRANT_POLICY = "permissionGrant"; // TODO: Expose this as SystemAPI once we add the query API /** * @hide */ public static String PERMISSION_GRANT_POLICY( @NonNull String packageName, @NonNull String permission) { Objects.requireNonNull(packageName); Objects.requireNonNull(permission); return PERMISSION_GRANT_POLICY_KEY + "_" + packageName + "_" + permission; } // TODO: Expose this as SystemAPI once we add the query API /** Loading Loading @@ -4061,6 +4051,12 @@ public class DevicePolicyManager { */ public static final String PACKAGE_UNINSTALL_BLOCKED_POLICY = "packageUninstallBlocked"; // TODO: Expose this as SystemAPI once we add the query API /** * @hide */ public static final String APPLICATION_RESTRICTIONS_POLICY = "applicationRestrictions"; /** * This object is a single place to tack on invalidation and disable calls. All * binder caches in this class derive from this Config, so all can be invalidated or Loading Loading @@ -16334,4 +16330,26 @@ public class DevicePolicyManager { } return null; } /** * Triggers the data migration of device policies for existing DPCs to the Device Policy Engine. * If {@code forceMigration} is set to {@code true} it skips the prerequisite checks before * triggering the migration. * * <p>Returns {@code true} if migration was completed successfully, {@code false} otherwise. * * @hide */ @TestApi @RequiresPermission(permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public boolean triggerDevicePolicyEngineMigration(boolean forceMigration) { if (mService != null) { try { return mService.triggerDevicePolicyEngineMigration(forceMigration); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return false; } } core/java/android/app/admin/DevicePolicyManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; import android.os.UserHandle; import java.util.List; import java.util.Map; import java.util.Set; /** Loading Loading @@ -309,4 +311,10 @@ public abstract class DevicePolicyManagerInternal { * Returns whether the application exemptions feature flag is enabled. */ public abstract boolean isApplicationExemptionsFlagEnabled(); /** * Returns the application restrictions set by each admin for the given {@code packageName}. */ public abstract Map<String, Bundle> getApplicationRestrictionsPerAdmin( String packageName, int userId); } Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -8190,6 +8190,7 @@ package android.app.admin { method public int getResultCode(); field public static final int RESULT_FAILURE_CONFLICTING_ADMIN_POLICY = 1; // 0x1 field public static final int RESULT_FAILURE_UNKNOWN = -1; // 0xffffffff field public static final int RESULT_POLICY_CLEARED = 2; // 0x2 field public static final int RESULT_SUCCESS = 0; // 0x0 }
core/api/test-current.txt +8 −0 Original line number Diff line number Diff line Loading @@ -544,6 +544,7 @@ package android.app.admin { method public void setDeviceOwnerType(@NonNull android.content.ComponentName, int); method @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_ADMINS) public void setNextOperationSafety(int, int); method @RequiresPermission(anyOf={android.Manifest.permission.MARK_DEVICE_ORGANIZATION_OWNED, android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS}, conditional=true) public void setProfileOwnerOnOrganizationOwnedDevice(@NonNull android.content.ComponentName, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public boolean triggerDevicePolicyEngineMigration(boolean); field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED"; field public static final String ACTION_DEVICE_POLICY_CONSTANTS_CHANGED = "android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED"; field public static final int DEVICE_OWNER_TYPE_DEFAULT = 0; // 0x0 Loading Loading @@ -598,6 +599,13 @@ package android.app.admin { field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FlagUnion> CREATOR; } public final class MostRecent<V> extends android.app.admin.ResolutionMechanism<V> { ctor public MostRecent(); method public int describeContents(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.MostRecent> CREATOR; } public final class MostRestrictive<V> extends android.app.admin.ResolutionMechanism<V> { method public int describeContents(); method public void writeToParcel(@NonNull android.os.Parcel, int); Loading
core/java/android/app/admin/BundlePolicyValue.java 0 → 100644 +80 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; import android.annotation.NonNull; import android.annotation.Nullable; import android.os.Bundle; import android.os.Parcel; import java.util.Objects; /** * @hide */ public final class BundlePolicyValue extends PolicyValue<Bundle> { public BundlePolicyValue(Bundle value) { super(value); } private BundlePolicyValue(Parcel source) { this(source.readBundle()); } @Override public boolean equals(@Nullable Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BundlePolicyValue other = (BundlePolicyValue) o; return Objects.equals(getValue(), other.getValue()); } @Override public int hashCode() { return Objects.hash(getValue()); } @Override public String toString() { return "BundlePolicyValue { mValue= " + getValue() + " }"; } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeBundle(getValue()); } @NonNull public static final Creator<BundlePolicyValue> CREATOR = new Creator<BundlePolicyValue>() { @Override public BundlePolicyValue createFromParcel(Parcel source) { return new BundlePolicyValue(source); } @Override public BundlePolicyValue[] newArray(int size) { return new BundlePolicyValue[size]; } }; }
core/java/android/app/admin/DevicePolicyManager.java +29 −11 Original line number Diff line number Diff line Loading @@ -4021,18 +4021,8 @@ public class DevicePolicyManager { /** * @hide */ public static final String PERMISSION_GRANT_POLICY_KEY = "permissionGrant"; public static final String PERMISSION_GRANT_POLICY = "permissionGrant"; // TODO: Expose this as SystemAPI once we add the query API /** * @hide */ public static String PERMISSION_GRANT_POLICY( @NonNull String packageName, @NonNull String permission) { Objects.requireNonNull(packageName); Objects.requireNonNull(permission); return PERMISSION_GRANT_POLICY_KEY + "_" + packageName + "_" + permission; } // TODO: Expose this as SystemAPI once we add the query API /** Loading Loading @@ -4061,6 +4051,12 @@ public class DevicePolicyManager { */ public static final String PACKAGE_UNINSTALL_BLOCKED_POLICY = "packageUninstallBlocked"; // TODO: Expose this as SystemAPI once we add the query API /** * @hide */ public static final String APPLICATION_RESTRICTIONS_POLICY = "applicationRestrictions"; /** * This object is a single place to tack on invalidation and disable calls. All * binder caches in this class derive from this Config, so all can be invalidated or Loading Loading @@ -16334,4 +16330,26 @@ public class DevicePolicyManager { } return null; } /** * Triggers the data migration of device policies for existing DPCs to the Device Policy Engine. * If {@code forceMigration} is set to {@code true} it skips the prerequisite checks before * triggering the migration. * * <p>Returns {@code true} if migration was completed successfully, {@code false} otherwise. * * @hide */ @TestApi @RequiresPermission(permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public boolean triggerDevicePolicyEngineMigration(boolean forceMigration) { if (mService != null) { try { return mService.triggerDevicePolicyEngineMigration(forceMigration); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return false; } }
core/java/android/app/admin/DevicePolicyManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -21,9 +21,11 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.content.ComponentName; import android.content.Intent; import android.os.Bundle; import android.os.UserHandle; import java.util.List; import java.util.Map; import java.util.Set; /** Loading Loading @@ -309,4 +311,10 @@ public abstract class DevicePolicyManagerInternal { * Returns whether the application exemptions feature flag is enabled. */ public abstract boolean isApplicationExemptionsFlagEnabled(); /** * Returns the application restrictions set by each admin for the given {@code packageName}. */ public abstract Map<String, Bundle> getApplicationRestrictionsPerAdmin( String packageName, int userId); }