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

Commit efc4a344 authored by Andrei Stingaceanu's avatar Andrei Stingaceanu
Browse files

AfW - suspend apps - API polish

* renamed getPackageSuspended => isPackageSuspended
* does not return false for an error, instead throws
  NameNotFoundException if the package could not be
  found, or if there is an unknown RemoteException,
  wraps it in a RuntimeException and rethrows.

Bug: 27532430
Bug: 22776761
Change-Id: Iee00600089b1c0556a3312b10456826464fa8f9f
parent bf0982d0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5860,7 +5860,6 @@ package android.app.admin {
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
    method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -5898,6 +5897,7 @@ package android.app.admin {
    method public boolean isDeviceOwnerApp(java.lang.String);
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isPackageSuspended(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isSecurityLoggingEnabled(android.content.ComponentName);
+1 −1
Original line number Diff line number Diff line
@@ -6001,7 +6001,6 @@ package android.app.admin {
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
    method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -6044,6 +6043,7 @@ package android.app.admin {
    method public boolean isDeviceOwnerApp(java.lang.String);
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isPackageSuspended(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isSecurityLoggingEnabled(android.content.ComponentName);
+1 −1
Original line number Diff line number Diff line
@@ -5864,7 +5864,6 @@ package android.app.admin {
    method public long getMaximumTimeToLock(android.content.ComponentName);
    method public int getOrganizationColor(android.content.ComponentName);
    method public java.lang.String getOrganizationName(android.content.ComponentName);
    method public boolean getPackageSuspended(android.content.ComponentName, java.lang.String);
    method public android.app.admin.DevicePolicyManager getParentProfileInstance(android.content.ComponentName);
    method public long getPasswordExpiration(android.content.ComponentName);
    method public long getPasswordExpirationTimeout(android.content.ComponentName);
@@ -5902,6 +5901,7 @@ package android.app.admin {
    method public boolean isDeviceOwnerApp(java.lang.String);
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isPackageSuspended(android.content.ComponentName, java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public boolean isProfileOwnerApp(java.lang.String);
    method public boolean isProvisioningAllowed(java.lang.String);
    method public boolean isSecurityLoggingEnabled(android.content.ComponentName);
+6 −2
Original line number Diff line number Diff line
@@ -3803,13 +3803,17 @@ public class DevicePolicyManager {
     * @return {@code true} if the package is suspended or {@code false} if the package is not
     *         suspended, could not be found or an error occurred.
     * @throws SecurityException if {@code admin} is not a device or profile owner.
     * @throws NameNotFoundException if the package could not be found.
     */
    public boolean getPackageSuspended(@NonNull ComponentName admin, String packageName) {
    public boolean isPackageSuspended(@NonNull ComponentName admin, String packageName)
            throws NameNotFoundException {
        if (mService != null) {
            try {
                return mService.getPackageSuspended(admin, packageName);
                return mService.isPackageSuspended(admin, packageName);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            } catch (IllegalArgumentException ex) {
                throw new NameNotFoundException(packageName);
            }
        }
        return false;
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ interface IDevicePolicyManager {
    String getDeviceOwnerLockScreenInfo();

    String[] setPackagesSuspended(in ComponentName admin, in String[] packageNames, boolean suspended);
    boolean getPackageSuspended(in ComponentName admin, String packageName);
    boolean isPackageSuspended(in ComponentName admin, String packageName);

    boolean installCaCert(in ComponentName admin, in byte[] certBuffer);
    void uninstallCaCerts(in ComponentName admin, in String[] aliases);
Loading