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

Commit 759a6d44 authored by Julius D'souza's avatar Julius D'souza Committed by Haiping Yang
Browse files

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: default avatarJulius D'souza <jdsouza@google.com>
(cherry picked from commit 2dc233a07dce898ae5706ea4940936d0fc990fef)
parent adae7c8a
Loading
Loading
Loading
Loading
+23 −18
Original line number Diff line number Diff line
@@ -1431,9 +1431,14 @@ public final class SystemServer implements Dumpable {
            ServiceManager.addService("scheduling_policy", new SchedulingPolicyService());
            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(
@@ -2524,10 +2529,12 @@ public final class SystemServer implements Dumpable {
            mActivityManagerService.enterSafeMode();
        }

        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();
            if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
                t.traceBegin("MakeMmsServiceReady");
                try {
                if (mmsServiceF != null) {
                    mmsServiceF.systemRunning();
                }
                    if (mmsServiceF != null) mmsServiceF.systemRunning();
                } catch (Throwable e) {
                    reportWtf("Notifying MmsService running", e);
                }
                t.traceEnd();
            }

            t.traceBegin("IncidentDaemonReady");
            try {