summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnci/jni/NativeNfcManager.cpp45
-rwxr-xr-xnci/src/com/android/nfc/dhimpl/NativeNfcManager.java7
-rwxr-xr-xnxp/src/com/android/nfc/dhimpl/NativeNfcManager.java7
-rw-r--r--res/values-ar/strings.xml12
-rw-r--r--src/com/android/nfc/DeviceHost.java2
-rw-r--r--src/com/android/nfc/NfcDispatcher.java5
-rwxr-xr-xsrc/com/android/nfc/NfcService.java45
-rw-r--r--src/com/android/nfc/SendUi.java2
-rw-r--r--src/com/android/nfc/handover/HandoverManager.java5
9 files changed, 97 insertions, 33 deletions
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index babe92a..eadca87 100755
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -111,6 +111,7 @@ static bool sIsNfaEnabled = false;
static bool sDiscoveryEnabled = false; //is polling for tag?
static bool sIsDisabling = false;
static bool sRfEnabled = false; // whether RF discovery is enabled
+static bool sSeRfActive = false; // whether RF with SE is likely active
static int sConnlessSap = 0;
static int sConnlessLinkMiu = 0;
static bool sAbortConnlessWait = false;
@@ -132,6 +133,7 @@ static UINT32 sConfigUpdated = 0;
static void nfaConnectionCallback (UINT8 event, tNFA_CONN_EVT_DATA *eventData);
static void nfaDeviceManagementCallback (UINT8 event, tNFA_DM_CBACK_DATA *eventData);
static bool isPeerToPeer (tNFA_ACTIVATED& activated);
+static bool isListenMode(tNFA_ACTIVATED& activated);
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
@@ -305,7 +307,19 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
ALOGD("%s: NFA_ACTIVATED_EVT; is p2p", __FUNCTION__);
}
else if (pn544InteropIsBusy() == false)
+ {
NfcTag::getInstance().connectionEventHandler (connEvent, eventData);
+
+ // We know it is not activating for P2P. If it activated in
+ // listen mode then it is likely for and SE transaction.
+ // Send the RF Event.
+ if (isListenMode(eventData->activated))
+ {
+ sSeRfActive = true;
+ SecureElement::getInstance().notifyRfFieldEvent (true);
+ }
+ }
+
break;
case NFA_DEACTIVATED_EVT: // NFC link/protocol deactivated
@@ -321,6 +335,16 @@ static void nfaConnectionCallback (UINT8 connEvent, tNFA_CONN_EVT_DATA* eventDat
NfcTag::getInstance().connectionEventHandler (connEvent, eventData);
nativeNfcTag_abortWaits();
NfcTag::getInstance().abort ();
+
+ // If RF is activated for what we think is a Secure Element transaction
+ // and it is deactivated to either IDLE or DISCOVERY mode, notify w/event.
+ if (sSeRfActive
+ && ((eventData->deactivated.type == NFA_DEACTIVATE_TYPE_IDLE)
+ || (eventData->deactivated.type == NFA_DEACTIVATE_TYPE_DISCOVERY)))
+ {
+ sSeRfActive = false;
+ SecureElement::getInstance().notifyRfFieldEvent (false);
+ }
break;
case NFA_TLV_DETECT_EVT: // TLV Detection complete
@@ -1262,6 +1286,26 @@ static bool isPeerToPeer (tNFA_ACTIVATED& activated)
return activated.activate_ntf.protocol == NFA_PROTOCOL_NFC_DEP;
}
+/*******************************************************************************
+**
+** Function: isListenMode
+**
+** Description: Indicates whether the activation data indicates it is
+** listen mode.
+**
+** Returns: True if this listen mode.
+**
+*******************************************************************************/
+static bool isListenMode(tNFA_ACTIVATED& activated)
+{
+ return ((NFC_DISCOVERY_TYPE_LISTEN_A == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_B == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_F == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_A_ACTIVE == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_F_ACTIVE == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_ISO15693 == activated.activate_ntf.rf_tech_param.mode)
+ || (NFC_DISCOVERY_TYPE_LISTEN_B_PRIME == activated.activate_ntf.rf_tech_param.mode));
+}
/*******************************************************************************
**
@@ -1733,4 +1777,3 @@ void startStopPolling (bool isStartPolling)
} /* namespace android */
-
diff --git a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
index 921e266..dde0c08 100755
--- a/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
+++ b/nci/src/com/android/nfc/dhimpl/NativeNfcManager.java
@@ -38,6 +38,8 @@ public class NativeNfcManager implements DeviceHost {
static final int DEFAULT_LLCP_MIU = 1980;
static final int DEFAULT_LLCP_RWSIZE = 2;
+ static final String DRIVER_NAME = "android-nci";
+
static {
System.loadLibrary("nfc_nci_jni");
}
@@ -99,6 +101,11 @@ public class NativeNfcManager implements DeviceHost {
}
@Override
+ public String getName() {
+ return DRIVER_NAME;
+ }
+
+ @Override
public native void enableDiscovery();
@Override
diff --git a/nxp/src/com/android/nfc/dhimpl/NativeNfcManager.java b/nxp/src/com/android/nfc/dhimpl/NativeNfcManager.java
index 903cafa..dc6ea7c 100755
--- a/nxp/src/com/android/nfc/dhimpl/NativeNfcManager.java
+++ b/nxp/src/com/android/nfc/dhimpl/NativeNfcManager.java
@@ -43,6 +43,8 @@ public class NativeNfcManager implements DeviceHost {
private static final String PREF_FIRMWARE_MODTIME = "firmware_modtime";
private static final long FIRMWARE_MODTIME_DEFAULT = -1;
+ static final String DRIVER_NAME = "nxp";
+
static final int DEFAULT_LLCP_MIU = 128;
static final int DEFAULT_LLCP_RWSIZE = 1;
@@ -161,6 +163,11 @@ public class NativeNfcManager implements DeviceHost {
}
@Override
+ public String getName() {
+ return DRIVER_NAME;
+ }
+
+ @Override
public native void enableDiscovery();
@Override
diff --git a/res/values-ar/strings.xml b/res/values-ar/strings.xml
index 5eceaf8..d7ec39f 100644
--- a/res/values-ar/strings.xml
+++ b/res/values-ar/strings.xml
@@ -8,14 +8,14 @@
<string name="outbound_me_profile_title" msgid="2523625031572784769">"اكتمل تفاعل NFC"</string>
<string name="outbound_me_profile_text" msgid="5594998841143667989">"المس لمنح هذا الشخص معلومات اتصالك."</string>
<string name="accessibility_nfc_enabled" msgid="7796246979948787735">"تم تمكين NFC."</string>
- <string name="touch" msgid="4727218133711188355">"المس لتبادل البيانات"</string>
- <string name="beam_progress" msgid="7453634884807323920">"بيانات واردة..."</string>
- <string name="beam_complete" msgid="477026736424637435">"اكتمل تبادل البيانات"</string>
- <string name="beam_failed" msgid="5116241718189888630">"لم يكتمل تبادل البيانات"</string>
- <string name="beam_canceled" msgid="5425192751826544741">"تم إلغاء تبادل البيانات"</string>
+ <string name="touch" msgid="4727218133711188355">"المس لرسم شعاع"</string>
+ <string name="beam_progress" msgid="7453634884807323920">"شعاع وارد..."</string>
+ <string name="beam_complete" msgid="477026736424637435">"اكتمل الشعاع"</string>
+ <string name="beam_failed" msgid="5116241718189888630">"لم يكتمل الشعاع"</string>
+ <string name="beam_canceled" msgid="5425192751826544741">"تم إلغاء الشعاع"</string>
<string name="cancel" msgid="61873902552555096">"إلغاء"</string>
<string name="beam_touch_to_view" msgid="7853129156831642630">"المس ليتم العرض"</string>
- <string name="beam_handover_not_supported" msgid="4083165921751489015">"جهاز المستلم لا يوفر نقل ملفات كبيرة عبر تبادل البيانات."</string>
+ <string name="beam_handover_not_supported" msgid="4083165921751489015">"جهاز المستلم لا يوفر نقل ملفات كبيرة عبر الشعاع."</string>
<string name="connecting_headset" msgid="3929250919225573008">"جارٍ الاتصال..."</string>
<string name="connected_headset" msgid="4047751837023241955">"متصل"</string>
<string name="connect_headset_failed" msgid="7500801585498094863">"تعذر الاتصال"</string>
diff --git a/src/com/android/nfc/DeviceHost.java b/src/com/android/nfc/DeviceHost.java
index b7336ad..487d2ad 100644
--- a/src/com/android/nfc/DeviceHost.java
+++ b/src/com/android/nfc/DeviceHost.java
@@ -175,6 +175,8 @@ public interface DeviceHost {
public boolean deinitialize();
+ public String getName();
+
public void enableDiscovery();
public void disableDiscovery();
diff --git a/src/com/android/nfc/NfcDispatcher.java b/src/com/android/nfc/NfcDispatcher.java
index b3ab97c..f628dea 100644
--- a/src/com/android/nfc/NfcDispatcher.java
+++ b/src/com/android/nfc/NfcDispatcher.java
@@ -305,7 +305,10 @@ public class NfcDispatcher {
if (message == null) {
return false;
}
- dispatch.setNdefIntent();
+ Intent intent = dispatch.setNdefIntent();
+
+ // Bail out if the intent does not contain filterable NDEF data
+ if (intent == null) return false;
// Try to start AAR activity with matching filter
List<String> aarPackages = extractAarPackages(message);
diff --git a/src/com/android/nfc/NfcService.java b/src/com/android/nfc/NfcService.java
index 3acfa1c..55570a1 100755
--- a/src/com/android/nfc/NfcService.java
+++ b/src/com/android/nfc/NfcService.java
@@ -187,9 +187,8 @@ public class NfcService extends Application implements DeviceHostListener {
private SharedPreferences mPrefs;
private SharedPreferences.Editor mPrefsEditor;
private PowerManager.WakeLock mRoutingWakeLock;
- private PowerManager.WakeLock mOpenWakeLock;
- private PowerManager.WakeLock mDisconnectWakeLock;
- private PowerManager.WakeLock mTransceiveWakeLock;
+ private PowerManager.WakeLock mEeWakeLock;
+
int mStartSound;
int mEndSound;
int mErrorSound;
@@ -323,16 +322,10 @@ public class NfcService extends Application implements DeviceHostListener {
mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
- // TODO(mikey|maco): consolidate as a single wakelock when individual
- // stats are no longer useful.
mRoutingWakeLock = mPowerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, "NfcService:mRoutingWakeLock");
- mOpenWakeLock = mPowerManager.newWakeLock(
- PowerManager.PARTIAL_WAKE_LOCK, "NfcService:mOpenWakeLock");
- mDisconnectWakeLock = mPowerManager.newWakeLock(
- PowerManager.PARTIAL_WAKE_LOCK, "NfcService:mDisconnectWakeLock");
- mTransceiveWakeLock = mPowerManager.newWakeLock(
- PowerManager.PARTIAL_WAKE_LOCK, "NfcService:mTransceiveWakeLock");
+ mEeWakeLock = mPowerManager.newWakeLock(
+ PowerManager.PARTIAL_WAKE_LOCK, "NfcService:mEeWakeLock");
mKeyguard = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
mScreenState = checkScreenState();
@@ -417,20 +410,20 @@ public class NfcService extends Application implements DeviceHostListener {
}
int doOpenSecureElementConnection() {
- mOpenWakeLock.acquire();
+ mEeWakeLock.acquire();
try {
return mSecureElement.doOpenSecureElementConnection();
} finally {
- mOpenWakeLock.release();
+ mEeWakeLock.release();
}
}
byte[] doTransceive(int handle, byte[] cmd) {
- mTransceiveWakeLock.acquire();
+ mEeWakeLock.acquire();
try {
return doTransceiveNoLock(handle, cmd);
} finally {
- mTransceiveWakeLock.release();
+ mEeWakeLock.release();
}
}
@@ -439,11 +432,11 @@ public class NfcService extends Application implements DeviceHostListener {
}
void doDisconnect(int handle) {
- mDisconnectWakeLock.acquire();
+ mEeWakeLock.acquire();
try {
mSecureElement.doDisconnect(handle);
} finally {
- mDisconnectWakeLock.release();
+ mEeWakeLock.release();
}
}
@@ -640,7 +633,7 @@ public class NfcService extends Application implements DeviceHostListener {
}
try {
- mTransceiveWakeLock.acquire();
+ mEeWakeLock.acquire();
try {
mDeviceHost.setTimeout(TagTechnology.ISO_DEP, 10000);
@@ -654,7 +647,7 @@ public class NfcService extends Application implements DeviceHostListener {
mDeviceHost.resetTimeouts();
} finally {
- mTransceiveWakeLock.release();
+ mEeWakeLock.release();
}
} finally {
doDisconnect(handle);
@@ -1367,6 +1360,12 @@ public class NfcService extends Application implements DeviceHostListener {
public void authenticate(String pkg, byte[] token) throws RemoteException {
NfcService.this.enforceNfceeAdminPerm(pkg);
}
+
+ @Override
+ public String getDriverName(String pkg) throws RemoteException {
+ NfcService.this.enforceNfceeAdminPerm(pkg);
+ return mDeviceHost.getName();
+ }
}
/** resources kept while secure element is open */
@@ -1427,7 +1426,7 @@ public class NfcService extends Application implements DeviceHostListener {
synchronized (this) {
if (!mWatchDogCanceled) {
// Trigger watch-dog
- Log.e(TAG, "Watch dog triggered");
+ Log.e(TAG, "--- NFC controller stuck while applying routing ---");
mDeviceHost.doAbort();
}
}
@@ -1847,7 +1846,11 @@ public class NfcService extends Application implements DeviceHostListener {
}
mScreenState = params[0].intValue();
- mRoutingWakeLock.acquire();
+ // HACK: We've seen applying the routing configuration
+ // getting stuck. The operation should normally easily
+ // complete within a minute, so don't hold the wakelock
+ // any longer than that.
+ mRoutingWakeLock.acquire(60000);
try {
applyRouting(false);
} finally {
diff --git a/src/com/android/nfc/SendUi.java b/src/com/android/nfc/SendUi.java
index 23602c9..c54f54e 100644
--- a/src/com/android/nfc/SendUi.java
+++ b/src/com/android/nfc/SendUi.java
@@ -183,7 +183,7 @@ public class SendUi implements Animator.AnimatorListener, View.OnTouchListener,
// We're only allowed to use hardware acceleration if
// isHighEndGfx() returns true - otherwise, we're too limited
// on resources to do it.
- mHardwareAccelerated = ActivityManager.isHighEndGfx(mDisplay);
+ mHardwareAccelerated = ActivityManager.isHighEndGfx();
int hwAccelerationFlags = mHardwareAccelerated ?
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED : 0;
diff --git a/src/com/android/nfc/handover/HandoverManager.java b/src/com/android/nfc/handover/HandoverManager.java
index fccdd17..a514f85 100644
--- a/src/com/android/nfc/handover/HandoverManager.java
+++ b/src/com/android/nfc/handover/HandoverManager.java
@@ -387,8 +387,7 @@ public class HandoverManager implements BluetoothHeadsetHandover.Callback {
notBuilder.setContentText(mContext.getString(R.string.beam_touch_to_view));
Intent viewIntent = buildViewIntent();
- PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, viewIntent,
- Intent.FLAG_ACTIVITY_NEW_TASK);
+ PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, viewIntent, 0);
notBuilder.setContentIntent(contentIntent);
@@ -535,7 +534,7 @@ public class HandoverManager implements BluetoothHeadsetHandover.Callback {
Uri uri = mediaUri != null ? mediaUri :
Uri.parse(ContentResolver.SCHEME_FILE + "://" + filePath);
viewIntent.setDataAndTypeAndNormalize(uri, mimeTypes.get(filePath));
-
+ viewIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return viewIntent;
}