Prevent EML messages from reloading indefinitely

- openMessageSync for EML files touches the provider since it copies
things into the Message table from temporary attachment data. Therefore,
acting on a reload of an EML message will trigger the observer, and do
the same thing.
- still unsure when or how this regressed, but I can't see the previous
behavior being correct regardless

Bug: 5150886
Change-Id: Icfcea7beb95b0fbb026184d6fdecc93c810569ef
This commit is contained in:
Ben Komalo 2011-08-11 13:34:52 -07:00
parent 6183b73ec5
commit c18843d746
2 changed files with 18 additions and 2 deletions

View File

@ -121,6 +121,12 @@ public class MessageFileViewFragment extends MessageViewFragmentBase {
return msg;
}
@Override
protected Message reloadMessageSync(Activity activity) {
// EML files will never change, so just return the same copy.
return getMessage();
}
/**
* {@inheritDoc}
*

View File

@ -1035,6 +1035,14 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
*/
protected abstract Message openMessageSync(Activity activity);
/**
* Called in a background thread to reload a new copy of the Message in case something has
* changed.
*/
protected Message reloadMessageSync(Activity activity) {
return openMessageSync(activity);
}
/**
* Async task for loading a single message outside of the UI thread
*/
@ -1097,7 +1105,7 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
if (activity == null) {
return null;
} else {
return openMessageSync(activity);
return reloadMessageSync(activity);
}
}
@ -1878,7 +1886,9 @@ public abstract class MessageViewFragmentBase extends Fragment implements View.O
@Override
public void onChange(boolean selfChange) {
mThrottle.onEvent();
if (mRegistered) {
mThrottle.onEvent();
}
}
/** This method is delay-called by {@link Throttle} on the UI thread. */