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

Commit 73912ce0 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Add bugreport info about network feature use. DO NOT MERGE

Backported from master change Ib9285359.

We've had a couple bug reports showing the effects of a left-live feature request.
We need a bit more bugreport-time logging.

bug: 2323226
bug: 2377507
change-id: I296b2887101c260aea678bf6db91144535cbad7e
parent 8c166512
Loading
Loading
Loading
Loading
+37 −8
Original line number Original line Diff line number Diff line
@@ -454,6 +454,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        IBinder mBinder;
        IBinder mBinder;
        int mPid;
        int mPid;
        int mUid;
        int mUid;
        long mCreateTime;


        FeatureUser(int type, String feature, IBinder binder) {
        FeatureUser(int type, String feature, IBinder binder) {
            super();
            super();
@@ -462,6 +463,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
            mBinder = binder;
            mBinder = binder;
            mPid = getCallingPid();
            mPid = getCallingPid();
            mUid = getCallingUid();
            mUid = getCallingUid();
            mCreateTime = System.currentTimeMillis();


            try {
            try {
                mBinder.linkToDeath(this, 0);
                mBinder.linkToDeath(this, 0);
@@ -476,15 +478,22 @@ public class ConnectivityService extends IConnectivityManager.Stub {


        public void binderDied() {
        public void binderDied() {
            Log.d(TAG, "ConnectivityService FeatureUser binderDied(" +
            Log.d(TAG, "ConnectivityService FeatureUser binderDied(" +
                    mNetworkType + ", " + mFeature + ", " + mBinder);
                    mNetworkType + ", " + mFeature + ", " + mBinder + "), created " +
                    (System.currentTimeMillis() - mCreateTime) + " mSec ago");
            stopUsingNetworkFeature(this, false);
            stopUsingNetworkFeature(this, false);
        }
        }


        public void expire() {
        public void expire() {
            Log.d(TAG, "ConnectivityService FeatureUser expire(" +
            Log.d(TAG, "ConnectivityService FeatureUser expire(" +
                    mNetworkType + ", " + mFeature + ", " + mBinder);
                    mNetworkType + ", " + mFeature + ", " + mBinder +"), created " +
                    (System.currentTimeMillis() - mCreateTime) + " mSec ago");
            stopUsingNetworkFeature(this, false);
            stopUsingNetworkFeature(this, false);
        }
        }

        public String toString() {
            return "FeatureUser("+mNetworkType+","+mFeature+","+mPid+","+mUid+"), created " +
                    (System.currentTimeMillis() - mCreateTime) + " mSec ago";
        }
    }
    }


    // javadoc from interface
    // javadoc from interface
@@ -596,6 +605,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
            return stopUsingNetworkFeature(u, true);
            return stopUsingNetworkFeature(u, true);
        } else {
        } else {
            // none found!
            // none found!
            if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature - not a live request");
            return 1;
            return 1;
        }
        }
    }
    }
@@ -640,6 +650,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
                    if (x.mUid == u.mUid && x.mPid == u.mPid &&
                    if (x.mUid == u.mUid && x.mPid == u.mPid &&
                            x.mNetworkType == u.mNetworkType &&
                            x.mNetworkType == u.mNetworkType &&
                            TextUtils.equals(x.mFeature, u.mFeature)) {
                            TextUtils.equals(x.mFeature, u.mFeature)) {
                        if (DBG) Log.d(TAG, "ignoring stopUsingNetworkFeature as dup is found");
                        return 1;
                        return 1;
                    }
                    }
                }
                }
@@ -1198,6 +1209,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
        }
        }
        pw.println();
        pw.println();
        for (NetworkStateTracker nst : mNetTrackers) {
        for (NetworkStateTracker nst : mNetTrackers) {
            if (nst != null) {
                if (nst.getNetworkInfo().isConnected()) {
                if (nst.getNetworkInfo().isConnected()) {
                    pw.println("Active network: " + nst.getNetworkInfo().
                    pw.println("Active network: " + nst.getNetworkInfo().
                            getTypeName());
                            getTypeName());
@@ -1208,6 +1220,23 @@ public class ConnectivityService extends IConnectivityManager.Stub {
            }
            }
        }
        }


        pw.println("Network Requester Pids:");
        for (int net : mPriorityList) {
            String pidString = net + ": ";
            for (Object pid : mNetRequestersPids[net]) {
                pidString = pidString + pid.toString() + ", ";
            }
            pw.println(pidString);
        }
        pw.println();

        pw.println("FeatureUsers:");
        for (Object requester : mFeatureUsers) {
            pw.println(requester.toString());
        }
        pw.println();
    }

    // must be stateless - things change under us.
    // must be stateless - things change under us.
    private class MyHandler extends Handler {
    private class MyHandler extends Handler {
        @Override
        @Override