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

Commit 1033e386 authored by Alex Chau's avatar Alex Chau
Browse files

Remove return value in clearApplicationUserData

Bug: 65280228
Test: cts-tradefed run singleCommand cts -m DevicePolicyManager --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testClearApplicationData_testPkg
Test: cts-tradefed run singleCommand cts -m DevicePolicyManager --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testClearApplicationData_deviceProvisioning
Test: cts-tradefed run singleCommand cts -m DevicePolicyManager --test com.android.cts.devicepolicy.MixedDeviceOwnerTest#testClearApplicationData_activeAdmina
Change-Id: I8808ba49492771321a3b7eb1773f1bda9c595bc6
parent 877553e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6390,7 +6390,7 @@ package android.app.admin {
    method public void addPersistentPreferredActivity(android.content.ComponentName, android.content.IntentFilter, android.content.ComponentName);
    method public void addUserRestriction(android.content.ComponentName, java.lang.String);
    method public boolean bindDeviceAdminServiceAsUser(android.content.ComponentName, android.content.Intent, android.content.ServiceConnection, int, android.os.UserHandle);
    method public boolean clearApplicationUserData(android.content.ComponentName, java.lang.String, java.util.concurrent.Executor, android.app.admin.DevicePolicyManager.OnClearApplicationUserDataListener);
    method public void clearApplicationUserData(android.content.ComponentName, java.lang.String, java.util.concurrent.Executor, android.app.admin.DevicePolicyManager.OnClearApplicationUserDataListener);
    method public void clearCrossProfileIntentFilters(android.content.ComponentName);
    method public deprecated void clearDeviceOwnerApp(java.lang.String);
    method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String);
+3 −3
Original line number Diff line number Diff line
@@ -9045,15 +9045,15 @@ public class DevicePolicyManager {
     * @param executor The executor through which the listener should be invoked.
     * @param listener A callback object that will inform the caller when the clearing is done.
     * @throws SecurityException if the caller is not the device owner/profile owner.
     * @return whether the clearing succeeded.
     */
    public boolean clearApplicationUserData(@NonNull ComponentName admin,
    public void clearApplicationUserData(@NonNull ComponentName admin,
            @NonNull String packageName, @NonNull @CallbackExecutor Executor executor,
            @NonNull OnClearApplicationUserDataListener listener) {
        throwIfParentInstance("clearAppData");
        Preconditions.checkNotNull(executor);
        Preconditions.checkNotNull(listener);
        try {
            return mService.clearApplicationUserData(admin, packageName,
            mService.clearApplicationUserData(admin, packageName,
                    new IPackageDataObserver.Stub() {
                        public void onRemoveCompleted(String pkg, boolean succeeded) {
                            executor.execute(() ->
+1 −1
Original line number Diff line number Diff line
@@ -385,7 +385,7 @@ interface IDevicePolicyManager {
    boolean isCurrentInputMethodSetByOwner();
    StringParceledListSlice getOwnerInstalledCaCerts(in UserHandle user);

    boolean clearApplicationUserData(in ComponentName admin, in String packageName, in IPackageDataObserver callback);
    void clearApplicationUserData(in ComponentName admin, in String packageName, in IPackageDataObserver callback);

    void setLogoutEnabled(in ComponentName admin, boolean enabled);
    boolean isLogoutEnabled();
+8 −11
Original line number Diff line number Diff line
@@ -12301,9 +12301,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    @Override
    public boolean clearApplicationUserData(ComponentName admin, String packageName,
    public void clearApplicationUserData(ComponentName admin, String packageName,
            IPackageDataObserver callback) {
        Preconditions.checkNotNull(admin, "ComponentName is null");
        Preconditions.checkNotNull(packageName, "packageName is null");
        Preconditions.checkNotNull(callback, "callback is null");
        synchronized (this) {
            getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER);
        }
@@ -12311,29 +12313,24 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        long ident = mInjector.binderClearCallingIdentity();
        try {
            return ActivityManager.getService().clearApplicationUserData(packageName, false,
                    callback, userId);
            ActivityManager.getService().clearApplicationUserData(packageName, false, callback,
                    userId);
        } catch(RemoteException re) {
            // Same process, should not happen.
        } catch (SecurityException se) {
            // This can happen e.g. for device admin packages, do not throw out the exception,
            // because callers have no means to know beforehand for which packages this might
            // happen.
            // happen. If so, we send back that removal failed.
            Slog.w(LOG_TAG, "Not allowed to clear application user data for package " + packageName,
                    se);
        } finally {
            mInjector.binderRestoreCallingIdentity(ident);
        }
        if (callback != null) {
            try {
                // If there was a throw above, we send back that removal failed
                callback.onRemoveCompleted(packageName, false);
            } catch (RemoteException re) {
                // Caller is no longer available, ignore
            }
        } finally {
            mInjector.binderRestoreCallingIdentity(ident);
        }
        return false;
    }
    @Override