Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e61dbcf3 authored by Ayush Sharma's avatar Ayush Sharma Committed by Automerger Merge Worker
Browse files

Throw exception if can't set default sms app on profile am: 613c8f4e am: 1b804771

parents 3a21859e 1b804771
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -9862,6 +9862,9 @@ public class DevicePolicyManager {
     *                                  profile owner of an organization-owned managed profile.
     * @throws IllegalArgumentException if called on the parent profile and the package
     *                                  provided is not a pre-installed system package.
     * @throws IllegalStateException while trying to set default sms app on the profile and
     *                             {@link ManagedSubscriptionsPolicy#TYPE_ALL_MANAGED_SUBSCRIPTIONS}
     *                             policy is not set.
     */
    @RequiresPermission(value = MANAGE_DEVICE_POLICY_DEFAULT_SMS, conditional = true)
    public void setDefaultSmsApplication(@Nullable ComponentName admin,
+9 −0
Original line number Diff line number Diff line
@@ -11573,6 +11573,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
            Preconditions.checkCallAuthorization(isDefaultDeviceOwner(caller)
                    || isProfileOwnerOfOrganizationOwnedDevice(caller));
        }
        if (!parent && isManagedProfile(caller.getUserId())
                && getManagedSubscriptionsPolicy().getPolicyType()
                != ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS) {
            throw new IllegalStateException(
                    "Default sms application can only be set on the profile, when "
                            + "ManagedSubscriptions policy is set");
        }
        if (parent) {
            userId = getProfileParentId(mInjector.userHandleGetCallingUserId());
            mInjector.binderWithCleanCallingIdentity(() -> enforcePackageIsSystemPackage(