diff options
author | calderwoodra <calderwoodra@google.com> | 2017-08-09 12:45:45 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-09 17:35:38 -0700 |
commit | 3edf1abd74ee1aaeaee7d152b7658922916a4201 (patch) | |
tree | 33466ceefd359f3f9761afda19b5b47b50cf63c0 /java/com/android/dialer | |
parent | fe82fb8da514f490a785d836cd61f2b7d5622e3e (diff) |
Post call prompt now only shows if the user pressed the disconnect button.
In addition, this also fixes an issue where if a user upgrade their calls
to duo video calls quickly, they would see the post call prompt.
Bug: 62689536,64113693
Test: PostCallIntegrationTest
PiperOrigin-RevId: 164758520
Change-Id: I5f91c40e78ce1ff82521a38b0ce5898095849134
Diffstat (limited to 'java/com/android/dialer')
-rw-r--r-- | java/com/android/dialer/postcall/PostCall.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java index c4922cd02..011fbc985 100644 --- a/java/com/android/dialer/postcall/PostCall.java +++ b/java/com/android/dialer/postcall/PostCall.java @@ -46,6 +46,7 @@ public class PostCall { private static final String KEY_POST_CALL_CALL_CONNECT_TIME = "post_call_call_connect_time"; private static final String KEY_POST_CALL_CALL_NUMBER = "post_call_call_number"; private static final String KEY_POST_CALL_MESSAGE_SENT = "post_call_message_sent"; + private static final String KEY_POST_CALL_DISCONNECT_PRESSED = "post_call_disconnect_pressed"; private static Snackbar activeSnackbar; @@ -146,6 +147,13 @@ public class PostCall { .apply(); } + public static void onDisconnectPressed(Context context) { + DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) + .edit() + .putBoolean(KEY_POST_CALL_DISCONNECT_PRESSED, true) + .apply(); + } + public static void onCallDisconnected(Context context, String number, long callConnectedMillis) { DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context) .edit() @@ -185,6 +193,7 @@ public class PostCall { .remove(KEY_POST_CALL_CALL_NUMBER) .remove(KEY_POST_CALL_MESSAGE_SENT) .remove(KEY_POST_CALL_CALL_CONNECT_TIME) + .remove(KEY_POST_CALL_DISCONNECT_PRESSED) .apply(); } @@ -197,6 +206,8 @@ public class PostCall { long timeSinceDisconnect = System.currentTimeMillis() - disconnectTimeMillis; long callDurationMillis = disconnectTimeMillis - connectTimeMillis; + boolean callDisconnectedByUser = manager.getBoolean(KEY_POST_CALL_DISCONNECT_PRESSED, false); + ConfigProvider binding = ConfigProviderBindings.get(context); return disconnectTimeMillis != -1 && connectTimeMillis != -1 @@ -204,7 +215,8 @@ public class PostCall { && binding.getLong("postcall_last_call_threshold", 30_000) > timeSinceDisconnect && (connectTimeMillis == 0 || binding.getLong("postcall_call_duration_threshold", 35_000) > callDurationMillis) - && getPhoneNumber(context) != null; + && getPhoneNumber(context) != null + && callDisconnectedByUser; } private static boolean shouldPromptUserToViewSentMessage(Context context) { |