Loading core/api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -7535,6 +7535,7 @@ package android.app.admin { method @Nullable public android.app.admin.PackagePolicy getManagedProfileCallerIdAccessPolicy(); method @Nullable public android.app.admin.PackagePolicy getManagedProfileContactsAccessPolicy(); method public long getManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName); method @NonNull public android.app.admin.ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy(); method public int getMaximumFailedPasswordsForWipe(@Nullable android.content.ComponentName); method public long getMaximumTimeToLock(@Nullable android.content.ComponentName); method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName); Loading Loading @@ -7685,6 +7686,7 @@ package android.app.admin { method public void setManagedProfileCallerIdAccessPolicy(@Nullable android.app.admin.PackagePolicy); method public void setManagedProfileContactsAccessPolicy(@Nullable android.app.admin.PackagePolicy); method public void setManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName, long); method public void setManagedSubscriptionsPolicy(@Nullable android.app.admin.ManagedSubscriptionsPolicy); method public void setMasterVolumeMuted(@NonNull android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(@NonNull android.content.ComponentName, int); method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long); Loading Loading @@ -7987,6 +7989,16 @@ package android.app.admin { method public java.time.MonthDay getStart(); } public final class ManagedSubscriptionsPolicy implements android.os.Parcelable { ctor public ManagedSubscriptionsPolicy(int); method public int describeContents(); method public int getPolicyType(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.ManagedSubscriptionsPolicy> CREATOR; field public static final int TYPE_ALL_MANAGED_SUBSCRIPTIONS = 1; // 0x1 field public static final int TYPE_ALL_PERSONAL_SUBSCRIPTIONS = 0; // 0x0 } public abstract class NetworkEvent implements android.os.Parcelable { method public int describeContents(); method public long getId(); core/java/android/app/admin/DevicePolicyManager.java +45 −0 Original line number Diff line number Diff line Loading @@ -10996,6 +10996,51 @@ public class DevicePolicyManager { } } /** * Called by a profile owner of an organization-owned device to specify {@link * ManagedSubscriptionsPolicy} * * <p>Managed subscriptions policy controls how SIMs would be associated with the * managed profile. For example a policy of type * {@link ManagedSubscriptionsPolicy#TYPE_ALL_MANAGED_SUBSCRIPTIONS} assigns all * SIM-based subscriptions to the managed profile. In this case OEM default * dialer and messages app are automatically installed in the managed profile * and all incoming and outgoing calls and text messages are handled by them. * <p>This API can only be called during device setup. * * @param policy {@link ManagedSubscriptionsPolicy} policy, passing null for this resets the * policy to be the default. * @throws SecurityException if the caller is not a profile owner on an organization-owned * managed profile. * @throws IllegalStateException if called after the device setup has been completed. * @see ManagedSubscriptionsPolicy */ public void setManagedSubscriptionsPolicy(@Nullable ManagedSubscriptionsPolicy policy) { throwIfParentInstance("setManagedSubscriptionsPolicy"); try { mService.setManagedSubscriptionsPolicy(policy); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns the current {@link ManagedSubscriptionsPolicy}. * If the policy has not been set, it will return a default policy of Type {@link * ManagedSubscriptionsPolicy#TYPE_ALL_PERSONAL_SUBSCRIPTIONS}. * * @see #setManagedSubscriptionsPolicy(ManagedSubscriptionsPolicy) */ @NonNull public ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy() { throwIfParentInstance("getManagedSubscriptionsPolicy"); try { return mService.getManagedSubscriptionsPolicy(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Similar to {@link #logoutUser(ComponentName)}, except: * Loading core/java/android/app/admin/IDevicePolicyManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.app.admin.PasswordMetrics; import android.app.admin.FactoryResetProtectionPolicy; import android.app.admin.ManagedProfileProvisioningParams; import android.app.admin.FullyManagedDeviceProvisioningParams; import android.app.admin.ManagedSubscriptionsPolicy; import android.app.admin.WifiSsidPolicy; import android.content.ComponentName; import android.content.Intent; Loading Loading @@ -583,4 +584,7 @@ interface IDevicePolicyManager { void setMtePolicy(int flag); int getMtePolicy(); void setManagedSubscriptionsPolicy(in ManagedSubscriptionsPolicy policy); ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy(); } core/java/android/app/admin/ManagedSubscriptionsPolicy.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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; parcelable ManagedSubscriptionsPolicy; No newline at end of file core/java/android/app/admin/ManagedSubscriptionsPolicy.java 0 → 100644 +156 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.IntDef; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** * A policy class that describes how managed SIM subscriptions should behave on the device. */ public final class ManagedSubscriptionsPolicy implements Parcelable { private static final String TAG = "ManagedSubscriptionsPolicy"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"TYPE_"}, value = {TYPE_ALL_PERSONAL_SUBSCRIPTIONS, TYPE_ALL_MANAGED_SUBSCRIPTIONS}) @interface ManagedSubscriptionsPolicyType { } /** * Represents default policy to not have any managed subscriptions on the device. */ public static final int TYPE_ALL_PERSONAL_SUBSCRIPTIONS = 0; /** * Represents policy to have only managed subscriptions on the device, any existing and * future subscriptions on the device are exclusively associated with the managed profile. * * <p>When a subscription is associated with the managed profile, incoming/outgoing calls and * text message using that subscription would only work via apps on managed profile. * Also, Call logs and messages would be accessible only from the managed profile. */ public static final int TYPE_ALL_MANAGED_SUBSCRIPTIONS = 1; @ManagedSubscriptionsPolicyType private final int mPolicyType; private static final String KEY_POLICY_TYPE = "policy_type"; public ManagedSubscriptionsPolicy(@ManagedSubscriptionsPolicyType int policyType) { if (policyType != TYPE_ALL_PERSONAL_SUBSCRIPTIONS && policyType != TYPE_ALL_MANAGED_SUBSCRIPTIONS) { throw new IllegalArgumentException("Invalid policy type"); } mPolicyType = policyType; } @NonNull public static final Parcelable.Creator<ManagedSubscriptionsPolicy> CREATOR = new Parcelable.Creator<ManagedSubscriptionsPolicy>() { public ManagedSubscriptionsPolicy createFromParcel(Parcel in) { ManagedSubscriptionsPolicy policy = new ManagedSubscriptionsPolicy( in.readInt()); return policy; } @Override public ManagedSubscriptionsPolicy[] newArray(int size) { return new ManagedSubscriptionsPolicy[size]; } }; /** * Returns the type of managed subscriptions policy, or {@link #TYPE_ALL_PERSONAL_SUBSCRIPTIONS} * if no policy has been set. * * @return The policy type. */ @ManagedSubscriptionsPolicyType public int getPolicyType() { return mPolicyType; } @Override public String toString() { return TextUtils.formatSimple("ManagedSubscriptionsPolicy (type: %d)", mPolicyType); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mPolicyType); } @Override public boolean equals(Object thatObject) { if (this == thatObject) { return true; } if (!(thatObject instanceof ManagedSubscriptionsPolicy)) { return false; } ManagedSubscriptionsPolicy that = (ManagedSubscriptionsPolicy) thatObject; return mPolicyType == that.mPolicyType; } @Override public int hashCode() { return Objects.hash(mPolicyType); } /** @hide */ @Nullable public static ManagedSubscriptionsPolicy readFromXml(@NonNull TypedXmlPullParser parser) { try { ManagedSubscriptionsPolicy policy = new ManagedSubscriptionsPolicy( parser.getAttributeInt(null, KEY_POLICY_TYPE, -1)); return policy; } catch (IllegalArgumentException e) { // Fail through Log.w(TAG, "Load xml failed", e); } return null; } /** * @hide */ public void saveToXml(TypedXmlSerializer out) throws IOException { out.attributeInt(null, KEY_POLICY_TYPE, mPolicyType); } } Loading
core/api/current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -7535,6 +7535,7 @@ package android.app.admin { method @Nullable public android.app.admin.PackagePolicy getManagedProfileCallerIdAccessPolicy(); method @Nullable public android.app.admin.PackagePolicy getManagedProfileContactsAccessPolicy(); method public long getManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName); method @NonNull public android.app.admin.ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy(); method public int getMaximumFailedPasswordsForWipe(@Nullable android.content.ComponentName); method public long getMaximumTimeToLock(@Nullable android.content.ComponentName); method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName); Loading Loading @@ -7685,6 +7686,7 @@ package android.app.admin { method public void setManagedProfileCallerIdAccessPolicy(@Nullable android.app.admin.PackagePolicy); method public void setManagedProfileContactsAccessPolicy(@Nullable android.app.admin.PackagePolicy); method public void setManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName, long); method public void setManagedSubscriptionsPolicy(@Nullable android.app.admin.ManagedSubscriptionsPolicy); method public void setMasterVolumeMuted(@NonNull android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(@NonNull android.content.ComponentName, int); method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long); Loading Loading @@ -7987,6 +7989,16 @@ package android.app.admin { method public java.time.MonthDay getStart(); } public final class ManagedSubscriptionsPolicy implements android.os.Parcelable { ctor public ManagedSubscriptionsPolicy(int); method public int describeContents(); method public int getPolicyType(); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.ManagedSubscriptionsPolicy> CREATOR; field public static final int TYPE_ALL_MANAGED_SUBSCRIPTIONS = 1; // 0x1 field public static final int TYPE_ALL_PERSONAL_SUBSCRIPTIONS = 0; // 0x0 } public abstract class NetworkEvent implements android.os.Parcelable { method public int describeContents(); method public long getId();
core/java/android/app/admin/DevicePolicyManager.java +45 −0 Original line number Diff line number Diff line Loading @@ -10996,6 +10996,51 @@ public class DevicePolicyManager { } } /** * Called by a profile owner of an organization-owned device to specify {@link * ManagedSubscriptionsPolicy} * * <p>Managed subscriptions policy controls how SIMs would be associated with the * managed profile. For example a policy of type * {@link ManagedSubscriptionsPolicy#TYPE_ALL_MANAGED_SUBSCRIPTIONS} assigns all * SIM-based subscriptions to the managed profile. In this case OEM default * dialer and messages app are automatically installed in the managed profile * and all incoming and outgoing calls and text messages are handled by them. * <p>This API can only be called during device setup. * * @param policy {@link ManagedSubscriptionsPolicy} policy, passing null for this resets the * policy to be the default. * @throws SecurityException if the caller is not a profile owner on an organization-owned * managed profile. * @throws IllegalStateException if called after the device setup has been completed. * @see ManagedSubscriptionsPolicy */ public void setManagedSubscriptionsPolicy(@Nullable ManagedSubscriptionsPolicy policy) { throwIfParentInstance("setManagedSubscriptionsPolicy"); try { mService.setManagedSubscriptionsPolicy(policy); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns the current {@link ManagedSubscriptionsPolicy}. * If the policy has not been set, it will return a default policy of Type {@link * ManagedSubscriptionsPolicy#TYPE_ALL_PERSONAL_SUBSCRIPTIONS}. * * @see #setManagedSubscriptionsPolicy(ManagedSubscriptionsPolicy) */ @NonNull public ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy() { throwIfParentInstance("getManagedSubscriptionsPolicy"); try { return mService.getManagedSubscriptionsPolicy(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Similar to {@link #logoutUser(ComponentName)}, except: * Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.app.admin.PasswordMetrics; import android.app.admin.FactoryResetProtectionPolicy; import android.app.admin.ManagedProfileProvisioningParams; import android.app.admin.FullyManagedDeviceProvisioningParams; import android.app.admin.ManagedSubscriptionsPolicy; import android.app.admin.WifiSsidPolicy; import android.content.ComponentName; import android.content.Intent; Loading Loading @@ -583,4 +584,7 @@ interface IDevicePolicyManager { void setMtePolicy(int flag); int getMtePolicy(); void setManagedSubscriptionsPolicy(in ManagedSubscriptionsPolicy policy); ManagedSubscriptionsPolicy getManagedSubscriptionsPolicy(); }
core/java/android/app/admin/ManagedSubscriptionsPolicy.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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; parcelable ManagedSubscriptionsPolicy; No newline at end of file
core/java/android/app/admin/ManagedSubscriptionsPolicy.java 0 → 100644 +156 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 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.IntDef; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.modules.utils.TypedXmlPullParser; import com.android.modules.utils.TypedXmlSerializer; import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Objects; /** * A policy class that describes how managed SIM subscriptions should behave on the device. */ public final class ManagedSubscriptionsPolicy implements Parcelable { private static final String TAG = "ManagedSubscriptionsPolicy"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"TYPE_"}, value = {TYPE_ALL_PERSONAL_SUBSCRIPTIONS, TYPE_ALL_MANAGED_SUBSCRIPTIONS}) @interface ManagedSubscriptionsPolicyType { } /** * Represents default policy to not have any managed subscriptions on the device. */ public static final int TYPE_ALL_PERSONAL_SUBSCRIPTIONS = 0; /** * Represents policy to have only managed subscriptions on the device, any existing and * future subscriptions on the device are exclusively associated with the managed profile. * * <p>When a subscription is associated with the managed profile, incoming/outgoing calls and * text message using that subscription would only work via apps on managed profile. * Also, Call logs and messages would be accessible only from the managed profile. */ public static final int TYPE_ALL_MANAGED_SUBSCRIPTIONS = 1; @ManagedSubscriptionsPolicyType private final int mPolicyType; private static final String KEY_POLICY_TYPE = "policy_type"; public ManagedSubscriptionsPolicy(@ManagedSubscriptionsPolicyType int policyType) { if (policyType != TYPE_ALL_PERSONAL_SUBSCRIPTIONS && policyType != TYPE_ALL_MANAGED_SUBSCRIPTIONS) { throw new IllegalArgumentException("Invalid policy type"); } mPolicyType = policyType; } @NonNull public static final Parcelable.Creator<ManagedSubscriptionsPolicy> CREATOR = new Parcelable.Creator<ManagedSubscriptionsPolicy>() { public ManagedSubscriptionsPolicy createFromParcel(Parcel in) { ManagedSubscriptionsPolicy policy = new ManagedSubscriptionsPolicy( in.readInt()); return policy; } @Override public ManagedSubscriptionsPolicy[] newArray(int size) { return new ManagedSubscriptionsPolicy[size]; } }; /** * Returns the type of managed subscriptions policy, or {@link #TYPE_ALL_PERSONAL_SUBSCRIPTIONS} * if no policy has been set. * * @return The policy type. */ @ManagedSubscriptionsPolicyType public int getPolicyType() { return mPolicyType; } @Override public String toString() { return TextUtils.formatSimple("ManagedSubscriptionsPolicy (type: %d)", mPolicyType); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { dest.writeInt(mPolicyType); } @Override public boolean equals(Object thatObject) { if (this == thatObject) { return true; } if (!(thatObject instanceof ManagedSubscriptionsPolicy)) { return false; } ManagedSubscriptionsPolicy that = (ManagedSubscriptionsPolicy) thatObject; return mPolicyType == that.mPolicyType; } @Override public int hashCode() { return Objects.hash(mPolicyType); } /** @hide */ @Nullable public static ManagedSubscriptionsPolicy readFromXml(@NonNull TypedXmlPullParser parser) { try { ManagedSubscriptionsPolicy policy = new ManagedSubscriptionsPolicy( parser.getAttributeInt(null, KEY_POLICY_TYPE, -1)); return policy; } catch (IllegalArgumentException e) { // Fail through Log.w(TAG, "Load xml failed", e); } return null; } /** * @hide */ public void saveToXml(TypedXmlSerializer out) throws IOException { out.attributeInt(null, KEY_POLICY_TYPE, mPolicyType); } }