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

Commit cfe48105 authored by Piyush Mehrotra's avatar Piyush Mehrotra Committed by Automerger Merge Worker
Browse files

Merge "Adds intent extra to package data clear broadcast during restore...

Merge "Adds intent extra to package data clear broadcast during restore operation." into udc-qpr-dev am: 539f9a34 am: 903ba87d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24586912



Change-Id: I57716a5457e3f4632a2625b36f03c99d8ca3c194
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5f3c9bff 903ba87d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.ActivityPresentationInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageDataObserver;
import android.content.pm.UserInfo;
import android.net.Uri;
import android.os.Bundle;
@@ -1224,4 +1225,13 @@ public abstract class ActivityManagerInternal {
     */
    @NonNull
    public abstract StatsEvent getCachedAppsHighWatermarkStats(int atomTag, boolean resetAfterPull);

    /**
     * Internal method for clearing app data, with the extra param that is used to indicate restore.
     * Used by Backup service during restore operation.
     *
     * @hide
     */
    public abstract boolean clearApplicationUserData(String packageName, boolean keepState,
            boolean isRestore, IPackageDataObserver observer, int userId);
}
+9 −0
Original line number Diff line number Diff line
@@ -6705,6 +6705,15 @@ public class Intent implements Parcelable, Cloneable {
    public static final String EXTRA_VISIBILITY_ALLOW_LIST =
            "android.intent.extra.VISIBILITY_ALLOW_LIST";
    /**
     * A boolean extra used with {@link #ACTION_PACKAGE_DATA_CLEARED} which indicates if the intent
     * is broadcast as part of a restore operation.
     *
     * @hide
     */
    public static final String EXTRA_IS_RESTORE =
            "android.intent.extra.IS_RESTORE";
    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // Intent flags (see mFlags variable).
+2 −6
Original line number Diff line number Diff line
@@ -1750,12 +1750,8 @@ public class UserBackupManagerService {

        synchronized (mClearDataLock) {
            mClearingData = true;
            try {
                mActivityManager.clearApplicationUserData(packageName, keepSystemState, observer,
                        mUserId);
            } catch (RemoteException e) {
                // can't happen because the activity manager is in this process
            }
            mActivityManagerInternal.clearApplicationUserData(packageName, keepSystemState,
                    /*isRestore=*/ true, observer, mUserId);

            // Only wait 30 seconds for the clear data to happen.
            long timeoutMark = System.currentTimeMillis() + CLEAR_DATA_TIMEOUT_INTERVAL;
+16 −0
Original line number Diff line number Diff line
@@ -3531,6 +3531,12 @@ public class ActivityManagerService extends IActivityManager.Stub
    @Override
    public boolean clearApplicationUserData(final String packageName, boolean keepState,
            final IPackageDataObserver observer, int userId) {
        return clearApplicationUserData(packageName, keepState, /*isRestore=*/ false, observer,
                userId);
    }
    private boolean clearApplicationUserData(final String packageName, boolean keepState,
            boolean isRestore, final IPackageDataObserver observer, int userId) {
        enforceNotIsolatedCaller("clearApplicationUserData");
        int uid = Binder.getCallingUid();
        int pid = Binder.getCallingPid();
@@ -3625,6 +3631,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                        intent.putExtra(Intent.EXTRA_UID,
                                (appInfo != null) ? appInfo.uid : INVALID_UID);
                        intent.putExtra(Intent.EXTRA_USER_HANDLE, resolvedUserId);
                        if (isRestore) {
                            intent.putExtra(Intent.EXTRA_IS_RESTORE, true);
                        }
                        if (isInstantApp) {
                            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
                        }
@@ -19014,6 +19023,13 @@ public class ActivityManagerService extends IActivityManager.Stub
            return mAppProfiler.mCachedAppsWatermarkData.getCachedAppsHighWatermarkStats(
                    atomTag, resetAfterPull);
        }
        @Override
        public boolean clearApplicationUserData(final String packageName, boolean keepState,
                boolean isRestore, final IPackageDataObserver observer, int userId) {
            return ActivityManagerService.this.clearApplicationUserData(packageName, keepState,
                    isRestore, observer, userId);
        }
    }
    long inputDispatchingTimedOut(int pid, final boolean aboveSystem, TimeoutRecord timeoutRecord) {