summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-07-27 15:36:29 -0700
committerYorke Lee <yorkelee@google.com>2015-07-27 15:36:29 -0700
commit601eadd8518b2a3683c50850af2a6db8147ec61a (patch)
tree39a59107b2d33feb1b99c444f36ea19ac150987d /src
parent3f468007170d180663af54d2380046f0c2f04543 (diff)
Remove onPreDrawListener logic
A bug in the PreDrawListener code was causing it to not be removed from the ViewTreeObserver. This means that everytime a view was rebound, another onPreDraw listener callback would be added but never removed. Compounding the problem is that in each callback, a costly permission check via IPC is done, causing each frame to slow down increasingly as more views are bound. In practice, these PreDrawListeners are no longer needed as they were only used to prime the Contact info query thread, which happens via other code paths anyway. Bug: 22759147 Change-Id: Ica2a31c0849c2eb34ac6f77d49cf23cbe32c6941
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java33
1 files changed, 1 insertions, 32 deletions
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 9609e4d6f..54552914a 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -65,8 +65,7 @@ import java.util.HashMap;
* Adapter class to fill in data for the Call Log.
*/
public class CallLogAdapter extends GroupingListAdapter
- implements ViewTreeObserver.OnPreDrawListener,
- CallLogGroupBuilder.GroupCreator,
+ implements CallLogGroupBuilder.GroupCreator,
VoicemailPlaybackPresenter.OnVoicemailDeletedListener {
/** Interface used to initiate a refresh of the content. */
@@ -96,7 +95,6 @@ public class CallLogAdapter extends GroupingListAdapter
private final ContactInfoHelper mContactInfoHelper;
private final VoicemailPlaybackPresenter mVoicemailPlaybackPresenter;
private final CallFetcher mCallFetcher;
- private ViewTreeObserver mViewTreeObserver = null;
protected ContactInfoCache mContactInfoCache;
@@ -294,16 +292,6 @@ public class CallLogAdapter extends GroupingListAdapter
}
};
- @Override
- public boolean onPreDraw() {
- // We only wanted to listen for the first draw (and this is it).
- unregisterPreDrawListener();
- if (PermissionsUtil.hasContactsPermissions(mContext)) {
- mContactInfoCache.start();
- }
- return true;
- }
-
public CallLogAdapter(
Context context,
CallFetcher callFetcher,
@@ -375,21 +363,8 @@ public class CallLogAdapter extends GroupingListAdapter
}
}
- /**
- * Stop receiving onPreDraw() notifications.
- */
- private void unregisterPreDrawListener() {
- if (mViewTreeObserver != null && mViewTreeObserver.isAlive()) {
- mViewTreeObserver.removeOnPreDrawListener(this);
- }
- mViewTreeObserver = null;
- }
-
public void invalidateCache() {
mContactInfoCache.invalidate();
-
- // Restart the request-processing thread after the next draw.
- unregisterPreDrawListener();
}
public void pauseCache() {
@@ -585,12 +560,6 @@ public class CallLogAdapter extends GroupingListAdapter
isVoicemailNumber, mContactInfoHelper.isBusiness(info.sourceType));
mCallLogListItemHelper.setPhoneCallDetails(views, details);
-
- // Listen for the first draw
- if (mViewTreeObserver == null) {
- mViewTreeObserver = views.rootView.getViewTreeObserver();
- mViewTreeObserver.addOnPreDrawListener(this);
- }
}
@Override