From 83b20211c3be04a850de3674977deee8e448d17f Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Wed, 31 May 2017 08:53:10 -0700 Subject: Update Dialer to v10 RC45. This release was created following the instructions at: go/dialer-aosp-release Subsequent dialer releases will follow as O bugs are fixed, until we reach our final RC. Version: 10 Candidate: RC45 Branch: dialer-android_release_branch/153304843.1 dialer-android_20170416.00/dialer-android_20170416.00_RC45 This release contains the following bug fixes since RC39: Bug: 38131932 38302993 38347350 38368993 38395481 62100344 Test: make, on device Change-Id: Ib4af5dcc58c684d51ea1f4628b301e40184b81b3 --- .../dialer/app/calllog/CallLogAsyncTaskUtil.java | 14 +++++++++----- .../android/dialer/blocking/FilteredNumberCompat.java | 3 ++- .../android/dialer/blocking/FilteredNumbersUtil.java | 15 +++++++++------ .../notification/NotificationChannelManager.java | 4 +++- java/com/android/dialer/postcall/PostCall.java | 18 +++++++++--------- 5 files changed, 32 insertions(+), 22 deletions(-) (limited to 'java/com/android/dialer') diff --git a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java index a58357448..a5553d134 100644 --- a/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java +++ b/java/com/android/dialer/app/calllog/CallLogAsyncTaskUtil.java @@ -56,11 +56,15 @@ public class CallLogAsyncTaskUtil { public Void doInBackground(Void... params) { ContentValues values = new ContentValues(); values.put(Voicemails.IS_READ, true); - context - .getContentResolver() - .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null); - - uploadVoicemailLocalChangesToServer(context); + // "External" changes to the database will be automatically marked as dirty, but this + // voicemail might be from dialer so it need to be marked manually. + values.put(Voicemails.DIRTY, 1); + if (context + .getContentResolver() + .update(voicemailUri, values, Voicemails.IS_READ + " = 0", null) + > 0) { + uploadVoicemailLocalChangesToServer(context); + } Intent intent = new Intent(context, CallLogNotificationsService.class); intent.setAction(CallLogNotificationsService.ACTION_MARK_NEW_VOICEMAILS_AS_OLD); diff --git a/java/com/android/dialer/blocking/FilteredNumberCompat.java b/java/com/android/dialer/blocking/FilteredNumberCompat.java index 0ee85d897..9e0112762 100644 --- a/java/com/android/dialer/blocking/FilteredNumberCompat.java +++ b/java/com/android/dialer/blocking/FilteredNumberCompat.java @@ -275,7 +275,8 @@ public class FilteredNumberCompat { && safeBlockedNumbersContractCanCurrentUserBlockNumbers(context); } - static void setCanAttemptBlockOperationsForTest(boolean canAttempt) { + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public static void setCanAttemptBlockOperationsForTest(boolean canAttempt) { canAttemptBlockOperationsForTest = canAttempt; } diff --git a/java/com/android/dialer/blocking/FilteredNumbersUtil.java b/java/com/android/dialer/blocking/FilteredNumbersUtil.java index 3c001a2c2..cdcf1f78d 100644 --- a/java/com/android/dialer/blocking/FilteredNumbersUtil.java +++ b/java/com/android/dialer/blocking/FilteredNumbersUtil.java @@ -22,12 +22,12 @@ import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.os.AsyncTask; -import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; import android.provider.Settings; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; +import android.support.v4.os.UserManagerCompat; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.widget.Toast; @@ -39,6 +39,7 @@ import com.android.dialer.notification.NotificationChannelManager; import com.android.dialer.notification.NotificationChannelManager.Channel; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.PermissionsUtil; +import java.util.concurrent.TimeUnit; /** Utility to help with tasks related to filtered numbers. */ public class FilteredNumbersUtil { @@ -54,7 +55,7 @@ public class FilteredNumbersUtil { protected static final String NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY = "notified_call_blocking_disabled_by_emergency_call"; // Disable incoming call blocking if there was a call within the past 2 days. - private static final long RECENT_EMERGENCY_CALL_THRESHOLD_MS = 1000 * 60 * 60 * 24 * 2; + static final long RECENT_EMERGENCY_CALL_THRESHOLD_MS = TimeUnit.DAYS.toMillis(2); /** * Used for testing to specify the custom threshold value, in milliseconds for whether an @@ -210,13 +211,15 @@ public class FilteredNumbersUtil { return; } - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putLong(LAST_EMERGENCY_CALL_MS_PREF_KEY, System.currentTimeMillis()) .putBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false) .apply(); - maybeNotifyCallBlockingDisabled(context); + if (UserManagerCompat.isUserUnlocked(context)) { + maybeNotifyCallBlockingDisabled(context); + } } public static void maybeNotifyCallBlockingDisabled(final Context context) { @@ -225,7 +228,7 @@ public class FilteredNumbersUtil { return; } // Skip if the user has already received a notification for the most recent emergency call. - if (PreferenceManager.getDefaultSharedPreferences(context) + if (DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, false)) { return; } @@ -265,7 +268,7 @@ public class FilteredNumbersUtil { builder.build()); // Record that the user has been notified for this emergency call. - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putBoolean(NOTIFIED_CALL_BLOCKING_DISABLED_BY_EMERGENCY_CALL_PREF_KEY, true) .apply(); diff --git a/java/com/android/dialer/notification/NotificationChannelManager.java b/java/com/android/dialer/notification/NotificationChannelManager.java index 599e5ca59..88679066d 100644 --- a/java/com/android/dialer/notification/NotificationChannelManager.java +++ b/java/com/android/dialer/notification/NotificationChannelManager.java @@ -312,7 +312,9 @@ public class NotificationChannelManager { importance = NotificationManager.IMPORTANCE_DEFAULT; canShowBadge = true; lights = true; - vibration = true; + vibration = + TelephonyManagerCompat.isVoicemailVibrationEnabled( + getTelephonyManager(context), phoneAccountHandle); sound = TelephonyManagerCompat.getVoicemailRingtoneUri( getTelephonyManager(context), phoneAccountHandle); diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index edc07baf5..586b47395 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -20,7 +20,6 @@ import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.design.widget.BaseTransientBottomBar.BaseCallback; import android.support.design.widget.Snackbar; @@ -101,7 +100,7 @@ public class PostCall { activity.getResources().getColor(R.color.dialer_snackbar_action_text_color)); activeSnackbar.show(); Logger.get(activity).logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE); - PreferenceManager.getDefaultSharedPreferences(activity) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity) .edit() .remove(KEY_POST_CALL_CALL_DISCONNECT_TIME) .apply(); @@ -138,14 +137,14 @@ public class PostCall { activeSnackbar.show(); Logger.get(activity) .logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE); - PreferenceManager.getDefaultSharedPreferences(activity) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(activity) .edit() .remove(KEY_POST_CALL_MESSAGE_SENT) .apply(); } public static void onCallDisconnected(Context context, String number, long callConnectedMillis) { - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putLong(KEY_POST_CALL_CALL_CONNECT_TIME, callConnectedMillis) .putLong(KEY_POST_CALL_CALL_DISCONNECT_TIME, System.currentTimeMillis()) @@ -154,7 +153,7 @@ public class PostCall { } public static void onMessageSent(Context context, String number) { - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .putString(KEY_POST_CALL_CALL_NUMBER, number) .putBoolean(KEY_POST_CALL_MESSAGE_SENT, true) @@ -164,7 +163,7 @@ public class PostCall { private static void clear(Context context) { activeSnackbar = null; - PreferenceManager.getDefaultSharedPreferences(context) + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() .remove(KEY_POST_CALL_CALL_DISCONNECT_TIME) .remove(KEY_POST_CALL_CALL_NUMBER) @@ -174,7 +173,8 @@ public class PostCall { } private static boolean shouldPromptUserToSendMessage(Context context) { - SharedPreferences manager = PreferenceManager.getDefaultSharedPreferences(context); + SharedPreferences manager = + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context); long disconnectTimeMillis = manager.getLong(KEY_POST_CALL_CALL_DISCONNECT_TIME, -1); long connectTimeMillis = manager.getLong(KEY_POST_CALL_CALL_CONNECT_TIME, -1); @@ -192,13 +192,13 @@ public class PostCall { } private static boolean shouldPromptUserToViewSentMessage(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) + return DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getBoolean(KEY_POST_CALL_MESSAGE_SENT, false); } @Nullable private static String getPhoneNumber(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) + return DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .getString(KEY_POST_CALL_CALL_NUMBER, null); } -- cgit v1.2.3