Merge "Initial Binder interface for installd."
diff --git a/services/core/Android.mk b/services/core/Android.mk
index a5b1069..b7a95c0 100644
--- a/services/core/Android.mk
+++ b/services/core/Android.mk
@@ -12,6 +12,7 @@
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
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java
index 2e18b1c..3dc8f54 100644
--- a/services/core/java/com/android/server/pm/Installer.java
+++ b/services/core/java/com/android/server/pm/Installer.java
@@ -20,6 +20,10 @@
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 @@
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 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 @@
Installer(Context context, InstallerConnection connection) {
super(context);
mInstaller = connection;
+ // TODO: reconnect if installd restarts
+ mInstalld = IInstalld.Stub.asInterface(ServiceManager.getService("installd"));
}
/**
@@ -84,8 +95,17 @@
public void createAppData(String uuid, String pkgname, int userid, int flags, int appid,
String seinfo, int targetSdkVersion) throws InstallerException {
- mInstaller.execute("create_app_data", uuid, pkgname, userid, flags, appid, seinfo,
- targetSdkVersion);
+ 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,