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

Commit d917e23b authored by Jeff Sharkey's avatar Jeff Sharkey Committed by android-build-merger
Browse files

Merge "Move moveCompleteApp() to Binder." am: 019867cb

am: 19426fef

Change-Id: I15640b868729b0f8e418c7b9f8d5366deb054abc
parents 95b7e5fb 19426fef
Loading
Loading
Loading
Loading
+26 −17
Original line number Original line Diff line number Diff line
@@ -37,8 +37,6 @@ import java.util.Arrays;
public final class Installer extends SystemService {
public final class Installer extends SystemService {
    private static final String TAG = "Installer";
    private static final String TAG = "Installer";


    private static final boolean USE_BINDER = true;

    /* ***************************************************************************
    /* ***************************************************************************
     * IMPORTANT: These values are passed to native code. Keep them in sync with
     * IMPORTANT: These values are passed to native code. Keep them in sync with
     * frameworks/native/cmds/installd/installd.h
     * frameworks/native/cmds/installd/installd.h
@@ -63,6 +61,8 @@ public final class Installer extends SystemService {
    private final InstallerConnection mInstaller;
    private final InstallerConnection mInstaller;
    private final IInstalld mInstalld;
    private final IInstalld mInstalld;


    private volatile Object mWarnIfHeld;

    public Installer(Context context) {
    public Installer(Context context) {
        super(context);
        super(context);
        mInstaller = new InstallerConnection();
        mInstaller = new InstallerConnection();
@@ -85,6 +85,7 @@ public final class Installer extends SystemService {
     */
     */
    public void setWarnIfHeld(Object warnIfHeld) {
    public void setWarnIfHeld(Object warnIfHeld) {
        mInstaller.setWarnIfHeld(warnIfHeld);
        mInstaller.setWarnIfHeld(warnIfHeld);
        mWarnIfHeld = warnIfHeld;
    }
    }


    @Override
    @Override
@@ -93,19 +94,22 @@ public final class Installer extends SystemService {
        mInstaller.waitForConnection();
        mInstaller.waitForConnection();
    }
    }


    public void createAppData(String uuid, String pkgname, int userid, int flags, int appid,
    private void checkLock() {
            String seinfo, int targetSdkVersion) throws InstallerException {
        if (mWarnIfHeld != null && Thread.holdsLock(mWarnIfHeld)) {
        if (USE_BINDER) {
            Slog.wtf(TAG, "Calling thread " + Thread.currentThread().getName() + " is holding 0x"
                    + Integer.toHexString(System.identityHashCode(mWarnIfHeld)), new Throwable());
        }
    }

    public void createAppData(String uuid, String packageName, int userId, int flags, int appId,
            String seInfo, int targetSdkVersion) throws InstallerException {
        checkLock();
        try {
        try {
                mInstalld.createAppData(uuid, pkgname, userid, flags, appid, seinfo,
            mInstalld.createAppData(uuid, packageName, userId, flags, appId, seInfo,
                    targetSdkVersion);
                    targetSdkVersion);
        } catch (RemoteException | ServiceSpecificException e) {
        } catch (RemoteException | ServiceSpecificException e) {
            throw new InstallerException(e.getMessage());
            throw new InstallerException(e.getMessage());
        }
        }
        } else {
            mInstaller.execute("create_app_data", uuid, pkgname, userid, flags, appid, seinfo,
                    targetSdkVersion);
        }
    }
    }


    public void restoreconAppData(String uuid, String pkgname, int userid, int flags, int appid,
    public void restoreconAppData(String uuid, String pkgname, int userid, int flags, int appid,
@@ -129,11 +133,16 @@ public final class Installer extends SystemService {
        mInstaller.execute("destroy_app_data", uuid, pkgname, userid, flags, ceDataInode);
        mInstaller.execute("destroy_app_data", uuid, pkgname, userid, flags, ceDataInode);
    }
    }


    public void moveCompleteApp(String from_uuid, String to_uuid, String package_name,
    public void moveCompleteApp(String fromUuid, String toUuid, String packageName,
            String data_app_name, int appid, String seinfo, int targetSdkVersion)
            String dataAppName, int appId, String seInfo, int targetSdkVersion)
            throws InstallerException {
            throws InstallerException {
        mInstaller.execute("move_complete_app", from_uuid, to_uuid, package_name,
        checkLock();
                data_app_name, appid, seinfo, targetSdkVersion);
        try {
            mInstalld.moveCompleteApp(fromUuid, toUuid, packageName, dataAppName, appId, seInfo,
                    targetSdkVersion);
        } catch (RemoteException | ServiceSpecificException e) {
            throw new InstallerException(e.getMessage());
        }
    }
    }


    public void getAppSize(String uuid, String pkgname, int userid, int flags, long ceDataInode,
    public void getAppSize(String uuid, String pkgname, int userid, int flags, long ceDataInode,