Loading src/java/com/android/internal/telephony/RIL.java +2 −9 Original line number Diff line number Diff line Loading @@ -4069,13 +4069,6 @@ public class RIL extends BaseCommands implements CommandsInterface { return workSource; } private String getWorkSourceClientId(WorkSource workSource) { if (workSource != null) { return String.valueOf(workSource.get(0)) + ":" + workSource.getName(0); } return null; } /** * Holds a PARTIAL_WAKE_LOCK whenever Loading @@ -4099,7 +4092,7 @@ public class RIL extends BaseCommands implements CommandsInterface { mWakeLockCount++; mWlSequenceNum++; String clientId = getWorkSourceClientId(rr.mWorkSource); String clientId = rr.getWorkSourceClientId(); if (!mClientWakelockTracker.isClientActive(clientId)) { if (mActiveWakelockWorkSource != null) { mActiveWakelockWorkSource.add(rr.mWorkSource); Loading Loading @@ -4161,7 +4154,7 @@ public class RIL extends BaseCommands implements CommandsInterface { mClientWakelockTracker.stopTracking(rr.mClientId, rr.mRequest, rr.mSerial, (mWakeLockCount > 1) ? mWakeLockCount - 1 : 0); String clientId = getWorkSourceClientId(rr.mWorkSource);; String clientId = rr.getWorkSourceClientId(); if (!mClientWakelockTracker.isClientActive(clientId) && (mActiveWakelockWorkSource != null)) { mActiveWakelockWorkSource.remove(rr.mWorkSource); Loading src/java/com/android/internal/telephony/RILRequest.java +27 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import android.os.AsyncResult; import android.os.Message; import android.os.SystemClock; import android.os.WorkSource; import android.os.WorkSource.WorkChain; import android.telephony.Rlog; import java.util.ArrayList; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; Loading Loading @@ -110,13 +112,14 @@ public class RILRequest { * @param workSource WorkSource to track the client * @return a RILRequest instance from the pool. */ static RILRequest obtain(int request, Message result, WorkSource workSource) { // @VisibleForTesting public static RILRequest obtain(int request, Message result, WorkSource workSource) { RILRequest rr = null; rr = obtain(request, result); if (workSource != null) { rr.mWorkSource = workSource; rr.mClientId = String.valueOf(workSource.get(0)) + ":" + workSource.getName(0); rr.mClientId = rr.getWorkSourceClientId(); } else { Rlog.e(LOG_TAG, "null workSource " + request); } Loading @@ -124,6 +127,28 @@ public class RILRequest { return rr; } /** * Generate a String client ID from the WorkSource. */ // @VisibleForTesting public String getWorkSourceClientId() { if (mWorkSource == null || mWorkSource.isEmpty()) { return null; } if (mWorkSource.size() > 0) { return mWorkSource.get(0) + ":" + mWorkSource.getName(0); } final ArrayList<WorkChain> workChains = mWorkSource.getWorkChains(); if (workChains != null && !workChains.isEmpty()) { final WorkChain workChain = workChains.get(0); return workChain.getAttributionUid() + ":" + workChain.getTags()[0]; } return null; } /** * Returns a RILRequest instance to the pool. * Loading tests/telephonytests/src/com/android/internal/telephony/RILTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -1353,6 +1353,30 @@ public class RILTest extends TelephonyTest { assertEquals(expected, cellInfoCdma); } @Test public void testGetWorksourceClientId() { RILRequest request = RILRequest.obtain(0, null, null); assertEquals(null, request.getWorkSourceClientId()); request = RILRequest.obtain(0, null, new WorkSource()); assertEquals(null, request.getWorkSourceClientId()); WorkSource ws = new WorkSource(); ws.add(100); request = RILRequest.obtain(0, null, ws); assertEquals("100:null", request.getWorkSourceClientId()); ws = new WorkSource(); ws.add(100, "foo"); request = RILRequest.obtain(0, null, ws); assertEquals("100:foo", request.getWorkSourceClientId()); ws = new WorkSource(); ws.createWorkChain().addNode(100, "foo").addNode(200, "bar"); request = RILRequest.obtain(0, null, ws); assertEquals("100:foo", request.getWorkSourceClientId()); } private ArrayList<CellInfo> getCellInfoListForLTE( String mcc, String mnc, String alphaLong, String alphaShort) { android.hardware.radio.V1_2.CellInfoLte lte = new android.hardware.radio.V1_2.CellInfoLte(); Loading Loading
src/java/com/android/internal/telephony/RIL.java +2 −9 Original line number Diff line number Diff line Loading @@ -4069,13 +4069,6 @@ public class RIL extends BaseCommands implements CommandsInterface { return workSource; } private String getWorkSourceClientId(WorkSource workSource) { if (workSource != null) { return String.valueOf(workSource.get(0)) + ":" + workSource.getName(0); } return null; } /** * Holds a PARTIAL_WAKE_LOCK whenever Loading @@ -4099,7 +4092,7 @@ public class RIL extends BaseCommands implements CommandsInterface { mWakeLockCount++; mWlSequenceNum++; String clientId = getWorkSourceClientId(rr.mWorkSource); String clientId = rr.getWorkSourceClientId(); if (!mClientWakelockTracker.isClientActive(clientId)) { if (mActiveWakelockWorkSource != null) { mActiveWakelockWorkSource.add(rr.mWorkSource); Loading Loading @@ -4161,7 +4154,7 @@ public class RIL extends BaseCommands implements CommandsInterface { mClientWakelockTracker.stopTracking(rr.mClientId, rr.mRequest, rr.mSerial, (mWakeLockCount > 1) ? mWakeLockCount - 1 : 0); String clientId = getWorkSourceClientId(rr.mWorkSource);; String clientId = rr.getWorkSourceClientId(); if (!mClientWakelockTracker.isClientActive(clientId) && (mActiveWakelockWorkSource != null)) { mActiveWakelockWorkSource.remove(rr.mWorkSource); Loading
src/java/com/android/internal/telephony/RILRequest.java +27 −2 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import android.os.AsyncResult; import android.os.Message; import android.os.SystemClock; import android.os.WorkSource; import android.os.WorkSource.WorkChain; import android.telephony.Rlog; import java.util.ArrayList; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; Loading Loading @@ -110,13 +112,14 @@ public class RILRequest { * @param workSource WorkSource to track the client * @return a RILRequest instance from the pool. */ static RILRequest obtain(int request, Message result, WorkSource workSource) { // @VisibleForTesting public static RILRequest obtain(int request, Message result, WorkSource workSource) { RILRequest rr = null; rr = obtain(request, result); if (workSource != null) { rr.mWorkSource = workSource; rr.mClientId = String.valueOf(workSource.get(0)) + ":" + workSource.getName(0); rr.mClientId = rr.getWorkSourceClientId(); } else { Rlog.e(LOG_TAG, "null workSource " + request); } Loading @@ -124,6 +127,28 @@ public class RILRequest { return rr; } /** * Generate a String client ID from the WorkSource. */ // @VisibleForTesting public String getWorkSourceClientId() { if (mWorkSource == null || mWorkSource.isEmpty()) { return null; } if (mWorkSource.size() > 0) { return mWorkSource.get(0) + ":" + mWorkSource.getName(0); } final ArrayList<WorkChain> workChains = mWorkSource.getWorkChains(); if (workChains != null && !workChains.isEmpty()) { final WorkChain workChain = workChains.get(0); return workChain.getAttributionUid() + ":" + workChain.getTags()[0]; } return null; } /** * Returns a RILRequest instance to the pool. * Loading
tests/telephonytests/src/com/android/internal/telephony/RILTest.java +24 −0 Original line number Diff line number Diff line Loading @@ -1353,6 +1353,30 @@ public class RILTest extends TelephonyTest { assertEquals(expected, cellInfoCdma); } @Test public void testGetWorksourceClientId() { RILRequest request = RILRequest.obtain(0, null, null); assertEquals(null, request.getWorkSourceClientId()); request = RILRequest.obtain(0, null, new WorkSource()); assertEquals(null, request.getWorkSourceClientId()); WorkSource ws = new WorkSource(); ws.add(100); request = RILRequest.obtain(0, null, ws); assertEquals("100:null", request.getWorkSourceClientId()); ws = new WorkSource(); ws.add(100, "foo"); request = RILRequest.obtain(0, null, ws); assertEquals("100:foo", request.getWorkSourceClientId()); ws = new WorkSource(); ws.createWorkChain().addNode(100, "foo").addNode(200, "bar"); request = RILRequest.obtain(0, null, ws); assertEquals("100:foo", request.getWorkSourceClientId()); } private ArrayList<CellInfo> getCellInfoListForLTE( String mcc, String mnc, String alphaLong, String alphaShort) { android.hardware.radio.V1_2.CellInfoLte lte = new android.hardware.radio.V1_2.CellInfoLte(); Loading