summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-11-23 00:47:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-11-23 00:47:24 +0000
commit6c773cbf112e5bef6074776d8cd91139d810f0ec (patch)
tree864af958509967249c92a2c0196a51ed66482574
parentecbcc5c8cce01c70480e73284a9e5e1115fc6649 (diff)
parent572a77ed339b5a511f9dc20680939dbb7bf5e085 (diff)
Merge changes I50da0d2d,Id00debe2,I2807510e,I3f7836d8,I2e31cd11, ...
* changes: Automated rollback of changelist 176587256 Check Contacts support for preferred SIM Add SpamJobType for all spam job IDs. Bubble v2 UI changes. Allow deleting a call log entry in the call log UI and the call details UI. Fix showing CallingAccountSelector in lock screen
-rw-r--r--assets/quantum/res/drawable/quantum_ic_exit_to_app_vd_theme_24.xml25
-rw-r--r--java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java70
-rw-r--r--java/com/android/dialer/app/res/values/ids.xml3
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsActivity.java78
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsAdapter.java10
-rw-r--r--java/com/android/dialer/calldetails/CallDetailsFooterViewHolder.java28
-rw-r--r--java/com/android/dialer/calldetails/res/layout/call_details_footer.xml9
-rw-r--r--java/com/android/dialer/calldetails/res/values/strings.xml2
-rw-r--r--java/com/android/dialer/constants/ScheduledJobIds.java11
-rw-r--r--java/com/android/dialer/precall/impl/CallingAccountSelector.java48
-rw-r--r--java/com/android/dialer/theme/res/values/colors.xml2
-rw-r--r--java/com/android/incallui/NewReturnToCallController.java2
-rw-r--r--java/com/android/newbubble/res/drawable/bubble_pill_up.xml (renamed from java/com/android/dialer/calldetails/res/menu/call_details_menu.xml)15
-rw-r--r--java/com/android/newbubble/res/drawable/bubble_ripple_pill_up.xml (renamed from java/com/android/newbubble/res/drawable/bubble_ripple_circle_small.xml)9
-rw-r--r--java/com/android/newbubble/res/layout/new_bubble_base.xml14
-rw-r--r--java/com/android/newbubble/res/values/colors.xml3
-rw-r--r--java/com/android/newbubble/res/values/styles.xml2
-rw-r--r--java/com/android/newbubble/res/values/values.xml4
18 files changed, 270 insertions, 65 deletions
diff --git a/assets/quantum/res/drawable/quantum_ic_exit_to_app_vd_theme_24.xml b/assets/quantum/res/drawable/quantum_ic_exit_to_app_vd_theme_24.xml
new file mode 100644
index 000000000..5279f0483
--- /dev/null
+++ b/assets/quantum/res/drawable/quantum_ic_exit_to_app_vd_theme_24.xml
@@ -0,0 +1,25 @@
+<!--
+ ~ 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
+ -->
+<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="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
+</vector> \ No newline at end of file
diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
index 1c106a720..26ca5bd26 100644
--- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
+++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java
@@ -16,6 +16,8 @@
package com.android.dialer.app.calllog;
+import android.Manifest.permission;
+import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -28,6 +30,7 @@ import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
+import android.support.annotation.RequiresPermission;
import android.support.annotation.VisibleForTesting;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
@@ -68,6 +71,7 @@ import com.android.dialer.calllogutils.CallbackActionHelper.CallbackAction;
import com.android.dialer.clipboard.ClipboardUtils;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
+import com.android.dialer.common.concurrent.AsyncTaskExecutors;
import com.android.dialer.compat.CompatUtils;
import com.android.dialer.configprovider.ConfigProviderBindings;
import com.android.dialer.constants.ActivityRequestCodes;
@@ -95,6 +99,7 @@ import com.android.dialer.util.DialerUtils;
import com.android.dialer.util.UriUtils;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.ref.WeakReference;
/**
* This is an object containing references to views contained by the call log list item. This
@@ -107,6 +112,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener,
MenuItem.OnMenuItemClickListener,
View.OnCreateContextMenuListener {
+
+ private static final String TASK_DELETE = "task_delete";
+
/** The root view of the call log list item */
public final View rootView;
/** The quick contact badge for the contact. */
@@ -431,6 +439,9 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
.logImpression(DialerImpression.Type.CALL_LOG_CONTEXT_MENU_REPORT_AS_NOT_SPAM);
mBlockReportListener.onReportNotSpam(
displayNumber, number, countryIso, callType, info.sourceType);
+ } else if (resId == R.id.context_menu_delete) {
+ AsyncTaskExecutors.createAsyncTaskExecutor()
+ .submit(TASK_DELETE, new DeleteCallTask(mContext, callIds));
}
return false;
}
@@ -1217,6 +1228,11 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
}
+ if (callType != CallLog.Calls.VOICEMAIL_TYPE) {
+ menu.add(ContextMenu.NONE, R.id.context_menu_delete, ContextMenu.NONE, R.string.delete)
+ .setOnMenuItemClickListener(this);
+ }
+
Logger.get(mContext).logScreenView(ScreenEvent.Type.CALL_LOG_CONTEXT_MENU, (Activity) mContext);
}
@@ -1261,4 +1277,58 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
int callType,
ContactSource.Type contactSourceType);
}
+
+ private static class DeleteCallTask extends AsyncTask<Void, Void, Void> {
+ // Using a weak reference to hold the Context so that there is no memory leak.
+ private final WeakReference<Context> contextWeakReference;
+
+ private final String callIdsStr;
+
+ DeleteCallTask(Context context, long[] callIdsArray) {
+ this.contextWeakReference = new WeakReference<>(context);
+ this.callIdsStr = concatCallIds(callIdsArray);
+ }
+
+ @Override
+ // Suppress the lint check here as the user will not be able to see call log entries if
+ // permission.WRITE_CALL_LOG is not granted.
+ @SuppressLint("MissingPermission")
+ @RequiresPermission(value = permission.WRITE_CALL_LOG)
+ protected Void doInBackground(Void... params) {
+ Context context = contextWeakReference.get();
+ if (context == null) {
+ return null;
+ }
+
+ if (callIdsStr != null) {
+ context
+ .getContentResolver()
+ .delete(
+ Calls.CONTENT_URI,
+ CallLog.Calls._ID + " IN (" + callIdsStr + ")" /* where */,
+ null /* selectionArgs */);
+ }
+
+ return null;
+ }
+
+ @Override
+ public void onPostExecute(Void result) {}
+
+ private String concatCallIds(long[] callIds) {
+ if (callIds == null || callIds.length == 0) {
+ return null;
+ }
+
+ StringBuilder str = new StringBuilder();
+ for (long callId : callIds) {
+ if (str.length() != 0) {
+ str.append(",");
+ }
+ str.append(callId);
+ }
+
+ return str.toString();
+ }
+ }
}
diff --git a/java/com/android/dialer/app/res/values/ids.xml b/java/com/android/dialer/app/res/values/ids.xml
index 8566f26b6..ca5f854de 100644
--- a/java/com/android/dialer/app/res/values/ids.xml
+++ b/java/com/android/dialer/app/res/values/ids.xml
@@ -15,7 +15,7 @@
-->
<resources>
- <item name="call_detail_delete_menu_item" type="id"/>
+ <item name="call_detail_action_delete" type="id"/>
<item name="context_menu_copy_to_clipboard" type="id"/>
<item name="context_menu_copy_transcript_to_clipboard" type="id"/>
<item name="context_menu_edit_before_call" type="id"/>
@@ -23,6 +23,7 @@
<item name="context_menu_block" type="id"/>
<item name="context_menu_unblock" type="id"/>
<item name="context_menu_report_not_spam" type="id"/>
+ <item name="context_menu_delete" type="id"/>
<item name="settings_header_sounds_and_vibration" type="id"/>
<item name="block_id" type="id"/>
</resources>
diff --git a/java/com/android/dialer/calldetails/CallDetailsActivity.java b/java/com/android/dialer/calldetails/CallDetailsActivity.java
index 7a117a3f1..06b6a1040 100644
--- a/java/com/android/dialer/calldetails/CallDetailsActivity.java
+++ b/java/com/android/dialer/calldetails/CallDetailsActivity.java
@@ -16,6 +16,9 @@
package com.android.dialer.calldetails;
+import android.Manifest.permission;
+import android.annotation.SuppressLint;
+import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -25,14 +28,14 @@ import android.provider.CallLog;
import android.provider.CallLog.Calls;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
+import android.support.annotation.RequiresPermission;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
-import android.support.v7.widget.Toolbar.OnMenuItemClickListener;
-import android.view.MenuItem;
import android.widget.Toast;
import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry;
+import com.android.dialer.calldetails.CallDetailsFooterViewHolder.DeleteCallDetailsListener;
import com.android.dialer.callintent.CallInitiationType;
import com.android.dialer.callintent.CallIntentBuilder;
import com.android.dialer.common.Assert;
@@ -52,15 +55,16 @@ import com.android.dialer.performancereport.PerformanceReport;
import com.android.dialer.postcall.PostCall;
import com.android.dialer.precall.PreCall;
import com.android.dialer.protos.ProtoParsers;
+import java.lang.ref.WeakReference;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/** Displays the details of a specific call log entry. */
public class CallDetailsActivity extends AppCompatActivity
- implements OnMenuItemClickListener,
- CallDetailsHeaderViewHolder.CallbackActionListener,
+ implements CallDetailsHeaderViewHolder.CallbackActionListener,
CallDetailsFooterViewHolder.ReportCallIdListener,
+ DeleteCallDetailsListener,
HistoricalDataChangedListener {
public static final String EXTRA_PHONE_NUMBER = "phone_number";
@@ -102,8 +106,6 @@ public class CallDetailsActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
setContentView(R.layout.call_details_activity);
Toolbar toolbar = findViewById(R.id.toolbar);
- toolbar.inflateMenu(R.menu.call_details_menu);
- toolbar.setOnMenuItemClickListener(this);
toolbar.setTitle(R.string.call_details);
toolbar.setNavigationOnClickListener(
v -> {
@@ -160,7 +162,8 @@ public class CallDetailsActivity extends AppCompatActivity
contact,
entries.getEntriesList(),
this /* callbackListener */,
- this /* reportCallIdListener */);
+ this /* reportCallIdListener */,
+ this /* callDetailDeletionListener */);
RecyclerView recyclerView = findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -169,17 +172,6 @@ public class CallDetailsActivity extends AppCompatActivity
}
@Override
- public boolean onMenuItemClick(MenuItem item) {
- if (item.getItemId() == R.id.call_detail_delete_menu_item) {
- Logger.get(this).logImpression(DialerImpression.Type.USER_DELETED_CALL_LOG_ITEM);
- AsyncTaskExecutors.createAsyncTaskExecutor().submit(TASK_DELETE, new DeleteCallsTask());
- item.setEnabled(false);
- return true;
- }
- return false;
- }
-
- @Override
public void onBackPressed() {
PerformanceReport.recordClick(UiAction.Type.PRESS_ANDROID_BACK_BUTTON);
super.onBackPressed();
@@ -246,6 +238,12 @@ public class CallDetailsActivity extends AppCompatActivity
PreCall.start(this, callIntentBuilder);
}
+ @Override
+ public void delete() {
+ AsyncTaskExecutors.createAsyncTaskExecutor()
+ .submit(TASK_DELETE, new DeleteCallsTask(this, contact, entries));
+ }
+
@NonNull
private Map<CallDetailsEntry, List<HistoryResult>> getAllHistoricalData(
@Nullable String number, @NonNull CallDetailsEntries entries) {
@@ -287,13 +285,22 @@ public class CallDetailsActivity extends AppCompatActivity
}
/** Delete specified calls from the call log. */
- private class DeleteCallsTask extends AsyncTask<Void, Void, Void> {
+ private static class DeleteCallsTask extends AsyncTask<Void, Void, Void> {
+ // Use a weak reference to hold the Activity so that there is no memory leak.
+ private final WeakReference<Activity> activityWeakReference;
+ private final DialerContact contact;
+ private final CallDetailsEntries callDetailsEntries;
private final String callIds;
- DeleteCallsTask() {
+ DeleteCallsTask(
+ Activity activity, DialerContact contact, CallDetailsEntries callDetailsEntries) {
+ this.activityWeakReference = new WeakReference<>(activity);
+ this.contact = contact;
+ this.callDetailsEntries = callDetailsEntries;
+
StringBuilder callIds = new StringBuilder();
- for (CallDetailsEntry entry : entries.getEntriesList()) {
+ for (CallDetailsEntry entry : callDetailsEntries.getEntriesList()) {
if (callIds.length() != 0) {
callIds.append(",");
}
@@ -303,24 +310,43 @@ public class CallDetailsActivity extends AppCompatActivity
}
@Override
+ // Suppress the lint check here as the user will not be able to see call log entries if
+ // permission.WRITE_CALL_LOG is not granted.
+ @SuppressLint("MissingPermission")
+ @RequiresPermission(value = permission.WRITE_CALL_LOG)
protected Void doInBackground(Void... params) {
- getContentResolver()
- .delete(Calls.CONTENT_URI, CallLog.Calls._ID + " IN (" + callIds + ")", null);
+ Activity activity = activityWeakReference.get();
+ if (activity == null) {
+ return null;
+ }
+
+ activity
+ .getContentResolver()
+ .delete(
+ Calls.CONTENT_URI,
+ CallLog.Calls._ID + " IN (" + callIds + ")" /* where */,
+ null /* selectionArgs */);
return null;
}
@Override
public void onPostExecute(Void result) {
+ Activity activity = activityWeakReference.get();
+ if (activity == null) {
+ return;
+ }
+
Intent data = new Intent();
data.putExtra(EXTRA_PHONE_NUMBER, contact.getNumber());
- for (CallDetailsEntry entry : entries.getEntriesList()) {
+ for (CallDetailsEntry entry : callDetailsEntries.getEntriesList()) {
if (entry.getHistoryResultsCount() > 0) {
data.putExtra(EXTRA_HAS_ENRICHED_CALL_DATA, true);
break;
}
}
- setResult(RESULT_OK, data);
- finish();
+
+ activity.setResult(RESULT_OK, data);
+ activity.finish();
}
}
}
diff --git a/java/com/android/dialer/calldetails/CallDetailsAdapter.java b/java/com/android/dialer/calldetails/CallDetailsAdapter.java
index b39fa0fb3..07590597e 100644
--- a/java/com/android/dialer/calldetails/CallDetailsAdapter.java
+++ b/java/com/android/dialer/calldetails/CallDetailsAdapter.java
@@ -23,6 +23,7 @@ import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import com.android.dialer.calldetails.CallDetailsEntries.CallDetailsEntry;
+import com.android.dialer.calldetails.CallDetailsFooterViewHolder.DeleteCallDetailsListener;
import com.android.dialer.calldetails.CallDetailsHeaderViewHolder.CallbackActionListener;
import com.android.dialer.calllogutils.CallTypeHelper;
import com.android.dialer.calllogutils.CallbackActionHelper;
@@ -42,6 +43,7 @@ final class CallDetailsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
private final DialerContact contact;
private final CallbackActionListener callbackActionListener;
private final CallDetailsFooterViewHolder.ReportCallIdListener reportCallIdListener;
+ private final DeleteCallDetailsListener deleteCallDetailsListener;
private final CallTypeHelper callTypeHelper;
private List<CallDetailsEntry> callDetailsEntries;
@@ -50,11 +52,13 @@ final class CallDetailsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
@NonNull DialerContact contact,
@NonNull List<CallDetailsEntry> callDetailsEntries,
CallbackActionListener callbackActionListener,
- CallDetailsFooterViewHolder.ReportCallIdListener reportCallIdListener) {
+ CallDetailsFooterViewHolder.ReportCallIdListener reportCallIdListener,
+ DeleteCallDetailsListener deleteCallDetailsListener) {
this.contact = Assert.isNotNull(contact);
this.callDetailsEntries = callDetailsEntries;
this.callbackActionListener = callbackActionListener;
this.reportCallIdListener = reportCallIdListener;
+ this.deleteCallDetailsListener = deleteCallDetailsListener;
callTypeHelper = new CallTypeHelper(context.getResources(), DuoComponent.get(context).getDuo());
}
@@ -70,7 +74,9 @@ final class CallDetailsAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
inflater.inflate(R.layout.call_details_entry, parent, false));
case FOOTER_VIEW_TYPE:
return new CallDetailsFooterViewHolder(
- inflater.inflate(R.layout.call_details_footer, parent, false), reportCallIdListener);
+ inflater.inflate(R.layout.call_details_footer, parent, false),
+ reportCallIdListener,
+ deleteCallDetailsListener);
default:
throw Assert.createIllegalStateFailException(
"No ViewHolder available for viewType: " + viewType);
diff --git a/java/com/android/dialer/calldetails/CallDetailsFooterViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsFooterViewHolder.java
index 6a5188e56..eeb19a862 100644
--- a/java/com/android/dialer/calldetails/CallDetailsFooterViewHolder.java
+++ b/java/com/android/dialer/calldetails/CallDetailsFooterViewHolder.java
@@ -34,32 +34,39 @@ import com.android.dialer.util.DialerUtils;
/** ViewHolder container for {@link CallDetailsActivity} footer. */
final class CallDetailsFooterViewHolder extends RecyclerView.ViewHolder implements OnClickListener {
- private final ReportCallIdListener listener;
+ private final ReportCallIdListener reportCallIdListener;
+ private final DeleteCallDetailsListener deleteCallDetailsListener;
private final View container;
private final View copy;
private final View edit;
private final View reportCallerId;
+ private final View delete;
private String number;
- CallDetailsFooterViewHolder(View view, ReportCallIdListener listener) {
+ CallDetailsFooterViewHolder(
+ View view,
+ ReportCallIdListener reportCallIdListener,
+ DeleteCallDetailsListener deleteCallDetailsListener) {
super(view);
- this.listener = listener;
+ this.reportCallIdListener = reportCallIdListener;
+ this.deleteCallDetailsListener = deleteCallDetailsListener;
container = view.findViewById(R.id.footer_container);
copy = view.findViewById(R.id.call_detail_action_copy);
edit = view.findViewById(R.id.call_detail_action_edit_before_call);
reportCallerId = view.findViewById(R.id.call_detail_action_report_caller_id);
-
+ delete = view.findViewById(R.id.call_detail_action_delete);
copy.setOnClickListener(this);
edit.setOnClickListener(this);
reportCallerId.setOnClickListener(this);
+ delete.setOnClickListener(this);
}
public void setPhoneNumber(String number) {
this.number = number;
if (TextUtils.isEmpty(number)) {
container.setVisibility(View.GONE);
- } else if (listener.canReportCallerId(number)) {
+ } else if (reportCallIdListener.canReportCallerId(number)) {
reportCallerId.setVisibility(View.VISIBLE);
}
}
@@ -81,7 +88,9 @@ final class CallDetailsFooterViewHolder extends RecyclerView.ViewHolder implemen
Intent dialIntent = new Intent(Intent.ACTION_DIAL, CallUtil.getCallUri(number));
DialerUtils.startActivityWithErrorToast(context, dialIntent);
} else if (view == reportCallerId) {
- listener.reportCallId(number);
+ reportCallIdListener.reportCallId(number);
+ } else if (view == delete) {
+ deleteCallDetailsListener.delete();
} else {
Assert.fail("View on click not implemented: " + view);
}
@@ -96,4 +105,11 @@ final class CallDetailsFooterViewHolder extends RecyclerView.ViewHolder implemen
/** returns true if the number can be reported as inaccurate. */
boolean canReportCallerId(String number);
}
+
+ /** Listener for deleting call details */
+ interface DeleteCallDetailsListener {
+
+ /** Delete call details */
+ void delete();
+ }
}
diff --git a/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml b/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml
index fbca3f8fe..dddb45156 100644
--- a/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml
+++ b/java/com/android/dialer/calldetails/res/layout/call_details_footer.xml
@@ -50,4 +50,13 @@
android:drawableStart="@drawable/quantum_ic_report_grey600_24"
android:text="@string/call_details_report_call_id"
android:visibility="gone"/>
+
+ <TextView
+ android:id="@+id/call_detail_action_delete"
+ style="@style/CallDetailsActionItemStyle"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:drawableStart="@drawable/quantum_ic_delete_vd_theme_24"
+ android:tint="@color/dialer_secondary_text_color"
+ android:text="@string/delete"/>
</LinearLayout>
diff --git a/java/com/android/dialer/calldetails/res/values/strings.xml b/java/com/android/dialer/calldetails/res/values/strings.xml
index 1441efdcd..74ac71c32 100644
--- a/java/com/android/dialer/calldetails/res/values/strings.xml
+++ b/java/com/android/dialer/calldetails/res/values/strings.xml
@@ -18,7 +18,7 @@
<!-- Title bar for call detail screen -->
<string name="call_details">Call details</string>
- <!-- Menu item in call details used to remove a call or voicemail from the call log. -->
+ <!-- Text for the action item to remove a call or voicemail from the call log. -->
<string name="delete">Delete</string>
<!-- Option displayed in context menu to copy long pressed phone number. [CHAR LIMIT=48] -->
diff --git a/java/com/android/dialer/constants/ScheduledJobIds.java b/java/com/android/dialer/constants/ScheduledJobIds.java
index 3fcbb0c2e..c0835b261 100644
--- a/java/com/android/dialer/constants/ScheduledJobIds.java
+++ b/java/com/android/dialer/constants/ScheduledJobIds.java
@@ -16,16 +16,27 @@
package com.android.dialer.constants;
+import android.support.annotation.IntDef;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
/**
* Registry of scheduled job ids used by the dialer UID.
*
* <p>Any dialer jobs which use the android JobScheduler should register their IDs here, to avoid
* the same ID accidentally being reused.
+ *
+ * <p>Do not change any existing IDs.
*/
public final class ScheduledJobIds {
public static final int SPAM_JOB_WIFI = 50;
public static final int SPAM_JOB_ANY_NETWORK = 51;
+ /** Spam job type including all spam job IDs. */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({SPAM_JOB_WIFI, SPAM_JOB_ANY_NETWORK})
+ public @interface SpamJobType {}
+
// This job refreshes dynamic launcher shortcuts.
public static final int SHORTCUT_PERIODIC_JOB = 100;
diff --git a/java/com/android/dialer/precall/impl/CallingAccountSelector.java b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
index 144d94e20..4308df73a 100644
--- a/java/com/android/dialer/precall/impl/CallingAccountSelector.java
+++ b/java/com/android/dialer/precall/impl/CallingAccountSelector.java
@@ -20,11 +20,16 @@ import android.app.Activity;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
+import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.PhoneLookup;
+import android.provider.ContactsContract.QuickContact;
import android.support.annotation.MainThread;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@@ -60,6 +65,9 @@ public class CallingAccountSelector implements PreCallAction {
@VisibleForTesting static final String TAG_CALLING_ACCOUNT_SELECTOR = "CallingAccountSelector";
+ @VisibleForTesting
+ static final String METADATA_SUPPORTS_PREFERRED_SIM = "supports_per_number_preferred_account";
+
private SelectPhoneAccountDialogFragment selectPhoneAccountDialogFragment;
private boolean isDiscarding;
@@ -244,6 +252,9 @@ public class CallingAccountSelector implements PreCallAction {
@WorkerThread
public PreferredAccountWorkerResult doInBackground(Context context) throws Throwable {
PreferredAccountWorkerResult result = new PreferredAccountWorkerResult();
+ if (!isPreferredSimEnabled(context)) {
+ return result;
+ }
result.dataId = getDataId(context.getContentResolver(), phoneNumber);
if (result.dataId.isPresent()) {
result.phoneAccountHandle = getPreferredAccount(context, result.dataId.get());
@@ -431,4 +442,41 @@ public class CallingAccountSelector implements PreCallAction {
return null;
}
}
+
+ @WorkerThread
+ private static boolean isPreferredSimEnabled(Context context) {
+ Assert.isWorkerThread();
+ if (!ConfigProviderBindings.get(context).getBoolean("preferred_sim_enabled", true)) {
+ return false;
+ }
+
+ Intent quickContactIntent = getQuickContactIntent();
+ ResolveInfo resolveInfo =
+ context
+ .getPackageManager()
+ .resolveActivity(quickContactIntent, PackageManager.GET_META_DATA);
+ if (resolveInfo == null
+ || resolveInfo.activityInfo == null
+ || resolveInfo.activityInfo.applicationInfo == null
+ || resolveInfo.activityInfo.applicationInfo.metaData == null) {
+ LogUtil.e("CallingAccountSelector.isPreferredSimEnabled", "cannot resolve quick contact app");
+ return false;
+ }
+ if (!resolveInfo.activityInfo.applicationInfo.metaData.getBoolean(
+ METADATA_SUPPORTS_PREFERRED_SIM, false)) {
+ LogUtil.i(
+ "CallingAccountSelector.isPreferredSimEnabled",
+ "system contacts does not support preferred SIM");
+ return false;
+ }
+ return true;
+ }
+
+ @VisibleForTesting
+ static Intent getQuickContactIntent() {
+ Intent intent = new Intent(QuickContact.ACTION_QUICK_CONTACT);
+ intent.addCategory(Intent.CATEGORY_DEFAULT);
+ intent.setData(Contacts.CONTENT_URI.buildUpon().appendPath("1").build());
+ return intent;
+ }
}
diff --git a/java/com/android/dialer/theme/res/values/colors.xml b/java/com/android/dialer/theme/res/values/colors.xml
index a59fa6704..a43487416 100644
--- a/java/com/android/dialer/theme/res/values/colors.xml
+++ b/java/com/android/dialer/theme/res/values/colors.xml
@@ -72,5 +72,5 @@
<color name="icon_color_grey">#89000000</color>
<!-- Color for bubble -->
- <color name="dialer_end_call_button_color">#FFDF0000</color>
+ <color name="dialer_end_call_button_color">#BD2A2A</color>
</resources>
diff --git a/java/com/android/incallui/NewReturnToCallController.java b/java/com/android/incallui/NewReturnToCallController.java
index 8f2463e8b..399b18568 100644
--- a/java/com/android/incallui/NewReturnToCallController.java
+++ b/java/com/android/incallui/NewReturnToCallController.java
@@ -280,7 +280,7 @@ public class NewReturnToCallController implements InCallUiListener, Listener, Au
// Return to call
actions.add(
Action.builder()
- .setIconDrawable(context.getDrawable(R.drawable.quantum_ic_fullscreen_vd_theme_24))
+ .setIconDrawable(context.getDrawable(R.drawable.quantum_ic_exit_to_app_vd_theme_24))
.setIntent(fullScreen)
.setName(context.getText(R.string.bubble_return_to_call))
.build());
diff --git a/java/com/android/dialer/calldetails/res/menu/call_details_menu.xml b/java/com/android/newbubble/res/drawable/bubble_pill_up.xml
index df0c34827..9dc0395f4 100644
--- a/java/com/android/dialer/calldetails/res/menu/call_details_menu.xml
+++ b/java/com/android/newbubble/res/drawable/bubble_pill_up.xml
@@ -14,11 +14,10 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
- <item
- android:id="@+id/call_detail_delete_menu_item"
- android:icon="@drawable/quantum_ic_delete_white_24"
- android:title="@string/delete"
- app:showAsAction="ifRoom"/>
-</menu> \ No newline at end of file
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <corners
+ android:topRightRadius="8dp"
+ android:topLeftRadius="8dp"/>
+ <solid android:color="@android:color/white"/>
+</shape>
diff --git a/java/com/android/newbubble/res/drawable/bubble_ripple_circle_small.xml b/java/com/android/newbubble/res/drawable/bubble_ripple_pill_up.xml
index 109d1cec1..77147f828 100644
--- a/java/com/android/newbubble/res/drawable/bubble_ripple_circle_small.xml
+++ b/java/com/android/newbubble/res/drawable/bubble_ripple_pill_up.xml
@@ -16,11 +16,6 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
- android:color="?android:colorControlHighlight">
- <item>
- <shape>
- <corners android:radius="@dimen/bubble_small_icon_size"/>
- <solid android:color="@android:color/white"/>
- </shape>
- </item>
+ android:color="@color/bubble_ripple_color">
+ <item android:drawable="@drawable/bubble_pill_up"/>
</ripple>
diff --git a/java/com/android/newbubble/res/layout/new_bubble_base.xml b/java/com/android/newbubble/res/layout/new_bubble_base.xml
index c90cabdf2..8cac982f4 100644
--- a/java/com/android/newbubble/res/layout/new_bubble_base.xml
+++ b/java/com/android/newbubble/res/layout/new_bubble_base.xml
@@ -88,10 +88,10 @@
tools:visibility="visible">
<RelativeLayout
android:id="@+id/bubble_triangle"
- android:layout_width="20dp"
- android:layout_height="20dp"
+ android:layout_width="12dp"
+ android:layout_height="12dp"
android:layout_marginTop="7dp"
- android:layout_marginBottom="-10dp"
+ android:layout_marginBottom="-6dp"
android:layout_centerHorizontal="true"
android:background="@color/background_dialer_white"
android:elevation="@dimen/bubble_expanded_elevation"
@@ -107,15 +107,14 @@
android:layoutDirection="inherit">
<com.android.newbubble.NewCheckableButton
android:id="@+id/bubble_button_full_screen"
- android:layout_marginTop="@dimen/bubble_radius"
+ android:layout_marginTop="8dp"
android:textColor="@color/bubble_button_color_grey"
- android:background="@color/background_dialer_white"
+ android:background="@drawable/bubble_ripple_pill_up"
android:drawableTint="@color/bubble_button_color_grey"
- style="@style/CheckableButtonWithSelectableItemBackground"/>
+ style="@style/CheckableButton"/>
<com.android.newbubble.NewCheckableButton
android:id="@+id/bubble_button_mute"
android:layout_below="@id/bubble_button_full_screen"
- android:layout_marginTop="@dimen/bubble_expanded_separator_height"
android:textColor="@color/bubble_button_color_grey"
android:background="@color/background_dialer_white"
android:drawableTint="@color/bubble_button_color_grey"
@@ -123,7 +122,6 @@
<com.android.newbubble.NewCheckableButton
android:id="@+id/bubble_button_audio_route"
android:layout_below="@id/bubble_button_mute"
- android:layout_marginTop="@dimen/bubble_expanded_separator_height"
android:textColor="@color/bubble_button_color_grey"
android:background="@color/background_dialer_white"
android:drawableTint="@color/bubble_button_color_grey"
diff --git a/java/com/android/newbubble/res/values/colors.xml b/java/com/android/newbubble/res/values/colors.xml
index 8b1294fc6..74ad85cea 100644
--- a/java/com/android/newbubble/res/values/colors.xml
+++ b/java/com/android/newbubble/res/values/colors.xml
@@ -18,7 +18,8 @@
<resources>
<color name="bubble_primary_background_darken">#33000000</color>
- <color name="bubble_button_color_grey">@color/dialer_secondary_text_color</color>
+ <color name="bubble_ripple_color">@color/bubble_primary_background_darken</color>
+ <color name="bubble_button_color_grey">@color/icon_color_grey</color>
<color name="bubble_button_color_white">@color/dialer_primary_text_color_white</color>
<color name="bubble_button_color_blue">@color/dialer_theme_color</color>
</resources>
diff --git a/java/com/android/newbubble/res/values/styles.xml b/java/com/android/newbubble/res/values/styles.xml
index 274bd8704..6c138d645 100644
--- a/java/com/android/newbubble/res/values/styles.xml
+++ b/java/com/android/newbubble/res/values/styles.xml
@@ -28,7 +28,7 @@
</style>
<style name="SelectableItemTheme">
- <item name="colorControlHighlight">@color/dialer_secondary_text_color_hiden</item>
+ <item name="colorControlHighlight">@color/bubble_ripple_color</item>
</style>
<style name="CheckableButtonWithSelectableItemBackground" parent="CheckableButton">
<item name="android:theme">@style/SelectableItemTheme</item>
diff --git a/java/com/android/newbubble/res/values/values.xml b/java/com/android/newbubble/res/values/values.xml
index a028254c7..6dda61d6c 100644
--- a/java/com/android/newbubble/res/values/values.xml
+++ b/java/com/android/newbubble/res/values/values.xml
@@ -34,8 +34,8 @@
<dimen name="bubble_elevation">6dp</dimen>
<dimen name="bubble_expanded_elevation">8dp</dimen>
<dimen name="bubble_expanded_width">160dp</dimen>
- <dimen name="bubble_radius">12dp</dimen>
- <dimen name="bubble_expanded_separator_height">4dp</dimen>
+ <dimen name="bubble_radius">16dp</dimen>
+ <dimen name="bubble_expanded_separator_height">8dp</dimen>
<dimen name="bubble_small_icon_size">24dp</dimen>
<dimen name="bubble_small_icon_padding">4dp</dimen>
</resources>