summaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-09-08 15:29:02 -0700
committerYorke Lee <yorkelee@google.com>2015-09-09 09:22:02 -0700
commitb7b0a210c377f4f09e6f0c34af6345c79a8990f7 (patch)
tree7e9a78a541a37f9e616e9cd0c2321b01d633e381 /src/com
parent5b62b78e829b4c6b264cd6d07676b7ac3a41a5bf (diff)
Add stub implementations for logging changes
Add abstract Logger class that serves as a contract for actual logging implementations. Bug: 23164804 Change-Id: Idaedae9b03aa60bbee21574584b47e3529ee9cad
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/dialer/logging/Logger.java58
-rw-r--r--src/com/android/dialerbind/ObjectFactory.java6
2 files changed, 64 insertions, 0 deletions
diff --git a/src/com/android/dialer/logging/Logger.java b/src/com/android/dialer/logging/Logger.java
new file mode 100644
index 000000000..300707779
--- /dev/null
+++ b/src/com/android/dialer/logging/Logger.java
@@ -0,0 +1,58 @@
+/*
+ * 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;
+
+import android.app.Activity;
+
+import com.android.dialerbind.ObjectFactory;
+import com.android.incallui.Call;
+
+public abstract class Logger {
+
+ public static Logger getInstance() {
+ return ObjectFactory.getLoggerInstance();
+ }
+
+ /**
+ * Logs a call event. PII like the call's number or caller details should never be logged.
+ *
+ * @param call to log.
+ */
+ public static void logCall(Call call) {
+ final Logger logger = getInstance();
+ if (logger != null) {
+ logger.logCallImpl(call);
+ }
+ }
+
+ /**
+ * Logs an event indicating that a screen/fragment was displayed.
+ *
+ * @param fragmentName of the displayed fragment.
+ * @param activity Parent activity of the fragment.
+ * @param tag Optional string used to provide additional information about the fragment.
+ */
+ public static void logScreenView(String fragmentName, Activity activity, String tag) {
+ final Logger logger = getInstance();
+ if (logger != null) {
+ logger.logScreenViewImpl(fragmentName, activity, tag);
+ }
+ }
+
+ public abstract void logCallImpl(Call call);
+ public abstract void logScreenViewImpl(String fragmentName, Activity activity, String tag);
+}
diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java
index d67ada0d1..c64afe83a 100644
--- a/src/com/android/dialerbind/ObjectFactory.java
+++ b/src/com/android/dialerbind/ObjectFactory.java
@@ -22,6 +22,7 @@ import android.content.Context;
import com.android.dialer.calllog.CallLogAdapter;
import com.android.dialer.calllog.ContactInfoHelper;
+import com.android.dialer.logging.Logger;
import com.android.dialer.service.CachedNumberLookupService;
import com.android.dialer.voicemail.VoicemailPlaybackPresenter;
@@ -59,4 +60,9 @@ public class ObjectFactory {
voicemailPlaybackPresenter,
isCallLogActivity);
}
+
+ public static Logger getLoggerInstance() {
+ // no-op
+ return null;
+ }
}