Merge "Initial Binder interface for installd." am: 19fc36fa33 am: 2ab7bff525
am: 48eb4e390e
Change-Id: I0f8015d3ca80d1f6a806b2ff7b739ea27feddc10
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,8 +95,17 @@ 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 {
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user