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

Commit e10b8d17 authored by Yorke Lee's avatar Yorke Lee Committed by Android (Google) Code Review
Browse files

Merge "Add BIND_TELECOM_CONNECTION_SERVICE permission" into mnc-dev

parents a955f69f 7bb8ce9b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -171,20 +171,20 @@ final class CreateConnectionProcessor {
            if (!mPhoneAccountRegistrar.phoneAccountRequiresBindPermission(
                    attempt.connectionManagerPhoneAccount)) {
                Log.w(this,
                        "Connection mgr does not have BIND_CONNECTION_SERVICE for attempt: %s",
                        attempt);
                        "Connection mgr does not have BIND_TELECOM_CONNECTION_SERVICE for "
                                + "attempt: %s", attempt);
                attemptNextPhoneAccount();
                return;
            }

            // If the target PhoneAccount differs from the ConnectionManager phone acount, ensure it
            // also requires the BIND_CONNECTION_SERVICE permission.
            // also requires the BIND_TELECOM_CONNECTION_SERVICE permission.
            if (!attempt.connectionManagerPhoneAccount.equals(attempt.targetPhoneAccount) &&
                    !mPhoneAccountRegistrar.phoneAccountRequiresBindPermission(
                            attempt.targetPhoneAccount)) {
                Log.w(this,
                        "Target PhoneAccount does not have BIND_CONNECTION_SERVICE for attempt: %s",
                        attempt);
                        "Target PhoneAccount does not have BIND_TELECOM_CONNECTION_SERVICE for "
                                + "attempt: %s", attempt);
                attemptNextPhoneAccount();
                return;
            }
+15 −6
Original line number Diff line number Diff line
@@ -470,10 +470,11 @@ public final class PhoneAccountRegistrar {
        // Enforce the requirement that a connection service for a phone account has the correct
        // permission.
        if (!phoneAccountRequiresBindPermission(account.getAccountHandle())) {
            Log.w(this, "Phone account %s does not have BIND_CONNECTION_SERVICE permission.",
            Log.w(this,
                    "Phone account %s does not have BIND_TELECOM_CONNECTION_SERVICE permission.",
                    account.getAccountHandle());
            throw new SecurityException(
                    "PhoneAccount connection service requires BIND_CONNECTION_SERVICE permission.");
            throw new SecurityException("PhoneAccount connection service requires "
                    + "BIND_TELECOM_CONNECTION_SERVICE permission.");
        }

        addOrReplacePhoneAccount(account);
@@ -569,7 +570,7 @@ public final class PhoneAccountRegistrar {

    /**
     * Determines if the connection service specified by a {@link PhoneAccountHandle} requires the
     * {@link Manifest.permission#BIND_CONNECTION_SERVICE} permission.
     * {@link Manifest.permission#BIND_TELECOM_CONNECTION_SERVICE} permission.
     *
     * @param phoneAccountHandle The phone account to check.
     * @return {@code True} if the phone account has permission.
@@ -582,8 +583,16 @@ public final class PhoneAccountRegistrar {
        }
        for (ResolveInfo resolveInfo : resolveInfos) {
            ServiceInfo serviceInfo = resolveInfo.serviceInfo;
            if (serviceInfo == null ||
                    !Manifest.permission.BIND_CONNECTION_SERVICE.equals(serviceInfo.permission)) {
            if (serviceInfo == null) {
                return false;
            }

            if (!Manifest.permission.BIND_CONNECTION_SERVICE.equals(serviceInfo.permission) &&
                    !Manifest.permission.BIND_TELECOM_CONNECTION_SERVICE.equals(
                            serviceInfo.permission)) {
                // The ConnectionService must require either the deprecated BIND_CONNECTION_SERVICE,
                // or the public BIND_TELECOM_CONNECTION_SERVICE permissions, both of which are
                // system/signature only.
                return false;
            }
        }
+2 −2
Original line number Diff line number Diff line
@@ -34,14 +34,14 @@
        <!-- Miscellaneous telecom app-related test activities. -->

        <service android:name="com.android.server.telecom.testapps.TestConnectionService"
                 android:permission="android.permission.BIND_CONNECTION_SERVICE" >
                 android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE" >
            <intent-filter>
                <action android:name="android.telecom.ConnectionService" />
            </intent-filter>
        </service>

        <service android:name="com.android.server.telecom.testapps.TestConnectionManager"
                 android:permission="android.permission.BIND_CONNECTION_SERVICE" >
                 android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE" >
            <intent-filter>
                <action android:name="android.telecom.ConnectionService" />
            </intent-filter>