diff options
author | Brandon Maxwell <maxwelb@google.com> | 2015-11-12 22:53:23 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2015-11-12 22:53:23 +0000 |
commit | 28e055e9559b41eabb831c3893ee23dc2c9f25eb (patch) | |
tree | 13c5c15af963ee4058bf2741d694a36b526cce39 | |
parent | 558ca8585e00acd0e5a2ed256900fcf8e7bf4f89 (diff) | |
parent | 0a6f700df273c98f5051cd43326dc78afc2eff77 (diff) |
Adding Logging to call blocking interactions am: d81cc6c64f
am: 0a6f700df2
* commit '0a6f700df273c98f5051cd43326dc78afc2eff77':
Adding Logging to call blocking interactions
8 files changed, 172 insertions, 11 deletions
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 14279f15d..34e49a99b 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -57,6 +57,8 @@ import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; import com.android.dialer.filterednumber.BlockNumberDialogFragment; import com.android.dialer.filterednumber.FilteredNumbersUtil; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil.CallIntentBuilder; import com.android.dialer.util.PhoneNumberUtil; @@ -390,7 +392,14 @@ public class CallDetailActivity extends AppCompatActivity } @Override - public void onChangeFilteredNumberSuccess() { + public void onFilterNumberSuccess() { + Logger.logInteraction(InteractionEvent.BLOCK_NUMBER_CALL_DETAIL); + updateFilteredNumberChanges(); + } + + @Override + public void onUnfilterNumberSuccess() { + Logger.logInteraction(InteractionEvent.UNBLOCK_NUMBER_CALL_DETAIL); updateFilteredNumberChanges(); } diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 53fe9f748..ea2dbd246 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -48,6 +48,9 @@ import com.android.dialer.R; import com.android.dialer.contactinfo.ContactInfoCache; import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener; import com.android.dialer.database.FilteredNumberAsyncQueryHandler; +import com.android.dialer.filterednumber.BlockNumberDialogFragment.Callback; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; import com.android.dialer.util.PhoneNumberUtil; import com.android.dialer.voicemail.VoicemailPlaybackPresenter; @@ -361,7 +364,22 @@ public class CallLogAdapter extends GroupingListAdapter mCallLogListItemHelper, mVoicemailPlaybackPresenter, mFilteredNumberAsyncQueryHandler, - null); + new Callback() { + @Override + public void onFilterNumberSuccess() { + Logger.logInteraction( + InteractionEvent.BLOCK_NUMBER_CALL_LOG); + } + + @Override + public void onUnfilterNumberSuccess() { + Logger.logInteraction( + InteractionEvent.UNBLOCK_NUMBER_CALL_LOG); + } + + @Override + public void onChangeFilteredNumberUndo() {} + }); viewHolder.callLogEntryView.setTag(viewHolder); viewHolder.callLogEntryView.setAccessibilityDelegate(mAccessibilityDelegate); diff --git a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java index 21746eecc..0f4bd74bd 100644 --- a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java +++ b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java @@ -36,6 +36,8 @@ import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnBlockNumberListener; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnUnblockNumberListener; import com.android.dialer.voicemail.VisualVoicemailEnabledChecker; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; /** * Fragment for confirming and enacting blocking/unblocking a number. Also invokes snackbar @@ -51,8 +53,20 @@ public class BlockNumberDialogFragment extends DialogFragment { * upon rotation instead. */ public interface Callback { - public void onChangeFilteredNumberSuccess(); - public void onChangeFilteredNumberUndo(); + /** + * Called when a number is successfully added to the set of filtered numbers + */ + void onFilterNumberSuccess(); + + /** + * Called when a number is successfully removed from the set of filtered numbers + */ + void onUnfilterNumberSuccess(); + + /** + * Called when the action of filtering or unfiltering a number is undone + */ + void onChangeFilteredNumberUndo(); } private static final String BLOCK_DIALOG_FRAGMENT = "BlockNumberDialog"; @@ -230,6 +244,7 @@ public class BlockNumberDialogFragment extends DialogFragment { @Override public void onClick(View view) { // Delete the newly created row on 'undo'. + Logger.logInteraction(InteractionEvent.UNDO_BLOCK_NUMBER); mHandler.unblock(onUndoListener, uri); } }; @@ -240,7 +255,7 @@ public class BlockNumberDialogFragment extends DialogFragment { .show(); if (callback != null) { - callback.onChangeFilteredNumberSuccess(); + callback.onFilterNumberSuccess(); } if (context != null && FilteredNumbersUtil.hasRecentEmergencyCall(context)) { @@ -278,6 +293,7 @@ public class BlockNumberDialogFragment extends DialogFragment { @Override public void onClick(View view) { // Re-insert the row on 'undo', with a new ID. + Logger.logInteraction(InteractionEvent.UNDO_UNBLOCK_NUMBER); mHandler.blockNumber(onUndoListener, values); } }; @@ -288,7 +304,7 @@ public class BlockNumberDialogFragment extends DialogFragment { .show(); if (callback != null) { - callback.onChangeFilteredNumberSuccess(); + callback.onUnfilterNumberSuccess(); } } }, getArguments().getInt(ARG_BLOCK_ID)); diff --git a/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java b/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java index a23e46d1e..e33b0f810 100644 --- a/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java +++ b/src/com/android/dialer/filterednumber/BlockedNumbersAdapter.java @@ -26,6 +26,8 @@ import com.android.contacts.common.GeoUtil; import com.android.dialer.R; import com.android.dialer.calllog.ContactInfoHelper; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; public class BlockedNumbersAdapter extends NumbersAdapter { @@ -67,7 +69,19 @@ public class BlockedNumbersAdapter extends NumbersAdapter { PhoneNumberUtils.formatNumber(number, countryIso), R.id.blocked_number_fragment, getFragmentManager(), - null /* callback */); + new BlockNumberDialogFragment.Callback() { + @Override + public void onFilterNumberSuccess() {} + + @Override + public void onUnfilterNumberSuccess() { + Logger.logInteraction( + InteractionEvent.UNBLOCK_NUMBER_MANAGEMENT_SCREEN); + } + + @Override + public void onChangeFilteredNumberUndo() {} + }); } }); diff --git a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java index 76d391357..23ce8a8de 100644 --- a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java +++ b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java @@ -26,11 +26,9 @@ import android.os.AsyncTask; import android.preference.PreferenceManager; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.provider.ContactsContract.Contacts; -import android.provider.ContactsContract.Data; import android.provider.Settings; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; -import android.util.Log; import android.widget.Toast; import java.util.LinkedList; @@ -43,6 +41,8 @@ import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnHasBlockedNumbersListener; import com.android.dialer.database.FilteredNumberContract.FilteredNumber; import com.android.dialer.database.FilteredNumberContract.FilteredNumberColumns; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; /** * Utility to help with tasks related to filtered numbers. @@ -164,10 +164,11 @@ public class FilteredNumbersUtil { */ public static void importSendToVoicemailContacts( final Context context, final ImportSendToVoicemailContactsListener listener) { + Logger.logInteraction(InteractionEvent.IMPORT_SEND_TO_VOICEMAIL); final FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler = new FilteredNumberAsyncQueryHandler(context.getContentResolver()); - final AsyncTask task = new AsyncTask<Object, Void, Boolean>() { + final AsyncTask<Object, Void, Boolean> task = new AsyncTask<Object, Void, Boolean>() { @Override public Boolean doInBackground(Object[] params) { if (context == null) { diff --git a/src/com/android/dialer/list/BlockedListSearchFragment.java b/src/com/android/dialer/list/BlockedListSearchFragment.java index 306847850..da6b42820 100644 --- a/src/com/android/dialer/list/BlockedListSearchFragment.java +++ b/src/com/android/dialer/list/BlockedListSearchFragment.java @@ -37,6 +37,8 @@ import com.android.dialer.R; import com.android.dialer.database.FilteredNumberAsyncQueryHandler; import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; import com.android.dialer.filterednumber.BlockNumberDialogFragment; +import com.android.dialer.logging.InteractionEvent; +import com.android.dialer.logging.Logger; import com.android.dialer.widget.SearchEditTextLayout; public class BlockedListSearchFragment extends RegularSearchFragment @@ -198,7 +200,18 @@ public class BlockedListSearchFragment extends RegularSearchFragment } @Override - public void onChangeFilteredNumberSuccess() { + public void onFilterNumberSuccess() { + Logger.logInteraction(InteractionEvent.BLOCK_NUMBER_MANAGEMENT_SCREEN); + goBack(); + } + + @Override + public void onUnfilterNumberSuccess() { + Log.wtf(TAG, "Unblocked a number from the BlockedListSearchFragment"); + goBack(); + } + + private void goBack() { Activity activity = getActivity(); if (activity == null) { return; diff --git a/src/com/android/dialer/logging/InteractionEvent.java b/src/com/android/dialer/logging/InteractionEvent.java new file mode 100644 index 000000000..88518b47c --- /dev/null +++ b/src/com/android/dialer/logging/InteractionEvent.java @@ -0,0 +1,76 @@ +/* + * 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.dialer.logging; + +/** + * Class holding constants for Dialer interactions + */ +public class InteractionEvent { + + public static final int UNKNOWN = 0; + + /** + * An incoming call was blocked + */ + public static final int CALL_BLOCKED = 15; + + /** + * The user blocked a number from the Call Log screen + */ + public static final int BLOCK_NUMBER_CALL_LOG = 16; + + /** + * The user blocked a number from the Call details screen + */ + public static final int BLOCK_NUMBER_CALL_DETAIL = 17; + + /** + * The user blocked a number from the Management screen + */ + public static final int BLOCK_NUMBER_MANAGEMENT_SCREEN = 18; + + /** + * The user unblocked a number from the Call Log screen + */ + public static final int UNBLOCK_NUMBER_CALL_LOG = 19; + + /** + * The user unblocked a number from the Call details screen + */ + public static final int UNBLOCK_NUMBER_CALL_DETAIL = 20; + + /** + * The user unblocked a number from the Management screen + */ + public static final int UNBLOCK_NUMBER_MANAGEMENT_SCREEN = 21; + + /** + * The user blocked numbers from contacts marked as send to voicemail + */ + public static final int IMPORT_SEND_TO_VOICEMAIL = 22; + + /** + * The user blocked a number then undid the block + */ + public static final int UNDO_BLOCK_NUMBER = 23; + + /** + * The user unblocked a number then undid the unblock + */ + public static final int UNDO_UNBLOCK_NUMBER = 24; + +} diff --git a/src/com/android/dialer/logging/Logger.java b/src/com/android/dialer/logging/Logger.java index fc19c8f8a..25b7268ad 100644 --- a/src/com/android/dialer/logging/Logger.java +++ b/src/com/android/dialer/logging/Logger.java @@ -66,6 +66,20 @@ public abstract class Logger { } } + /** + * Logs an interaction that occurred + * + * @param interaction an integer representing what interaction occurred. + * {@see com.android.dialer.logging.InteractionEvent} + */ + public static void logInteraction(int interaction) { + final Logger logger = getInstance(); + if (logger != null) { + logger.logInteractionImpl(interaction); + } + } + public abstract void logCallImpl(Call call); public abstract void logScreenViewImpl(int screenType); + public abstract void logInteractionImpl(int dialerInteraction); } |