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

Commit e67c5643 authored by markchien's avatar markchien
Browse files

Fix NPE that netd callback call null TetheringConfiguration object

Bug: 148386056
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: I3b1dd958fc107fdc9a6059fbdcf358af4822ebde
parent 497afcff
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -272,13 +272,6 @@ public class Tethering {

        mStateReceiver = new StateReceiver();

        mNetdCallback = new NetdCallback();
        try {
            mNetd.registerUnsolicitedEventListener(mNetdCallback);
        } catch (RemoteException e) {
            mLog.e("Unable to register netd UnsolicitedEventListener");
        }

        final UserManager userManager = (UserManager) mContext.getSystemService(
                Context.USER_SERVICE);
        mTetheringRestriction = new UserRestrictionActionListener(userManager, this);
@@ -287,6 +280,14 @@ public class Tethering {

        // Load tethering configuration.
        updateConfiguration();
        // NetdCallback should be registered after updateConfiguration() to ensure
        // TetheringConfiguration is created.
        mNetdCallback = new NetdCallback();
        try {
            mNetd.registerUnsolicitedEventListener(mNetdCallback);
        } catch (RemoteException e) {
            mLog.e("Unable to register netd UnsolicitedEventListener");
        }

        startStateMachineUpdaters(mHandler);
        startTrackDefaultNetwork();