Merge "Fix NPE when using VisibilityLogger."
This commit is contained in:
committed by
Android (Google) Code Review
commit
d97f64d082
@@ -49,8 +49,8 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsProto;
|
||||
import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
|
||||
import com.android.settings.core.instrumentation.Instrumentable;
|
||||
import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
@@ -84,6 +84,13 @@ public class DeviceAdminSettings extends ListFragment implements Instrumentable
|
||||
return this.name.compareTo(other.name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mVisibilityLoggerMixin.onAttach(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal collection of device admin info objects for all profiles associated with the current
|
||||
* user.
|
||||
|
@@ -80,6 +80,12 @@ public class UserDictionarySettings extends ListFragment implements Instrumentab
|
||||
return MetricsProto.MetricsEvent.USER_DICTIONARY_SETTINGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mVisibilityLoggerMixin.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@@ -136,6 +136,12 @@ public class ZonePicker extends ListFragment implements Instrumentable {
|
||||
return TimeZone.getTimeZone((String)((Map<?, ?>)item).get(ZoneGetter.KEY_ID));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
mVisibilityLoggerMixin.onAttach(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.ZONE_PICKER;
|
||||
|
@@ -50,11 +50,15 @@ public class VisibilityLoggerMixin implements LifecycleObserver, OnResume, OnPau
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
mMetricsFeature.visible(null /* context */, mMetricsCategory);
|
||||
if (mMetricsFeature != null) {
|
||||
mMetricsFeature.visible(null /* context */, mMetricsCategory);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
mMetricsFeature.hidden(null /* context */, mMetricsCategory);
|
||||
if (mMetricsFeature != null) {
|
||||
mMetricsFeature.hidden(null /* context */, mMetricsCategory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user