Merge "Import revised translations. DO NOT MERGE" into ics-mr1
diff --git a/jni/Android.mk b/jni/Android.mk
index 600a54a..8ae792a 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -24,11 +24,12 @@
libnativehelper \
libcutils \
libutils \
- libnfc
+ libnfc \
+ libhardware
#LOCAL_CFLAGS += -O0 -g
LOCAL_MODULE := libnfc_jni
LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
+include $(BUILD_SHARED_LIBRARY)
diff --git a/jni/com_android_nfc_NativeNfcManager.cpp b/jni/com_android_nfc_NativeNfcManager.cpp
index 1a5dc7d..70c60bb 100644
--- a/jni/com_android_nfc_NativeNfcManager.cpp
+++ b/jni/com_android_nfc_NativeNfcManager.cpp
@@ -21,12 +21,13 @@
#include <stdio.h>
#include <math.h>
#include <sys/queue.h>
+#include <hardware/hardware.h>
+#include <hardware/nfc.h>
#include "com_android_nfc.h"
#define ERROR_BUFFER_TOO_SMALL -12
#define ERROR_INSUFFICIENT_RESOURCES -9
-#define EEDATA_SETTINGS_NUMBER 34
extern uint32_t libnfc_llc_error_count;
@@ -61,72 +62,6 @@
struct nfc_jni_native_data *exported_nat = NULL;
-/* TODO: move product specific configuration such as this
- * antenna tuning into product specific configuration */
-uint8_t EEDATA_Settings[EEDATA_SETTINGS_NUMBER][4] = {
- // DIFFERENTIAL_ANTENNA
-
- // RF Settings
- {0x00,0x9B,0xD1,0x0D} // Tx consumption higher than 0x0D (average 50mA)
- ,{0x00,0x9B,0xD2,0x24} // GSP setting for this threshold
- ,{0x00,0x9B,0xD3,0x0A} // Tx consumption higher than 0x0A (average 40mA)
- ,{0x00,0x9B,0xD4,0x22} // GSP setting for this threshold
- ,{0x00,0x9B,0xD5,0x08} // Tx consumption higher than 0x08 (average 30mA)
- ,{0x00,0x9B,0xD6,0x1E} // GSP setting for this threshold
- ,{0x00,0x9B,0xDD,0x1C} // GSP setting for this threshold
- ,{0x00,0x9B,0x84,0x13} // ANACM2 setting
- ,{0x00,0x99,0x81,0x7F} // ANAVMID setting PCD
- ,{0x00,0x99,0x31,0x70} // ANAVMID setting PICC
-
- // Enable PBTF
- ,{0x00,0x98,0x00,0x3F} // SECURE_ELEMENT_CONFIGURATION - No Secure Element
- ,{0x00,0x9F,0x09,0x00} // SWP_PBTF_RFU
- ,{0x00,0x9F,0x0A,0x05} // SWP_PBTF_RFLD --> RFLEVEL Detector for PBTF
- ,{0x00,0x9E,0xD1,0xA1} //
-
- // Change RF Level Detector ANARFLDWU
- ,{0x00,0x99,0x23,0x00} // Default Value is 0x01
-
- // Low-power polling
- ,{0x00,0x9E,0x74,0xC0} // Default Value is 0x00, bits 0->2: sensitivity (0==max, 6==min),
- // bit 3: RFU,
- // bits 4->6 hybrid low-power: # of low-power polls per regular poll
- // bit 7: (0 -> disabled, 1 -> enabled)
- ,{0x00,0x9F,0x28,0x01} // bits 0->7: # of measurements per low-power poll
-
- // Polling Loop - Card Emulation Timeout
- ,{0x00,0x9F,0x35,0x14} // Time for which PN544 stays in Card Emulation mode after leaving RF field
- ,{0x00,0x9F,0x36,0x60} // Default value 0x0411 = 50 ms ---> New Value : 0x1460 = 250 ms
-
- //LLC Timer
- ,{0x00,0x9C,0x31,0x00} // Guard host time-out in ms (MSB)
- ,{0x00,0x9C,0x32,0xC8} // Guard host time-out in ms (LSB)
- ,{0x00,0x9C,0x19,0x40} // Max RX retry (PN544=>host?)
- ,{0x00,0x9C,0x1A,0x40} // Max TX retry (PN544=>host?)
-
- ,{0x00,0x9C,0x0C,0x00} //
- ,{0x00,0x9C,0x0D,0x00} //
- ,{0x00,0x9C,0x12,0x00} //
- ,{0x00,0x9C,0x13,0x00} //
-
- //WTX for LLCP communication
- ,{0x00,0x98,0xA2,0x0E} // Max value: 14 (default value: 09)
-
- //SE GPIO
- ,{0x00, 0x98, 0x93, 0x40}
-
- // Set NFCT ATQA
- ,{0x00, 0x98, 0x7D, 0x02}
- ,{0x00, 0x98, 0x7E, 0x00}
-
- // Enable CEA detection mechanism
- ,{0x00, 0x9F, 0xC8, 0x01}
- // Set NFC-F poll RC=0x00
- ,{0x00, 0x9F, 0x9A, 0x00}
- // Setting for EMD support for ISO 14443-4 Reader
- ,{0x00,0x9F,0x09,0x00} // 0x00 - Disable EMD support, 0x01 - Enable EMD support
-};
-
/* Internal functions declaration */
static void *nfc_jni_client_thread(void *arg);
static void nfc_jni_init_callback(void *pContext, NFCSTATUS status);
@@ -137,48 +72,6 @@
static void nfc_jni_llcpcfg_callback(void *pContext, NFCSTATUS status);
static void nfc_jni_start_discovery_locked(struct nfc_jni_native_data *nat);
-static phLibNfc_eConfigLinkType parseLinkType(const char* link_name)
-{
- struct link_name_entry {
- phLibNfc_eConfigLinkType value;
- const char * name;
- };
- const struct link_name_entry sLinkNameTable[] = {
- {ENUM_LINK_TYPE_COM1, "COM1"},
- {ENUM_LINK_TYPE_COM2, "COM2"},
- {ENUM_LINK_TYPE_COM3, "COM3"},
- {ENUM_LINK_TYPE_COM4, "COM4"},
- {ENUM_LINK_TYPE_COM5, "COM5"},
- {ENUM_LINK_TYPE_COM6, "COM6"},
- {ENUM_LINK_TYPE_COM7, "COM7"},
- {ENUM_LINK_TYPE_COM8, "COM8"},
- {ENUM_LINK_TYPE_I2C, "I2C"},
- {ENUM_LINK_TYPE_USB, "USB"},
- };
- phLibNfc_eConfigLinkType ret;
- unsigned int i;
-
- /* NOTE: ENUM_LINK_TYPE_NB corresponds to undefined link name */
-
- if (link_name == NULL)
- {
- return ENUM_LINK_TYPE_NB;
- }
-
- ret = ENUM_LINK_TYPE_NB;
- for (i=0 ; i<sizeof(sLinkNameTable)/sizeof(link_name_entry) ; i++)
- {
- if (strcmp(sLinkNameTable[i].name, link_name) == 0)
- {
- ret = sLinkNameTable[i].value;
- break;
- }
- }
-
- return ret;
-}
-
-
/*
* Deferred callback called when client thread must be exited
*/
@@ -383,10 +276,7 @@
/* Configure hardware link */
gDrvCfg.nClientId = phDal4Nfc_msgget(0, 0600);
- property_get("ro.nfc.port", value, "unknown");
- gDrvCfg.nLinkType = parseLinkType(value);
-
- TRACE("phLibNfc_Mgt_ConfigureDriver(0x%08x, 0x%08x)", gDrvCfg.nClientId, gDrvCfg.nLinkType);
+ TRACE("phLibNfc_Mgt_ConfigureDriver(0x%08x, 0x%08x)", gDrvCfg.nClientId);
REENTRANCE_LOCK();
status = phLibNfc_Mgt_ConfigureDriver(&gDrvCfg, &gHWRef);
REENTRANCE_UNLOCK();
@@ -450,7 +340,9 @@
uint8_t firmware_status;
uint8_t update = TRUE;
int result = JNI_FALSE;
-
+ const hw_module_t* hw_module;
+ nfc_pn544_device_t* pn544_dev = NULL;
+ int ret = 0;
LOGD("Start Initialization\n");
/* Create the local semaphore */
@@ -458,6 +350,21 @@
{
goto clean_and_return;
}
+ /* Get EEPROM values and device port from product-specific settings */
+ ret = hw_get_module(NFC_HARDWARE_MODULE_ID, &hw_module);
+ if (ret) {
+ LOGE("hw_get_module() failed.");
+ goto clean_and_return;
+ }
+ ret = nfc_pn544_open(hw_module, &pn544_dev);
+ if (ret) {
+ LOGE("Could not open pn544 hw_module.");
+ goto clean_and_return;
+ }
+ if (pn544_dev->num_eeprom_settings == 0 || pn544_dev->eeprom_settings == NULL) {
+ LOGE("Could not load EEPROM settings");
+ goto clean_and_return;
+ }
/* Reset device connected handle */
device_connected_flag = 0;
@@ -552,13 +459,14 @@
// Update EEPROM settings
TRACE("****** START EEPROM SETTINGS UPDATE ******");
- for (i = 0; i < EEDATA_SETTINGS_NUMBER; i++)
+ for (i = 0; i < pn544_dev->num_eeprom_settings; i++)
{
- gInputParam.buffer = EEDATA_Settings[i];
+ gInputParam.buffer = &(pn544_dev->eeprom_settings[i*4]);
gInputParam.length = 0x04;
gOutputParam.buffer = resp;
TRACE("> EEPROM SETTING: %d", i);
+
REENTRANCE_LOCK();
status = phLibNfc_Mgt_IoCtl(gHWRef, NFC_MEM_WRITE, &gInputParam, &gOutputParam, nfc_jni_ioctl_callback, (void *)&cb_data);
REENTRANCE_UNLOCK();
@@ -670,7 +578,9 @@
kill_client(nat);
}
}
-
+ if (pn544_dev != NULL) {
+ nfc_pn544_close(pn544_dev);
+ }
nfc_cb_data_deinit(&cb_data);
return result;
diff --git a/res/drawable-hdpi/back.png b/res/drawable-hdpi/back.png
deleted file mode 100644
index dcad41d..0000000
--- a/res/drawable-hdpi/back.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/screenshot.xml b/res/layout/screenshot.xml
index 2e12a59..24a3a71 100644
--- a/res/layout/screenshot.xml
+++ b/res/layout/screenshot.xml
@@ -22,14 +22,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
- <ImageView android:id="@+id/back"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:adjustViewBounds="true"
- android:src="@drawable/back"
- android:scaleType="centerCrop"
- android:visibility="gone"
- />
+
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/src/com/android/nfc/SendUi.java b/src/com/android/nfc/SendUi.java
index a198811..37ac6e0 100644
--- a/src/com/android/nfc/SendUi.java
+++ b/src/com/android/nfc/SendUi.java
@@ -77,9 +77,6 @@
static final int TEXT_HINT_ALPHA_DURATION_MS = 500;
static final int TEXT_HINT_ALPHA_START_DELAY_MS = 300;
- static final float[] BACKGROUND_SCALE_RANGE = {2.0f, 1.0f};
- static final int BACKGROUND_SCALE_DURATION_MS = 5000;
-
static final int FINISH_SCALE_UP = 0;
static final int FINISH_SLIDE_OUT = 1;
@@ -94,7 +91,6 @@
final StatusBarManager mStatusBarManager;
final View mScreenshotLayout;
final ImageView mScreenshotView;
- final ImageView mBackgroundImage;
final TextureView mTextureView;
final TextView mTextHint;
final Callback mCallback;
@@ -104,7 +100,6 @@
final ObjectAnimator mFadeInAnimator;
final ObjectAnimator mHintAnimator;
final AnimatorSet mSuccessAnimatorSet;
- final ObjectAnimator mBackgroundAnimator;
final boolean mHardwareAccelerated;
Bitmap mScreenshotBitmap;
@@ -140,7 +135,6 @@
mTextureView = (TextureView) mScreenshotLayout.findViewById(R.id.fireflies);
mTextureView.setSurfaceTextureListener(this);
- mBackgroundImage = (ImageView) mScreenshotLayout.findViewById(R.id.back);
// We're only allowed to use hardware acceleration if
// isHighEndGfx() returns true - otherwise, we're too limited
// on resources to do it.
@@ -148,11 +142,6 @@
int hwAccelerationFlags = mHardwareAccelerated ?
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED : 0;
- if (!mHardwareAccelerated) {
- // Only show background in case we're not hw-accelerated
- mBackgroundImage.setVisibility(View.VISIBLE);
- }
-
mWindowLayoutParams = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT, 0, 0,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
@@ -209,12 +198,6 @@
mSuccessAnimatorSet = new AnimatorSet();
mSuccessAnimatorSet.playSequentially(mFastCloneAnimator, mFadeInAnimator);
- scaleUpX = PropertyValuesHolder.ofFloat("scaleX", BACKGROUND_SCALE_RANGE);
- scaleUpY = PropertyValuesHolder.ofFloat("scaleY", BACKGROUND_SCALE_RANGE);
- mBackgroundAnimator = ObjectAnimator.ofPropertyValuesHolder(mBackgroundImage, scaleUpX, scaleUpY);
- mBackgroundAnimator.setInterpolator(new DecelerateInterpolator(2.0f));
- mBackgroundAnimator.setDuration(BACKGROUND_SCALE_DURATION_MS);
-
mAttached = false;
}
@@ -274,10 +257,6 @@
mAttached = true;
mPreAnimator.start();
-
- if (!mHardwareAccelerated) {
- mBackgroundAnimator.start();
- }
}
/** Show starting send animation */