From 437ae9552cce7768068fa92663740711ee541417 Mon Sep 17 00:00:00 2001 From: linyuh Date: Mon, 26 Mar 2018 12:46:18 -0700 Subject: Remove obsolete version checks and compat utilities after min SDK was bumped up to N. Test: Existing tests PiperOrigin-RevId: 190508397 Change-Id: Ia5f33e45af1d1cc666fec5f43efa564b2b68c193 --- .../com/android/contacts/common/ContactsUtils.java | 6 ++-- .../contacts/common/compat/CallableCompat.java | 36 ------------------- .../contacts/common/compat/ContactsCompat.java | 41 ---------------------- .../contacts/common/compat/PhoneCompat.java | 36 ------------------- 4 files changed, 2 insertions(+), 117 deletions(-) delete mode 100644 java/com/android/contacts/common/compat/CallableCompat.java delete mode 100644 java/com/android/contacts/common/compat/ContactsCompat.java delete mode 100644 java/com/android/contacts/common/compat/PhoneCompat.java (limited to 'java/com/android/contacts/common') diff --git a/java/com/android/contacts/common/ContactsUtils.java b/java/com/android/contacts/common/ContactsUtils.java index bca8b62e0..7e44a2626 100644 --- a/java/com/android/contacts/common/ContactsUtils.java +++ b/java/com/android/contacts/common/ContactsUtils.java @@ -17,8 +17,8 @@ package com.android.contacts.common; import android.provider.ContactsContract.Contacts; +import android.provider.ContactsContract.Directory; import android.support.annotation.IntDef; -import com.android.dialer.common.cp2.DirectoryCompat; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -60,9 +60,7 @@ public class ContactsUtils { public static @UserType long determineUserType(Long directoryId, Long contactId) { // First check directory id if (directoryId != null) { - return DirectoryCompat.isEnterpriseDirectoryId(directoryId) - ? USER_TYPE_WORK - : USER_TYPE_CURRENT; + return Directory.isEnterpriseDirectoryId(directoryId) ? USER_TYPE_WORK : USER_TYPE_CURRENT; } // Only check contact id if directory id is null if (contactId != null && contactId != 0L && Contacts.isEnterpriseContactId(contactId)) { diff --git a/java/com/android/contacts/common/compat/CallableCompat.java b/java/com/android/contacts/common/compat/CallableCompat.java deleted file mode 100644 index 5e86f518e..000000000 --- a/java/com/android/contacts/common/compat/CallableCompat.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2015 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.contacts.common.compat; - -import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.provider.ContactsContract.CommonDataKinds.Callable; - -public class CallableCompat { - - // TODO: Use N APIs - private static final Uri ENTERPRISE_CONTENT_FILTER_URI = - Uri.withAppendedPath(Callable.CONTENT_URI, "filter_enterprise"); - - public static Uri getContentFilterUri() { - if (VERSION.SDK_INT >= VERSION_CODES.N) { - return ENTERPRISE_CONTENT_FILTER_URI; - } - return Callable.CONTENT_FILTER_URI; - } -} diff --git a/java/com/android/contacts/common/compat/ContactsCompat.java b/java/com/android/contacts/common/compat/ContactsCompat.java deleted file mode 100644 index e0c9b7e53..000000000 --- a/java/com/android/contacts/common/compat/ContactsCompat.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2015 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.contacts.common.compat; - -import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.provider.ContactsContract; -import android.provider.ContactsContract.Contacts; - -/** Compatibility class for {@link ContactsContract.Contacts} */ -public class ContactsCompat { - - // TODO: Use N APIs - private static final Uri ENTERPRISE_CONTENT_FILTER_URI = - Uri.withAppendedPath(Contacts.CONTENT_URI, "filter_enterprise"); - - /** Not instantiable. */ - private ContactsCompat() {} - - public static Uri getContentUri() { - if (VERSION.SDK_INT >= VERSION_CODES.N) { - return ENTERPRISE_CONTENT_FILTER_URI; - } - return Contacts.CONTENT_FILTER_URI; - } -} diff --git a/java/com/android/contacts/common/compat/PhoneCompat.java b/java/com/android/contacts/common/compat/PhoneCompat.java deleted file mode 100644 index 31db7b537..000000000 --- a/java/com/android/contacts/common/compat/PhoneCompat.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2015 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.contacts.common.compat; - -import android.net.Uri; -import android.os.Build.VERSION; -import android.os.Build.VERSION_CODES; -import android.provider.ContactsContract.CommonDataKinds.Phone; - -public class PhoneCompat { - - // TODO: Use N APIs - private static final Uri ENTERPRISE_CONTENT_FILTER_URI = - Uri.withAppendedPath(Phone.CONTENT_URI, "filter_enterprise"); - - public static Uri getContentFilterUri() { - if (VERSION.SDK_INT >= VERSION_CODES.N) { - return ENTERPRISE_CONTENT_FILTER_URI; - } - return Phone.CONTENT_FILTER_URI; - } -} -- cgit v1.2.3