summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip P. Moltmann <moltmann@google.com>2020-01-08 19:06:38 -0800
committerandroid-build-merger <android-build-merger@google.com>2020-01-08 19:06:38 -0800
commit61f51b103cd2602e1ccc1af65112b2f5c6cf9f8f (patch)
tree6c95f488c3421894deb1b5cd6d57f668d0a3cd98
parent56939ba6e784e91ad2ae852fdca56799981df2a5 (diff)
parent6c32b3e699f675f93e5b661a572ec18b6ad238e9 (diff)
downloadplatform_packages_services_AlternativeNetworkAccess-61f51b103cd2602e1ccc1af65112b2f5c6cf9f8f.tar.gz
platform_packages_services_AlternativeNetworkAccess-61f51b103cd2602e1ccc1af65112b2f5c6cf9f8f.tar.bz2
platform_packages_services_AlternativeNetworkAccess-61f51b103cd2602e1ccc1af65112b2f5c6cf9f8f.zip
(Backport) Pipe through featureId from caller to permission checks.
am: 6c32b3e699 Change-Id: Ibd99bb3b5e7199dcf7d7707dca1a1d194dc141db
-rw-r--r--src/com/android/ons/OpportunisticNetworkService.java6
-rw-r--r--tests/src/com/android/ons/OpportunisticNetworkServiceTest.java5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java
index deae9e9..96af81f 100644
--- a/src/com/android/ons/OpportunisticNetworkService.java
+++ b/src/com/android/ons/OpportunisticNetworkService.java
@@ -271,11 +271,13 @@ public class OpportunisticNetworkService extends Service {
* subscription id
*
*/
- public int getPreferredDataSubscriptionId(String callingPackage) {
+ @Override
+ public int getPreferredDataSubscriptionId(String callingPackage,
+ String callingFeatureId) {
TelephonyPermissions
.checkCallingOrSelfReadPhoneState(mContext,
mSubscriptionManager.getDefaultSubscriptionId(),
- callingPackage, "getPreferredDataSubscriptionId");
+ callingPackage, callingFeatureId, "getPreferredDataSubscriptionId");
final long identity = Binder.clearCallingIdentity();
try {
return mProfileSelector.getPreferredDataSubscriptionId();
diff --git a/tests/src/com/android/ons/OpportunisticNetworkServiceTest.java b/tests/src/com/android/ons/OpportunisticNetworkServiceTest.java
index 74330b4..d382450 100644
--- a/tests/src/com/android/ons/OpportunisticNetworkServiceTest.java
+++ b/tests/src/com/android/ons/OpportunisticNetworkServiceTest.java
@@ -50,6 +50,7 @@ import androidx.test.runner.AndroidJUnit4;
public class OpportunisticNetworkServiceTest extends ONSBaseTest {
private static final String TAG = "ONSTest";
private String pkgForDebug;
+ private String pkgForFeature;
private int mResult;
private IOns iOpportunisticNetworkService;
private Looper mLooper;
@@ -64,6 +65,7 @@ public class OpportunisticNetworkServiceTest extends ONSBaseTest {
public void setUp() throws Exception {
super.setUp("ONSTest");
pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
+ pkgForFeature = null;
Intent intent = new Intent(mContext, OpportunisticNetworkService.class);
new Thread(new Runnable() {
@Override
@@ -226,7 +228,8 @@ public class OpportunisticNetworkServiceTest extends ONSBaseTest {
assertNotNull(iOpportunisticNetworkService);
mResult = -1;
try {
- mResult = iOpportunisticNetworkService.getPreferredDataSubscriptionId(pkgForDebug);
+ mResult = iOpportunisticNetworkService.getPreferredDataSubscriptionId(pkgForDebug,
+ pkgForFeature);
Log.d(TAG, "testGetPreferredDataSubscriptionId: " + mResult);
assertNotNull(mResult);
} catch (RemoteException ex) {