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

Commit 4e7a7658 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Jeff Sharkey
Browse files

Clean/destroy app shared storage via installd.

In P we moved destroying per-user shared storage into installd,
where it can iterate quickly over large sets of files.  This change
now moves cleaning/destroying of per-app shared storage data down into
installd, letting us greatly simplify the logic in PMS to no longer
require spinning up DefaultContainerService.  This also fixes an
obscure bug where DCS (which always runs as USER_SYSTEM) wasn't able
to clear shared storage for secondary users.

This also gives us the ability to target specific storage devices
by UUID, such as when the user has migrated their primary shared
storage to an adopted device.

We no longer distinguish between keeping or deleting OBB files
during various operations, since upcoming changes in the Q release
will mean OBB files are no longer shared between users, and they'll
now live inside a sandbox that will be fully cleared when the user
clears data.  (Going forward, apps should be using splits instead
of OBBs, so they're effectively deprecated.)

Uses newer "const" feature of AIDL to ensure constant values remain
consistent between native and Java code.

Bug: 111854851, 111838160
Test: atest android.appsecurity.cts.StorageHostTest#testCache
Change-Id: Ib90be155718a768da76110fbfcf010a471b37378
parent be3a75cb
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -1753,12 +1753,6 @@ HPLandroid/content/pm/LauncherApps$CallbackMessageHandler;->postOnPackageAdded(L
HPLandroid/content/pm/LauncherApps$CallbackMessageHandler;->postOnPackageChanged(Ljava/lang/String;Landroid/os/UserHandle;)V
HPLandroid/content/pm/LauncherApps$CallbackMessageHandler;->postOnPackageRemoved(Ljava/lang/String;Landroid/os/UserHandle;)V
HPLandroid/content/pm/LauncherApps$ShortcutQuery;->setActivity(Landroid/content/ComponentName;)Landroid/content/pm/LauncherApps$ShortcutQuery;
HPLandroid/content/pm/PackageCleanItem$1;-><init>()V
HPLandroid/content/pm/PackageCleanItem$1;->createFromParcel(Landroid/os/Parcel;)Landroid/content/pm/PackageCleanItem;
HPLandroid/content/pm/PackageCleanItem$1;->createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
HPLandroid/content/pm/PackageCleanItem;-><init>(ILjava/lang/String;Z)V
HPLandroid/content/pm/PackageCleanItem;->equals(Ljava/lang/Object;)Z
HPLandroid/content/pm/PackageCleanItem;->writeToParcel(Landroid/os/Parcel;I)V
HPLandroid/content/pm/PackageInfo$1;->newArray(I)[Landroid/content/pm/PackageInfo;
HPLandroid/content/pm/PackageInfo$1;->newArray(I)[Ljava/lang/Object;
HPLandroid/content/pm/PackageInfo;->isOverlayPackage()Z
@@ -18113,7 +18107,6 @@ HSPLandroid/content/pm/IPackageManager;->isUpgrade()Z
HSPLandroid/content/pm/IPackageManager;->logAppProcessStartIfNeeded(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V
HSPLandroid/content/pm/IPackageManager;->movePackage(Ljava/lang/String;Ljava/lang/String;)I
HSPLandroid/content/pm/IPackageManager;->movePrimaryStorage(Ljava/lang/String;)I
HSPLandroid/content/pm/IPackageManager;->nextPackageToClean(Landroid/content/pm/PackageCleanItem;)Landroid/content/pm/PackageCleanItem;
HSPLandroid/content/pm/IPackageManager;->notifyDexLoad(Ljava/lang/String;Ljava/util/List;Ljava/util/List;Ljava/lang/String;)V
HSPLandroid/content/pm/IPackageManager;->notifyPackageUse(Ljava/lang/String;I)V
HSPLandroid/content/pm/IPackageManager;->performDexOptMode(Ljava/lang/String;ZLjava/lang/String;ZZLjava/lang/String;)Z
+0 −3
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.content.pm.IntentFilterVerificationInfo;
import android.content.pm.InstrumentationInfo;
import android.content.pm.KeySet;
import android.content.pm.PackageInfo;
import android.content.pm.PackageCleanItem;
import android.content.pm.ParceledListSlice;
import android.content.pm.ProviderInfo;
import android.content.pm.PermissionGroupInfo;
@@ -553,8 +552,6 @@ interface IPackageManager {
     */
    void reconcileSecondaryDexFiles(String packageName);

    PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);

    int getMoveStatus(int moveId);

    void registerMoveCallback(in IPackageMoveObserver callback);
+0 −18
Original line number Diff line number Diff line
/* Copyright 2012, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/

package android.content.pm;

parcelable PackageCleanItem;
+0 −85
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.content.pm;

import android.os.Parcel;
import android.os.Parcelable;

/** @hide */
public class PackageCleanItem implements Parcelable {
    public final int userId;
    public final String packageName;
    public final boolean andCode;

    public PackageCleanItem(int userId, String packageName, boolean andCode) {
        this.userId = userId;
        this.packageName = packageName;
        this.andCode = andCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        try {
            if (obj != null) {
                PackageCleanItem other = (PackageCleanItem)obj;
                return userId == other.userId && packageName.equals(other.packageName)
                        && andCode == other.andCode;
            }
        } catch (ClassCastException e) {
        }
        return false;
    }

    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + userId;
        result = 31 * result + packageName.hashCode();
        result = 31 * result + (andCode ? 1 : 0);
        return result;
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel dest, int parcelableFlags) {
        dest.writeInt(userId);
        dest.writeString(packageName);
        dest.writeInt(andCode ? 1 : 0);
    }

    public static final Parcelable.Creator<PackageCleanItem> CREATOR
            = new Parcelable.Creator<PackageCleanItem>() {
        public PackageCleanItem createFromParcel(Parcel source) {
            return new PackageCleanItem(source);
        }

        public PackageCleanItem[] newArray(int size) {
            return new PackageCleanItem[size];
        }
    };

    private PackageCleanItem(Parcel source) {
        userId = source.readInt();
        packageName = source.readString();
        andCode = source.readInt() != 0;
    }
}
+0 −7
Original line number Diff line number Diff line
@@ -2677,13 +2677,6 @@ public abstract class PackageManager {
    public static final String FEATURE_DEVICE_ID_ATTESTATION =
            "android.software.device_id_attestation";

    /**
     * Action to external storage service to clean out removed apps.
     * @hide
     */
    public static final String ACTION_CLEAN_EXTERNAL_STORAGE
            = "android.content.pm.CLEAN_EXTERNAL_STORAGE";

    /**
     * Extra field name for the URI to a verification file. Passed to a package
     * verifier.
Loading