diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-24 22:41:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-24 22:41:00 +0000 |
commit | daa1c44c00f3c598223639c9b80a52cf41db51ba (patch) | |
tree | e4c88a1862b157dc858abe73e52b077bf7b96948 /java/com/android/dialer/app | |
parent | ef7338cf787301c573fde8129bf8880d7faba040 (diff) | |
parent | 938468da6f5c225ebb161a68bd949c9cf3261892 (diff) |
Merge "Rename the new bubble package name from "bubble" to "newbubble"."
Diffstat (limited to 'java/com/android/dialer/app')
21 files changed, 384 insertions, 69 deletions
diff --git a/java/com/android/dialer/app/DialtactsActivity.java b/java/com/android/dialer/app/DialtactsActivity.java index b96b127e2..5f4b62c22 100644 --- a/java/com/android/dialer/app/DialtactsActivity.java +++ b/java/com/android/dialer/app/DialtactsActivity.java @@ -1163,7 +1163,7 @@ public class DialtactsActivity extends TransactionSafeActivity LogUtil.i("DialtactsActivity.enterSearchUi", "smart dial: %b", smartDialSearch); if (mStateSaved || getFragmentManager().isDestroyed()) { // Weird race condition where fragment is doing work after the activity is destroyed - // due to talkback being on (b/10209937). Just return since we can't do any + // due to talkback being on (a bug). Just return since we can't do any // constructive here. LogUtil.i( "DialtactsActivity.enterSearchUi", diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java index 016bce322..589029827 100644 --- a/java/com/android/dialer/app/calllog/CallLogAdapter.java +++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java @@ -361,7 +361,7 @@ public class CallLogAdapter extends GroupingListAdapter "mExpandCollapseListener.onClick", "%s is temporarily unavailable, requesting capabilities", LogUtil.sanitizePhoneNumber(viewHolder.number)); - // Refresh the capabilities when temporarily unavailable, see go/ec-temp-unavailable. + // Refresh the capabilities when temporarily unavailable. // Similarly to when we request capabilities the first time, the 'Share and call' button // won't pop in with the new capabilities. Instead the row needs to be collapsed and // expanded again. diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index 78ec7a695..c0d30f53a 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -103,7 +103,7 @@ public class CallLogAsyncTaskUtil { ContentValues values = new ContentValues(); values.put(Voicemails.DELETED, "1"); context.getContentResolver().update(voicemailUri, values, null, null); - // TODO(b/35440541): check which source package is changed. Don't need + // TODO(a bug): check which source package is changed. Don't need // to upload changes on foreign voicemails, they will get a PROVIDER_CHANGED uploadVoicemailLocalChangesToServer(context); } diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index d5dfb06dc..fa73bb251 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -536,8 +536,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder CallIntentBuilder.increaseLightbringerCallButtonAppearInCollapsedCallLogItemCount(); primaryActionButtonView.setTag(IntentProvider.getDuoVideoIntentProvider(number)); } else { - primaryActionButtonView.setTag( - IntentProvider.getReturnVideoCallIntentProvider(number, accountHandle)); + primaryActionButtonView.setTag(IntentProvider.getReturnVideoCallIntentProvider(number)); } primaryActionButtonView.setContentDescription( TextUtils.expandTemplate( @@ -793,7 +792,7 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder if (show) { if (!isLoaded) { - // b/31268128 for some unidentified reason showActions() can be called before the item is + // a bug for some unidentified reason showActions() can be called before the item is // loaded, causing NPE on uninitialized fields. Just log and return here, showActions() will // be called again once the item is loaded. LogUtil.e( diff --git a/java/com/android/dialer/app/calllog/MissedCallNotifier.java b/java/com/android/dialer/app/calllog/MissedCallNotifier.java index fff68d4c4..8e09cf8df 100644 --- a/java/com/android/dialer/app/calllog/MissedCallNotifier.java +++ b/java/com/android/dialer/app/calllog/MissedCallNotifier.java @@ -470,7 +470,7 @@ public class MissedCallNotifier implements Worker<Pair<Integer, String>, Void> { private PendingIntent createCallLogPendingIntent(@Nullable Uri callUri) { Intent contentIntent = DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_HISTORY); - // TODO (b/35486204): scroll to call + // TODO (a bug): scroll to call contentIntent.setData(callUri); return PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT); } diff --git a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java index 4fc956fa8..f9cb4bf6c 100644 --- a/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java +++ b/java/com/android/dialer/app/calllog/VisualVoicemailNotifier.java @@ -274,7 +274,7 @@ final class VisualVoicemailNotifier { @NonNull Context context, @Nullable NewCall voicemail) { Intent intent = DialtactsActivity.getShowTabIntent(context, DialtactsPagerAdapter.TAB_INDEX_VOICEMAIL); - // TODO (b/35486204): scroll to this voicemail + // TODO (a bug): scroll to this voicemail if (voicemail != null) { intent.setData(voicemail.voicemailUri); } diff --git a/java/com/android/dialer/app/list/RemoveView.java b/java/com/android/dialer/app/list/RemoveView.java index 1d566c5a0..244f2da24 100644 --- a/java/com/android/dialer/app/list/RemoveView.java +++ b/java/com/android/dialer/app/list/RemoveView.java @@ -68,7 +68,7 @@ public class RemoveView extends FrameLayout { switch (action) { case DragEvent.ACTION_DRAG_ENTERED: // TODO: This is temporary solution and should be removed once accessibility for - // drag and drop is supported by framework(b/26871588). + // drag and drop is supported by framework(a bug). sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT); setAppearanceHighlighted(); break; diff --git a/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml b/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml index 0729d7293..9e08f5f5d 100644 --- a/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml +++ b/java/com/android/dialer/app/manifests/activities/AndroidManifest.xml @@ -27,6 +27,11 @@ android:name="com.android.dialer.app.settings.DialerSettingsActivity" android:parentActivityName="com.android.dialer.app.DialtactsActivity" android:theme="@style/SettingsStyle"> + <intent-filter> + <action android:name="android.intent.action.VIEW" /> + <category android:name="android.intent.category.DEFAULT"/> + <data android:scheme="header"/> + </intent-filter> </activity> <!-- The entrance point for Phone UI. @@ -41,7 +46,7 @@ android:resizeableActivity="true" android:theme="@style/DialtactsActivityTheme" android:windowSoftInputMode="stateAlwaysHidden|adjustNothing"> - <!-- LINT.IfChange --> + <intent-filter> <action android:name="android.intent.action.DIAL"/> @@ -107,7 +112,7 @@ <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.TAB"/> </intent-filter> - <!-- LINT.ThenChange(//depot/google3/third_party/java_src/android_app/dialer/java/com/android/dialer/dialtacts/impl/AndroidManifest.xml) --> + <meta-data android:name="com.android.keyguard.layout" diff --git a/java/com/android/dialer/app/res/layout/call_log_list_item.xml b/java/com/android/dialer/app/res/layout/call_log_list_item.xml index 4382008d4..e0f9e63b4 100644 --- a/java/com/android/dialer/app/res/layout/call_log_list_item.xml +++ b/java/com/android/dialer/app/res/layout/call_log_list_item.xml @@ -162,6 +162,8 @@ android:layout_height="wrap_content" android:textColor="@color/call_log_voicemail_transcript_color" android:textSize="@dimen/call_log_voicemail_transcription_text_size" + android:focusable="true" + android:nextFocusDown="@+id/voicemail_transcription_branding" android:textIsSelectable="true"/> <TextView @@ -170,6 +172,8 @@ android:layout_height="wrap_content" android:textColor="@color/call_log_voicemail_transcript_branding_color" android:textSize="@dimen/call_log_voicemail_transcription_text_size" + android:focusable="true" + android:nextFocusUp="@id/voicemail_transcription" android:paddingTop="2dp"/> </LinearLayout> diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java index 706f0985a..89c69ca45 100644 --- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java +++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java @@ -18,6 +18,7 @@ package com.android.dialer.app.settings; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.os.Bundle; @@ -51,11 +52,28 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { protected SharedPreferences mPreferences; private boolean migrationStatusOnBuildHeaders; + private List<Header> headers; @Override protected void onCreate(Bundle savedInstanceState) { + LogUtil.enterBlock("DialerSettingsActivity.onCreate"); super.onCreate(savedInstanceState); mPreferences = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()); + + Intent intent = getIntent(); + Uri data = intent.getData(); + if (data != null) { + String headerToOpen = data.getSchemeSpecificPart(); + if (headerToOpen != null && headers != null) { + for (Header header : headers) { + if (headerToOpen.equals(header.fragment)) { + LogUtil.i("DialerSettingsActivity.onCreate", "switching to header: " + headerToOpen); + switchToHeader(header); + break; + } + } + } + } } @Override @@ -72,6 +90,9 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { @Override public void onBuildHeaders(List<Header> target) { + // Keep a reference to the list of headers (since PreferenceActivity.getHeaders() is @Hide) + headers = target; + if (showDisplayOptions()) { Header displayOptionsHeader = new Header(); displayOptionsHeader.titleRes = R.string.display_options_title; diff --git a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java index bc6ffb5a7..39ef3fab8 100644 --- a/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java +++ b/java/com/android/dialer/app/voicemail/VoicemailErrorManager.java @@ -92,7 +92,7 @@ public class VoicemailErrorManager implements CallLogQueryHandler.Listener, Voic } } alertItem.updateStatus(statuses, this); - // TODO(twyen): b/30668323 support error from multiple sources. + // TODO(twyen): a bug support error from multiple sources. return; } diff --git a/java/com/android/dialer/app/voicemail/error/AndroidManifest.xml b/java/com/android/dialer/app/voicemail/error/AndroidManifest.xml index 65d043034..bb6c55f5c 100644 --- a/java/com/android/dialer/app/voicemail/error/AndroidManifest.xml +++ b/java/com/android/dialer/app/voicemail/error/AndroidManifest.xml @@ -1,5 +1,29 @@ +<!-- Copyright (C) 2017 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. +--> + <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.dialer.app.voicemail.error"> <uses-permission android:name="android.permission.CALL_PHONE"/> + + <application> + <receiver android:name=".PackageReplacedReceiver" android:exported="false"> + <intent-filter> + <action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> + </intent-filter> + </receiver> + </application> + </manifest> diff --git a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java index 79e038332..9c8b1469e 100644 --- a/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/OmtpVoicemailMessageCreator.java @@ -129,7 +129,7 @@ public class OmtpVoicemailMessageCreator { VoicemailErrorMessage.createRetryAction(context, status)); } - // This should be an assertion error, but there's a bug in NYC-DR (b/31069259) that will + // This should be an assertion error, but there's a bug in NYC-DR (a bug) that will // sometimes give status mixed from multiple SIMs. There's no meaningful message to be displayed // from it, so just suppress the message. LogUtil.e("OmtpVoicemailMessageCreator.create", "Unhandled status: " + status); diff --git a/java/com/android/dialer/app/voicemail/error/PackageReplacedReceiver.java b/java/com/android/dialer/app/voicemail/error/PackageReplacedReceiver.java new file mode 100644 index 000000000..64d72b18f --- /dev/null +++ b/java/com/android/dialer/app/voicemail/error/PackageReplacedReceiver.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2017 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 + */ + +package com.android.dialer.app.voicemail.error; + +import android.annotation.TargetApi; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.net.Uri; +import android.preference.PreferenceManager; +import android.provider.CallLog.Calls; +import android.provider.VoicemailContract.Voicemails; +import com.android.dialer.common.LogUtil; +import com.android.dialer.common.concurrent.DialerExecutor.Worker; +import com.android.dialer.common.concurrent.DialerExecutorComponent; + +/** Receives MY_PACKAGE_REPLACED to check for legacy voicemail users. */ +public class PackageReplacedReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + LogUtil.enterBlock("PackageReplacedReceiver.onReceive"); + + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + if (!prefs.contains(VoicemailTosMessageCreator.PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY)) { + setVoicemailFeatureVersionAsync(context); + } + } + + private void setVoicemailFeatureVersionAsync(Context context) { + LogUtil.enterBlock("PackageReplacedReceiver.setVoicemailFeatureVersionAsync"); + + // Check if user is already using voicemail (ie do they have any voicemails), and set the + // acknowledged feature value accordingly. + PendingResult pendingResult = goAsync(); + DialerExecutorComponent.get(context) + .dialerExecutorFactory() + .createNonUiTaskBuilder(new ExistingVoicemailCheck(context)) + .onSuccess( + output -> { + LogUtil.i("PackageReplacedReceiver.setVoicemailFeatureVersionAsync", "success"); + pendingResult.finish(); + }) + .onFailure( + throwable -> { + LogUtil.i("PackageReplacedReceiver.setVoicemailFeatureVersionAsync", "failure"); + pendingResult.finish(); + }) + .build() + .executeParallel(null); + } + + private static class ExistingVoicemailCheck implements Worker<Void, Void> { + private static final String[] PROJECTION = new String[] {Voicemails._ID}; + + private final Context context; + + ExistingVoicemailCheck(Context context) { + this.context = context; + } + + @TargetApi(android.os.Build.VERSION_CODES.M) // used for try with resources + @Override + public Void doInBackground(Void arg) throws Throwable { + LogUtil.i("PackageReplacedReceiver.ExistingVoicemailCheck.doInBackground", ""); + + // Check the database for existing voicemails. + boolean hasVoicemails = false; + Uri uri = Voicemails.buildSourceUri(context.getPackageName()); + String whereClause = Calls.TYPE + " = " + Calls.VOICEMAIL_TYPE; + try (Cursor cursor = + context.getContentResolver().query(uri, PROJECTION, whereClause, null, null)) { + if (cursor == null) { + LogUtil.e( + "PackageReplacedReceiver.ExistingVoicemailCheck.doInBackground", + "failed to check for existing voicemails"); + } else if (cursor.moveToNext()) { + hasVoicemails = true; + } + } + + LogUtil.i( + "PackageReplacedReceiver.ExistingVoicemailCheck.doInBackground", + "has voicemails: " + hasVoicemails); + int version = hasVoicemails ? VoicemailTosMessageCreator.LEGACY_VOICEMAIL_FEATURE_VERSION : 0; + PreferenceManager.getDefaultSharedPreferences(context) + .edit() + .putInt(VoicemailTosMessageCreator.PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY, version) + .apply(); + return null; + } + } +} diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailStatusCorruptionHandler.java b/java/com/android/dialer/app/voicemail/error/VoicemailStatusCorruptionHandler.java index bbba7ac76..b357f9a4d 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailStatusCorruptionHandler.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailStatusCorruptionHandler.java @@ -82,7 +82,7 @@ public class VoicemailStatusCorruptionHandler { // If visual voicemail is enabled, the CONFIGURATION_STATE should be either OK, PIN_NOT_SET, // or other failure code. CONFIGURATION_STATE_NOT_CONFIGURED means that the client has been - // shut down improperly (b/32371710). The client should be reset or the VVM tab will be + // shut down improperly (a bug). The client should be reset or the VVM tab will be // missing. if (Status.CONFIGURATION_STATE_NOT_CONFIGURED == status.configurationState && visualVoicemailEnabled) { diff --git a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java index 63ebd1959..96850ad02 100644 --- a/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/VoicemailTosMessageCreator.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Build; import android.preference.PreferenceManager; import android.support.annotation.Nullable; @@ -40,6 +41,7 @@ import com.android.dialer.app.voicemail.error.VoicemailErrorMessage.Action; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.configprovider.ConfigProviderBindings; +import com.android.dialer.constants.Constants; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.voicemail.VisualVoicemailTypeExtensions; @@ -52,14 +54,21 @@ import java.util.Locale; * terms of service for Verizon and for other carriers. */ public class VoicemailTosMessageCreator { - // Flag to check which version of the Verizon ToS that the user has accepted. - public static final String VVM3_TOS_VERSION_ACCEPTED_KEY = "vvm3_tos_version_accepted"; + // Preference key to check which version of the Verizon ToS that the user has accepted. + static final String PREF_VVM3_TOS_VERSION_ACCEPTED_KEY = "vvm3_tos_version_accepted"; - // Flag to check which version of the Google Dialer ToS that the user has accepted. - public static final String DIALER_TOS_VERSION_ACCEPTED_KEY = "dialer_tos_version_accepted"; + // Preference key to check which version of the Google Dialer ToS that the user has accepted. + static final String PREF_DIALER_TOS_VERSION_ACCEPTED_KEY = "dialer_tos_version_accepted"; - public static final int CURRENT_VVM3_TOS_VERSION = 2; - public static final int CURRENT_DIALER_TOS_VERSION = 1; + // Preference key to check which feature version the user has acknowledged + static final String PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY = + "dialer_feature_version_acknowledged"; + + static final int CURRENT_VVM3_TOS_VERSION = 2; + static final int CURRENT_DIALER_TOS_VERSION = 1; + static final int LEGACY_VOICEMAIL_FEATURE_VERSION = 1; // original visual voicemail + static final int TRANSCRIPTION_VOICEMAIL_FEATURE_VERSION = 2; // adds voicemail transcription + static final int CURRENT_VOICEMAIL_FEATURE_VERSION = TRANSCRIPTION_VOICEMAIL_FEATURE_VERSION; private static final String ISO639_SPANISH = "es"; @@ -81,25 +90,28 @@ public class VoicemailTosMessageCreator { @Nullable VoicemailErrorMessage maybeCreateTosMessage() { - if (hasAcceptedTos()) { + if (!canShowTos()) { return null; - } - - if (!shouldShowTos()) { + } else if (shouldShowTos()) { + logTosCreatedImpression(); + return getTosMessage(); + } else if (shouldShowPromo()) { + return getPromoMessage(); + } else { return null; } + } - logTosCreatedImpression(); - + private VoicemailErrorMessage getTosMessage() { return new VoicemailTosMessage( - getTosTitle(), - getTosMessage(), + getNewUserTosTitle(), + getNewUserTosMessageText(), new Action( getDeclineText(), new OnClickListener() { @Override public void onClick(View v) { - LogUtil.i("VoicemailTosMessageCreator.maybeShowTosMessage", "decline clicked"); + LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "decline clicked"); PhoneAccountHandle handle = new PhoneAccountHandle( ComponentName.unflattenFromString(status.phoneAccountComponentName), @@ -113,8 +125,10 @@ public class VoicemailTosMessageCreator { new OnClickListener() { @Override public void onClick(View v) { - LogUtil.i("VoicemailTosMessageCreator.maybeShowTosMessage", "accept clicked"); + LogUtil.i("VoicemailTosMessageCreator.getTosMessage", "accept clicked"); recordTosAcceptance(); + // Accepting the TOS also acknowledges the latest features + recordFeatureAcknowledgement(); logTosAcceptedImpression(); statusReader.refresh(); } @@ -124,15 +138,65 @@ public class VoicemailTosMessageCreator { .setImageResourceId(R.drawable.voicemail_tos_image); } - private boolean shouldShowTos() { + private VoicemailErrorMessage getPromoMessage() { + return new VoicemailTosMessage( + getExistingUserTosTitle(), + getExistingUserTosMessageText(), + new Action( + context.getString(R.string.dialer_terms_and_conditions_existing_user_setings), + new OnClickListener() { + @Override + public void onClick(View v) { + LogUtil.i("VoicemailTosMessageCreator.getPromoMessage", "open settings"); + Intent intent = + new Intent(Intent.ACTION_VIEW) + .setComponent( + new ComponentName(context, Constants.get().getSettingsActivity())) + .setData( + Uri.fromParts( + "header", + VoicemailComponent.get(context) + .getVoicemailClient() + .getSettingsFragment(), + null)); + context.startActivity(intent); + } + }), + new Action( + context.getString(R.string.dialer_terms_and_conditions_existing_user_ack), + new OnClickListener() { + @Override + public void onClick(View v) { + LogUtil.i("VoicemailTosMessageCreator.getPromoMessage", "acknowledge clicked"); + // Feature acknowledgement also means accepting TOS + recordTosAcceptance(); + recordFeatureAcknowledgement(); + statusReader.refresh(); + } + }, + true /* raised */)) + .setModal(true) + .setImageResourceId(R.drawable.voicemail_tos_image); + } + + private boolean canShowTos() { if (!isValidVoicemailType(status.type)) { - LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "unsupported type: " + status.type); + LogUtil.i("VoicemailTosMessageCreator.canShowTos", "unsupported type: " + status.type); return false; } if (status.getPhoneAccountHandle() == null || status.getPhoneAccountHandle().getComponentName() == null) { - LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "invalid phone account"); + LogUtil.i("VoicemailTosMessageCreator.canShowTos", "invalid phone account"); + return false; + } + + return true; + } + + private boolean shouldShowTos() { + if (hasAcceptedTos()) { + LogUtil.i("VoicemailTosMessageCreator.shouldShowTos", "already accepted TOS"); return false; } @@ -141,7 +205,7 @@ public class VoicemailTosMessageCreator { return true; } - if (isVoicemailTranscriptionEnabled()) { + if (isVoicemailTranscriptionEnabled() && !isLegacyVoicemailUser()) { LogUtil.i( "VoicemailTosMessageCreator.shouldShowTos", "showing TOS for Google transcription users"); return true; @@ -150,6 +214,23 @@ public class VoicemailTosMessageCreator { return false; } + private boolean shouldShowPromo() { + if (hasAcknowledgedFeatures()) { + LogUtil.i( + "VoicemailTosMessageCreator.shouldShowPromo", "already acknowledeged latest features"); + return false; + } + + if (isVoicemailTranscriptionEnabled()) { + LogUtil.i( + "VoicemailTosMessageCreator.shouldShowPromo", + "showing promo for Google transcription users"); + return true; + } + + return false; + } + private static boolean isValidVoicemailType(String type) { if (type == null) { return false; @@ -181,6 +262,7 @@ public class VoicemailTosMessageCreator { "showing decline ToS dialog, status=" + status); final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class); AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle(R.string.terms_and_conditions_decline_dialog_title); builder.setMessage(getTosDeclinedDialogMessageId()); builder.setPositiveButton( getTosDeclinedDialogDowngradeId(), @@ -249,24 +331,49 @@ public class VoicemailTosMessageCreator { private boolean hasAcceptedTos() { if (isVvm3()) { - return preferences.getInt(VVM3_TOS_VERSION_ACCEPTED_KEY, 0) >= CURRENT_VVM3_TOS_VERSION; + return preferences.getInt(PREF_VVM3_TOS_VERSION_ACCEPTED_KEY, 0) >= CURRENT_VVM3_TOS_VERSION; } else { - return preferences.getInt(DIALER_TOS_VERSION_ACCEPTED_KEY, 0) >= CURRENT_DIALER_TOS_VERSION; + return preferences.getInt(PREF_DIALER_TOS_VERSION_ACCEPTED_KEY, 0) + >= CURRENT_DIALER_TOS_VERSION; } } private void recordTosAcceptance() { if (isVvm3()) { - preferences.edit().putInt(VVM3_TOS_VERSION_ACCEPTED_KEY, CURRENT_VVM3_TOS_VERSION).apply(); + preferences + .edit() + .putInt(PREF_VVM3_TOS_VERSION_ACCEPTED_KEY, CURRENT_VVM3_TOS_VERSION) + .apply(); } else { preferences .edit() - .putInt(DIALER_TOS_VERSION_ACCEPTED_KEY, CURRENT_DIALER_TOS_VERSION) + .putInt(PREF_DIALER_TOS_VERSION_ACCEPTED_KEY, CURRENT_DIALER_TOS_VERSION) .apply(); } VoicemailComponent.get(context).getVoicemailClient().onTosAccepted(context); } + private boolean hasAcknowledgedFeatures() { + if (isVvm3()) { + return true; + } + + return preferences.getInt(PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY, 0) + >= CURRENT_VOICEMAIL_FEATURE_VERSION; + } + + private void recordFeatureAcknowledgement() { + preferences + .edit() + .putInt(PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY, CURRENT_VOICEMAIL_FEATURE_VERSION) + .apply(); + } + + private boolean isLegacyVoicemailUser() { + return preferences.getInt(PREF_DIALER_FEATURE_VERSION_ACKNOWLEDGED_KEY, 0) + == LEGACY_VOICEMAIL_FEATURE_VERSION; + } + private void logTosCreatedImpression() { if (isVvm3()) { Logger.get(context).logImpression(DialerImpression.Type.VOICEMAIL_VVM3_TOS_V2_CREATED); @@ -299,17 +406,30 @@ public class VoicemailTosMessageCreator { : context.getString(R.string.verizon_terms_and_conditions_1_1_english, policyUrl); } - private CharSequence getDialerTos() { + private CharSequence getVvmDialerTos() { if (!isVoicemailTranscriptionEnabled()) { return ""; } - if (isVvm3()) { - return context.getString(R.string.dialer_terms_and_conditions_for_verizon_1_0); - } else { - String learnMoreText = context.getString(R.string.dialer_terms_and_conditions_learn_more); - return context.getString(R.string.dialer_terms_and_conditions_1_0, learnMoreText); + return context.getString(R.string.dialer_terms_and_conditions_for_verizon_1_0); + } + + private CharSequence getNewUserDialerTos() { + if (!isVoicemailTranscriptionEnabled()) { + return ""; + } + + String learnMoreText = context.getString(R.string.dialer_terms_and_conditions_learn_more); + return context.getString(R.string.dialer_terms_and_conditions_1_0, learnMoreText); + } + + private CharSequence getExistingUserDialerTos() { + if (!isVoicemailTranscriptionEnabled()) { + return ""; } + + String learnMoreText = context.getString(R.string.dialer_terms_and_conditions_learn_more); + return context.getString(R.string.dialer_terms_and_conditions_existing_user, learnMoreText); } private CharSequence getAcceptText() { @@ -336,13 +456,19 @@ public class VoicemailTosMessageCreator { } } - private CharSequence getTosTitle() { + private CharSequence getNewUserTosTitle() { return isVvm3() ? context.getString(R.string.verizon_terms_and_conditions_title) : context.getString(R.string.dialer_terms_and_conditions_title); } - private CharSequence getTosMessage() { + private CharSequence getExistingUserTosTitle() { + return isVvm3() + ? context.getString(R.string.verizon_terms_and_conditions_title) + : context.getString(R.string.dialer_terms_and_conditions_existing_user_title); + } + + private CharSequence getNewUserTosMessageText() { SpannableString spannableTos; if (isVvm3()) { // For verizon the TOS consist of three pieces: google dialer TOS, Verizon TOS message and @@ -350,7 +476,7 @@ public class VoicemailTosMessageCreator { CharSequence vvm3Details = getVvm3Tos(); CharSequence tos = context.getString( - R.string.verizon_terms_and_conditions_message, getDialerTos(), vvm3Details); + R.string.verizon_terms_and_conditions_message, getVvmDialerTos(), vvm3Details); spannableTos = new SpannableString(tos); // Set the text style for the details part of the TOS int start = spannableTos.length() - vvm3Details.length(); @@ -365,7 +491,7 @@ public class VoicemailTosMessageCreator { } else { // The TOS for everyone else, there are no details, but change to center alignment. CharSequence tos = - context.getString(R.string.dialer_terms_and_conditions_message, getDialerTos()); + context.getString(R.string.dialer_terms_and_conditions_message, getNewUserDialerTos()); spannableTos = new SpannableString(tos); spannableTos.setSpan( new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER), @@ -375,11 +501,27 @@ public class VoicemailTosMessageCreator { // Add 'Learn more' link for dialer TOS String learnMore = context.getString(R.string.dialer_terms_and_conditions_learn_more); - String linkUrl = context.getString(R.string.dialer_terms_and_conditions_learn_more_url); - return addLink(spannableTos, learnMore, linkUrl); + return addLink(spannableTos, learnMore, getLearnMoreUrl()); } } + private CharSequence getExistingUserTosMessageText() { + SpannableString spannableTos; + // Change to center alignment. + CharSequence tos = + context.getString(R.string.dialer_terms_and_conditions_message, getExistingUserDialerTos()); + spannableTos = new SpannableString(tos); + spannableTos.setSpan( + new AlignmentSpan.Standard(Layout.Alignment.ALIGN_CENTER), + 0, + tos.length(), + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + + // Add 'Learn more' link for dialer TOS + String learnMore = context.getString(R.string.dialer_terms_and_conditions_learn_more); + return addLink(spannableTos, learnMore, getLearnMoreUrl()); + } + private SpannableString addLink(SpannableString spannable, String linkText, String linkUrl) { if (TextUtils.isEmpty(linkUrl) || TextUtils.isEmpty(linkText)) { return spannable; @@ -398,6 +540,13 @@ public class VoicemailTosMessageCreator { return spannable; } + private String getLearnMoreUrl() { + return ConfigProviderBindings.get(context) + .getString( + "voicemail_transcription_learn_more_url", + context.getString(R.string.dialer_terms_and_conditions_learn_more_url)); + } + private int getTosDeclinedDialogMessageId() { return isVvm3() ? R.string.verizon_terms_and_conditions_decline_dialog_message diff --git a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java index 8e8106b44..748b8142a 100644 --- a/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java +++ b/java/com/android/dialer/app/voicemail/error/Vvm3VoicemailMessageCreator.java @@ -39,7 +39,7 @@ import com.android.dialer.logging.Logger; public class Vvm3VoicemailMessageCreator { // Copied from com.android.phone.vvm.omtp.protocol.Vvm3EventHandler - // TODO(b/28380841): unbundle VVM client so we can access these values directly + // TODO(a bug): unbundle VVM client so we can access these values directly public static final int VMS_DNS_FAILURE = -9001; public static final int VMG_DNS_FAILURE = -9002; public static final int SPG_DNS_FAILURE = -9003; diff --git a/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml b/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml index 184a81fec..4e143a59a 100644 --- a/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml +++ b/java/com/android/dialer/app/voicemail/error/res/layout/voicemail_tos_fragment.xml @@ -73,6 +73,7 @@ android:paddingEnd="16dp" android:paddingTop="10dp" android:paddingBottom="10dp" + android:background="#ffffffff" android:orientation="horizontal"> <TextView android:id="@+id/voicemail_tos_button_decline" @@ -82,7 +83,7 @@ android:layout_height="wrap_content" android:text="@string/verizon_terms_and_conditions_decline_english"/> <android.support.v4.widget.Space - android:layout_width="0dp" + android:layout_width="8dp" android:layout_height="match_parent" android:layout_weight="1"/> <TextView diff --git a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml index eb4877a4b..05082d8d9 100644 --- a/java/com/android/dialer/app/voicemail/error/res/values/strings.xml +++ b/java/com/android/dialer/app/voicemail/error/res/values/strings.xml @@ -140,6 +140,8 @@ <string name="verizon_terms_and_conditions_message"><xliff:g>%1$s</xliff:g> By turning on visual voicemail you agree to the Verizon Wireless terms and conditions:\n\n<xliff:g>%2$s</xliff:g></string> <string name="dialer_terms_and_conditions_title">Turn on visual voicemail</string> + + <string name="dialer_terms_and_conditions_existing_user_title">New! Read your voicemail</string> <string name="dialer_terms_and_conditions_message"><xliff:g>%s</xliff:g></string> <string translatable="false" name="verizon_terms_and_conditions_1.1_english"> @@ -173,14 +175,16 @@ Si no acepta todos estos términos y condiciones, no use el buzón de voz visual See and listen to your messages, without having to call voicemail. Transcripts of your voicemail are provided by Google’s free transcription service. <xliff:g>%s</xliff:g> </string> + <string name="dialer_terms_and_conditions_existing_user"> + Transcripts of your voicemail are now provided by Google’s free transcription service. %s + </string> + <string name="dialer_terms_and_conditions_for_verizon_1.0"> See and listen to your messages, without having to call voicemail. </string> <string name="dialer_terms_and_conditions_learn_more">Learn more</string> - - <!-- TODO(mdooley): STOP SHIP, get real url, b/65734734 --> - <string translatable="false" name="dialer_terms_and_conditions_learn_more_url">https://www.google.com</string> + <string translatable="false" name="dialer_terms_and_conditions_learn_more_url">https://support.google.com/phoneapp/answer/2811844?hl=en%26ref_topic=7539039</string> <string translatable="false" name="verizon_terms_and_conditions_policy_url">http://www.verizon.com/about/privacy/policy/</string> @@ -194,11 +198,16 @@ Si no acepta todos estos términos y condiciones, no use el buzón de voz visual <string translatable="false" name="dialer_terms_and_conditions_decline_english">No Thanks</string> <string translatable="false" name="dialer_terms_and_conditions_decline_spanish">Rechazar</string> + <string name="dialer_terms_and_conditions_existing_user_ack">Ok, got it</string> + <string name="dialer_terms_and_conditions_existing_user_setings">Settings</string> + + <string name="terms_and_conditions_decline_dialog_title">Disable visual voicemail?</string> + <string name="verizon_terms_and_conditions_decline_dialog_message">Visual voicemail will be disabled if the terms and conditions are declined.</string> - <string name="verizon_terms_and_conditions_decline_dialog_downgrade">Disable visual voicemail</string> + <string name="verizon_terms_and_conditions_decline_dialog_downgrade">Disable</string> - <string name="dialer_terms_and_conditions_decline_dialog_message">Visual voicemail will be disabled if the terms and conditions are declined.</string> - <string name="dialer_terms_and_conditions_decline_dialog_downgrade">Disable visual voicemail</string> + <string name="dialer_terms_and_conditions_decline_dialog_message">Visual voicemail will be disabled if you turn off visual voicemail.</string> + <string name="dialer_terms_and_conditions_decline_dialog_downgrade">Disable</string> <string name="verizon_terms_and_conditions_decline_set_pin_dialog_message">Voicemail will only be accessible by calling *86. Set a new voicemail PIN to proceed.</string> <string name="verizon_terms_and_conditions_decline_set_pin_dialog_set_pin">Set PIN</string> diff --git a/java/com/android/dialer/app/voicemail/error/res/values/styles.xml b/java/com/android/dialer/app/voicemail/error/res/values/styles.xml index 938c77a01..bf70240b6 100644 --- a/java/com/android/dialer/app/voicemail/error/res/values/styles.xml +++ b/java/com/android/dialer/app/voicemail/error/res/values/styles.xml @@ -20,32 +20,32 @@ <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">48dp</item> <item name="android:gravity">end|center_vertical</item> - <item name="android:paddingStart">8dp</item> - <item name="android:paddingEnd">8dp</item> <item name="android:layout_marginStart">8dp</item> <item name="android:layout_marginEnd">8dp</item> + <item name="android:padding">8dp</item> <item name="android:textColor">@color/dialer_theme_color</item> <item name="android:fontFamily">"sans-serif-medium"</item> <item name="android:focusable">true</item> <item name="android:singleLine">true</item> <item name="android:textAllCaps">true</item> <item name="android:textSize">14sp</item> + <item name="android:minHeight">48dp</item> </style> <style name="ErrorActionDeclineStyle"> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">48dp</item> <item name="android:gravity">end|center_vertical</item> - <item name="android:paddingStart">8dp</item> - <item name="android:paddingEnd">8dp</item> <item name="android:layout_marginStart">8dp</item> <item name="android:layout_marginEnd">8dp</item> - <item name="android:textColor">#80000000</item> + <item name="android:padding">8dp</item> + <item name="android:textColor">#757575</item> <item name="android:fontFamily">"sans-serif-medium"</item> <item name="android:focusable">true</item> <item name="android:singleLine">true</item> <item name="android:textAllCaps">true</item> <item name="android:textSize">14sp</item> + <item name="android:minHeight">48dp</item> </style> <style name="RaisedErrorActionStyle" parent="Widget.AppCompat.Button.Colored"> diff --git a/java/com/android/dialer/app/widget/SearchEditTextLayout.java b/java/com/android/dialer/app/widget/SearchEditTextLayout.java index e7a707feb..ebd62080b 100644 --- a/java/com/android/dialer/app/widget/SearchEditTextLayout.java +++ b/java/com/android/dialer/app/widget/SearchEditTextLayout.java @@ -51,7 +51,6 @@ public class SearchEditTextLayout extends FrameLayout { private View mCollapsedSearchBox; private View mVoiceSearchButtonView; private View mOverflowButtonView; - private View mBackButtonView; private View mClearButtonView; private ValueAnimator mAnimator; @@ -95,11 +94,6 @@ public class SearchEditTextLayout extends FrameLayout { mCollapsedSearchBox = findViewById(R.id.search_box_start_search); mVoiceSearchButtonView = findViewById(R.id.voice_search_button); mOverflowButtonView = findViewById(R.id.dialtacts_options_menu_button); - mBackButtonView = findViewById(R.id.search_back_button); - mBackButtonView - .getResources() - .getDrawable(R.drawable.quantum_ic_arrow_back_vd_theme_24, null) - .setAutoMirrored(true); mClearButtonView = findViewById(R.id.search_close_button); // Convert a long click into a click to expand the search box. Touch events are also |