summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2017-11-10 16:35:42 -0800
committerZachary Heidepriem <zachh@google.com>2017-11-11 20:26:20 -0800
commit66834e40d812439171b5cb670b098e41a34eea6a (patch)
tree47918b050db4c264ca9830e1cd87a81317ddc013 /java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
parent4c7d959c3e944963436705340eccf4b82cde7e47 (diff)
Implement PreferredSimFallbackProvider
The PhoneAccountHandle is keyed with the DATA_ID of a Phone row in the Contacts provider. Bug: 64213352 Test: PreferredSimFallbackProviderTest PiperOrigin-RevId: 175354818 Change-Id: I828ff9d5a1e03e18b05256bcf8a61170be8ce7bc
Diffstat (limited to 'java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java')
-rw-r--r--java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java b/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
new file mode 100644
index 000000000..79e097c47
--- /dev/null
+++ b/java/com/android/dialer/preferredsim/PreferredSimFallbackContract.java
@@ -0,0 +1,72 @@
+/*
+ * 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
+ */
+
+package com.android.dialer.preferredsim;
+
+import android.content.ComponentName;
+import android.net.Uri;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.telecom.PhoneAccountHandle;
+import com.android.dialer.constants.Constants;
+
+/**
+ * Extend fields for preferred SIM that is not available in {@link
+ * android.provider.ContactsContract.Data} before P. Only query and update is supported for this
+ * provider, and the update selection must be {@link PreferredSim#UPDATE_ID_SELECTION}. Caller must
+ * have {@link android.Manifest.permission#READ_CONTACTS} to read or {@link
+ * android.Manifest.permission#WRITE_CONTACTS} to write.
+ */
+public final class PreferredSimFallbackContract {
+
+ /**
+ * Check the meta-data "com.android.dialer.PREFERRED_SIM_FALLBACK_AUTHORITY" to get the authority
+ * of the default dialer if it support it.
+ */
+ public static final String AUTHORITY = Constants.get().getPreferredSimFallbackProviderAuthority();
+
+ public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
+
+ /** Columns for preferred SIM. */
+ public static final class PreferredSim {
+
+ /**
+ * Unique key that should match {@link
+ * android.provider.ContactsContract.CommonDataKinds.Phone#_ID} of the data row it is associated
+ * with.
+ */
+ public static final String DATA_ID = "data_id";
+
+ /**
+ * The flattened {@link android.content.ComponentName} of a {@link PhoneAccountHandle} that is
+ * the preferred {@code PhoneAccountHandle} to call the contact with. Used by {@link
+ * CommonDataKinds.Phone}.
+ *
+ * @see PhoneAccountHandle#getComponentName()
+ * @see ComponentName#flattenToString()
+ */
+ public static final String PREFERRED_PHONE_ACCOUNT_COMPONENT_NAME =
+ "preferred_phone_account_component_name";
+
+ /**
+ * The ID of a {@link PhoneAccountHandle} that is the preferred {@code PhoneAccountHandle} to
+ * call the contact with. Used by {@link CommonDataKinds.Phone}.
+ *
+ * @see PhoneAccountHandle#getId() ()
+ * @see ComponentName#flattenToString()
+ */
+ public static final String PREFERRED_PHONE_ACCOUNT_ID = "preferred_phone_account_id";
+ }
+}