diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-09-22 05:18:11 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2016-09-22 05:18:11 -0700 |
commit | 8525d9d615ba2a75e93599bbddf8cbb0f5e4cf90 (patch) | |
tree | f51e95d364ddcc8947af07864aa0ff351cb98a07 /src/com/android | |
parent | 884dfe701804f6a232d3ae131cbc6e5e2435d398 (diff) | |
parent | 81e450c558a942613bfc0e1e814cf228fb398762 (diff) | |
download | android_packages_apps_Contacts-8525d9d615ba2a75e93599bbddf8cbb0f5e4cf90.tar.gz android_packages_apps_Contacts-8525d9d615ba2a75e93599bbddf8cbb0f5e4cf90.tar.bz2 android_packages_apps_Contacts-8525d9d615ba2a75e93599bbddf8cbb0f5e4cf90.zip |
Merge 81e450c558a942613bfc0e1e814cf228fb398762 on remote branch
Change-Id: I24ad5309e7e356f8db88b1558c39d6fa1882909b
Diffstat (limited to 'src/com/android')
-rwxr-xr-x | src/com/android/contacts/ContactSaveService.java | 53 | ||||
-rwxr-xr-x | src/com/android/contacts/activities/MultiPickContactsActivity.java | 5 | ||||
-rw-r--r-- | src/com/android/contacts/detail/ContactDisplayUtils.java | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/contacts/multipicker/ContactsFragment.java | 13 | ||||
-rw-r--r--[-rwxr-xr-x] | src/com/android/contacts/quickcontact/ExpandingEntryCardView.java | 31 | ||||
-rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 9 |
6 files changed, 51 insertions, 64 deletions
diff --git a/src/com/android/contacts/ContactSaveService.java b/src/com/android/contacts/ContactSaveService.java index 062f118f8..c00660f56 100755 --- a/src/com/android/contacts/ContactSaveService.java +++ b/src/com/android/contacts/ContactSaveService.java @@ -76,6 +76,8 @@ import java.util.HashSet; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import org.codeaurora.wrapper.UiccPhoneBookController_Wrapper; + /** * A service responsible for saving changes to the content provider. */ @@ -705,39 +707,26 @@ public class ContactSaveService extends IntentService { } } - if (entity.isContactInsert()) { - int count = 0; - Cursor c = null; - Uri iccUri; - SubscriptionInfo subInfoRecord = null; - try { - subInfoRecord = mSubscriptionManager - .getActiveSubscriptionInfoForSimSlotIndex(subscription); - } catch (SecurityException e) { - Log.w(TAG, "SecurityException thrown, lack permission for" - + " getActiveSubscriptionInfoList", e); - } - if (subInfoRecord == null) { - iccUri = Uri.parse(SimContactsConstants.SIM_URI); - } else { - iccUri = Uri.parse(SimContactsConstants.SIM_SUB_URI - + subInfoRecord.getSubscriptionId()); - } - try { - c = resolver.query(iccUri, null, null, null, null); - if (c != null) { - count = c.getCount(); - } - } finally { - if (c != null) { - c.close(); - } - } - - if (count == MoreContactUtils.getAdnCount(this, subscription)) { - return RESULT_SIM_FULL_FAILURE; - } + if (entity.isContactInsert()) { + int count = 0; + SubscriptionInfo subInfoRecord = null; + try { + subInfoRecord = mSubscriptionManager + .getActiveSubscriptionInfoForSimSlotIndex(subscription); + } catch (SecurityException e) { + Log.w(TAG, "SecurityException thrown, lack permission for" + + " getActiveSubscriptionInfoList", e); } + if (subInfoRecord != null) { + int[] adnCount = UiccPhoneBookController_Wrapper + .getAdnRecordsCapacityForSubscriber(subInfoRecord.getSubscriptionId()); + if(adnCount!=null) + count= adnCount[MoreContactUtils.ADN_USED_POS]; + } + if (count >0 && count == MoreContactUtils.getAdnCount(this, subscription)) { + return RESULT_SIM_FULL_FAILURE; + } + } if (isInsert) { Uri resultUri = mSimContactsOperation.insert(values, diff --git a/src/com/android/contacts/activities/MultiPickContactsActivity.java b/src/com/android/contacts/activities/MultiPickContactsActivity.java index 8d7824117..28ac8d49d 100755 --- a/src/com/android/contacts/activities/MultiPickContactsActivity.java +++ b/src/com/android/contacts/activities/MultiPickContactsActivity.java @@ -246,7 +246,7 @@ public class MultiPickContactsActivity extends Activity implements ViewPager.OnP // occur crash. position = getRtlPosition(position); - if (mAreTabsHiddenInViewPager) { + if (mAreTabsHiddenInViewPager || !mPickMode.isPickPhone()) { if (mPickMode.isPickCall()) { mDelCallLogFragment = new DelCallLogFragment(); mDelCallLogFragment.setCheckListListener(new CheckListListener()); @@ -295,8 +295,7 @@ public class MultiPickContactsActivity extends Activity implements ViewPager.OnP public Object instantiateItem(ViewGroup container, int position) { Fragment f = (Fragment) super.instantiateItem(container, position); - - if (mAreTabsHiddenInViewPager) { + if (mAreTabsHiddenInViewPager || !mPickMode.isPickPhone()) { if (mPickMode.isPickCall()) { if (mDelCallLogFragment == null) { mDelCallLogFragment = (DelCallLogFragment) f; diff --git a/src/com/android/contacts/detail/ContactDisplayUtils.java b/src/com/android/contacts/detail/ContactDisplayUtils.java index 0987371fb..45a6c07d9 100644 --- a/src/com/android/contacts/detail/ContactDisplayUtils.java +++ b/src/com/android/contacts/detail/ContactDisplayUtils.java @@ -462,8 +462,6 @@ public class ContactDisplayUtils { return vt; } catch (Exception e) { Log.d(TAG, "getVTCapOfContact ERROR " + e); - } finally { - return false; } } return false; @@ -480,8 +478,6 @@ public class ContactDisplayUtils { return vt; } catch (Exception e) { Log.d(TAG, "getVTCapability ERROR " + e); - } finally { - return false; } } return false; diff --git a/src/com/android/contacts/multipicker/ContactsFragment.java b/src/com/android/contacts/multipicker/ContactsFragment.java index ac11f45fe..4f1049b05 100644..100755 --- a/src/com/android/contacts/multipicker/ContactsFragment.java +++ b/src/com/android/contacts/multipicker/ContactsFragment.java @@ -423,8 +423,7 @@ public class ContactsFragment extends ListFragment { uri = Contacts.CONTENT_URI; break; default: - throw new IllegalArgumentException("getUriToQuery: Incorrect mode: " - + mPickMode.getMode()); + uri = Contacts.CONTENT_URI; } return uri.buildUpon().appendQueryParameter(Contacts.EXTRA_ADDRESS_BOOK_INDEX, "true") .build(); @@ -592,6 +591,8 @@ public class ContactsFragment extends ListFragment { public void startQuery() { Uri uri = getUriToQuery(); + if(uri == null) + return; ContactListFilter filter = (ContactListFilter) mPickMode.getIntent() .getParcelableExtra(AccountFilterActivity.KEY_EXTRA_CONTACT_LIST_FILTER); if (filter != null) { @@ -1125,19 +1126,15 @@ public class ContactsFragment extends ListFragment { private Uri querySimContacts(int subscription) { Uri uri = null; - TelephonyManager tm = (TelephonyManager) mContext - .getSystemService(Context.TELEPHONY_SERVICE); + if (subscription != SimContactsConstants.SLOT1 && subscription != SimContactsConstants.SLOT2) { return uri; } int subId = MoreContactUtils.getActiveSubId(mContext, subscription); - if (subId > 0 && tm.getPhoneCount() > 1) { + if (subId > 0) { uri = Uri.parse(SimContactsConstants.SIM_SUB_URI + subId); } - else { - uri = Uri.parse(SimContactsConstants.SIM_URI); - } return uri; } diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java index 7aa95383e..c23476502 100755..100644 --- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java +++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java @@ -99,6 +99,7 @@ public class ExpandingEntryCardView extends CardView { private String mContactName; private Handler mHandler; private boolean mEnablePresence = false; + private boolean mHaveFetched = false; private static final Property<View, Integer> VIEW_LAYOUT_HEIGHT_PROPERTY = new Property<View, Integer>(Integer.class, "height") { @@ -357,8 +358,8 @@ public class ExpandingEntryCardView extends CardView { mTitleTextView = (TextView) expandingEntryCardView.findViewById(R.id.title); mContainer = (LinearLayout) expandingEntryCardView.findViewById(R.id.container); - mEnablePresence = System.getProperty("persist.presence.enable", "false").equals("true"); - + mEnablePresence = getResources().getBoolean(R.bool.config_presence_enabled); + Log.d(TAG, "ExpandingEntryCardView mEnablePresence = " + mEnablePresence); if (mEnablePresence) { mVideoCalling = (Switch) expandingEntryCardView .findViewById(R.id.switch_video_call); @@ -890,20 +891,22 @@ public class ExpandingEntryCardView extends CardView { if (mEnablePresence) { if (mEnable == CallUtil.ENABLE_VIDEO_CALLING) { showVTicon = ContactDisplayUtils.getVTCapability(entry.getHeader()); - new Thread(new Runnable(){ - public void run(){ - if (null != entry.getHeader()) { - boolean oldVT = ContactDisplayUtils.getVTCapability( - entry.getHeader()); - boolean newVT = ContactDisplayUtils.startAvailabilityFetch( - entry.getHeader()); - if (oldVT != newVT) { - mHandler.sendEmptyMessage(PRESENCE_AVAILABILITY_FETCH); + if(!mHaveFetched){ + new Thread(new Runnable(){ + public void run(){ + if (null != entry.getHeader()) { + boolean oldVT = ContactDisplayUtils.getVTCapability( + entry.getHeader()); + boolean newVT = ContactDisplayUtils.startAvailabilityFetch( + entry.getHeader()); + if (oldVT != newVT) { + mHaveFetched = true; + mHandler.sendEmptyMessage(PRESENCE_AVAILABILITY_FETCH); + } } } - } - - }).start(); + }).start(); + } } } if (entry.getThirdIcon() != null && entry.getThirdAction() != Entry.ACTION_NONE diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index 38f7820ea..b69c9decd 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -1026,7 +1026,8 @@ public class QuickContactActivity extends ContactsActivity mContactCard.setExpandButtonText( getResources().getString(R.string.expanding_entry_card_view_see_all)); mContactCard.setOnCreateContextMenuListener(mEntryContextMenuListener); - mEnablePresence = System.getProperty("persist.presence.enable", "false").equals("true"); + mEnablePresence = getResources().getBoolean(R.bool.config_presence_enabled); + Log.e(TAG, "onCreate mEnablePresence = " + mEnablePresence); if (mEnablePresence) { mContactCard.disPlayVideoCallSwitch(mEnablePresence); if (!ContactDisplayUtils.mIsBound) { @@ -1035,7 +1036,9 @@ public class QuickContactActivity extends ContactsActivity mContactCard.setCallBack(new VideoCallingCallback(){ @Override public void updateContact(){ - reFreshContact(); + if(mContactData != null){ + reFreshContact(); + } } }); } @@ -2880,7 +2883,7 @@ public class QuickContactActivity extends ContactsActivity } final MenuItem refreshMenuItem = menu.findItem(R.id.menu_refresh); - refreshMenuItem.setVisible(isContactEditable()); + refreshMenuItem.setVisible(false); final MenuItem deleteMenuItem = menu.findItem(R.id.menu_delete); deleteMenuItem.setVisible(isContactEditable() && !mContactData.isUserProfile()); |