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

Commit 895d9328 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

DO NOT MERGE: Adds artificial package handler latency am: de626c28

Change-Id: I5303926e34c973ca9e4a7d12d0f4cd46e2fbcde8
parents c866e0c5 de626c28
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.IBinder;
import android.os.TransactionTooLargeException;
import android.view.RemoteAnimationAdapter;

import java.util.ArrayList;
import java.util.List;
@@ -345,4 +344,7 @@ public abstract class ActivityManagerInternal {
     * Unregisters the specified {@code processObserver}.
     */
    public abstract void unregisterProcessObserver(IProcessObserver processObserver);

    /** Returns true if the given UID is registered as an active instrumentation. */
    public abstract boolean isActiveInstrumentation(int uid);
}
+12 −0
Original line number Diff line number Diff line
@@ -999,4 +999,16 @@ public abstract class PackageManagerInternal {
     * Migrates legacy obb data to its new location.
     */
    public abstract void migrateLegacyObbData();

    /**
     * Ensures that we block deletion of unused packages on user removal. This is purely for the
     * purpose of ensuring that b/141413692 is not reproducible on Q.
     */
    public abstract void notifyingOnNextUserRemovalForTest();

    /**
     * Notifies PackageManager of the removal of a user. This is purely for the purpose of ensuring
     * that b/141413692 is not reproducible on Q.
     */
    public abstract void userRemovedForTest();
}
+1 −0
Original line number Diff line number Diff line
@@ -106,4 +106,5 @@ interface IUserManager {
    String getUserName();
    long getUserStartRealtime();
    long getUserUnlockRealtime();
    void notifyOnNextUserRemoveForTest();
}
+21 −1
Original line number Diff line number Diff line
@@ -271,8 +271,8 @@ import android.os.WorkSource;
import android.os.storage.IStorageManager;
import android.os.storage.StorageManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.DeviceConfig.Properties;
import android.provider.Settings;
import android.server.ServerProtoEnums;
import android.sysprop.VoldProperties;
import android.text.TextUtils;
@@ -8259,6 +8259,21 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
    }
    private boolean isActiveInstrumentation(int uid) {
        synchronized (ActivityManagerService.this) {
            for (int i = mActiveInstrumentation.size() - 1; i >= 0; i--) {
                final ActiveInstrumentation instrumentation = mActiveInstrumentation.get(i);
                for (int j = instrumentation.mRunningProcesses.size() - 1; j >= 0; j--) {
                    final ProcessRecord process = instrumentation.mRunningProcesses.get(j);
                    if (process.uid == uid) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
    @Override
    public int getUidProcessState(int uid, String callingPackage) {
        if (!hasUsageStatsPermission(callingPackage)) {
@@ -18503,6 +18518,11 @@ public class ActivityManagerService extends IActivityManager.Stub
        public void unregisterProcessObserver(IProcessObserver processObserver) {
            ActivityManagerService.this.unregisterProcessObserver(processObserver);
        }
        @Override
        public boolean isActiveInstrumentation(int uid) {
            return ActivityManagerService.this.isActiveInstrumentation(uid);
        }
    }
    long inputDispatchingTimedOut(int pid, final boolean aboveSystem, String reason) {
+20 −2
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ import android.os.AsyncTask;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.ConditionVariable;
import android.os.Debug;
import android.os.Environment;
import android.os.FileUtils;
@@ -980,6 +981,8 @@ public class PackageManagerService extends IPackageManager.Stub
    private Future<?> mPrepareAppDataFuture;
    private final ConditionVariable mBlockDeleteOnUserRemoveForTest = new ConditionVariable(true);
    private static class IFVerificationParams {
        PackageParser.Package pkg;
        boolean replacing;
@@ -23686,8 +23689,13 @@ public class PackageManagerService extends IPackageManager.Stub
                    Slog.i(TAG, "  Removing package " + packageName);
                }
                //end run
                mHandler.post(() -> deletePackageX(packageName, PackageManager.VERSION_CODE_HIGHEST,
                        userHandle, 0));
                mHandler.post(() -> {
                    if (!mBlockDeleteOnUserRemoveForTest.block(30000 /* 30 seconds*/)) {
                        mBlockDeleteOnUserRemoveForTest.open();
                    }
                    deletePackageX(packageName, PackageManager.VERSION_CODE_HIGHEST,
                            userHandle, 0);
                });
            }
        }
    }
@@ -25049,6 +25057,16 @@ public class PackageManagerService extends IPackageManager.Stub
                Slog.wtf(TAG, e);
            }
        }
        @Override
        public void notifyingOnNextUserRemovalForTest() {
            mBlockDeleteOnUserRemoveForTest.close();
        }
        @Override
        public void userRemovedForTest() {
            mBlockDeleteOnUserRemoveForTest.open();
        }
    }
    @GuardedBy("mPackages")
Loading