summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/p13n
diff options
context:
space:
mode:
authorcalderwoodra <calderwoodra@google.com>2018-03-21 16:57:10 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-26 22:14:35 -0700
commit58d0b2a7cdd4b988f527f03a7cb4ba2a4b7cd145 (patch)
tree9f345f599109739aa93fe700981fc289dab0e66a /java/com/android/dialer/p13n
parent2213f8e4a91bf5bd39e8f55554f7020f0e6b5792 (diff)
Delete old search, old contacts, p13n logger, filtered numbers add number search.
These components are safe to delete because: - New Contacts has been in prod for several releases. - New Search has been in in prod for 2 releases. - p13n logger was based on old search and is no longer being implemented in Dialer. - Filtered Number Settings contact search since we no longer support M. Bug: 37208802,73902692 Test: tap PiperOrigin-RevId: 189992017 Change-Id: I2720a252ababd164b5d0fb1011753a3c96a704d1
Diffstat (limited to 'java/com/android/dialer/p13n')
-rw-r--r--java/com/android/dialer/p13n/inference/P13nRanking.java90
-rw-r--r--java/com/android/dialer/p13n/inference/protocol/P13nRanker.java81
-rw-r--r--java/com/android/dialer/p13n/inference/protocol/P13nRankerFactory.java26
-rw-r--r--java/com/android/dialer/p13n/logging/P13nLogger.java35
-rw-r--r--java/com/android/dialer/p13n/logging/P13nLoggerFactory.java29
-rw-r--r--java/com/android/dialer/p13n/logging/P13nLogging.java60
6 files changed, 0 insertions, 321 deletions
diff --git a/java/com/android/dialer/p13n/inference/P13nRanking.java b/java/com/android/dialer/p13n/inference/P13nRanking.java
deleted file mode 100644
index 79b4d7136..000000000
--- a/java/com/android/dialer/p13n/inference/P13nRanking.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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.p13n.inference;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import com.android.dialer.common.Assert;
-import com.android.dialer.configprovider.ConfigProviderBindings;
-import com.android.dialer.p13n.inference.protocol.P13nRanker;
-import com.android.dialer.p13n.inference.protocol.P13nRankerFactory;
-import java.util.List;
-
-/** Single entry point for all personalized ranking. */
-public final class P13nRanking {
-
- private static P13nRanker ranker;
-
- private P13nRanking() {}
-
- @MainThread
- @NonNull
- public static P13nRanker get(@NonNull Context context) {
- Assert.isNotNull(context);
- Assert.isMainThread();
-
- if (ranker != null) {
- return ranker;
- }
-
- if (!ConfigProviderBindings.get(context).getBoolean("p13n_ranker_should_enable", false)) {
- setToIdentityRanker();
- return ranker;
- }
-
- Context application = context.getApplicationContext();
- if (application instanceof P13nRankerFactory) {
- ranker = ((P13nRankerFactory) application).newP13nRanker();
- }
-
- if (ranker == null) {
- setToIdentityRanker();
- }
- return ranker;
- }
-
- private static void setToIdentityRanker() {
- ranker =
- new P13nRanker() {
- @Override
- public void refresh(@Nullable P13nRefreshCompleteListener listener) {}
-
- @Override
- public List<String> rankList(List<String> phoneNumbers) {
- return phoneNumbers;
- }
-
- @NonNull
- @Override
- public Cursor rankCursor(@NonNull Cursor phoneQueryResults, int queryLength) {
- return phoneQueryResults;
- }
-
- @Override
- public boolean shouldShowEmptyListForNullQuery() {
- return true;
- }
- };
- }
-
- public static void setForTesting(@NonNull P13nRanker ranker) {
- P13nRanking.ranker = ranker;
- }
-}
diff --git a/java/com/android/dialer/p13n/inference/protocol/P13nRanker.java b/java/com/android/dialer/p13n/inference/protocol/P13nRanker.java
deleted file mode 100644
index 41f1de49d..000000000
--- a/java/com/android/dialer/p13n/inference/protocol/P13nRanker.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.p13n.inference.protocol;
-
-import android.database.Cursor;
-import android.support.annotation.MainThread;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import java.util.List;
-
-/** Provides personalized ranking of outgoing call targets. */
-public interface P13nRanker {
-
- /**
- * Re-orders a list of phone numbers according to likelihood they will be the next outgoing call.
- *
- * @param phoneNumbers the list of candidate numbers to call (may be in contacts list or not)
- */
- @NonNull
- @MainThread
- List<String> rankList(@NonNull List<String> phoneNumbers);
-
- /**
- * Re-orders a retrieved contact list according to likelihood they will be the next outgoing call.
- *
- * <p>A new cursor with reordered data is returned; the input cursor is unmodified except for its
- * position. If the order is unchanged, this method may return a reference to the unmodified input
- * cursor directly. The order would be unchanged if the ranking cache is not yet ready, or if the
- * input cursor is closed or invalid, or if any other error occurs in the ranking process.
- *
- * @param phoneQueryResults cursor of results of a Dialer search query
- * @param queryLength length of the search query that resulted in the cursor data, if below 0,
- * assumes no length is specified, thus applies the default behavior which is same as when
- * queryLength is greater than zero.
- * @return new cursor of data reordered by ranking (or reference to input cursor if order
- * unchanged)
- */
- @NonNull
- @MainThread
- Cursor rankCursor(@NonNull Cursor phoneQueryResults, int queryLength);
-
- /**
- * Refreshes ranking cache (pulls fresh contextual features, pre-caches inference results, etc.).
- *
- * <p>Asynchronously runs in background as the process might take a few seconds, notifying a
- * listener upon completion; meanwhile, any calls to {@link #rankList} will simply return the
- * input in same order.
- *
- * @param listener callback for when ranking refresh has completed; null value skips notification.
- */
- @MainThread
- void refresh(@Nullable P13nRefreshCompleteListener listener);
-
- /** Decides if results should be displayed for no-query search. */
- @MainThread
- boolean shouldShowEmptyListForNullQuery();
-
- /**
- * Callback class for when ranking refresh has completed.
- *
- * <p>Primary use is to notify {@link com.android.dialer.app.DialtactsActivity} that the ranking
- * functions {@link #rankList} and {@link #rankCursor(Cursor, int)} will now give useful results.
- */
- interface P13nRefreshCompleteListener {
-
- /** Callback for when ranking refresh has completed. */
- void onP13nRefreshComplete();
- }
-}
diff --git a/java/com/android/dialer/p13n/inference/protocol/P13nRankerFactory.java b/java/com/android/dialer/p13n/inference/protocol/P13nRankerFactory.java
deleted file mode 100644
index 7038cf456..000000000
--- a/java/com/android/dialer/p13n/inference/protocol/P13nRankerFactory.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.p13n.inference.protocol;
-
-import android.support.annotation.Nullable;
-
-/**
- * This interface should be implemented by the Application subclass. It allows this module to get
- * references to the {@link P13nRanker}.
- */
-public interface P13nRankerFactory {
- @Nullable
- P13nRanker newP13nRanker();
-}
diff --git a/java/com/android/dialer/p13n/logging/P13nLogger.java b/java/com/android/dialer/p13n/logging/P13nLogger.java
deleted file mode 100644
index 069a29328..000000000
--- a/java/com/android/dialer/p13n/logging/P13nLogger.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.p13n.logging;
-
-import com.android.contacts.common.list.PhoneNumberListAdapter;
-
-/** Allows logging of data for personalization. */
-public interface P13nLogger {
-
- /**
- * Logs a search query (text or digits) entered by user.
- *
- * @param query search text (or digits) entered by user
- * @param adapter list adapter providing access to contacts matching search query
- */
- void onSearchQuery(String query, PhoneNumberListAdapter adapter);
-
- /**
- * Resets logging session (clears searches, re-initializes app entry timestamp, etc.) Should be
- * called when Dialer app is resumed.
- */
- void reset();
-}
diff --git a/java/com/android/dialer/p13n/logging/P13nLoggerFactory.java b/java/com/android/dialer/p13n/logging/P13nLoggerFactory.java
deleted file mode 100644
index 7350e99e1..000000000
--- a/java/com/android/dialer/p13n/logging/P13nLoggerFactory.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.p13n.logging;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-
-/**
- * This interface should be implemented by the Application subclass. It allows this module to get
- * references to the P13nLogger.
- */
-public interface P13nLoggerFactory {
-
- @Nullable
- P13nLogger newP13nLogger(@NonNull Context context);
-}
diff --git a/java/com/android/dialer/p13n/logging/P13nLogging.java b/java/com/android/dialer/p13n/logging/P13nLogging.java
deleted file mode 100644
index 21b97257b..000000000
--- a/java/com/android/dialer/p13n/logging/P13nLogging.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.p13n.logging;
-
-import android.content.Context;
-import android.support.annotation.NonNull;
-import com.android.contacts.common.list.PhoneNumberListAdapter;
-import com.android.dialer.common.Assert;
-
-/** Single entry point for all logging for personalization. */
-public final class P13nLogging {
-
- private static P13nLogger logger;
-
- private P13nLogging() {}
-
- @NonNull
- public static P13nLogger get(@NonNull Context context) {
- Assert.isNotNull(context);
- Assert.isMainThread();
- if (logger != null) {
- return logger;
- }
-
- Context application = context.getApplicationContext();
- if (application instanceof P13nLoggerFactory) {
- logger = ((P13nLoggerFactory) application).newP13nLogger(context);
- }
-
- if (logger == null) {
- logger =
- new P13nLogger() {
- @Override
- public void onSearchQuery(String query, PhoneNumberListAdapter adapter) {}
-
- @Override
- public void reset() {}
- };
- }
- return logger;
- }
-
- public static void setForTesting(@NonNull P13nLogger logger) {
- P13nLogging.logger = logger;
- }
-}