Merge change I56e83543
* changes:
Switching to the new sort key on Contacts
diff --git a/src/com/android/contacts/ui/QuickContactActivity.java b/src/com/android/contacts/ui/QuickContactActivity.java
index b5e445f..897d912 100644
--- a/src/com/android/contacts/ui/QuickContactActivity.java
+++ b/src/com/android/contacts/ui/QuickContactActivity.java
@@ -33,7 +33,7 @@
QuickContactWindow.OnDismissListener {
private static final String TAG = "QuickContactActivity";
- static final boolean LOGV = true;
+ static final boolean LOGV = false;
static final boolean FORCE_CREATE = false;
private QuickContactWindow mQuickContact;
@@ -65,30 +65,13 @@
final Bundle extras = intent.getExtras();
// Read requested parameters for displaying
- final Rect target = getTargetRect(intent);
+ final Rect target = intent.getSourceBounds();
final int mode = extras.getInt(QuickContact.EXTRA_MODE, QuickContact.MODE_MEDIUM);
final String[] excludeMimes = extras.getStringArray(QuickContact.EXTRA_EXCLUDE_MIMES);
mQuickContact.show(lookupUri, target, mode, excludeMimes);
}
- private Rect getTargetRect(Intent intent) {
- Rect target = intent.getSourceBounds();
- if (target != null) {
- return target;
- }
- final Bundle extras = intent.getExtras();
- try {
- target = (Rect)extras.getParcelable(QuickContact.EXTRA_TARGET_RECT);
- if (target != null) {
- return target;
- }
- } catch (ClassCastException ex) {
- // fall through
- }
- return new Rect(0, 0, 0, 0);
- }
-
/** {@inheritDoc} */
@Override
public void onBackPressed() {
diff --git a/src/com/android/contacts/ui/QuickContactWindow.java b/src/com/android/contacts/ui/QuickContactWindow.java
index baf42ac..69a2801 100644
--- a/src/com/android/contacts/ui/QuickContactWindow.java
+++ b/src/com/android/contacts/ui/QuickContactWindow.java
@@ -323,6 +323,18 @@
android.os.Debug.startMethodTracing(TRACE_TAG);
}
+ // Validate incoming parameters
+ final boolean validMode = (mode == QuickContact.MODE_SMALL
+ || mode == QuickContact.MODE_MEDIUM || mode == QuickContact.MODE_LARGE);
+ if (!validMode) {
+ throw new IllegalArgumentException("Invalid mode, expecting MODE_LARGE, "
+ + "MODE_MEDIUM, or MODE_SMALL");
+ }
+
+ if (anchor == null) {
+ throw new IllegalArgumentException("Missing anchor rectangle");
+ }
+
// Prepare header view for requested mode
mLookupUri = lookupUri;
mAnchor = new Rect(anchor);