diff options
author | Tony Mak <tonymak@google.com> | 2016-02-22 19:58:42 +0000 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2016-02-22 19:58:42 +0000 |
commit | 83583b735686aa02119f5754f77eb9f0d318fe44 (patch) | |
tree | 51e57a37b703698a70dcd7b24dfa37b94ff74aa2 /src/com/android/dialer/util | |
parent | 3fc59a42bb9911ab436bd4304483a28dc7c029b3 (diff) |
Show Briefcase icon not displayed in in-call UI for work SIP calls
Current dialer always queries PhoneLookup._ID and uses this as a contact
ID.
In pre-N, contact id of non-sip query is stored in PhoneLookup._ID and
it is actually a mistake. This problem does not exist in sip query,
and contact id of sip query is stored in Data.CONTACT_ID. So it is a "bug"
in dialer that we use PhoneLooup._ID for sip query as it is not really a
contacat id. The bug of missing work badge may not be the only issue
introduced by this.
In N, the issue is get fixed in framework, PhoneLookup.CONTACT_ID is
introduced. We should access PhoneLookup.CONTACT_ID no matter what
phone lookup query we are having.
The ideal case is we always use PhoneLookup.CONTACT_ID for retrieving
contact id, but given that we need to support in pre-N, we need to
query PhoneLookup._ID for contact id in non-sip query in pre-N.
BUG:27242975
Change-Id: Id14378e3dce5b07629ffe0c6e83c3d107fbb468e
Diffstat (limited to 'src/com/android/dialer/util')
-rw-r--r-- | src/com/android/dialer/util/PhoneLookupUtil.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/android/dialer/util/PhoneLookupUtil.java b/src/com/android/dialer/util/PhoneLookupUtil.java new file mode 100644 index 000000000..1a7239642 --- /dev/null +++ b/src/com/android/dialer/util/PhoneLookupUtil.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 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.util; + +import android.net.Uri; +import android.provider.ContactsContract; + +import com.android.contacts.common.compat.CompatUtils; +import com.android.contacts.common.compat.PhoneLookupSdkCompat; + +public final class PhoneLookupUtil { + /** + * @return the column name that stores contact id for phone lookup query. + */ + public static String getContactIdColumnNameForUri(Uri phoneLookupUri) { + if (CompatUtils.isNCompatible()) { + return PhoneLookupSdkCompat.CONTACT_ID; + } + // In pre-N, contact id is stored in {@link PhoneLookup#_ID} in non-sip query. + boolean isSip = phoneLookupUri.getBooleanQueryParameter( + ContactsContract.PhoneLookup.QUERY_PARAMETER_SIP_ADDRESS, false); + return (isSip) ? PhoneLookupSdkCompat.CONTACT_ID : ContactsContract.PhoneLookup._ID; + } + + private PhoneLookupUtil() {} +} |