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

Commit e435b062 authored by Matthew Fritze's avatar Matthew Fritze
Browse files

Fix NPE in constructor

Move getActivity() call and fetching of metrics feature provider into
onCreateView rathre than the Constructor of the fragment (where Activity
is not yet created).

Test: manual
Test: existing robotests
Fixes: 128808444
Change-Id: I88586b0ca3ebda60f8933041322541cc5911de68
parent 23924cf3
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -48,16 +48,11 @@ public class PanelFragment extends Fragment {
    private RecyclerView mPanelSlices;

    private PanelContent mPanel;
    private final MetricsFeatureProvider mMetricsProvider;
    private MetricsFeatureProvider mMetricsProvider;

    @VisibleForTesting
    PanelSlicesAdapter mAdapter;

    public PanelFragment() {
        final Context context = getActivity();
        mMetricsProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
@@ -83,6 +78,7 @@ public class PanelFragment extends Fragment {
                .getPanelFeatureProvider()
                .getPanel(activity, panelType, mediaPackageName);

        mMetricsProvider = FeatureFactory.getFactory(activity).getMetricsFeatureProvider();
        // Log panel opened.
        mMetricsProvider.action(
                0 /* attribution */,