From 806d114d5975c89843c9ba16eadfcaf143afdebb Mon Sep 17 00:00:00 2001
From: Igor Murashkin
+ * This tracing mechanism is independent of the method tracing mechanism
+ * offered by {@link Debug#startMethodTracing}. In particular, it enables
+ * tracing of events that occur across multiple processes.
+ *
+ * All traces are written using the APP
tag.
+ *
At this time the vertical bar character '|', newline character '\n', and + * null character '\0' are used internally by the tracing mechanism. If sectionName contains + * these characters they will be replaced with a space character in the trace. + * + * @param sectionName The name of the code section to appear in the trace. This may be at + * most 127 Unicode code units long. + */ + public static void beginSection(String sectionName) { + if (VERBOSE) { + Log.v(TAG, String.format("beginSection[%d] %s", sNestingLevel, sectionName)); + sNestingLevel++; + } + } + + /** + * Writes a trace message to indicate that a given section of code has + * ended. + *
+ * This call must be preceded by a corresponding call to + * {@link #beginSection(String)}. Calling this method will mark the end of + * the most recently begun section of code, so care must be taken to ensure + * that beginSection / endSection pairs are properly nested and called from + * the same thread. + *
+ */ + public static void endSection() { + if (VERBOSE) { + sNestingLevel--; + Log.v(TAG, String.format("endSection[%d]", sNestingLevel)); + } + } + + /** + * Writes a trace message to indicate that a given section of code has + * begun. + * + *Must be followed by a call to {@link #endSectionAsync} using the same + * tag. Unlike {@link #beginSection} and {@link #endSection}, + * asynchronous events do not need to be nested. The name and cookie used to + * begin an event must be used to end it.
+ * + * @param methodName The method name to appear in the trace. + * @param cookie Unique identifier for distinguishing simultaneous events + */ + public static void beginSectionAsync(String methodName, int cookie) { + if (VERBOSE) { + Log.v(TAG, "beginSectionAsync " + methodName + " " + cookie); + } + } + + /** + * Writes a trace message to indicate that the current method has ended. + * Must be called exactly once for each call to {@link #beginSectionAsync} + * using the same tag, name and cookie. + * + * @param methodName The method name to appear in the trace. + * @param cookie Unique identifier for distinguishing simultaneous events + */ + public static void endSectionAsync(String methodName, int cookie) { + if (VERBOSE) { + Log.v(TAG, "endSectionAsync " + methodName + " " + cookie); + } + } +} -- cgit v1.2.3 From 2d8e55f45e52ac0b18c0e46de602e6a6d5ab1001 Mon Sep 17 00:00:00 2001 From: Igor Murashkin+ * When dropping capture results (by not invoking {@link #onCaptureCompleted} when a new + * {@link CaptureResult} is available), call this function to reset the state. Otherwise + * the next time a new state is observed this class may incorrectly consider it as the same + * state as before, and not issue any callbacks by {@link AutoFocusStateListener}. + *
+ */ + public synchronized void resetState() { + if (VERBOSE_LOGGING) Log.v(TAG, "resetState - last state was " + mLastAfState); + + mLastAfState = AF_UNINITIALIZED; + } + /** * Lock the lens from moving. Typically used before taking a picture. * -- cgit v1.2.3 From d4429271623c05376ee1445d13fde9bcf76a0033 Mon Sep 17 00:00:00 2001 From: Zhijun HeThis is typically used when a new repeating request is created to update preview with + * new metadata (i.e. crop region). The current auto focus mode needs to be carried over for + * correct auto focus behavior.
+ *
+ * @param repeatingBuilder Builder for a repeating request.
+ */
+ public synchronized void updateCaptureRequest(CaptureRequest.Builder repeatingBuilder) {
+ if (repeatingBuilder == null) {
+ throw new IllegalArgumentException("repeatingBuilder shouldn't be null");
+ }
+
+ if (mCurrentAfMode == AF_UNINITIALIZED) {
+ throw new IllegalStateException("AF mode was not enabled");
+ }
+
+ repeatingBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentAfMode);
+ }
}
--
cgit v1.2.3
From 7d1e2245d443faaf833c19e7e9c837112d618c68 Mon Sep 17 00:00:00 2001
From: Igor Murashkin
+ * When dropping capture results (by not invoking {@link #onCaptureCompleted} when a new
+ * {@link CaptureResult} is available), call this function to reset the state. Otherwise
+ * the next time a new state is observed this class may incorrectly consider it as the same
+ * state as before, and not issue any callbacks by {@link AutoFocusStateListener}.
+ * This is typically used when a new repeating request is created to update preview with
+ * new metadata (i.e. crop region). The current auto focus mode needs to be carried over for
+ * correct auto focus behavior.
+ *
+ * @param repeatingBuilder Builder for a repeating request.
+ */
+ public synchronized void updateCaptureRequest(CaptureRequest.Builder repeatingBuilder) {
+ if (repeatingBuilder == null) {
+ throw new IllegalArgumentException("repeatingBuilder shouldn't be null");
+ }
+
+ if (mCurrentAfMode == AF_UNINITIALIZED) {
+ throw new IllegalStateException("AF mode was not enabled");
+ }
+
+ repeatingBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentAfMode);
+ }
}
--
cgit v1.2.3
From 3e8176df16950c067bcb1b37e62b2fc07d74065a Mon Sep 17 00:00:00 2001
From: Scott Kennedy true if it came from GAL, false otherwise
+ */
+ boolean isGalContact();
}
diff --git a/chips/src/com/android/ex/chips/recipientchip/InvisibleRecipientChip.java b/chips/src/com/android/ex/chips/recipientchip/InvisibleRecipientChip.java
index 0380a81..11a66da 100644
--- a/chips/src/com/android/ex/chips/recipientchip/InvisibleRecipientChip.java
+++ b/chips/src/com/android/ex/chips/recipientchip/InvisibleRecipientChip.java
@@ -81,6 +81,11 @@ public class InvisibleRecipientChip extends ReplacementSpan implements DrawableR
return mDelegate.getOriginalText();
}
+ @Override
+ public boolean isGalContact() {
+ return mDelegate.isGalContact();
+ }
+
@Override
public void draw(final Canvas canvas, final CharSequence text, final int start, final int end,
final float x, final int top, final int y, final int bottom, final Paint paint) {
diff --git a/chips/src/com/android/ex/chips/recipientchip/SimpleRecipientChip.java b/chips/src/com/android/ex/chips/recipientchip/SimpleRecipientChip.java
index c04b3be..ac8e897 100644
--- a/chips/src/com/android/ex/chips/recipientchip/SimpleRecipientChip.java
+++ b/chips/src/com/android/ex/chips/recipientchip/SimpleRecipientChip.java
@@ -92,6 +92,11 @@ class SimpleRecipientChip implements BaseRecipientChip {
return !TextUtils.isEmpty(mOriginalText) ? mOriginalText : mEntry.getDestination();
}
+ @Override
+ public boolean isGalContact() {
+ return mEntry.isGalContact();
+ }
+
@Override
public String toString() {
return mDisplay + " <" + mValue + ">";
diff --git a/chips/src/com/android/ex/chips/recipientchip/VisibleRecipientChip.java b/chips/src/com/android/ex/chips/recipientchip/VisibleRecipientChip.java
index acade7f..4637f69 100644
--- a/chips/src/com/android/ex/chips/recipientchip/VisibleRecipientChip.java
+++ b/chips/src/com/android/ex/chips/recipientchip/VisibleRecipientChip.java
@@ -82,6 +82,11 @@ public class VisibleRecipientChip extends ImageSpan implements DrawableRecipient
return mDelegate.getOriginalText();
}
+ @Override
+ public boolean isGalContact() {
+ return mDelegate.isGalContact();
+ }
+
@Override
public Rect getBounds() {
return getDrawable().getBounds();
diff --git a/chips/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java b/chips/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java
index a1a1c7a..d4c0460 100644
--- a/chips/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java
+++ b/chips/tests/src/com/android/ex/chips/RecipientAlternatesAdapterTest.java
@@ -120,7 +120,8 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase {
{
final RecipientEntry entry1 =
RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME,
- "1@android.com", 0, null, 0, 0, (Uri) null, true);
+ "1@android.com", 0, null, 0, 0, (Uri) null, true,
+ false /* isGalContact */);
final RecipientEntry entry2 = RecipientEntry.constructFakeEntry("1@android.com", true);
assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1);
@@ -132,10 +133,12 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase {
{
final RecipientEntry entry1 =
RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME,
- "1@android.com", 0, null, 0, 0, (Uri) null, true);
+ "1@android.com", 0, null, 0, 0, (Uri) null, true,
+ false /* isGalContact */);
final RecipientEntry entry2 =
RecipientEntry.constructTopLevelEntry("2@android.com", DisplayNameSources.EMAIL,
- "2@android.com", 0, null, 0, 0, (Uri) null, true);
+ "2@android.com", 0, null, 0, 0, (Uri) null, true,
+ false /* isGalContact */);
assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1);
assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry2, entry1), entry1);
@@ -146,10 +149,11 @@ public class RecipientAlternatesAdapterTest extends AndroidTestCase {
final RecipientEntry entry1 =
RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.NICKNAME,
"1@android.com", 0, null, 0, 0, Uri.parse("http://www.android.com"),
- true);
+ true, false /* isGalContact */);
final RecipientEntry entry2 =
RecipientEntry.constructTopLevelEntry("Android", DisplayNameSources.EMAIL,
- "2@android.com", 0, null, 0, 0, (Uri) null, true);
+ "2@android.com", 0, null, 0, 0, (Uri) null, true,
+ false /* isGalContact */);
assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry1, entry2), entry1);
assertEquals(RecipientAlternatesAdapter.getBetterRecipient(entry2, entry1), entry1);
--
cgit v1.2.3