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

Commit a7f50466 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Let debug builds set SubscriptionPlan owners.

Examine system property to decide if a test app should be granted
the ability to manage SubscriptionPlan details for a specific subId.

This doesn't give the testing app any access to existing plans
defined by other carrier apps, it only allows the testing app to
provide plans for testing purposes.  Purposefully ignored on
end-user builds.

Test: builds, boots
Bug: 73173096
Change-Id: I926ec0f88b7c2c282a1ec4410eaab92e1e1090dd
parent 3270ae05
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ import android.net.TrafficStats;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.Binder;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.HandlerThread;
@@ -2759,6 +2760,13 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
            return;
        }

        // Fourth check: is caller a testing app on a debug build?
        final boolean enableDebug = Build.IS_USERDEBUG || Build.IS_ENG;
        if (enableDebug && callingPackage
                .equals(SystemProperties.get("fw.sub_plan_owner." + subId, null))) {
            return;
        }

        // Final check: does the caller hold a permission?
        mContext.enforceCallingOrSelfPermission(MANAGE_SUBSCRIPTION_PLANS, TAG);
    }