use of android.nfc.INfcFCardEmulation in project android_frameworks_base by ResurrectionRemix.
the class NfcFCardEmulation method getInstance.
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null)
throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF, 0)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
use of android.nfc.INfcFCardEmulation in project android_frameworks_base by AOSPA.
the class NfcFCardEmulation method getInstance.
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null)
throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF, 0)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
use of android.nfc.INfcFCardEmulation in project platform_frameworks_base by android.
the class NfcFCardEmulation method getInstance.
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null)
throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF, 0)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
use of android.nfc.INfcFCardEmulation in project android_frameworks_base by DirtyUnicorns.
the class NfcFCardEmulation method getInstance.
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null)
throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF, 0)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
use of android.nfc.INfcFCardEmulation in project android_frameworks_base by crdroidandroid.
the class NfcFCardEmulation method getInstance.
/**
* Helper to get an instance of this class.
*
* @param adapter A reference to an NfcAdapter object.
* @return
*/
public static synchronized NfcFCardEmulation getInstance(NfcAdapter adapter) {
if (adapter == null)
throw new NullPointerException("NfcAdapter is null");
Context context = adapter.getContext();
if (context == null) {
Log.e(TAG, "NfcAdapter context is null.");
throw new UnsupportedOperationException();
}
if (!sIsInitialized) {
IPackageManager pm = ActivityThread.getPackageManager();
if (pm == null) {
Log.e(TAG, "Cannot get PackageManager");
throw new UnsupportedOperationException();
}
try {
if (!pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF, 0)) {
Log.e(TAG, "This device does not support NFC-F card emulation");
throw new UnsupportedOperationException();
}
} catch (RemoteException e) {
Log.e(TAG, "PackageManager query failed.");
throw new UnsupportedOperationException();
}
sIsInitialized = true;
}
NfcFCardEmulation manager = sCardEmus.get(context);
if (manager == null) {
// Get card emu service
INfcFCardEmulation service = adapter.getNfcFCardEmulationService();
if (service == null) {
Log.e(TAG, "This device does not implement the INfcFCardEmulation interface.");
throw new UnsupportedOperationException();
}
manager = new NfcFCardEmulation(context, service);
sCardEmus.put(context, manager);
}
return manager;
}
Aggregations