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

Commit 31799013 authored by Omar Eissa's avatar Omar Eissa Committed by Android (Google) Code Review
Browse files

Merge "Call notifyComponentUsed for broadcast flow" into main

parents 90730e90 c676cdfc
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1387,11 +1387,12 @@ public abstract class PackageManagerInternal {
            @UserIdInt int userId);

    /**
     * Tells PackageManager when a component (except BroadcastReceivers) of the package is used
     * Tells PackageManager when a component of the package is used
     * and the package should get out of stopped state and be enabled.
     */
    public abstract void notifyComponentUsed(@NonNull String packageName,
            @UserIdInt int userId, @NonNull String recentCallingPackage, @NonNull String debugInfo);
            @UserIdInt int userId, @Nullable String recentCallingPackage,
            @NonNull String debugInfo);

    /** @deprecated For legacy shell command only. */
    @Deprecated
+2 −3
Original line number Diff line number Diff line
@@ -1440,10 +1440,9 @@ public class BroadcastQueueImpl extends BroadcastQueue {
                    r.curComponent.getPackageName(), r.userId, Event.APP_COMPONENT_USED);
        }

        // Broadcast is being executed, its package can't be stopped.
        try {
            mService.mPackageManagerInt.setPackageStoppedState(
                    r.curComponent.getPackageName(), false, r.userId);
            mService.mPackageManagerInt.notifyComponentUsed(
                    r.curComponent.getPackageName(), r.userId, r.callerPackage, r.toString());
        } catch (IllegalArgumentException e) {
            Slog.w(TAG, "Failed trying to unstop package "
                    + r.curComponent.getPackageName() + ": " + e);
+2 −2
Original line number Diff line number Diff line
@@ -1982,8 +1982,8 @@ class BroadcastQueueModernImpl extends BroadcastQueue {
        mService.notifyPackageUse(receiverPackageName,
                PackageManager.NOTIFY_PACKAGE_USE_BROADCAST_RECEIVER);

        mService.mPackageManagerInt.setPackageStoppedState(
                receiverPackageName, false, r.userId);
        mService.mPackageManagerInt.notifyComponentUsed(
                receiverPackageName, r.userId, r.callerPackage, r.toString());
    }

    private void reportUsageStatsBroadcastDispatched(@NonNull ProcessRecord app,
+1 −1
Original line number Diff line number Diff line
@@ -747,7 +747,7 @@ abstract class PackageManagerInternalBase extends PackageManagerInternal {

    @Override
    public void notifyComponentUsed(@NonNull String packageName, @UserIdInt int userId,
            @NonNull String recentCallingPackage, @NonNull String debugInfo) {
            @Nullable String recentCallingPackage, @NonNull String debugInfo) {
        mService.notifyComponentUsed(snapshot(), packageName, userId,
                recentCallingPackage, debugInfo);
    }
+1 −1
Original line number Diff line number Diff line
@@ -4576,7 +4576,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService
    }

    void notifyComponentUsed(@NonNull Computer snapshot, @NonNull String packageName,
            @UserIdInt int userId, @NonNull String recentCallingPackage,
            @UserIdInt int userId, @Nullable String recentCallingPackage,
            @NonNull String debugInfo) {
        synchronized (mLock) {
            final PackageSetting pkgSetting = mSettings.getPackageLPr(packageName);
Loading