Merge "Revert "Add a new logger for StatsLog""
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.settings.core.instrumentation;
|
||||
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
public class SettingsMetricsFeatureProvider extends MetricsFeatureProvider {
|
||||
@Override
|
||||
protected void installLogWriters() {
|
||||
super.installLogWriters();
|
||||
mLoggerWriters.add(new StatsLogWriter());
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.settings.core.instrumentation;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.util.Pair;
|
||||
import android.util.StatsLog;
|
||||
|
||||
import com.android.settingslib.core.instrumentation.LogWriter;
|
||||
|
||||
public class StatsLogWriter implements LogWriter {
|
||||
|
||||
@Override
|
||||
public void visible(Context context, int attribution, int pageId) {
|
||||
StatsLog.write(StatsLog.SETTINGS_UI_CHANGED /* Atom name */,
|
||||
attribution,
|
||||
SettingsEnums.PAGE_VISIBLE /* action */,
|
||||
pageId,
|
||||
null /* changedPreferenceKey */,
|
||||
0 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hidden(Context context, int pageId) {
|
||||
StatsLog.write(StatsLog.SETTINGS_UI_CHANGED /* Atom name */,
|
||||
SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
SettingsEnums.PAGE_HIDE /* action */,
|
||||
pageId,
|
||||
null /* changedPreferenceKey */,
|
||||
0 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(int category, int value, Pair<Integer, Object>... taggedData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(int category, boolean value, Pair<Integer, Object>... taggedData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(Context context, int action, Pair<Integer, Object>... taggedData) {
|
||||
action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
action,
|
||||
SettingsEnums.PAGE_UNKNOWN /* pageId */,
|
||||
null /* changedPreferenceKey */,
|
||||
0 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionWithSource(Context context, int pageId, int action) {
|
||||
action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
action,
|
||||
pageId /* pageId */,
|
||||
null /* changedPreferenceKey */,
|
||||
0 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(Context context, int action, int value) {
|
||||
action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
action,
|
||||
SettingsEnums.PAGE_UNKNOWN /* pageId */,
|
||||
null /* changedPreferenceKey */,
|
||||
value /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(Context context, int action, boolean value) {
|
||||
action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
action,
|
||||
SettingsEnums.PAGE_UNKNOWN /* pageId */,
|
||||
null /* changedPreferenceKey */,
|
||||
value ? 1 : 0 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(Context context, int action, String pkg,
|
||||
Pair<Integer, Object>... taggedData) {
|
||||
action(SettingsEnums.PAGE_UNKNOWN /* attribution */,
|
||||
action,
|
||||
SettingsEnums.PAGE_UNKNOWN /* pageId */,
|
||||
pkg /* changedPreferenceKey */,
|
||||
1 /* changedPreferenceIntValue */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void count(Context context, String name, int value) {
|
||||
// No-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(int attribution, int action, int pageId, String key, int value) {
|
||||
StatsLog.write(StatsLog.SETTINGS_UI_CHANGED /* atomName */,
|
||||
attribution,
|
||||
action,
|
||||
pageId,
|
||||
key,
|
||||
value);
|
||||
}
|
||||
}
|
@@ -16,12 +16,16 @@
|
||||
|
||||
package com.android.settings.gestures;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
@@ -38,7 +42,7 @@ public class WakeScreenGestureSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.SETTINGS_GESTURE_WAKE_SCREEN;
|
||||
return MetricsProto.MetricsEvent.SETTINGS_GESTURE_WAKE_SCREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.homepage.contextualcards;
|
||||
|
||||
import static com.android.settings.homepage.contextualcards.ContextualCardsAdapter.SPAN_COUNT;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -27,6 +26,7 @@ import android.view.ViewGroup;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
|
||||
@@ -69,6 +69,6 @@ public class ContextualCardsFragment extends InstrumentedFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.SETTINGS_HOMEPAGE;
|
||||
return MetricsEvent.SETTINGS_HOMEPAGE;
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -32,6 +31,7 @@ import android.util.Log;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.telephony.TelephonyIntents;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||
@@ -75,7 +75,7 @@ public class MobileNetworkSettings extends RestrictedDashboardFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.MOBILE_NETWORK;
|
||||
return MetricsProto.MetricsEvent.MOBILE_NETWORK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package com.android.settings.network.telephony;
|
||||
|
||||
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -202,7 +203,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.MOBILE_NETWORK_SELECT;
|
||||
return MOBILE_NETWORK_SELECT;
|
||||
}
|
||||
|
||||
private final Handler mHandler = new Handler() {
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.network.telephony.gsm;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
@@ -27,6 +26,7 @@ import android.telephony.TelephonyManager;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
@@ -100,7 +100,7 @@ public class AutoSelectPreferenceController extends TogglePreferenceController {
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setSourceMetricsCategory(MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.network.telephony.gsm;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
@@ -28,6 +27,7 @@ import android.text.TextUtils;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
@@ -88,7 +88,7 @@ public class OpenNetworkSelectPagePreferenceController extends BasePreferenceCon
|
||||
bundle.putInt(Settings.EXTRA_SUB_ID, mSubId);
|
||||
new SubSettingLauncher(mContext)
|
||||
.setDestination(NetworkSelectSettings.class.getName())
|
||||
.setSourceMetricsCategory(SettingsEnums.MOBILE_NETWORK_SELECT)
|
||||
.setSourceMetricsCategory(MetricsProto.MetricsEvent.MOBILE_NETWORK_SELECT)
|
||||
.setTitleRes(R.string.choose_network_title)
|
||||
.setArguments(bundle)
|
||||
.launch();
|
||||
|
@@ -29,7 +29,6 @@ import com.android.settings.accounts.AccountFeatureProviderImpl;
|
||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||
import com.android.settings.applications.ApplicationFeatureProviderImpl;
|
||||
import com.android.settings.connecteddevice.dock.DockUpdaterFeatureProviderImpl;
|
||||
import com.android.settings.core.instrumentation.SettingsMetricsFeatureProvider;
|
||||
import com.android.settings.dashboard.DashboardFeatureProvider;
|
||||
import com.android.settings.dashboard.DashboardFeatureProviderImpl;
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProvider;
|
||||
@@ -81,7 +80,7 @@ public class FeatureFactoryImpl extends FeatureFactory {
|
||||
@Override
|
||||
public MetricsFeatureProvider getMetricsFeatureProvider() {
|
||||
if (mMetricsFeatureProvider == null) {
|
||||
mMetricsFeatureProvider = new SettingsMetricsFeatureProvider();
|
||||
mMetricsFeatureProvider = new MetricsFeatureProvider();
|
||||
}
|
||||
return mMetricsFeatureProvider;
|
||||
}
|
||||
|
Reference in New Issue
Block a user