SystemServer: add Telephony guards

* Add FEATURE_TELEPHONY checks for telephony services
* Add FEATURE_MICROPHONE check for TelecomLoaderService

Bug: 132729373

Change-Id: Idcafc61ec951b6fcb9a626f08d4837d7af26ff01
Signed-off-by: Julius D'souza <jdsouza@google.com>
(cherry picked from commit 2dc233a07dce898ae5706ea4940936d0fc990fef)
This commit is contained in:
Julius D'souza
2019-05-15 11:16:32 -07:00
committed by Haiping Yang
parent adae7c8a82
commit 759a6d44db

View File

@@ -1431,13 +1431,18 @@ public final class SystemServer implements Dumpable {
ServiceManager.addService("scheduling_policy", new SchedulingPolicyService());
t.traceEnd();
t.traceBegin("StartTelecomLoaderService");
mSystemServiceManager.startService(TelecomLoaderService.class);
t.traceEnd();
// TelecomLoader hooks into classes with defined HFP logic,
// so check for either telephony or microphone.
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE) ||
mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
t.traceBegin("StartTelecomLoaderService");
mSystemServiceManager.startService(TelecomLoaderService.class);
t.traceEnd();
}
t.traceBegin("StartTelephonyRegistry");
telephonyRegistry = new TelephonyRegistry(
context, new TelephonyRegistry.ConfigurationProvider());
context, new TelephonyRegistry.ConfigurationProvider());
ServiceManager.addService("telephony.registry", telephonyRegistry);
t.traceEnd();
@@ -2524,10 +2529,12 @@ public final class SystemServer implements Dumpable {
mActivityManagerService.enterSafeMode();
}
// MMS service broker
t.traceBegin("StartMmsService");
mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);
t.traceEnd();
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
// MMS service broker
t.traceBegin("StartMmsService");
mmsService = mSystemServiceManager.startService(MmsServiceBroker.class);
t.traceEnd();
}
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOFILL)) {
t.traceBegin("StartAutoFillService");
@@ -2913,9 +2920,7 @@ public final class SystemServer implements Dumpable {
t.traceEnd();
t.traceBegin("MakeTelephonyRegistryReady");
try {
if (telephonyRegistryF != null) {
telephonyRegistryF.systemRunning();
}
if (telephonyRegistryF != null) telephonyRegistryF.systemRunning();
} catch (Throwable e) {
reportWtf("Notifying TelephonyRegistry running", e);
}
@@ -2929,15 +2934,15 @@ public final class SystemServer implements Dumpable {
reportWtf("Notifying MediaRouterService running", e);
}
t.traceEnd();
t.traceBegin("MakeMmsServiceReady");
try {
if (mmsServiceF != null) {
mmsServiceF.systemRunning();
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
t.traceBegin("MakeMmsServiceReady");
try {
if (mmsServiceF != null) mmsServiceF.systemRunning();
} catch (Throwable e) {
reportWtf("Notifying MmsService running", e);
}
} catch (Throwable e) {
reportWtf("Notifying MmsService running", e);
t.traceEnd();
}
t.traceEnd();
t.traceBegin("IncidentDaemonReady");
try {