Loading boot/preloaded-classes +2 −0 Original line number Diff line number Diff line Loading @@ -5525,6 +5525,8 @@ android.nfc.NfcAdapter$CreateNdefMessageCallback android.nfc.NfcAdapter android.nfc.NfcControllerAlwaysOnListener android.nfc.NfcManager android.nfc.NfcServiceManager$ServiceRegisterer android.nfc.NfcServiceManager android.nfc.Tag$1 android.nfc.Tag android.nfc.TechListParcel$1 Loading core/api/module-lib-current.txt +24 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,30 @@ package android.net.wifi { } package android.nfc { public class NfcFrameworkInitializer { method public static void registerServiceWrappers(); method public static void setNfcServiceManager(@NonNull android.nfc.NfcServiceManager); } public class NfcServiceManager { method @NonNull public android.nfc.NfcServiceManager.ServiceRegisterer getNfcManagerServiceRegisterer(); } public static class NfcServiceManager.ServiceNotFoundException extends java.lang.Exception { ctor public NfcServiceManager.ServiceNotFoundException(@NonNull String); } public static final class NfcServiceManager.ServiceRegisterer { method @Nullable public android.os.IBinder get(); method @NonNull public android.os.IBinder getOrThrow() throws android.nfc.NfcServiceManager.ServiceNotFoundException; method public void register(@NonNull android.os.IBinder); method @Nullable public android.os.IBinder tryGet(); } } package android.os { public class ArtModuleServiceManager { Loading core/java/android/app/ActivityThread.java +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ import android.net.ConnectivityManager; import android.net.Proxy; import android.net.TrafficStats; import android.net.Uri; import android.nfc.NfcFrameworkInitializer; import android.nfc.NfcServiceManager; import android.os.AsyncTask; import android.os.Binder; import android.os.BluetoothServiceManager; Loading Loading @@ -8135,6 +8137,7 @@ public final class ActivityThread extends ClientTransactionHandler BluetoothFrameworkInitializer.setBluetoothServiceManager(new BluetoothServiceManager()); BluetoothFrameworkInitializer.setBinderCallsStatsInitializer(context -> { BinderCallsStats.startForBluetooth(context); }); NfcFrameworkInitializer.setNfcServiceManager(new NfcServiceManager()); } private void purgePendingResources() { Loading core/java/android/app/SystemServiceRegistry.java +2 −8 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ import android.net.vcn.VcnManager; import android.net.wifi.WifiFrameworkInitializer; import android.net.wifi.nl80211.WifiNl80211Manager; import android.net.wifi.sharedconnectivity.app.SharedConnectivityManager; import android.nfc.NfcManager; import android.nfc.NfcFrameworkInitializer; import android.ondevicepersonalization.OnDevicePersonalizationFrameworkInitializer; import android.os.BatteryManager; import android.os.BatteryStats; Loading Loading @@ -484,13 +484,6 @@ public final class SystemServiceRegistry { return new BatteryManager(ctx, stats, registrar); }}); registerService(Context.NFC_SERVICE, NfcManager.class, new CachedServiceFetcher<NfcManager>() { @Override public NfcManager createService(ContextImpl ctx) { return new NfcManager(ctx); }}); registerService(Context.DROPBOX_SERVICE, DropBoxManager.class, new CachedServiceFetcher<DropBoxManager>() { @Override Loading Loading @@ -1589,6 +1582,7 @@ public final class SystemServiceRegistry { JobSchedulerFrameworkInitializer.registerServiceWrappers(); BlobStoreManagerFrameworkInitializer.initialize(); BluetoothFrameworkInitializer.registerServiceWrappers(); NfcFrameworkInitializer.registerServiceWrappers(); TelephonyFrameworkInitializer.registerServiceWrappers(); AppSearchManagerFrameworkInitializer.initialize(); HealthServicesInitializer.registerServiceWrappers(); Loading core/java/android/nfc/NfcAdapter.java +14 −7 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import java.io.IOException; Loading Loading @@ -426,6 +425,7 @@ public final class NfcAdapter { // recovery @UnsupportedAppUsage static INfcAdapter sService; static NfcServiceManager.ServiceRegisterer sServiceRegisterer; static INfcTag sTagService; static INfcCardEmulation sCardEmulationService; static INfcFCardEmulation sNfcFCardEmulationService; Loading Loading @@ -624,6 +624,12 @@ public final class NfcAdapter { Log.v(TAG, "this device does not have NFC support"); throw new UnsupportedOperationException(); } NfcServiceManager manager = NfcFrameworkInitializer.getNfcServiceManager(); if (manager == null) { Log.e(TAG, "NfcServiceManager is null"); throw new UnsupportedOperationException(); } sServiceRegisterer = manager.getNfcManagerServiceRegisterer(); sService = getServiceInterface(); if (sService == null) { Log.e(TAG, "could not retrieve NFC service"); Loading Loading @@ -665,7 +671,7 @@ public final class NfcAdapter { /** get handle to NFC service interface */ private static INfcAdapter getServiceInterface() { /* get a handle to NFC service */ IBinder b = ServiceManager.getService("nfc"); IBinder b = sServiceRegisterer.get(); if (b == null) { return null; } Loading Loading @@ -695,12 +701,13 @@ public final class NfcAdapter { "context not associated with any application (using a mock context?)"); } if (getServiceInterface() == null) { // NFC is not available return null; if (sIsInitialized && sServiceRegisterer.tryGet() == null) { synchronized (NfcAdapter.class) { /* Stale sService pointer */ if (sIsInitialized) sIsInitialized = false; } /* use getSystemService() for consistency */ } /* Try to initialize the service */ NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager == null) { // NFC not available Loading Loading
boot/preloaded-classes +2 −0 Original line number Diff line number Diff line Loading @@ -5525,6 +5525,8 @@ android.nfc.NfcAdapter$CreateNdefMessageCallback android.nfc.NfcAdapter android.nfc.NfcControllerAlwaysOnListener android.nfc.NfcManager android.nfc.NfcServiceManager$ServiceRegisterer android.nfc.NfcServiceManager android.nfc.Tag$1 android.nfc.Tag android.nfc.TechListParcel$1 Loading
core/api/module-lib-current.txt +24 −0 Original line number Diff line number Diff line Loading @@ -316,6 +316,30 @@ package android.net.wifi { } package android.nfc { public class NfcFrameworkInitializer { method public static void registerServiceWrappers(); method public static void setNfcServiceManager(@NonNull android.nfc.NfcServiceManager); } public class NfcServiceManager { method @NonNull public android.nfc.NfcServiceManager.ServiceRegisterer getNfcManagerServiceRegisterer(); } public static class NfcServiceManager.ServiceNotFoundException extends java.lang.Exception { ctor public NfcServiceManager.ServiceNotFoundException(@NonNull String); } public static final class NfcServiceManager.ServiceRegisterer { method @Nullable public android.os.IBinder get(); method @NonNull public android.os.IBinder getOrThrow() throws android.nfc.NfcServiceManager.ServiceNotFoundException; method public void register(@NonNull android.os.IBinder); method @Nullable public android.os.IBinder tryGet(); } } package android.os { public class ArtModuleServiceManager { Loading
core/java/android/app/ActivityThread.java +3 −0 Original line number Diff line number Diff line Loading @@ -109,6 +109,8 @@ import android.net.ConnectivityManager; import android.net.Proxy; import android.net.TrafficStats; import android.net.Uri; import android.nfc.NfcFrameworkInitializer; import android.nfc.NfcServiceManager; import android.os.AsyncTask; import android.os.Binder; import android.os.BluetoothServiceManager; Loading Loading @@ -8135,6 +8137,7 @@ public final class ActivityThread extends ClientTransactionHandler BluetoothFrameworkInitializer.setBluetoothServiceManager(new BluetoothServiceManager()); BluetoothFrameworkInitializer.setBinderCallsStatsInitializer(context -> { BinderCallsStats.startForBluetooth(context); }); NfcFrameworkInitializer.setNfcServiceManager(new NfcServiceManager()); } private void purgePendingResources() { Loading
core/java/android/app/SystemServiceRegistry.java +2 −8 Original line number Diff line number Diff line Loading @@ -157,7 +157,7 @@ import android.net.vcn.VcnManager; import android.net.wifi.WifiFrameworkInitializer; import android.net.wifi.nl80211.WifiNl80211Manager; import android.net.wifi.sharedconnectivity.app.SharedConnectivityManager; import android.nfc.NfcManager; import android.nfc.NfcFrameworkInitializer; import android.ondevicepersonalization.OnDevicePersonalizationFrameworkInitializer; import android.os.BatteryManager; import android.os.BatteryStats; Loading Loading @@ -484,13 +484,6 @@ public final class SystemServiceRegistry { return new BatteryManager(ctx, stats, registrar); }}); registerService(Context.NFC_SERVICE, NfcManager.class, new CachedServiceFetcher<NfcManager>() { @Override public NfcManager createService(ContextImpl ctx) { return new NfcManager(ctx); }}); registerService(Context.DROPBOX_SERVICE, DropBoxManager.class, new CachedServiceFetcher<DropBoxManager>() { @Override Loading Loading @@ -1589,6 +1582,7 @@ public final class SystemServiceRegistry { JobSchedulerFrameworkInitializer.registerServiceWrappers(); BlobStoreManagerFrameworkInitializer.initialize(); BluetoothFrameworkInitializer.registerServiceWrappers(); NfcFrameworkInitializer.registerServiceWrappers(); TelephonyFrameworkInitializer.registerServiceWrappers(); AppSearchManagerFrameworkInitializer.initialize(); HealthServicesInitializer.registerServiceWrappers(); Loading
core/java/android/nfc/NfcAdapter.java +14 −7 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; import android.util.Log; import java.io.IOException; Loading Loading @@ -426,6 +425,7 @@ public final class NfcAdapter { // recovery @UnsupportedAppUsage static INfcAdapter sService; static NfcServiceManager.ServiceRegisterer sServiceRegisterer; static INfcTag sTagService; static INfcCardEmulation sCardEmulationService; static INfcFCardEmulation sNfcFCardEmulationService; Loading Loading @@ -624,6 +624,12 @@ public final class NfcAdapter { Log.v(TAG, "this device does not have NFC support"); throw new UnsupportedOperationException(); } NfcServiceManager manager = NfcFrameworkInitializer.getNfcServiceManager(); if (manager == null) { Log.e(TAG, "NfcServiceManager is null"); throw new UnsupportedOperationException(); } sServiceRegisterer = manager.getNfcManagerServiceRegisterer(); sService = getServiceInterface(); if (sService == null) { Log.e(TAG, "could not retrieve NFC service"); Loading Loading @@ -665,7 +671,7 @@ public final class NfcAdapter { /** get handle to NFC service interface */ private static INfcAdapter getServiceInterface() { /* get a handle to NFC service */ IBinder b = ServiceManager.getService("nfc"); IBinder b = sServiceRegisterer.get(); if (b == null) { return null; } Loading Loading @@ -695,12 +701,13 @@ public final class NfcAdapter { "context not associated with any application (using a mock context?)"); } if (getServiceInterface() == null) { // NFC is not available return null; if (sIsInitialized && sServiceRegisterer.tryGet() == null) { synchronized (NfcAdapter.class) { /* Stale sService pointer */ if (sIsInitialized) sIsInitialized = false; } /* use getSystemService() for consistency */ } /* Try to initialize the service */ NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager == null) { // NFC not available Loading