summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/postcall
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/postcall')
-rw-r--r--java/com/android/dialer/postcall/AndroidManifest.xml7
-rw-r--r--java/com/android/dialer/postcall/PostCall.java60
-rw-r--r--java/com/android/dialer/postcall/res/layout/post_call_activity.xml23
3 files changed, 53 insertions, 37 deletions
diff --git a/java/com/android/dialer/postcall/AndroidManifest.xml b/java/com/android/dialer/postcall/AndroidManifest.xml
index 79ca5d5eb..a09750564 100644
--- a/java/com/android/dialer/postcall/AndroidManifest.xml
+++ b/java/com/android/dialer/postcall/AndroidManifest.xml
@@ -15,14 +15,13 @@
-->
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.dialer.callcomposer">
+ package="com.android.dialer.postcall">
<application android:theme="@style/Theme.AppCompat">
<activity
android:name="com.android.dialer.postcall.PostCallActivity"
android:exported="false"
- android:theme="@style/Theme.AppCompat.NoActionBar"
- android:windowSoftInputMode="adjustResize"
- android:screenOrientation="portrait"/>
+ android:theme="@style/DialerThemeBase.NoActionBar"
+ android:windowSoftInputMode="adjustResize"/>
</application>
</manifest>
diff --git a/java/com/android/dialer/postcall/PostCall.java b/java/com/android/dialer/postcall/PostCall.java
index 586b47395..011fbc985 100644
--- a/java/com/android/dialer/postcall/PostCall.java
+++ b/java/com/android/dialer/postcall/PostCall.java
@@ -26,26 +26,27 @@ import android.support.design.widget.Snackbar;
import android.telephony.TelephonyManager;
import android.view.View;
import android.view.View.OnClickListener;
-import com.android.dialer.buildtype.BuildType;
import com.android.dialer.common.Assert;
-import com.android.dialer.common.ConfigProvider;
-import com.android.dialer.common.ConfigProviderBindings;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.configprovider.ConfigProvider;
+import com.android.dialer.configprovider.ConfigProviderBindings;
import com.android.dialer.enrichedcall.EnrichedCallCapabilities;
import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
import com.android.dialer.logging.DialerImpression;
import com.android.dialer.logging.Logger;
+import com.android.dialer.performancereport.PerformanceReport;
import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.IntentUtil;
/** Helper class to handle all post call actions. */
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_DISCONNECT_TIME = "post_call_call_disconnect_time";
+ 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;
@@ -55,6 +56,8 @@ public class PostCall {
promptUserToViewSentMessage(activity, rootView);
} else if (shouldPromptUserToSendMessage(activity)) {
promptUserToSendMessage(activity, rootView);
+ } else {
+ clear(activity);
}
}
}
@@ -77,18 +80,18 @@ public class PostCall {
LogUtil.sanitizePhoneNumber(getPhoneNumber(activity)),
capabilities);
- boolean isRcsPostCall = capabilities != null && capabilities.supportsPostCall();
+ boolean isRcsPostCall = capabilities != null && capabilities.isPostCallCapable();
String actionText =
isRcsPostCall
? activity.getString(R.string.post_call_add_message)
: activity.getString(R.string.post_call_send_message);
+ String number = Assert.isNotNull(getPhoneNumber(activity));
OnClickListener onClickListener =
v -> {
Logger.get(activity)
.logImpression(DialerImpression.Type.POST_CALL_PROMPT_USER_TO_SEND_MESSAGE_CLICKED);
- activity.startActivity(
- PostCallActivity.newIntent(activity, getPhoneNumber(activity), isRcsPostCall));
+ activity.startActivity(PostCallActivity.newIntent(activity, number, isRcsPostCall));
};
int durationMs =
@@ -112,12 +115,13 @@ public class PostCall {
"returned from sending a post call message, message sent.");
String message = activity.getString(R.string.post_call_message_sent);
String addMessage = activity.getString(R.string.view);
+ String number = Assert.isNotNull(getPhoneNumber(activity));
OnClickListener onClickListener =
v -> {
Logger.get(activity)
.logImpression(
DialerImpression.Type.POST_CALL_PROMPT_USER_TO_VIEW_SENT_MESSAGE_CLICKED);
- Intent intent = IntentUtil.getSendSmsIntent(getPhoneNumber(activity));
+ Intent intent = IntentUtil.getSendSmsIntent(number);
DialerUtils.startActivityWithErrorToast(activity, intent);
};
@@ -143,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()
@@ -160,6 +171,19 @@ public class PostCall {
.apply();
}
+ /**
+ * Restart performance recording if there is a recent call (disconnect time to now is under
+ * threshold)
+ */
+ public static void restartPerformanceRecordingIfARecentCallExist(Context context) {
+ long disconnectTimeMillis =
+ DialerUtils.getDefaultSharedPreferenceForDeviceProtectedStorageContext(context)
+ .getLong(PostCall.KEY_POST_CALL_CALL_DISCONNECT_TIME, -1);
+ if (disconnectTimeMillis != -1 && PerformanceReport.isRecording()) {
+ PerformanceReport.startRecording();
+ }
+ }
+
private static void clear(Context context) {
activeSnackbar = null;
@@ -169,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();
}
@@ -181,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
@@ -188,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) {
@@ -203,19 +231,7 @@ public class PostCall {
}
private static boolean isEnabled(Context context) {
- @BuildType.Type int type = BuildType.get();
- switch (type) {
- case BuildType.BUGFOOD:
- case BuildType.DOGFOOD:
- case BuildType.FISHFOOD:
- case BuildType.TEST:
- return ConfigProviderBindings.get(context).getBoolean("enable_post_call", true);
- case BuildType.RELEASE:
- return ConfigProviderBindings.get(context).getBoolean("enable_post_call_prod", true);
- default:
- Assert.fail();
- return false;
- }
+ return ConfigProviderBindings.get(context).getBoolean("enable_post_call_prod", true);
}
private static boolean isSimReady(Context context) {
diff --git a/java/com/android/dialer/postcall/res/layout/post_call_activity.xml b/java/com/android/dialer/postcall/res/layout/post_call_activity.xml
index 256c110b9..c42764e5b 100644
--- a/java/com/android/dialer/postcall/res/layout/post_call_activity.xml
+++ b/java/com/android/dialer/postcall/res/layout/post_call_activity.xml
@@ -14,20 +14,21 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="@color/background_dialer_white"
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <FrameLayout
- android:id="@+id/message_container"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_alignParentBottom="true"
- android:background="@color/background_dialer_white"/>
+ android:layout_height="match_parent"
+ android:background="@color/background_dialer_white">
<com.android.dialer.widget.DialerToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
-</RelativeLayout> \ No newline at end of file
+
+ <FrameLayout
+ android:id="@+id/message_container"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@color/background_dialer_white"/>
+</LinearLayout> \ No newline at end of file