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

Commit e39d1d75 authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

Revert "base: start nfc service prior to systemui"

We no longer need to start NFC before anything else, System UI will
properly handle getting a proper refernce to the Nfc Adapter.

This reverts commit 1882a02f.

Ticket: OPO-755
Change-Id: I14514746a55fe89e6960f4e453309da5d21012f0
parent 2c755a67
Loading
Loading
Loading
Loading
+0 −28
Original line number Original line Diff line number Diff line
@@ -1189,15 +1189,6 @@ public final class SystemServer {
                Slog.i(TAG, "WebViewFactory preparation");
                Slog.i(TAG, "WebViewFactory preparation");
                WebViewFactory.prepareWebViewInSystemServer();
                WebViewFactory.prepareWebViewInSystemServer();


                // Start Nfc before SystemUi to ensure NfcTile and other apps gets a
                // valid NfcAdapter from NfcManager
                try {
                    startNfcService(context);
                } catch (Throwable e) {
                    // Don't crash. Nfc is an optional service. Just annotate that isn't ready
                    Slog.e(TAG, "Nfc service didn't start. Nfc will not be available.", e);
                }

                try {
                try {
                    startSystemUi(context);
                    startSystemUi(context);
                } catch (Throwable e) {
                } catch (Throwable e) {
@@ -1316,23 +1307,4 @@ public final class SystemServer {
        //Slog.d(TAG, "Starting service: " + intent);
        //Slog.d(TAG, "Starting service: " + intent);
        context.startServiceAsUser(intent, UserHandle.OWNER);
        context.startServiceAsUser(intent, UserHandle.OWNER);
    }
    }

    static final void startNfcService(Context context) {
        IPackageManager pm = ActivityThread.getPackageManager();
        if (pm == null) {
            Slog.w(TAG, "Cannot get package manager, assuming no NFC feature");
            return;
        }
        try {
            if (pm.hasSystemFeature(PackageManager.FEATURE_NFC)) {
                Intent intent = new Intent();
                intent.setComponent(new ComponentName("com.android.nfc",
                            "com.android.nfc.NfcBootstrapService"));
                context.startServiceAsUser(intent, UserHandle.OWNER);
            }
        } catch (RemoteException e) {
            Slog.w(TAG, "Package manager query failed, assuming no NFC feature", e);
            return;
        }
    }
}
}