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

Commit 3957f97a authored by Winson Chiu's avatar Winson Chiu
Browse files

Remove PackageDataSnapshot and forAllPackageStates from API

It was decided to remove the snapshot from the API surface and
instead expose a wrapper which could be closed and better monitor
data flow.

This also does the real removal of forAllPackageStates which had
to be left in the API because of a build system prebuilt issue.

Bug: 244479008

Test: presubmit

Change-Id: I60c0c2f4e0d81e7b135404978988bf5e77a2b30b
parent b4740bc0
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ package com.android.server.pm {

  public static interface PackageManagerLocal.FilteredSnapshot extends java.lang.AutoCloseable {
    method public void close();
    method public void forAllPackageStates(@NonNull java.util.function.Consumer<com.android.server.pm.pkg.PackageState>);
    method @Nullable public com.android.server.pm.pkg.PackageState getPackageState(@NonNull String);
    method @NonNull public java.util.Map<java.lang.String,com.android.server.pm.pkg.PackageState> getPackageStates();
  }
@@ -129,13 +128,6 @@ package com.android.server.pm.pkg {

}

package com.android.server.pm.snapshot {

  public interface PackageDataSnapshot {
  }

}

package com.android.server.role {

  public interface RoleServicePlatformHelper {
+0 −3
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

/**
 * In-process API for server side PackageManager related infrastructure.
@@ -177,8 +176,6 @@ public interface PackageManagerLocal {
        @NonNull
        Map<String, PackageState> getPackageStates();

        void forAllPackageStates(@NonNull Consumer<PackageState> consumer);

        @Override
        void close();
    }
+0 −14
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;

/** @hide */
public class PackageManagerLocalImpl implements PackageManagerLocal {
@@ -198,18 +197,5 @@ public class PackageManagerLocalImpl implements PackageManagerLocal {

            return mFilteredPackageStates;
        }

        @Override
        public void forAllPackageStates(@NonNull Consumer<PackageState> consumer) {
            checkClosed();

            var packageStates = mSnapshot.getPackageStates();
            for (int index = 0, size = packageStates.size(); index < size; index++) {
                var packageState = packageStates.valueAt(index);
                if (!mSnapshot.shouldFilterApplication(packageState, mCallingUid, mUserId)) {
                    consumer.accept(packageState);
                }
            }
        }
    }
}
+0 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.pm.snapshot;

import android.annotation.SystemApi;
import android.content.pm.PackageManagerInternal;

import com.android.server.pm.Computer;
@@ -32,6 +31,5 @@ import com.android.server.pm.PackageManagerService;
 *
 * @hide
 */
@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
public interface PackageDataSnapshot {
}