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

Commit 81f7471a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove return value in clearApplicationUserData"

parents 0083ed6d 1033e386
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
@@ -9078,15 +9078,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
@@ -386,7 +386,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
@@ -12399,9 +12399,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);
        }
@@ -12409,29 +12411,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