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

Commit edfdd415 authored by Srinivas Paladugu's avatar Srinivas Paladugu Committed by Android (Google) Code Review
Browse files

Merge "Add new dpm api to disable user control over apps"

parents 5c495245 0bb962c1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6790,6 +6790,7 @@ package android.app.admin {
    method @Nullable public java.util.List<java.lang.String> getPermittedAccessibilityServices(@NonNull android.content.ComponentName);
    method @Nullable public java.util.List<java.lang.String> getPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName);
    method @Nullable public java.util.List<java.lang.String> getPermittedInputMethods(@NonNull android.content.ComponentName);
    method @NonNull public java.util.List<java.lang.String> getProtectedPackages(@NonNull android.content.ComponentName);
    method public long getRequiredStrongAuthTimeout(@Nullable android.content.ComponentName);
    method public boolean getScreenCaptureDisabled(@Nullable android.content.ComponentName);
    method public java.util.List<android.os.UserHandle> getSecondaryUsers(@NonNull android.content.ComponentName);
@@ -6911,6 +6912,7 @@ package android.app.admin {
    method public boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>);
    method public void setProfileEnabled(@NonNull android.content.ComponentName);
    method public void setProfileName(@NonNull android.content.ComponentName, String);
    method public void setProtectedPackages(@NonNull android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
    method public void setRecommendedGlobalProxy(@NonNull android.content.ComponentName, @Nullable android.net.ProxyInfo);
    method public void setRequiredStrongAuthTimeout(@NonNull android.content.ComponentName, long);
    method public boolean setResetPasswordToken(android.content.ComponentName, byte[]);
+35 −0
Original line number Diff line number Diff line
@@ -11338,4 +11338,39 @@ public class DevicePolicyManager {
        }
        return false;
    }

    /**
     * Called by Device owner to set packages as protected. User will not be able to clear app
     * data or force-stop protected packages.
     *
     * @param admin which {@link DeviceAdminReceiver} this request is associated with
     * @param packages The package names to protect.
     * @throws SecurityException if {@code admin} is not a device owner.
     */
    public void setProtectedPackages(@NonNull ComponentName admin, @NonNull List<String> packages) {
        if (mService != null) {
            try {
                mService.setProtectedPackages(admin, packages);
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }
        }
    }

    /**
     * Returns the list of packages protected by the device owner.
     *
     * @param admin which {@link DeviceAdminReceiver} this request is associated with
     * @throws SecurityException if {@code admin} is not a device owner.
     */
    public @NonNull List<String> getProtectedPackages(@NonNull ComponentName admin) {
        if (mService != null) {
            try {
                return mService.getProtectedPackages(admin);
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }
        }
        return Collections.emptyList();
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -452,4 +452,8 @@ interface IDevicePolicyManager {
    boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags);

    boolean setKeyGrantForApp(in ComponentName admin, String callerPackage, String alias, String packageName, boolean hasGrant);

    void setProtectedPackages(in ComponentName admin, in List<String> packages);

    List<String> getProtectedPackages(in ComponentName admin);
}
+1 −0
Original line number Diff line number Diff line
@@ -153,4 +153,5 @@ enum EventId {
  CROSS_PROFILE_APPS_START_ACTIVITY_AS_USER = 126;
  SET_AUTO_TIME = 127;
  SET_AUTO_TIME_ZONE = 128;
  SET_PACKAGES_PROTECTED = 129;
}
+6 −0
Original line number Diff line number Diff line
@@ -318,6 +318,12 @@ public abstract class PackageManagerInternal {
    public abstract void setDeviceAndProfileOwnerPackages(
            int deviceOwnerUserId, String deviceOwner, SparseArray<String> profileOwners);

    /**
     * Called by DevicePolicyManagerService to set the package names protected by the device
     * owner.
     */
    public abstract void setDeviceOwnerProtectedPackages(List<String> packageNames);

    /**
     * Returns {@code true} if a given package can't be wiped. Otherwise, returns {@code false}.
     */
Loading