Merge "IllegalStateException if apex is unavailable."

This commit is contained in:
Dario Freni
2019-02-19 15:47:55 +00:00
committed by Android (Google) Code Review

View File

@@ -27,6 +27,7 @@ import android.content.pm.PackageParser;
import android.content.pm.PackageParser.PackageParserException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager.ServiceNotFoundException;
import android.util.Slog;
import com.android.internal.util.IndentingPrintWriter;
@@ -50,8 +51,12 @@ class ApexManager {
private final Map<String, PackageInfo> mActivePackagesCache;
ApexManager() {
mApexService = IApexService.Stub.asInterface(
ServiceManager.getService("apexservice"));
try {
mApexService = IApexService.Stub.asInterface(
ServiceManager.getServiceOrThrow("apexservice"));
} catch (ServiceNotFoundException e) {
throw new IllegalStateException("Required service apexservice not available");
}
mActivePackagesCache = populateActivePackagesCache();
}