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

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

Snap for 4661748 from 4a54a2fd to qt-release

Change-Id: Ic05cb34c38b21fb74898c0eb813dad9b2ca15e03
parents feb305ba 4a54a2fd
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2018 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License
  -->

<!-- A custom-made "unblock" icon for Dialer -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0"
    android:tint="?attr/colorControlNormal">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M12,2C17.52,2 22,6.48 22,12C22,17.52 17.52,22 12,22C6.48,22 2,17.52 2,12C2,6.48 6.48,2 12,2ZM12,4C7.584,4 4,7.584 4,12C4,16.416 7.584,20 12,20C16.416,20 20,16.416 20,12C20,7.584 16.416,4 12,4ZM16.5,6.086L17.914,7.5L16.5,8.914L15.086,7.5L16.5,6.086ZM13.5,9.086L14.914,10.5L13.5,11.914L12.086,10.5L13.5,9.086ZM10.5,12.086L11.914,13.5L10.5,14.914L9.086,13.5L10.5,12.086ZM7.5,15.086L8.914,16.5L7.5,17.914L6.086,16.5L7.5,15.086Z"/>
</vector>
+47 −46
Original line number Diff line number Diff line
@@ -94,6 +94,49 @@ public class PhoneCallDetailsHelper
    calendar = Calendar.getInstance();
  }

  static boolean shouldShowVoicemailDonationPromo(
      Context context, PhoneAccountHandle accountHandle) {
    VoicemailClient client = VoicemailComponent.get(context).getVoicemailClient();
    return client.isVoicemailDonationAvailable(context, accountHandle)
        && !hasSeenVoicemailDonationPromo(context);
  }

  static boolean hasSeenVoicemailDonationPromo(Context context) {
    return StorageComponent.get(context.getApplicationContext())
        .unencryptedSharedPrefs()
        .getBoolean(PREF_VOICEMAIL_DONATION_PROMO_SHOWN_KEY, false);
  }

  private static int dpsToPixels(Context context, int dps) {
    return (int)
        (TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, dps, context.getResources().getDisplayMetrics()));
  }

  private static void recordPromoShown(Context context) {
    StorageComponent.get(context.getApplicationContext())
        .unencryptedSharedPrefs()
        .edit()
        .putBoolean(PREF_VOICEMAIL_DONATION_PROMO_SHOWN_KEY, true)
        .apply();
  }

  /** Returns true if primary name is empty or the data is from Cequint Caller ID. */
  private static boolean shouldShowLocation(PhoneCallDetails details) {
    if (TextUtils.isEmpty(details.geocode)) {
      return false;
    }
    // For caller ID provided by Cequint we want to show the geo location.
    if (details.sourceType == ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID) {
      return true;
    }
    // Don't bother showing geo location for contacts.
    if (!TextUtils.isEmpty(details.namePrimary)) {
      return false;
    }
    return true;
  }

  /** Fills the call details views with content. */
  public void setPhoneCallDetails(PhoneCallDetailsViews views, PhoneCallDetails details) {
    // Display up to a given number of icons.
@@ -250,9 +293,10 @@ public class PhoneCallDetailsHelper
      return true;
    }

    // Also show the rating option if voicemail transcription is available (but not enabled)
    // Also show the rating option if voicemail donation is available (but not enabled)
    // and the donation promo has not yet been shown.
    if (client.isVoicemailDonationAvailable(context) && !hasSeenVoicemailDonationPromo(context)) {
    if (client.isVoicemailDonationAvailable(context, account)
        && !hasSeenVoicemailDonationPromo(context)) {
      return true;
    }

@@ -263,7 +307,7 @@ public class PhoneCallDetailsHelper
      TranscriptionRatingValue ratingValue, PhoneCallDetails details, View ratingView) {
    LogUtil.enterBlock("PhoneCallDetailsHelper.recordTranscriptionRating");

    if (shouldShowVoicemailDonationPromo(context)) {
    if (shouldShowVoicemailDonationPromo(context, details.accountHandle)) {
      showVoicemailDonationPromo(ratingValue, details, ratingView);
    } else {
      TranscriptionRatingHelper.sendRating(
@@ -275,19 +319,6 @@ public class PhoneCallDetailsHelper
    }
  }

  static boolean shouldShowVoicemailDonationPromo(Context context) {
    VoicemailClient client = VoicemailComponent.get(context).getVoicemailClient();
    return client.isVoicemailTranscriptionAvailable(context)
        && client.isVoicemailDonationAvailable(context)
        && !hasSeenVoicemailDonationPromo(context);
  }

  static boolean hasSeenVoicemailDonationPromo(Context context) {
    return StorageComponent.get(context.getApplicationContext())
        .unencryptedSharedPrefs()
        .getBoolean(PREF_VOICEMAIL_DONATION_PROMO_SHOWN_KEY, false);
  }

  private void showVoicemailDonationPromo(
      TranscriptionRatingValue ratingValue, PhoneCallDetails details, View ratingView) {
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
@@ -360,20 +391,6 @@ public class PhoneCallDetailsHelper
    }
  }

  private static int dpsToPixels(Context context, int dps) {
    return (int)
        (TypedValue.applyDimension(
            TypedValue.COMPLEX_UNIT_DIP, dps, context.getResources().getDisplayMetrics()));
  }

  private static void recordPromoShown(Context context) {
    StorageComponent.get(context.getApplicationContext())
        .unencryptedSharedPrefs()
        .edit()
        .putBoolean(PREF_VOICEMAIL_DONATION_PROMO_SHOWN_KEY, true)
        .apply();
  }

  private SpannableString getVoicemailDonationPromoContent() {
    return new ContentWithLearnMoreSpanner(context)
        .create(
@@ -462,22 +479,6 @@ public class PhoneCallDetailsHelper
    return numberFormattedLabel;
  }

  /** Returns true if primary name is empty or the data is from Cequint Caller ID. */
  private static boolean shouldShowLocation(PhoneCallDetails details) {
    if (TextUtils.isEmpty(details.geocode)) {
      return false;
    }
    // For caller ID provided by Cequint we want to show the geo location.
    if (details.sourceType == ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID) {
      return true;
    }
    // Don't bother showing geo location for contacts.
    if (!TextUtils.isEmpty(details.namePrimary)) {
      return false;
    }
    return true;
  }

  public void setPhoneTypeLabelForTest(CharSequence phoneTypeLabel) {
    this.phoneTypeLabelForTest = phoneTypeLabel;
  }
+3 −1
Original line number Diff line number Diff line
@@ -151,8 +151,10 @@ public class VisualVoicemailCallLogFragment extends CallLogFragment {
  @Override
  public void fetchCalls() {
    super.fetchCalls();
    if (FragmentUtils.getParent(this, CallLogFragmentListener.class) != null) {
      FragmentUtils.getParentUnsafe(this, CallLogFragmentListener.class).updateTabUnreadCounts();
    }
  }

  @Override
  public void onVisible() {
+3 −4
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
      android:exported="false"
      android:label="@string/dialer_settings_label"
      android:name="com.android.dialer.app.settings.DialerSettingsActivity"
      android:parentActivityName="com.android.dialer.app.DialtactsActivity"
      android:parentActivityName="com.android.dialer.main.impl.MainActivity"
      android:theme="@style/SettingsStyle">
      <intent-filter>
        <action android:name="android.intent.action.VIEW" />
@@ -38,6 +38,7 @@
         stateAlwaysHidden is set to suppress keyboard show up on
         dialpad screen. -->
    <activity
      android:enabled="false"
      android:clearTaskOnLaunch="true"
      android:directBootAware="true"
      android:label="@string/launcherActivityLabel"
@@ -46,7 +47,6 @@
      android:resizeableActivity="true"
      android:theme="@style/DialtactsActivityTheme"
      android:windowSoftInputMode="stateAlwaysHidden|adjustNothing">

      <intent-filter>
        <action android:name="android.intent.action.DIAL"/>

@@ -113,7 +113,6 @@
        <category android:name="android.intent.category.TAB"/>
      </intent-filter>


      <meta-data
        android:name="com.android.keyguard.layout"
        android:resource="@layout/keyguard_preview"/>
@@ -122,7 +121,7 @@
    <activity-alias
        android:exported="true"
        android:name="com.android.dialer.DialtactsActivity"
        android:targetActivity="com.android.dialer.app.DialtactsActivity"/>
        android:targetActivity="com.android.dialer.main.impl.MainActivity"/>

  </application>

+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ public class SharedModules {
      @Override
      public int getDrawableId() {
        return isBlocked
            ? R.drawable.bottomsheet_unblock // TODO(a bug): use a vector icon
            ? R.drawable.quantum_ic_unblock_vd_theme_24
            : R.drawable.quantum_ic_block_vd_theme_24;
      }

Loading