Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40c7479f authored by Walter Jang's avatar Walter Jang
Browse files

Add factory to create AOSP overlays

* And return a null Logger in the AOSP contacts code
  so we don't expose the name "clearcut".
* We also don't need a no-op Logger impl anymore.

Bug 26985491

Change-Id: I18b1fe76f09012acd067d0c186f25f6eb7530bb3
(cherry picked from commit 99a05151699230f7c93311ceab50e7902c8596be)
parent 6bf5f68c
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ package com.android.contacts.common.logging;

import android.app.Activity;

import com.android.contacts.commonbind.ObjectFactory;
import com.android.contacts.commonbind.analytics.AnalyticsUtil;
import com.android.contacts.commonbind.logging.ClearcutLoggerHelper;

/**
 * Logs analytics events.
@@ -27,7 +27,7 @@ public abstract class Logger {
    public static final String TAG = "Logger";

    public static Logger getInstance() {
        return ClearcutLoggerHelper.getInstance();
        return ObjectFactory.getLogger();
    }

    /**
@@ -47,6 +47,16 @@ public abstract class Logger {
        AnalyticsUtil.sendScreenView(screenName, activity, tag);
    }

    /**
     * Logs the results of a user search for a particular contact.
     */
    public static void logSearchEvent(SearchState searchState) {
        final Logger logger = getInstance();
         if (logger != null) {
            logger.logSearchEventImpl(searchState);
        }
    }

    public abstract void logScreenViewImpl(int screenType);
    public abstract void logSearchEventImpl(SearchState searchState);
}
+26 −0
Original line number Diff line number Diff line
/*
 * 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.contacts.commonbind;

import com.android.contacts.common.logging.Logger;

/**
 * Creates default bindings for overlays.
 */
public class ObjectFactory {

    public static Logger getLogger() {
        return null;
    }
}
+0 −45
Original line number Diff line number Diff line
/*
 * 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.contacts.commonbind.logging;

import com.android.contacts.common.logging.Logger;
import com.android.contacts.common.logging.SearchState;

/**
 * No-op clearcut logger implementation.
 */
public class ClearcutLoggerHelper extends Logger {

    private static ClearcutLoggerHelper sInstance;

    public static ClearcutLoggerHelper getInstance() {
        if (sInstance == null) {
            sInstance = new ClearcutLoggerHelper();
        }
        return sInstance;
    }

    private ClearcutLoggerHelper() {
    }

    @Override
    public void logScreenViewImpl(int screenType) {
    }

    @Override
    public void logSearchEventImpl(SearchState searchState) {
    }
}