Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4896ac87 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-05263112-375a-4b1f-a657-a14bb2a5c5a3-for-git_oc-mr1-release-41...

release-request-05263112-375a-4b1f-a657-a14bb2a5c5a3-for-git_oc-mr1-release-4185249 snap-temp-L63000000082739046

Change-Id: Ibe8fb2284880105220bdcd6f0c75450eb4999268
parents ece81758 a110c3f4
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ import android.content.AsyncQueryHandler;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * An {@AsyncQueryHandler} that will never return a null cursor.
@@ -27,6 +30,8 @@ import android.net.Uri;
 * <p>Instead, will return a {@link Cursor} with 0 records.
 */
public abstract class NoNullCursorAsyncQueryHandler extends AsyncQueryHandler {
  private static final AtomicInteger pendingQueryCount = new AtomicInteger();
  @Nullable private static PendingQueryCountChangedListener pendingQueryCountChangedListener;

  public NoNullCursorAsyncQueryHandler(ContentResolver cr) {
    super(cr);
@@ -41,6 +46,11 @@ public abstract class NoNullCursorAsyncQueryHandler extends AsyncQueryHandler {
      String selection,
      String[] selectionArgs,
      String orderBy) {
    pendingQueryCount.getAndIncrement();
    if (pendingQueryCountChangedListener != null) {
      pendingQueryCountChangedListener.onPendingQueryCountChanged();
    }

    final CookieWithProjection projectionCookie = new CookieWithProjection(cookie, projection);
    super.startQuery(token, projectionCookie, uri, projection, selection, selectionArgs, orderBy);
  }
@@ -55,10 +65,31 @@ public abstract class NoNullCursorAsyncQueryHandler extends AsyncQueryHandler {
      cursor = new EmptyCursor(projectionCookie.projection);
    }
    onNotNullableQueryComplete(token, projectionCookie.originalCookie, cursor);

    pendingQueryCount.getAndDecrement();
    if (pendingQueryCountChangedListener != null) {
      pendingQueryCountChangedListener.onPendingQueryCountChanged();
    }
  }

  protected abstract void onNotNullableQueryComplete(int token, Object cookie, Cursor cursor);

  @VisibleForTesting(otherwise = VisibleForTesting.NONE)
  public static void setPendingQueryCountChangedListener(
      @Nullable PendingQueryCountChangedListener listener) {
    pendingQueryCountChangedListener = listener;
  }

  @VisibleForTesting(otherwise = VisibleForTesting.NONE)
  public static int getPendingQueryCount() {
    return pendingQueryCount.get();
  }

  /** Callback to listen for changes in the number of queries that have not completed. */
  public interface PendingQueryCountChangedListener {
    void onPendingQueryCountChanged();
  }

  /** Class to add projection to an existing cookie. */
  private static class CookieWithProjection {

+11 −1
Original line number Diff line number Diff line
@@ -967,7 +967,7 @@ public class CallLogAdapter extends GroupingListAdapter
  }

  @MainThread
  private static CallDetailsEntries createCallDetailsEntries(Cursor cursor, int count) {
  private CallDetailsEntries createCallDetailsEntries(Cursor cursor, int count) {
    Assert.isMainThread();
    int position = cursor.getPosition();
    CallDetailsEntries.Builder entries = CallDetailsEntries.newBuilder();
@@ -980,6 +980,16 @@ public class CallLogAdapter extends GroupingListAdapter
              .setDate(cursor.getLong(CallLogQuery.DATE))
              .setDuration(cursor.getLong(CallLogQuery.DURATION))
              .setFeatures(cursor.getInt(CallLogQuery.FEATURES));

      String phoneAccountComponentName = cursor.getString(CallLogQuery.ACCOUNT_COMPONENT_NAME);
      if (getLightbringer().getPhoneAccountComponentName() != null
          && getLightbringer()
              .getPhoneAccountComponentName()
              .flattenToString()
              .equals(phoneAccountComponentName)) {
        entry.setIsLightbringerCall(true);
      }

      entries.addEntries(entry.build());
      cursor.moveToNext();
    }
+5 −4
Original line number Diff line number Diff line
@@ -581,12 +581,16 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
      return;
    }

    TextView callTypeOrLocationView =
        ((TextView) callButtonView.findViewById(R.id.call_type_or_location_text));

    if (canPlaceCallToNumber) {
      // Set up the call button but hide it by default (the primary action is to call so it is
      // redundant). We then set it to be visible when appropriate below. This saves us having to
      // remember to set it to GONE in multiple places.
      callButtonView.setTag(IntentProvider.getReturnCallIntentProvider(number));
      callButtonView.setVisibility(View.GONE);
      callTypeOrLocationView.setVisibility(View.GONE);
    }

    if (!TextUtils.isEmpty(voicemailUri) && canPlaceCallToNumber) {
@@ -595,13 +599,10 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
              TextUtils.expandTemplate(
                  mContext.getString(R.string.call_log_action_call),
                  nameOrNumber == null ? "" : nameOrNumber));
      TextView callTypeOrLocationView =
          ((TextView) callButtonView.findViewById(R.id.call_type_or_location_text));

      if (callType == Calls.VOICEMAIL_TYPE && !TextUtils.isEmpty(callTypeOrLocation)) {
        callTypeOrLocationView.setText(callTypeOrLocation);
        callTypeOrLocationView.setVisibility(View.VISIBLE);
      } else {
        callTypeOrLocationView.setVisibility(View.GONE);
      }
      callButtonView.setVisibility(View.VISIBLE);
    }
+1 −2
Original line number Diff line number Diff line
@@ -35,8 +35,7 @@

  <LinearLayout
    android:id="@+id/call_action"
    style="@style/CallLogActionStyle"
    android:paddingTop="@dimen/call_log_actions_top_padding">
    style="@style/CallLogActionStyle">

    <ImageView
      style="@style/CallLogActionIconStyle"
+0 −1
Original line number Diff line number Diff line
@@ -51,7 +51,6 @@
      android:background="@color/call_composer_divider"/>

  <RelativeLayout
      android:orientation="horizontal"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">

Loading