diff options
author | Michael Groover <mpgroover@google.com> | 2018-10-01 16:14:50 -0700 |
---|---|---|
committer | Michael Groover <mpgroover@google.com> | 2018-10-09 13:44:02 -0700 |
commit | 6d20d75e9ea1b5df326ca243f966aa9f7328eaa4 (patch) | |
tree | 64c8f03ea4e39eac4db4d0f6bc8cab58323658ee /core/tests/bandwidthtests | |
parent | 42f4e79d7e87eefe4a9528b646b1ae456a9f23e6 (diff) |
Protect Device Identifiers behind priv permission and DO/PO checks
Bug: 110099294
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
-t com.android.cts.devicepolicy.DeviceOwnerTest.testDeviceOwnerCanGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsDevicePolicyManagerTestCases \
-t com.android.cts.devicepolicy.ManagedProfileTest#testGetDeviceIdentifiers
Test: cts-tradefed run cts -m CtsTelephonyTestCases -t android.telephony.cts.TelephonyManagerTest
Test: cts-tradefed run cts -m CtsPermissionTestCases -t android.permission.cts.TelephonyManagerPermissionTest
Change-Id: I3c82c53ec89cd17b34a61166ccc9e9747388efac
Diffstat (limited to 'core/tests/bandwidthtests')
-rw-r--r-- | core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java index 4a58f885ff08..2989df83866c 100644 --- a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java +++ b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java @@ -16,6 +16,7 @@ package com.android.bandwidthtest; +import android.app.UiAutomation; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo.State; @@ -74,7 +75,13 @@ public class BandwidthTest extends InstrumentationTestCase { Log.v(LOG_TAG, "Initialized mConnectionUtil"); mUid = Process.myUid(); mTManager = (TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE); - mDeviceId = mTManager.getDeviceId(); + final UiAutomation uiAutomation = getInstrumentation().getUiAutomation(); + try { + uiAutomation.adoptShellPermissionIdentity(); + mDeviceId = mTManager.getDeviceId(); + } finally { + uiAutomation.dropShellPermissionIdentity(); + } } @Override |