Merge "Reland: Add attribution tags for VCN and VPN" into udc-dev am: 67c8f87df0 am: f5e3b75afc am: 150125f2d9
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23642150 Change-Id: Ia2cbed1dfc3c7a2595051adaecc649615fe9ca6f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -162,6 +162,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
// TODO(b/180451994): ensure all incoming + outgoing calls have a cleared calling identity
|
// TODO(b/180451994): ensure all incoming + outgoing calls have a cleared calling identity
|
||||||
public class VcnManagementService extends IVcnManagementService.Stub {
|
public class VcnManagementService extends IVcnManagementService.Stub {
|
||||||
@NonNull private static final String TAG = VcnManagementService.class.getSimpleName();
|
@NonNull private static final String TAG = VcnManagementService.class.getSimpleName();
|
||||||
|
@NonNull private static final String CONTEXT_ATTRIBUTION_TAG = "VCN";
|
||||||
|
|
||||||
private static final long DUMP_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5);
|
private static final long DUMP_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5);
|
||||||
private static final int LOCAL_LOG_LINE_COUNT = 512;
|
private static final int LOCAL_LOG_LINE_COUNT = 512;
|
||||||
|
|
||||||
@@ -223,7 +225,9 @@ public class VcnManagementService extends IVcnManagementService.Stub {
|
|||||||
|
|
||||||
@VisibleForTesting(visibility = Visibility.PRIVATE)
|
@VisibleForTesting(visibility = Visibility.PRIVATE)
|
||||||
VcnManagementService(@NonNull Context context, @NonNull Dependencies deps) {
|
VcnManagementService(@NonNull Context context, @NonNull Dependencies deps) {
|
||||||
mContext = requireNonNull(context, "Missing context");
|
mContext =
|
||||||
|
requireNonNull(context, "Missing context")
|
||||||
|
.createAttributionContext(CONTEXT_ATTRIBUTION_TAG);
|
||||||
mDeps = requireNonNull(deps, "Missing dependencies");
|
mDeps = requireNonNull(deps, "Missing dependencies");
|
||||||
|
|
||||||
mLooper = mDeps.getLooper();
|
mLooper = mDeps.getLooper();
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class VpnManagerService extends IVpnManager.Stub {
|
public class VpnManagerService extends IVpnManager.Stub {
|
||||||
private static final String TAG = VpnManagerService.class.getSimpleName();
|
private static final String TAG = VpnManagerService.class.getSimpleName();
|
||||||
|
private static final String CONTEXT_ATTRIBUTION_TAG = "VPN_MANAGER";
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected final HandlerThread mHandlerThread;
|
protected final HandlerThread mHandlerThread;
|
||||||
@@ -157,7 +158,7 @@ public class VpnManagerService extends IVpnManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public VpnManagerService(Context context, Dependencies deps) {
|
public VpnManagerService(Context context, Dependencies deps) {
|
||||||
mContext = context;
|
mContext = context.createAttributionContext(CONTEXT_ATTRIBUTION_TAG);
|
||||||
mDeps = deps;
|
mDeps = deps;
|
||||||
mHandlerThread = mDeps.makeHandlerThread();
|
mHandlerThread = mDeps.makeHandlerThread();
|
||||||
mHandlerThread.start();
|
mHandlerThread.start();
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ import java.util.UUID;
|
|||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class VcnManagementServiceTest {
|
public class VcnManagementServiceTest {
|
||||||
|
private static final String CONTEXT_ATTRIBUTION_TAG = "VCN";
|
||||||
private static final String TEST_PACKAGE_NAME =
|
private static final String TEST_PACKAGE_NAME =
|
||||||
VcnManagementServiceTest.class.getPackage().getName();
|
VcnManagementServiceTest.class.getPackage().getName();
|
||||||
private static final String TEST_PACKAGE_NAME_2 = "TEST_PKG_2";
|
private static final String TEST_PACKAGE_NAME_2 = "TEST_PKG_2";
|
||||||
@@ -177,6 +178,7 @@ public class VcnManagementServiceTest {
|
|||||||
0 /* carrierId */,
|
0 /* carrierId */,
|
||||||
0 /* profileClass */);
|
0 /* profileClass */);
|
||||||
|
|
||||||
|
private final Context mMockContextWithoutAttributionTag = mock(Context.class);
|
||||||
private final Context mMockContext = mock(Context.class);
|
private final Context mMockContext = mock(Context.class);
|
||||||
private final VcnManagementService.Dependencies mMockDeps =
|
private final VcnManagementService.Dependencies mMockDeps =
|
||||||
mock(VcnManagementService.Dependencies.class);
|
mock(VcnManagementService.Dependencies.class);
|
||||||
@@ -202,6 +204,10 @@ public class VcnManagementServiceTest {
|
|||||||
private final IBinder mMockIBinder = mock(IBinder.class);
|
private final IBinder mMockIBinder = mock(IBinder.class);
|
||||||
|
|
||||||
public VcnManagementServiceTest() throws Exception {
|
public VcnManagementServiceTest() throws Exception {
|
||||||
|
doReturn(mMockContext)
|
||||||
|
.when(mMockContextWithoutAttributionTag)
|
||||||
|
.createAttributionContext(CONTEXT_ATTRIBUTION_TAG);
|
||||||
|
|
||||||
setupSystemService(
|
setupSystemService(
|
||||||
mMockContext, mConnMgr, Context.CONNECTIVITY_SERVICE, ConnectivityManager.class);
|
mMockContext, mConnMgr, Context.CONNECTIVITY_SERVICE, ConnectivityManager.class);
|
||||||
setupSystemService(
|
setupSystemService(
|
||||||
@@ -249,7 +255,7 @@ public class VcnManagementServiceTest {
|
|||||||
doReturn(bundle).when(mConfigReadWriteHelper).readFromDisk();
|
doReturn(bundle).when(mConfigReadWriteHelper).readFromDisk();
|
||||||
|
|
||||||
setupMockedCarrierPrivilege(true);
|
setupMockedCarrierPrivilege(true);
|
||||||
mVcnMgmtSvc = new VcnManagementService(mMockContext, mMockDeps);
|
mVcnMgmtSvc = new VcnManagementService(mMockContextWithoutAttributionTag, mMockDeps);
|
||||||
setupActiveSubscription(TEST_UUID_1);
|
setupActiveSubscription(TEST_UUID_1);
|
||||||
|
|
||||||
doReturn(mMockIBinder).when(mMockPolicyListener).asBinder();
|
doReturn(mMockIBinder).when(mMockPolicyListener).asBinder();
|
||||||
|
|||||||
Reference in New Issue
Block a user