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

Commit d6b1e271 authored by Naresh Jayaram's avatar Naresh Jayaram Committed by Gerrit - the friendly Code Review server
Browse files

P2P : Adding debug information for null pointer exception in p2p

System service intialises connectivity service during device boot
up.If intialization is failed and wifi direct is going to enable
it would crash. Because while enabling p2p it is setting up the
interface using INetworkManagement service object.
This crash is observed only with monkey test. Hence adding debug
logs for capturing detailed information

Change-Id: Idd1666a5546f999d8952a8ab96374184c4490eab
CRs-Fixed: 569648
parent 383b26b7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -560,7 +560,11 @@ class ServerThread {
                       networkStats.bindConnectivityManager(connectivity);
                       networkPolicy.bindConnectivityManager(connectivity);
                       wifi.checkAndStartWifi();
                       try {
                           wifiP2p.connectivityServiceReady();
                       } catch (NullPointerException np){
                          Slog.i(TAG,"Exception while initialsing connectivity service ",np);
                       }
                   }
               } catch (Throwable e) {
                   reportWtf("starting Connectivity Service", e);
+1 −0
Original line number Diff line number Diff line
@@ -3083,6 +3083,7 @@ public class WifiStateMachine extends StateMachine {

            if (mP2pSupported) {
                if (mOperationalMode == CONNECT_MODE) {
                    log("enabling p2p from driver started state");
                    mWifiP2pChannel.sendMessage(WifiStateMachine.CMD_ENABLE_P2P);
                } else {
                    // P2P statemachine starts in disabled state, and is not enabled until
+7 −0
Original line number Diff line number Diff line
@@ -329,8 +329,13 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
    }

    public void connectivityServiceReady() {
        Slog.d(TAG,"Initialising NetworkManagement Service");
        IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE);
        mNwService = INetworkManagementService.Stub.asInterface(b);
        if (mNwService==null) {
           throw new NullPointerException(
           "Failed to intialise NetwrokManagement service from Binder interface");
        }
    }

    private void enforceAccessPermission() {
@@ -811,6 +816,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
            switch (message.what) {
                case WifiStateMachine.CMD_ENABLE_P2P:
                    try {
                        if(mNwService == null)
                           loge("NetworkManagement service is null");
                        mNwService.setInterfaceUp(mInterface);
                    } catch (RemoteException re) {
                        loge("Unable to change interface settings: " + re);