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

Commit 88a6ed54 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Reduce PackageInstaller Binder memory pressure." into lmp-dev

parents 8e029715 97d47ed0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.pm.IPackageDeleteObserver2;
import android.content.pm.IPackageInstallerCallback;
import android.content.pm.IPackageInstallerSession;
import android.content.pm.PackageInstaller;
import android.content.pm.ParceledListSlice;
import android.content.IntentSender;

import android.graphics.Bitmap;
@@ -37,8 +38,8 @@ interface IPackageInstaller {

    PackageInstaller.SessionInfo getSessionInfo(int sessionId);

    List<PackageInstaller.SessionInfo> getAllSessions(int userId);
    List<PackageInstaller.SessionInfo> getMySessions(String installerPackageName, int userId);
    ParceledListSlice getAllSessions(int userId);
    ParceledListSlice getMySessions(String installerPackageName, int userId);

    void registerCallback(IPackageInstallerCallback callback, int userId);
    void unregisterCallback(IPackageInstallerCallback callback);
+2 −2
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ public class PackageInstaller {
        }

        try {
            return mInstaller.getAllSessions(mUserId);
            return mInstaller.getAllSessions(mUserId).getList();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
@@ -410,7 +410,7 @@ public class PackageInstaller {
     */
    public @NonNull List<SessionInfo> getMySessions() {
        try {
            return mInstaller.getMySessions(mInstallerPackageName, mUserId);
            return mInstaller.getMySessions(mInstallerPackageName, mUserId).getList();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
+5 −4
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.PackageInstaller.SessionParams;
import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
@@ -714,7 +715,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
    }

    @Override
    public List<SessionInfo> getAllSessions(int userId) {
    public ParceledListSlice<SessionInfo> getAllSessions(int userId) {
        mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getAllSessions");

        final List<SessionInfo> result = new ArrayList<>();
@@ -726,11 +727,11 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
                }
            }
        }
        return result;
        return new ParceledListSlice<>(result);
    }

    @Override
    public List<SessionInfo> getMySessions(String installerPackageName, int userId) {
    public ParceledListSlice<SessionInfo> getMySessions(String installerPackageName, int userId) {
        mPm.enforceCrossUserPermission(Binder.getCallingUid(), userId, true, false, "getMySessions");
        mAppOps.checkPackage(Binder.getCallingUid(), installerPackageName);

@@ -744,7 +745,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub {
                }
            }
        }
        return result;
        return new ParceledListSlice<>(result);
    }

    @Override