Merge "Fix cursor exception in getThumbnailSize" into lmp-mr1-dev
diff --git a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
index fc6e460..a9bd684 100644
--- a/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
+++ b/src/com/android/contacts/common/interactions/ImportExportDialogFragment.java
@@ -231,7 +231,7 @@
*
* @return {@code true} if the dialog show be closed. {@code false} otherwise.
*/
- private boolean handleImportRequest(int resId, long subscriptionId) {
+ private boolean handleImportRequest(int resId, int subscriptionId) {
// There are three possibilities:
// - more than one accounts -> ask the user
// - just one account -> use the account without asking the user
@@ -243,7 +243,7 @@
// Send over to the account selector
final Bundle args = new Bundle();
args.putInt(KEY_RES_ID, resId);
- args.putLong(KEY_SUBSCRIPTION_ID, subscriptionId);
+ args.putInt(KEY_SUBSCRIPTION_ID, subscriptionId);
SelectAccountDialogFragment.show(
getFragmentManager(), this,
R.string.dialog_new_contact_account,
@@ -266,7 +266,7 @@
@Override
public void onAccountChosen(AccountWithDataSet account, Bundle extraArgs) {
AccountSelectionUtil.doImport(getActivity(), extraArgs.getInt(KEY_RES_ID),
- account, extraArgs.getLong(KEY_SUBSCRIPTION_ID));
+ account, extraArgs.getInt(KEY_SUBSCRIPTION_ID));
// At this point the dialog is still showing (which is why we can use getActivity() above)
// So close it.
diff --git a/src/com/android/contacts/common/list/ContactListAdapter.java b/src/com/android/contacts/common/list/ContactListAdapter.java
index 7e9a2e9..9107d04 100644
--- a/src/com/android/contacts/common/list/ContactListAdapter.java
+++ b/src/com/android/contacts/common/list/ContactListAdapter.java
@@ -350,8 +350,7 @@
super.changeCursor(partitionIndex, cursor);
// Check if a profile exists
- if (cursor != null && cursor.getCount() > 0) {
- cursor.moveToFirst();
+ if (cursor != null && cursor.moveToFirst()) {
setProfileExists(cursor.getInt(ContactQuery.CONTACT_IS_USER_PROFILE) == 1);
}
}
diff --git a/src/com/android/contacts/common/util/AccountSelectionUtil.java b/src/com/android/contacts/common/util/AccountSelectionUtil.java
index c378041..78cc2d5 100644
--- a/src/com/android/contacts/common/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/common/util/AccountSelectionUtil.java
@@ -161,7 +161,7 @@
}
public static void doImport(Context context, int resId, AccountWithDataSet account,
- long subscriptionId) {
+ int subscriptionId) {
switch (resId) {
case R.string.import_from_sim: {
doImportFromSim(context, account, subscriptionId);
@@ -175,7 +175,7 @@
}
public static void doImportFromSim(Context context, AccountWithDataSet account,
- long subscriptionId) {
+ int subscriptionId) {
Intent importIntent = new Intent(Intent.ACTION_VIEW);
importIntent.setType("vnd.android.cursor.item/sim-contact");
if (account != null) {
@@ -183,7 +183,7 @@
importIntent.putExtra("account_type", account.type);
importIntent.putExtra("data_set", account.dataSet);
}
- importIntent.putExtra("subscription_id", subscriptionId);
+ importIntent.putExtra("subscription_id", (Integer) subscriptionId);
importIntent.setClassName("com.android.phone", "com.android.phone.SimContacts");
context.startActivity(importIntent);
}