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

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

Merge "Initial Binder interface for installd." am: 19fc36fa

am: 2ab7bff5

Change-Id: I80f56bc8e531fd23ffc95f2f75c84add3f9a34e5
parents 5e215505 2ab7bff5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ LOCAL_SRC_FILES += \
    java/com/android/server/am/EventLogTags.logtags \
    ../../../../system/netd/server/binder/android/net/INetd.aidl \
    ../../../../system/netd/server/binder/android/net/metrics/INetdEventListener.aidl \
    ../../../native/cmds/installd/binder/android/os/IInstalld.aidl \

LOCAL_AIDL_INCLUDES += \
    system/netd/server/binder
+22 −2
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@ import android.annotation.Nullable;
import android.content.Context;
import android.content.pm.PackageStats;
import android.os.Build;
import android.os.IInstalld;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceSpecificException;
import android.util.Slog;

import com.android.internal.os.InstallerConnection;
@@ -33,6 +37,8 @@ import java.util.Arrays;
public final class Installer extends SystemService {
    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
     * frameworks/native/cmds/installd/installd.h
@@ -55,10 +61,13 @@ public final class Installer extends SystemService {
    public static final int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 9;

    private final InstallerConnection mInstaller;
    private final IInstalld mInstalld;

    public Installer(Context context) {
        super(context);
        mInstaller = new InstallerConnection();
        // TODO: reconnect if installd restarts
        mInstalld = IInstalld.Stub.asInterface(ServiceManager.getService("installd"));
    }

    // Package-private installer that accepts a custom InstallerConnection. Used for
@@ -66,6 +75,8 @@ public final class Installer extends SystemService {
    Installer(Context context, InstallerConnection connection) {
        super(context);
        mInstaller = connection;
        // TODO: reconnect if installd restarts
        mInstalld = IInstalld.Stub.asInterface(ServiceManager.getService("installd"));
    }

    /**
@@ -84,9 +95,18 @@ public final class Installer extends SystemService {

    public void createAppData(String uuid, String pkgname, int userid, int flags, int appid,
            String seinfo, int targetSdkVersion) throws InstallerException {
        if (USE_BINDER) {
            try {
                mInstalld.createAppData(uuid, pkgname, userid, flags, appid, seinfo,
                        targetSdkVersion);
            } catch (RemoteException | ServiceSpecificException e) {
                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,
            String seinfo) throws InstallerException {